Class: Phoebe::Resources::Ref::Region::Info

Inherits:
Object
  • Object
show all
Defined in:
lib/phoebe/resources/ref/region/info.rb

Overview

The ref/region end-points return information on regions.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Info

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 Info.

Parameters:



53
54
55
# File 'lib/phoebe/resources/ref/region/info.rb', line 53

def initialize(client:)
  @client = client
end

Instance Method Details

#retrieve(region_code, delim: nil, region_name_format: nil, request_options: {}) ⇒ Phoebe::Models::Ref::Region::InfoRetrieveResponse

Get information on the name and geographical area covered by a region.

#### Notes

Taking Madison County, New York, USA (location code US-NY-053) as an example the various values for the regionNameFormat query parameter work as follows:

| Value | Description | Result | | ————– | —————————————— | ——————————– | | detailed | return a detailed description | Madison County, New York, US | | detailednoqual | return the name to the subnational1 level | Madison, New York | | full | return the full description | Madison, New York, United States | | namequal | return the qualified name | Madison County | | nameonly | return only the name of the region | Madison | | revdetailed | return the detailed description in reverse | US, New York, Madison County |

Parameters:

Returns:

See Also:



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/phoebe/resources/ref/region/info.rb', line 38

def retrieve(region_code, params = {})
  parsed, options = Phoebe::Ref::Region::InfoRetrieveParams.dump_request(params)
  query = Phoebe::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["ref/region/info/%1$s", region_code],
    query: query.transform_keys(region_name_format: "regionNameFormat"),
    model: Phoebe::Models::Ref::Region::InfoRetrieveResponse,
    options: options
  )
end