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

Inherits:
Base show all
Defined in:
lib/yelp/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::Request

#compress_response, #response_format, #yws_id

Instance Method Summary collapse

Methods inherited from Base

#base_url

Constructor Details

#initialize(params) ⇒ Location

Returns a new instance of Location.



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

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



13
14
15
# File 'lib/yelp/review/request/location.rb', line 13

def address
  @address
end

#cityObject (readonly)

the city of the location sought



16
17
18
# File 'lib/yelp/review/request/location.rb', line 16

def city
  @city
end

#neighborhoodObject (readonly)

the neighborhood of the location sought



19
20
21
# File 'lib/yelp/review/request/location.rb', line 19

def neighborhood
  @neighborhood
end

#radiusObject (readonly)

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



23
24
25
# File 'lib/yelp/review/request/location.rb', line 23

def radius
  @radius
end

#stateObject (readonly)

the state of the location sought



26
27
28
# File 'lib/yelp/review/request/location.rb', line 26

def state
  @state
end

#zipcodeObject (readonly)

the zipcode of the location sought



29
30
31
# File 'lib/yelp/review/request/location.rb', line 29

def zipcode
  @zipcode
end

Instance Method Details

#to_yelp_paramsObject



44
45
46
47
# File 'lib/yelp/review/request/location.rb', line 44

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