Class: Phoebe::Resources::Ref::Region::List
- Inherits:
-
Object
- Object
- Phoebe::Resources::Ref::Region::List
- Defined in:
- lib/phoebe/resources/ref/region/list.rb
Overview
The ref/region end-points return information on regions.
Instance Method Summary collapse
-
#initialize(client:) ⇒ List
constructor
private
A new instance of List.
-
#list(parent_region_code, region_type:, fmt: nil, request_options: {}) ⇒ Array<Phoebe::Models::Ref::Region::ListListResponseItem>
Get the list of sub-regions for a given country or region.
Constructor Details
#initialize(client:) ⇒ List
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of List.
46 47 48 |
# File 'lib/phoebe/resources/ref/region/list.rb', line 46 def initialize(client:) @client = client end |
Instance Method Details
#list(parent_region_code, region_type:, fmt: nil, request_options: {}) ⇒ Array<Phoebe::Models::Ref::Region::ListListResponseItem>
Get the list of sub-regions for a given country or region. #### Notes Not all combinations of region type and region code are valid. You can fetch all the subnational1 or subnational2 regions for a country however you can only specify a region type of ‘country’ when using ‘world’ as a region code.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/phoebe/resources/ref/region/list.rb', line 27 def list(parent_region_code, params) parsed, = Phoebe::Ref::Region::ListListParams.dump_request(params) query = Phoebe::Internal::Util.encode_query_params(parsed) region_type = parsed.delete(:region_type) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: ["ref/region/list/%1$s/%2$s", region_type, parent_region_code], query: query, model: Phoebe::Internal::Type::ArrayOf[Phoebe::Models::Ref::Region::ListListResponseItem], options: ) end |