Class: Yelp::V2::Search::Request::Location

Inherits:
Base show all
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

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

Methods inherited from Base

#base_url

Methods inherited from Request

#pull_results

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

#addressObject (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

#cityObject (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

#countryObject (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

#latitudeObject (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

#longitudeObject (readonly)

Returns the value of attribute longitude.



36
37
38
# File 'lib/yelped/v2/search/request/location.rb', line 36

def longitude
  @longitude
end

#neighborhoodObject (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

#stateObject (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

#zipcodeObject (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_paramsObject



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