Class: Yelp::V1::Review::Request::Location

Inherits:
Base show all
Defined in:
lib/yelpster/v1/review/request/location.rb

Overview

Describes a request to search for business reviews near a specific address/location. You do not need to specify all of the address attributes – some subset of the core address, city, neighborhood, state and zipcode will suffice.

Instance Attribute Summary collapse

Attributes inherited from Base

#business_count, #category, #term

Attributes inherited from Yelp::V1::Request

#response_format, #yws_id

Instance Method Summary collapse

Methods inherited from Base

#base_url

Methods inherited from Yelp::V1::Request

#pull_results

Constructor Details

#initialize(params) ⇒ Location


32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/yelpster/v1/review/request/location.rb', line 32

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,
    :city => nil,
    :neighborhood => nil,
    :state => nil,
    :zipcode => nil
  }.merge(params))
end

Instance Attribute Details

#addressObject (readonly)

the street address of the location sought


14
15
16
# File 'lib/yelpster/v1/review/request/location.rb', line 14

def address
  @address
end

#cityObject (readonly)

the city of the location sought


17
18
19
# File 'lib/yelpster/v1/review/request/location.rb', line 17

def city
  @city
end

#neighborhoodObject (readonly)

the neighborhood of the location sought


20
21
22
# File 'lib/yelpster/v1/review/request/location.rb', line 20

def neighborhood
  @neighborhood
end

#radiusObject (readonly)

radius to use while searching around specified geo-point. default value is 1, maximum value is 25.


24
25
26
# File 'lib/yelpster/v1/review/request/location.rb', line 24

def radius
  @radius
end

#stateObject (readonly)

the state of the location sought


27
28
29
# File 'lib/yelpster/v1/review/request/location.rb', line 27

def state
  @state
end

#zipcodeObject (readonly)

the zipcode of the location sought


30
31
32
# File 'lib/yelpster/v1/review/request/location.rb', line 30

def zipcode
  @zipcode
end

Instance Method Details

#to_yelp_paramsObject


45
46
47
48
# File 'lib/yelpster/v1/review/request/location.rb', line 45

def to_yelp_params
  super.merge(:location => build_location_string,
              :radius => radius)
end