yelpster 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG.rdoc +5 -0
- data/{README.rdoc → README.md} +35 -27
- data/lib/yelpster.rb +1 -1
- data/lib/yelpster/client.rb +31 -33
- data/lib/yelpster/v1/neighborhood/request/base.rb +7 -7
- data/lib/yelpster/v1/neighborhood/request/geo_point.rb +15 -15
- data/lib/yelpster/v1/neighborhood/request/location.rb +46 -46
- data/lib/yelpster/v1/phone/request/number.rb +16 -16
- data/lib/yelpster/v1/request.rb +48 -48
- data/lib/yelpster/v1/review/request/base.rb +21 -21
- data/lib/yelpster/v1/review/request/bounding_box.rb +30 -30
- data/lib/yelpster/v1/review/request/geo_point.rb +19 -19
- data/lib/yelpster/v1/review/request/location.rb +51 -51
- data/lib/yelpster/v2/business/request/id.rb +19 -19
- data/lib/yelpster/v2/request.rb +50 -50
- data/lib/yelpster/v2/search/request/base.rb +51 -51
- data/lib/yelpster/v2/search/request/bounding_box.rb +21 -21
- data/lib/yelpster/v2/search/request/geo_point.rb +46 -46
- data/lib/yelpster/v2/search/request/location.rb +1 -1
- metadata +3 -3
@@ -2,64 +2,64 @@ require 'yelpster/v2/request'
|
|
2
2
|
|
3
3
|
class Yelp
|
4
4
|
module V2
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
module Search
|
6
|
+
module Request
|
7
|
+
class Base < Yelp::V2::Request
|
8
|
+
#------------------------General Search Params -----------------
|
9
|
+
# string representing the name of business or search term being
|
10
10
|
#requested.
|
11
|
-
|
11
|
+
attr_reader :term
|
12
12
|
|
13
13
|
# integer representing number of business results to return
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
14
|
+
attr_reader :limit
|
15
|
+
|
16
|
+
# integer representing number of results to skip (for pagination)
|
17
|
+
attr_reader :offset
|
18
|
+
|
19
|
+
# integer for specifying how to sort results
|
20
|
+
# Sort Mode:
|
21
|
+
# 0 = Best matched (default)
|
22
|
+
# 1 = Distance
|
23
|
+
# 2 = Highest rated
|
24
|
+
# see www.yelp.com/developers/documentation/v2/search_api for more info
|
25
|
+
attr_reader :sort
|
26
|
+
|
27
|
+
# string specifying which business category to search in
|
28
|
+
# see www.yelp.com/developers/documentation/category_list for list of
|
29
|
+
# categories
|
30
|
+
attr_reader :category_filter
|
31
|
+
|
32
|
+
# integer specifying the search radius in meters
|
33
|
+
attr_reader :radius_filter
|
34
|
+
|
35
35
|
# boolean representing if business has a deal available
|
36
36
|
attr_reader :deals_filter
|
37
|
-
|
37
|
+
#---------------------------------------------------------------
|
38
|
+
|
39
|
+
#--------------------------- Locale Params ---------------------
|
40
|
+
# string representing default country to use while parsing location field
|
41
|
+
attr_reader :cc
|
42
|
+
|
43
|
+
# string representing which language of reviews to return
|
44
|
+
attr_reader :lang
|
45
|
+
#---------------------------------------------------------------
|
38
46
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
# string representing which language of reviews to return
|
44
|
-
attr_reader :lang
|
45
|
-
#---------------------------------------------------------------
|
46
|
-
|
47
|
-
def base_url
|
48
|
-
'http://api.yelp.com/v2/search'
|
49
|
-
end
|
47
|
+
def base_url
|
48
|
+
'http://api.yelp.com/v2/search'
|
49
|
+
end
|
50
50
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
51
|
+
def to_yelp_params
|
52
|
+
super.merge(:term => term,
|
53
|
+
:limit => limit,
|
54
|
+
:offset => offset,
|
55
|
+
:sort => sort,
|
56
|
+
:category_filter => category_filter,
|
57
|
+
:radius_filter => radius_filter,
|
58
|
+
:deals_filter => deals_filter,
|
59
|
+
:cc => cc,
|
60
|
+
:lang => lang)
|
61
|
+
end
|
62
|
+
end
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
@@ -2,28 +2,28 @@ require 'yelpster/v2/search/request/base'
|
|
2
2
|
|
3
3
|
class Yelp
|
4
4
|
module V2
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
# REQUIRED - double, bottom right longitude of bounding box (SOUTH-WEST LONG)
|
15
|
-
attr_reader :sw_longitude
|
16
|
-
|
17
|
-
# REQUIRED - double, top left latitude of bounding box (NORTH-EAST LAT)
|
18
|
-
attr_reader :ne_latitude
|
19
|
-
|
20
|
-
# REQUIRED - double, top left longitude of bounding box (NORTH-EAST LONG)
|
21
|
-
attr_reader :ne_longitude
|
5
|
+
module Search
|
6
|
+
module Request
|
7
|
+
# Describes a request to search for businesses
|
8
|
+
# within a geo-point-specific bounding box
|
9
|
+
#
|
10
|
+
class BoundingBox < Yelp::V2::Search::Request::Base
|
11
|
+
# REQUIRED - double, bottom right latitude of bounding box (SOUTH-WEST LAT)
|
12
|
+
attr_reader :sw_latitude
|
22
13
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
14
|
+
# REQUIRED - double, bottom right longitude of bounding box (SOUTH-WEST LONG)
|
15
|
+
attr_reader :sw_longitude
|
16
|
+
|
17
|
+
# REQUIRED - double, top left latitude of bounding box (NORTH-EAST LAT)
|
18
|
+
attr_reader :ne_latitude
|
19
|
+
|
20
|
+
# REQUIRED - double, top left longitude of bounding box (NORTH-EAST LONG)
|
21
|
+
attr_reader :ne_longitude
|
22
|
+
|
23
|
+
def to_yelp_params
|
24
|
+
super.merge(:bounds => "#{sw_latitude},#{sw_longitude}|#{ne_latitude},#{ne_longitude}")
|
25
|
+
end
|
26
|
+
end
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -2,52 +2,52 @@ require 'yelpster/v2/search/request/base'
|
|
2
2
|
|
3
3
|
class Yelp
|
4
4
|
module V2
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
5
|
+
module Search
|
6
|
+
module Request
|
7
|
+
# Describes a request to search for the name of a neighborhood at a
|
8
|
+
# specific geo-point location.
|
9
|
+
#
|
10
|
+
class GeoPoint < Yelp::V2::Search::Request::Base
|
11
|
+
# REQUIRED - double, latitude of geo-point to search
|
12
|
+
attr_reader :latitude
|
13
|
+
|
14
|
+
# REQUIRED - double, longitude of geo-point to search
|
15
|
+
attr_reader :longitude
|
16
|
+
|
17
|
+
# OPTIONAL - double, accuracy of latitude and longitude of geo-point to search
|
18
|
+
attr_reader :accuracy
|
19
|
+
|
20
|
+
# OPTIONAL - double, altitude of geo-point to search
|
21
|
+
attr_reader :altitude
|
22
|
+
|
23
|
+
# OPTIONAL - double, accuracy of altitude geo-point to search
|
24
|
+
attr_reader :altitude_accuracy
|
25
|
+
|
26
|
+
def initialize(params)
|
27
|
+
# we explicitly initialize the location fields since we reference
|
28
|
+
# them later when building a full location string and we want
|
29
|
+
# to know they were initialized properly (and avoid warnings)
|
30
|
+
# 50 and -100 default values are provided as they lie within yelp API's geo-location range
|
31
|
+
super({
|
32
|
+
:latitude => 50.0,
|
33
|
+
:longitude => -100.0,
|
34
|
+
:accuracy => nil,
|
35
|
+
:altitude => nil,
|
36
|
+
:altitude_accuracy => nil
|
37
|
+
}.merge(params))
|
38
|
+
end
|
39
|
+
|
40
|
+
def to_yelp_params
|
41
|
+
super.merge(:ll => build_geo_loc_string)
|
42
|
+
end
|
43
|
+
|
44
|
+
# Returns the Yelp-compatible concatenated string with the various
|
45
|
+
# possible bits of an address-oriented location.
|
46
|
+
#
|
47
|
+
def build_geo_loc_string
|
48
|
+
[ @latitude, @longitude, @accuracy, @altitude, @altitude_accuracy ].compact.join(",")
|
49
|
+
end
|
50
|
+
end
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
@@ -63,7 +63,7 @@ class Yelp
|
|
63
63
|
def build_location_string
|
64
64
|
# per the Yelp documentation, the location string is to be built
|
65
65
|
# as some combination of "address, neighborhood, city, state, or zip, country".
|
66
|
-
[ @address, @neighborhood, @city, @state, @zipcode, @country ].compact.join(
|
66
|
+
[ @address, @neighborhood, @city, @state, @zipcode, @country ].compact.join(',')
|
67
67
|
end
|
68
68
|
|
69
69
|
def build_geo_location_string
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yelpster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naveed Siddiqui
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -46,7 +46,7 @@ extra_rdoc_files: []
|
|
46
46
|
files:
|
47
47
|
- CHANGELOG.rdoc
|
48
48
|
- LICENSE.txt
|
49
|
-
- README.
|
49
|
+
- README.md
|
50
50
|
- lib/yelpster/client.rb
|
51
51
|
- lib/yelpster/record.rb
|
52
52
|
- lib/yelpster/response_format.rb
|