Module: LibTAD::Client::PlacesService

Included in:
LibTAD::Client
Defined in:
lib/services/places.rb

Overview

Places API.

Instance Method Summary collapse

Instance Method Details

#get_places(geo: nil, lang: nil) ⇒ Array<::LibTAD::Places::Place>

The Places service can be used to retrieve the list of supported places. The ids for the places are then used in the other services to indicate the location to be queried.

Parameters:

  • geo (Boolean) (defaults to: nil)

    Return longitude or latitude for the geo object.

  • lang (Boolean) (defaults to: nil)

    The preferred language for the texts.

Returns:



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/services/places.rb', line 11

def get_places(geo: nil, lang: nil)
  args = {
    geo: geo,
    lang: lang
  }.compact

  response = get('places', args)
  places = response.fetch('places', [])

  places.collect do |e|
    ::LibTAD::Places::Place.new(e)
  end
end