Class: Yelp::V2::Search::Request::Location
- Defined in:
- lib/yelped/v2/search/request/location.rb
Overview
Describes a request to search for a businesses by a address/location. You do not need to specify all of the address attributes – some subset of the core address, neighborhood, city, state or zip, optional country
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
string representing the street address of the location sought.
-
#city ⇒ Object
readonly
string representing the city of the location sought.
-
#country ⇒ Object
readonly
string representing the country of the location sought.
-
#latitude ⇒ Object
readonly
additional attributes that can be specified = latitude + longitude.
-
#longitude ⇒ Object
readonly
Returns the value of attribute longitude.
-
#neighborhood ⇒ Object
readonly
string representing the neighborhood of the location sought.
-
#state ⇒ Object
readonly
string representing the state of the location sought.
-
#zipcode ⇒ Object
readonly
string representing the zipcode of the location sought.
Attributes inherited from Base
#category_filter, #cc, #claimed_filter, #lang, #limit, #offset, #radius_filter, #sort, #term
Attributes inherited from Request
#compress_response, #consumer_key, #consumer_secret, #response_format, #token, #token_secret
Instance Method Summary collapse
-
#initialize(params) ⇒ Location
constructor
A new instance of Location.
- #to_yelp_params ⇒ Object
Methods inherited from Base
Methods inherited from Request
Constructor Details
#initialize(params) ⇒ Location
Returns a new instance of Location.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/yelped/v2/search/request/location.rb', line 38 def initialize (params) # we explicitly initialize the location fields since we reference # them later when building a full location string and we want # to know they were initialized properly (and avoid warnings) super({ :address => nil, :neighborhood => nil, :city => nil, :state => nil, :zipcode => nil, :country => nil, :latitude => nil, :longitude => nil }.merge(params)) end |
Instance Attribute Details
#address ⇒ Object (readonly)
string representing the street address of the location sought
17 18 19 |
# File 'lib/yelped/v2/search/request/location.rb', line 17 def address @address end |
#city ⇒ Object (readonly)
string representing the city of the location sought
23 24 25 |
# File 'lib/yelped/v2/search/request/location.rb', line 23 def city @city end |
#country ⇒ Object (readonly)
string representing the country of the location sought
32 33 34 |
# File 'lib/yelped/v2/search/request/location.rb', line 32 def country @country end |
#latitude ⇒ Object (readonly)
additional attributes that can be specified = latitude + longitude
35 36 37 |
# File 'lib/yelped/v2/search/request/location.rb', line 35 def latitude @latitude end |
#longitude ⇒ Object (readonly)
Returns the value of attribute longitude.
36 37 38 |
# File 'lib/yelped/v2/search/request/location.rb', line 36 def longitude @longitude end |
#neighborhood ⇒ Object (readonly)
string representing the neighborhood of the location sought
20 21 22 |
# File 'lib/yelped/v2/search/request/location.rb', line 20 def neighborhood @neighborhood end |
#state ⇒ Object (readonly)
string representing the state of the location sought
26 27 28 |
# File 'lib/yelped/v2/search/request/location.rb', line 26 def state @state end |
#zipcode ⇒ Object (readonly)
string representing the zipcode of the location sought
29 30 31 |
# File 'lib/yelped/v2/search/request/location.rb', line 29 def zipcode @zipcode end |
Instance Method Details
#to_yelp_params ⇒ Object
53 54 55 56 |
# File 'lib/yelped/v2/search/request/location.rb', line 53 def to_yelp_params super.merge(:location => build_location_string, :cll => build_geo_location_string) end |