-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1156 from Vizzuality/develop
Hotfix: fix indonesia ports layer
- Loading branch information
Showing
33 changed files
with
2,328 additions
and
314 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
module Api | ||
module Public | ||
class CommoditiesController < ApiController | ||
include Api::V3::ParamHelpers | ||
|
||
skip_before_action :load_context | ||
before_action :set_collection, only: [:index] | ||
|
||
def index | ||
render json: @collection, | ||
each_serializer: Api::Public::CommoditySerializer | ||
end | ||
|
||
private | ||
|
||
def set_collection | ||
@collection = Api::Public::FilterCommodities.new(filter_params).call | ||
end | ||
|
||
def filter_params | ||
{ | ||
countries_ids: cs_string_to_int_array(params[:countries_ids]), | ||
commodities_ids: cs_string_to_int_array(params[:commodities_ids]), | ||
include: params[:include] | ||
} | ||
end | ||
end | ||
end | ||
end |
8 changes: 4 additions & 4 deletions
8
...ontrollers/api/v3/countries_controller.rb → ...ollers/api/public/countries_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module Api | ||
module Public | ||
class NodesController < ApiController | ||
skip_before_action :load_context | ||
|
||
def data | ||
ensure_required_param_present(:id) | ||
ensure_required_param_present(:year) | ||
|
||
@result = Api::Public::Node::Filter.new(filter_params).call | ||
|
||
render json: @result, | ||
root: 'data', | ||
serializer: Api::Public::Node::NodeSerializer | ||
end | ||
|
||
private | ||
|
||
def filter_params | ||
{ | ||
id: params[:id], | ||
year: params[:year] | ||
} | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module Api | ||
module Public | ||
class CommoditySerializer < ActiveModel::Serializer | ||
attributes :id, :name | ||
attribute :country_ids, if: :include_countries? | ||
|
||
def include_countries? | ||
@instance_options[:include_countries] | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module Api | ||
module Public | ||
class CountrySerializer < ActiveModel::Serializer | ||
attributes :id, :name | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module Api | ||
module Public | ||
module Node | ||
class NodeSerializer < ActiveModel::Serializer | ||
attributes :name, | ||
:node_type, | ||
:geo_id, | ||
:availability, | ||
:node_attributes, | ||
:flow_attributes | ||
end | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.