Class: Yelp::V2::Search::Request::GeoPoint

Inherits:
Base show all
Defined in:
lib/yelped/v2/search/request/geo_point.rb

Overview

Describes a request to search for the name of a neighborhood at a specific geo-point location.

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) ⇒ GeoPoint

Returns a new instance of GeoPoint.



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/yelped/v2/search/request/geo_point.rb', line 26

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)
	# 50 and -100 default values are provided as they lie within yelp API's geo-location range
	super({
	:latitude	=> 50.0,
	:longitude	=> -100.0,
	:accuracy	=> nil,
	:altitude	=> nil,
	:altitude_accuracy => nil
	}.merge(params))
end

Instance Attribute Details

#accuracyObject (readonly)

OPTIONAL - double, accuracy of latitude and longitude of geo-point to search



18
19
20
# File 'lib/yelped/v2/search/request/geo_point.rb', line 18

def accuracy
  @accuracy
end

#altitudeObject (readonly)

OPTIONAL - double, altitude of geo-point to search



21
22
23
# File 'lib/yelped/v2/search/request/geo_point.rb', line 21

def altitude
  @altitude
end

#altitude_accuracyObject (readonly)

OPTIONAL - double, accuracy of altitude geo-point to search



24
25
26
# File 'lib/yelped/v2/search/request/geo_point.rb', line 24

def altitude_accuracy
  @altitude_accuracy
end

#latitudeObject (readonly)

REQUIRED - double, latitude of geo-point to search



12
13
14
# File 'lib/yelped/v2/search/request/geo_point.rb', line 12

def latitude
  @latitude
end

#longitudeObject (readonly)

REQUIRED - double, longitude of geo-point to search



15
16
17
# File 'lib/yelped/v2/search/request/geo_point.rb', line 15

def longitude
  @longitude
end

Instance Method Details

#build_geo_loc_stringObject

Returns the Yelp-compatible concatenated string with the various possible bits of an address-oriented location.



47
48
49
# File 'lib/yelped/v2/search/request/geo_point.rb', line 47

def build_geo_loc_string
	[ @latitude, @longitude, @accuracy, @altitude, @altitude_accuracy ].compact.join(",")
end

#to_yelp_paramsObject



40
41
42
# File 'lib/yelped/v2/search/request/geo_point.rb', line 40

def to_yelp_params
  super.merge(:ll => build_geo_loc_string)
end