Module: Lieu::Client::Search

Included in:
Lieu::Client
Defined in:
lib/lieu/client/search.rb

Overview

Methods for the Place Search API

Instance Method Summary collapse

Instance Method Details

#nearby_search(options = {}) ⇒ Array<Hashie::Mash>

Search places within an area.

Examples:

Lieu.nearby_search(location: {
    lat: '0.00',
    lng: '0.00'
  },
  radius: '500'
)

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :location (Hash)

    the location to find around

    • :lat (String) the latitude to find around
    • :lng (String) the longitude to find around
  • :radius (String)

    the distance (in meters) to search in

Returns:

  • (Array<Hashie::Mash>)

    a list of places details

See Also:



22
23
24
25
26
# File 'lib/lieu/client/search.rb', line 22

def nearby_search(options={})
  options[:location] = format_location(options[:location])

  get('nearbysearch', options).results
end

#radar_search(options = {}) ⇒ Array<Hashie::Mash>

Radar search places within an area.

Examples:

Lieu.radar_search(location: {
    lat: '0.00',
    lng: '0.00'
  },
  radius: '500',
  keyword: 'Pizza',
  name: 'Express'
)

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :location (Hash)

    the location to find around

    • :lat (String) the latitude to find around
    • :lng (String) the longitude to find around
  • :radius (String)

    the distance (in meters) to search in

  • :keyword (String)

    a term to be matched against all content for this place

  • :name (String)

    a term to be matched against the names of places

  • :types (Array<String>)

    types to restrict the results to

Returns:

  • (Array<Hashie::Mash>)

    a list of places minimal details

See Also:



61
62
63
64
65
66
# File 'lib/lieu/client/search.rb', line 61

def radar_search(options={})
  options[:location] = format_location(options[:location])
  options[:types] = format_types(options[:types]) if options[:types]

  get('radarsearch', options).results
end

#text_search(query, options = {}) ⇒ Array<Hashie::Mash>

Text search places.

Examples:

Lieu.text_search('Tour Eiffel')

Parameters:

  • query (String)

    the text search term

  • options (Hash) (defaults to: {})

    optional parameters

Returns:

  • (Array<Hashie::Mash>)

    a list of places details

See Also:



35
36
37
38
39
# File 'lib/lieu/client/search.rb', line 35

def text_search(query, options={})
  options.merge!(query: query)

  get('textsearch', options).results
end