yelpster 1.1.4 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +26 -36
- data/lib/yelpster.rb +7 -0
- data/lib/yelpster/base.rb +11 -0
- data/lib/yelpster/client.rb +6 -1
- data/lib/yelpster/v1/request.rb +1 -1
- data/lib/yelpster/v2/request.rb +17 -0
- data/lib/yelpster/version.rb +1 -1
- data/spec/business_retrieve_spec.rb +9 -5
- data/spec/business_search_spec.rb +10 -18
- data/spec/configuration_spec.rb +27 -0
- data/spec/neighborhood_search_spec.rb +4 -5
- data/spec/phone_search_spec.rb +3 -2
- data/spec/review_search_spec.rb +8 -14
- data/spec/spec_helper.rb +29 -10
- metadata +7 -4
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
## Yelpster
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.org/nvd/yelpster.png?branch=develop)](https://travis-ci.org/nvd/yelpster)
|
4
|
+
[![Dependency Status](https://gemnasium.com/nvd/yelpster.png)](https://gemnasium.com/nvd/yelpster)
|
4
5
|
|
5
6
|
A Ruby object-oriented interface to the local business content available
|
6
7
|
on Yelp at http://www.yelp.com. Functionality is provided to perform
|
@@ -36,8 +37,8 @@ or
|
|
36
37
|
```console
|
37
38
|
% export YELP_CONSUMER_KEY='YOUR_CONSUMER_KEY_HERE'
|
38
39
|
% export YELP_CONSUMER_SECRET='YOUR_CONSUMER_SECRET_HERE'
|
39
|
-
% export
|
40
|
-
% export
|
40
|
+
% export YELP_TOKEN='YOUR_TOKEN_HERE'
|
41
|
+
% export YELP_TOKEN_SECRET='YOUR_TOKEN_SECRET_HERE'
|
41
42
|
```
|
42
43
|
|
43
44
|
## Installing
|
@@ -73,6 +74,19 @@ original pure JSON) can be specified on request record construction via the
|
|
73
74
|
Yelp::[V1/V2]::Request ```response_format``` parameter, available in all request record
|
74
75
|
types.
|
75
76
|
|
77
|
+
### One Time Client Configuration (Recommended)
|
78
|
+
To configure token/keys, add the following in a pre-loader file (eg: in initializers dir for Rails).
|
79
|
+
Although currently available, support for specifying keys in request object will be deprecated in the future.
|
80
|
+
|
81
|
+
```ruby
|
82
|
+
Yelp.configure(:yws_id => 'YOUR_YWSID',
|
83
|
+
:consumer_key => 'YOUR_CONSUMER_KEY',
|
84
|
+
:consumer_secret => 'YOUR_CONSUMER_SECRET',
|
85
|
+
:token => 'YOUR_TOKEN',
|
86
|
+
:token_secret => 'YOUR_TOKEN_SECRET')
|
87
|
+
```
|
88
|
+
Then create a client object (or use Yelp::Base.client) and call ```search``` method with the request object.
|
89
|
+
|
76
90
|
A few examples:
|
77
91
|
|
78
92
|
```ruby
|
@@ -86,23 +100,20 @@ A few examples:
|
|
86
100
|
:city => 'San Francisco',
|
87
101
|
:state => 'CA',
|
88
102
|
:radius => 2,
|
89
|
-
:term => 'cream puffs'
|
90
|
-
:yws_id => 'YOUR_YWSID_HERE')
|
103
|
+
:term => 'cream puffs')
|
91
104
|
response = client.search(request)
|
92
105
|
|
93
106
|
# perform a location-based category search for either ice cream or donut shops in SF
|
94
107
|
request = Location.new(
|
95
108
|
:city => 'San Francisco',
|
96
109
|
:state => 'CA',
|
97
|
-
:category => ['donuts', 'icecream']
|
98
|
-
:yws_id => 'YOUR_YWSID_HERE')
|
110
|
+
:category => ['donuts', 'icecream'])
|
99
111
|
response = client.search(request)
|
100
112
|
|
101
113
|
# perform a neighborhood name lookup for a specific geo-location point
|
102
114
|
request = GeoPoint.new(
|
103
115
|
:latitude => 37.782093,
|
104
|
-
:longitude => -122.483230
|
105
|
-
:yws_id => 'YOUR_YWSID_HERE')
|
116
|
+
:longitude => -122.483230)
|
106
117
|
response = client.search(request)
|
107
118
|
|
108
119
|
# -------------------------------------------------------
|
@@ -110,8 +121,7 @@ A few examples:
|
|
110
121
|
include Yelp::V1::Phone::Request
|
111
122
|
# perform a business review search based on a business phone number
|
112
123
|
request = Number.new(
|
113
|
-
:phone_number => '4155551212'
|
114
|
-
:yws_id => 'YOUR_YWSID_HERE')
|
124
|
+
:phone_number => '4155551212')
|
115
125
|
response = client.search(request)
|
116
126
|
|
117
127
|
# -------------------------------------------------------
|
@@ -119,11 +129,7 @@ A few examples:
|
|
119
129
|
include Yelp::V2::Business::Request
|
120
130
|
# retrieve details of business vi yelp business id
|
121
131
|
request = Id.new(
|
122
|
-
:yelp_business_id => "pjb2WMwa0AfK3L-dWimO8w"
|
123
|
-
:consumer_key => 'YOUR_CONSUMER_KEY',
|
124
|
-
:consumer_secret => 'YOUR_CONSUMER_SECRET',
|
125
|
-
:token => 'YOUR_TOKEN',
|
126
|
-
:token_secret => 'YOUR_TOKEN_SECRET')
|
132
|
+
:yelp_business_id => "pjb2WMwa0AfK3L-dWimO8w")
|
127
133
|
response = client.search(request)
|
128
134
|
|
129
135
|
# -------------------------------------------------------
|
@@ -136,43 +142,27 @@ A few examples:
|
|
136
142
|
:sw_longitude => -122.500000,
|
137
143
|
:ne_latitude => 37.788022,
|
138
144
|
:ne_longitude => -122.399797,
|
139
|
-
:limit => 3
|
140
|
-
:consumer_key => 'YOUR_CONSUMER_KEY',
|
141
|
-
:consumer_secret => 'YOUR_CONSUMER_SECRET',
|
142
|
-
:token => 'YOUR_TOKEN',
|
143
|
-
:token_secret => 'YOUR_TOKEN_SECRET')
|
145
|
+
:limit => 3)
|
144
146
|
response = client.search(request)
|
145
147
|
|
146
148
|
# search for businesses via lat/long geo point'
|
147
149
|
request = GeoPoint.new(
|
148
150
|
:term => "cream puffs",
|
149
151
|
:latitude => 37.788022,
|
150
|
-
:longitude => -122.399797
|
151
|
-
:consumer_key => 'YOUR_CONSUMER_KEY',
|
152
|
-
:consumer_secret => 'YOUR_CONSUMER_SECRET',
|
153
|
-
:token => 'YOUR_TOKEN',
|
154
|
-
:token_secret => 'YOUR_TOKEN_SECRET')
|
152
|
+
:longitude => -122.399797)
|
155
153
|
response = client.search(request)
|
156
154
|
|
157
155
|
# search for businesses via location (address, neighbourhood, city, state, zip, country, latitude, longitude)'
|
158
156
|
request = Location.new(
|
159
157
|
:term => "cream puffs",
|
160
|
-
:city => "San Francisco"
|
161
|
-
:consumer_key => 'YOUR_CONSUMER_KEY',
|
162
|
-
:consumer_secret => 'YOUR_CONSUMER_SECRET',
|
163
|
-
:token => 'YOUR_TOKEN',
|
164
|
-
:token_secret => 'YOUR_TOKEN_SECRET')
|
158
|
+
:city => "San Francisco")
|
165
159
|
response = client.search(request)
|
166
160
|
|
167
161
|
request = Location.new(
|
168
162
|
:term => "german food",
|
169
163
|
:address => "Hayes",
|
170
164
|
:latitude => 37.77493,
|
171
|
-
:longitude => -122.419415
|
172
|
-
:consumer_key => 'YOUR_CONSUMER_KEY',
|
173
|
-
:consumer_secret => 'YOUR_CONSUMER_SECRET',
|
174
|
-
:token => 'YOUR_TOKEN',
|
175
|
-
:token_secret => 'YOUR_TOKEN_SECRET')
|
165
|
+
:longitude => -122.419415)
|
176
166
|
response = client.search(request)
|
177
167
|
```
|
178
168
|
|
@@ -187,5 +177,5 @@ This library is provided via the GNU LGPL license at http://www.gnu.org/licenses
|
|
187
177
|
|
188
178
|
Copyright 2007 - 2009, Walter Korman <shaper@fatgoose.com>, http://lemurware.blogspot.com
|
189
179
|
|
190
|
-
2011 – Yelp V2 Additions by Naveed Siddiqui <
|
180
|
+
2011 – Yelp V2 Additions by Naveed Siddiqui <n@10eighteen.com>
|
191
181
|
|
data/lib/yelpster.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'yelpster/base'
|
1
2
|
require 'yelpster/client'
|
2
3
|
require 'yelpster/record'
|
3
4
|
require 'yelpster/response_format'
|
@@ -18,3 +19,9 @@ require 'yelpster/v2/search/request/base'
|
|
18
19
|
require 'yelpster/v2/search/request/geo_point'
|
19
20
|
require 'yelpster/v2/search/request/bounding_box'
|
20
21
|
require 'yelpster/v2/search/request/location'
|
22
|
+
|
23
|
+
module Yelp
|
24
|
+
def self.configure(options)
|
25
|
+
Base.client = Client.new(options)
|
26
|
+
end
|
27
|
+
end
|
data/lib/yelpster/client.rb
CHANGED
@@ -37,16 +37,21 @@ module Yelp
|
|
37
37
|
# defaulting to output to STDOUT
|
38
38
|
attr_accessor :logger
|
39
39
|
|
40
|
+
attr_accessor :yws_id, :consumer_key, :consumer_secret, :token, :token_secret
|
41
|
+
|
40
42
|
# the default user agent submitted with search requests
|
41
43
|
DEFAULT_AGENT = 'yelp for Ruby (http://www.rubyforge.org/projects/yelp/)'
|
42
44
|
|
43
45
|
# Constructs a new client that uses the supplied YWSID for submitting
|
44
46
|
# search requests.
|
45
47
|
#
|
46
|
-
def initialize
|
48
|
+
def initialize(attributes = {})
|
47
49
|
@agent = DEFAULT_AGENT
|
48
50
|
@debug = false
|
49
51
|
@logger = nil
|
52
|
+
attributes.each do |attr, value|
|
53
|
+
self.send("#{attr}=", value)
|
54
|
+
end
|
50
55
|
end
|
51
56
|
|
52
57
|
# Submits the supplied search request to Yelp and returns the response in
|
data/lib/yelpster/v1/request.rb
CHANGED
data/lib/yelpster/v2/request.rb
CHANGED
@@ -51,6 +51,23 @@ module Yelp
|
|
51
51
|
access_token = OAuth::AccessToken.new(consumer, token, token_secret)
|
52
52
|
access_token.get(url).body
|
53
53
|
end
|
54
|
+
|
55
|
+
# For backwards compatibility
|
56
|
+
def consumer_key
|
57
|
+
@consumer_key || Yelp::Base.client.consumer_key
|
58
|
+
end
|
59
|
+
|
60
|
+
def consumer_secret
|
61
|
+
@consumer_secret || Yelp::Base.client.consumer_secret
|
62
|
+
end
|
63
|
+
|
64
|
+
def token
|
65
|
+
@token || Yelp::Base.client.token
|
66
|
+
end
|
67
|
+
|
68
|
+
def token_secret
|
69
|
+
@token_secret || Yelp::Base.client.token_secret
|
70
|
+
end
|
54
71
|
end
|
55
72
|
end
|
56
73
|
end
|
data/lib/yelpster/version.rb
CHANGED
@@ -2,15 +2,19 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module Yelp::V2::Business::Request
|
4
4
|
describe Id do
|
5
|
-
|
5
|
+
before(:all) { Yelp.configure(:consumer_key => Credentials.consumer_key,
|
6
|
+
:consumer_secret => Credentials.consumer_secret,
|
7
|
+
:token => Credentials.token,
|
8
|
+
:token_secret => Credentials.token_secret) }
|
9
|
+
let(:client) { Yelp::Base.client }
|
6
10
|
|
7
11
|
subject do
|
8
12
|
client.search(Id.new(
|
9
13
|
:yelp_business_id => 'pjb2WMwa0AfK3L-dWimO8w',
|
10
|
-
:consumer_key =>
|
11
|
-
:consumer_secret =>
|
12
|
-
:token =>
|
13
|
-
:token_secret =>
|
14
|
+
:consumer_key => Credentials.consumer_key,
|
15
|
+
:consumer_secret => Credentials.consumer_secret,
|
16
|
+
:token => Credentials.token,
|
17
|
+
:token_secret => Credentials.token_secret))
|
14
18
|
end
|
15
19
|
|
16
20
|
it 'returns a valid business hash' do
|
@@ -2,9 +2,13 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module Yelp::V2::Search::Request
|
4
4
|
describe 'Business Search' do
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
before(:all) { Yelp.configure(:consumer_key => Credentials.consumer_key,
|
6
|
+
:consumer_secret => Credentials.consumer_secret,
|
7
|
+
:token => Credentials.token,
|
8
|
+
:token_secret => Credentials.token_secret) }
|
9
|
+
let(:client) { Yelp::Base.client }
|
10
|
+
let(:latitude) { 37.7821868 }
|
11
|
+
let(:longitude) { -122.4841149 }
|
8
12
|
let(:location) { {
|
9
13
|
'cross_streets' => '24th Ave & 25th Ave',
|
10
14
|
'city' => 'San Francisco',
|
@@ -25,11 +29,7 @@ module Yelp::V2::Search::Request
|
|
25
29
|
:sw_longitude => -122.5,
|
26
30
|
:ne_latitude => 37.788022,
|
27
31
|
:ne_longitude => -122.399797,
|
28
|
-
:term => 'yelp'
|
29
|
-
:consumer_key => @consumer_key,
|
30
|
-
:consumer_secret => @consumer_secret,
|
31
|
-
:token => @token,
|
32
|
-
:token_secret => @token_secret)
|
32
|
+
:term => 'yelp')
|
33
33
|
expect(client.search(request)).to be_valid_response_hash
|
34
34
|
end
|
35
35
|
end
|
@@ -37,11 +37,7 @@ module Yelp::V2::Search::Request
|
|
37
37
|
describe 'by GeoPoint' do
|
38
38
|
it 'returns business at geo point' do
|
39
39
|
request = GeoPoint.new(:latitude => latitude,
|
40
|
-
:longitude => longitude
|
41
|
-
:consumer_key => @consumer_key,
|
42
|
-
:consumer_secret => @consumer_secret,
|
43
|
-
:token => @token,
|
44
|
-
:token_secret => @token_secret)
|
40
|
+
:longitude => longitude)
|
45
41
|
response = client.search(request)
|
46
42
|
expect(response).to be_valid_response_hash
|
47
43
|
expect(response['businesses'].first['location']).to eq(location)
|
@@ -53,11 +49,7 @@ module Yelp::V2::Search::Request
|
|
53
49
|
request = Location.new(:address => '2308 Clement St',
|
54
50
|
:city => 'San Francisco',
|
55
51
|
:state => 'CA',
|
56
|
-
:zipcode => 94121
|
57
|
-
:consumer_key => @consumer_key,
|
58
|
-
:consumer_secret => @consumer_secret,
|
59
|
-
:token => @token,
|
60
|
-
:token_secret => @token_secret)
|
52
|
+
:zipcode => 94121)
|
61
53
|
response = client.search(request)
|
62
54
|
expect(response).to be_valid_response_hash
|
63
55
|
expect(response['businesses'].first['location']['postal_code']).to eq('94121')
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Configuration' do
|
4
|
+
describe 'per request (for backwards compatibility)' do
|
5
|
+
it 'configures correctly on V1 request' do
|
6
|
+
client = create_client(AdditionalSpecHelpers::API_V1)
|
7
|
+
request = Yelp::V1::Neighborhood::Request::Location.new(
|
8
|
+
:address => '2252 Clement Street',
|
9
|
+
:city => 'San Francisco',
|
10
|
+
:state => 'CA',
|
11
|
+
:zipcode => 94121,
|
12
|
+
:yws_id => Credentials.yws_id)
|
13
|
+
expect(client.search(request)).to be_valid_response_hash
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'configures correctly on V2' do
|
17
|
+
client = create_client(AdditionalSpecHelpers::API_V2)
|
18
|
+
request = Yelp::V2::Business::Request::Id.new(
|
19
|
+
:yelp_business_id => 'pjb2WMwa0AfK3L-dWimO8w',
|
20
|
+
:consumer_key => Credentials.consumer_key,
|
21
|
+
:consumer_secret => Credentials.consumer_secret,
|
22
|
+
:token => Credentials.token,
|
23
|
+
:token_secret => Credentials.token_secret)
|
24
|
+
expect(client.search(request)).to be_valid_business_hash
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -2,13 +2,13 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module Yelp::V1::Neighborhood::Request
|
4
4
|
describe 'Neighborhood Search' do
|
5
|
-
|
5
|
+
before(:all) { Yelp.configure(:yws_id => Credentials.yws_id) }
|
6
|
+
let(:client) { Yelp::Base.client }
|
6
7
|
|
7
8
|
describe 'by GeoPoint' do
|
8
9
|
it 'returns neighbourhoods at point' do
|
9
10
|
request = GeoPoint.new(:latitude => 37.782093,
|
10
|
-
:longitude => -122.483230
|
11
|
-
:yws_id => @yws_id)
|
11
|
+
:longitude => -122.483230)
|
12
12
|
response = client.search(request)
|
13
13
|
expect(response).to be_valid_response_hash
|
14
14
|
expect(response['neighborhoods'].first['name']).to eq('Outer Richmond')
|
@@ -20,8 +20,7 @@ module Yelp::V1::Neighborhood::Request
|
|
20
20
|
request = Location.new(:address => '2252 Clement Street',
|
21
21
|
:city => 'San Francisco',
|
22
22
|
:state => 'CA',
|
23
|
-
:zipcode => 94121
|
24
|
-
:yws_id => @yws_id)
|
23
|
+
:zipcode => 94121)
|
25
24
|
response = client.search(request)
|
26
25
|
expect(response).to be_valid_response_hash
|
27
26
|
expect(response['neighborhoods'].first['name']).to eq('Outer Richmond')
|
data/spec/phone_search_spec.rb
CHANGED
@@ -2,10 +2,11 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module Yelp::V1::Phone::Request
|
4
4
|
describe 'Search by phone number' do
|
5
|
-
|
5
|
+
before(:all) { Yelp.configure(:yws_id => Credentials.yws_id) }
|
6
|
+
let(:client) { Yelp::Base.client }
|
6
7
|
|
7
8
|
it 'returns business with specified phone number' do
|
8
|
-
request = Number.new(:phone_number => '4155666011'
|
9
|
+
request = Number.new(:phone_number => '4155666011')
|
9
10
|
expect(client.search(request)).to be_valid_response_hash
|
10
11
|
end
|
11
12
|
end
|
data/spec/review_search_spec.rb
CHANGED
@@ -2,7 +2,8 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module Yelp::V1::Review::Request
|
4
4
|
describe 'Review Search' do
|
5
|
-
|
5
|
+
before(:all) { Yelp.configure(:yws_id => Credentials.yws_id) }
|
6
|
+
let(:client) { Yelp::Base.client }
|
6
7
|
|
7
8
|
describe 'by Bounding Box' do
|
8
9
|
it 'returns reviews in box' do
|
@@ -11,8 +12,7 @@ module Yelp::V1::Review::Request
|
|
11
12
|
:bottom_right_longitude => -122.399797,
|
12
13
|
:top_left_latitude => 37.9,
|
13
14
|
:top_left_longitude => -122.5,
|
14
|
-
:term => 'yelp'
|
15
|
-
:yws_id => @yws_id)
|
15
|
+
:term => 'yelp')
|
16
16
|
expect(client.search(request)).to be_valid_response_hash
|
17
17
|
end
|
18
18
|
end
|
@@ -23,8 +23,7 @@ module Yelp::V1::Review::Request
|
|
23
23
|
:latitude => 37.78022,
|
24
24
|
:longitude => -122.399797,
|
25
25
|
:radius => 2,
|
26
|
-
:term => 'yelp'
|
27
|
-
:yws_id => @yws_id)
|
26
|
+
:term => 'yelp')
|
28
27
|
expect(client.search(request)).to be_valid_response_hash
|
29
28
|
end
|
30
29
|
end
|
@@ -36,8 +35,7 @@ module Yelp::V1::Review::Request
|
|
36
35
|
:city => 'San Francisco',
|
37
36
|
:state => 'CA',
|
38
37
|
:radius => 2,
|
39
|
-
:term => 'cream puffs'
|
40
|
-
:yws_id => @yws_id)
|
38
|
+
:term => 'cream puffs')
|
41
39
|
expect(client.search(request)).to be_valid_response_hash
|
42
40
|
end
|
43
41
|
end
|
@@ -49,8 +47,7 @@ module Yelp::V1::Review::Request
|
|
49
47
|
:latitude => 37.78022,
|
50
48
|
:longitude => -122.399797,
|
51
49
|
:radius => 5,
|
52
|
-
:term => 'yelp'
|
53
|
-
:yws_id => @yws_id)
|
50
|
+
:term => 'yelp')
|
54
51
|
response = client.search(request)
|
55
52
|
|
56
53
|
# perform the same search focusing only on playgrounds
|
@@ -59,8 +56,7 @@ module Yelp::V1::Review::Request
|
|
59
56
|
:longitude => -122.399797,
|
60
57
|
:radius => 5,
|
61
58
|
:term => 'yelp',
|
62
|
-
:category => 'playgrounds'
|
63
|
-
:yws_id => @yws_id)
|
59
|
+
:category => 'playgrounds')
|
64
60
|
narrowed_response = client.search(narrowed_request)
|
65
61
|
|
66
62
|
# make sure we got less for the second
|
@@ -95,7 +91,6 @@ module Yelp::V1::Review::Request
|
|
95
91
|
params = {
|
96
92
|
:city => 'San Francisco',
|
97
93
|
:state => 'CA',
|
98
|
-
:yws_id => @yws_id,
|
99
94
|
:category => 'donuts'
|
100
95
|
}
|
101
96
|
request = Location.new(params)
|
@@ -138,8 +133,7 @@ module Yelp::V1::Review::Request
|
|
138
133
|
default_params = {
|
139
134
|
:city => 'San Francisco',
|
140
135
|
:state => 'CA',
|
141
|
-
:term => 'gordo'
|
142
|
-
:yws_id => @yws_id
|
136
|
+
:term => 'gordo'
|
143
137
|
}
|
144
138
|
Location.new(default_params.merge(options))
|
145
139
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -12,20 +12,15 @@ module AdditionalSpecHelpers
|
|
12
12
|
|
13
13
|
case api_ver
|
14
14
|
when API_V1
|
15
|
-
|
16
|
-
@yws_id = ENV['YWSID']
|
15
|
+
expect(Credentials.yws_id).to_not be_nil, "Missing YWSID. Obtain from http://www.yelp.com/developers and set in your shell environment under 'YWSID'."
|
17
16
|
when API_V2
|
18
|
-
|
19
|
-
@consumer_key = ENV['YELP_CONSUMER_KEY']
|
17
|
+
expect(Credentials.consumer_key).to_not be_nil, "Missing YELP_CONSUMER_KEY. Obtain from http://www.yelp.com/developers and set in your shell environment under 'YELP_CONSUMER_KEY'."
|
20
18
|
|
21
|
-
|
22
|
-
@consumer_secret = ENV['YELP_CONSUMER_SECRET']
|
19
|
+
expect(Credentials.consumer_secret).to_not be_nil, "Missing YELP_CONSUMER_SECRET. Obtain from http://www.yelp.com/developers and set in your shell environment under 'YELP_CONSUMER_SECRET'."
|
23
20
|
|
24
|
-
|
25
|
-
@token = ENV['YELP_TOKEN']
|
21
|
+
expect(Credentials.token).to_not be_nil, "Missing YELP_TOKEN. Obtain from http://www.yelp.com/developers and set in your shell environment under 'YELP_TOKEN'."
|
26
22
|
|
27
|
-
|
28
|
-
@token_secret = ENV['YELP_TOKEN_SECRET']
|
23
|
+
expect(Credentials.token_secret).to_not be_nil, "Missing YELP_TOKEN_SECRET. Obtain from http://www.yelp.com/developers and set in your shell environment under 'YELP_TOKEN_SECRET'."
|
29
24
|
else
|
30
25
|
assert_false('No api version specified in test case; cannot continue')
|
31
26
|
end
|
@@ -35,6 +30,30 @@ module AdditionalSpecHelpers
|
|
35
30
|
|
36
31
|
end
|
37
32
|
|
33
|
+
module Credentials
|
34
|
+
class << self
|
35
|
+
def yws_id
|
36
|
+
@yws_id ||= ENV['YWSID']
|
37
|
+
end
|
38
|
+
|
39
|
+
def consumer_key
|
40
|
+
@consumer_key ||= ENV['YELP_CONSUMER_KEY']
|
41
|
+
end
|
42
|
+
|
43
|
+
def consumer_secret
|
44
|
+
@consumer_secret ||= ENV['YELP_CONSUMER_SECRET']
|
45
|
+
end
|
46
|
+
|
47
|
+
def token
|
48
|
+
@token ||= ENV['YELP_TOKEN']
|
49
|
+
end
|
50
|
+
|
51
|
+
def token_secret
|
52
|
+
@token_secret ||= ENV['YELP_TOKEN_SECRET']
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
38
57
|
#TODO: These matchers are quite lame and need to meaningfully test
|
39
58
|
# No point in testing ruby conversion of json to hashes
|
40
59
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yelpster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-10-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
@@ -52,6 +52,7 @@ files:
|
|
52
52
|
- CHANGELOG.rdoc
|
53
53
|
- LICENSE.txt
|
54
54
|
- README.md
|
55
|
+
- lib/yelpster/base.rb
|
55
56
|
- lib/yelpster/client.rb
|
56
57
|
- lib/yelpster/record.rb
|
57
58
|
- lib/yelpster/response_format.rb
|
@@ -75,6 +76,7 @@ files:
|
|
75
76
|
- spec/business_retrieve_spec.rb
|
76
77
|
- spec/business_search_spec.rb
|
77
78
|
- spec/client_spec.rb
|
79
|
+
- spec/configuration_spec.rb
|
78
80
|
- spec/neighborhood_search_spec.rb
|
79
81
|
- spec/phone_search_spec.rb
|
80
82
|
- spec/review_search_spec.rb
|
@@ -94,7 +96,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
94
96
|
version: '0'
|
95
97
|
segments:
|
96
98
|
- 0
|
97
|
-
hash:
|
99
|
+
hash: 3290065746868731034
|
98
100
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
101
|
none: false
|
100
102
|
requirements:
|
@@ -103,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
105
|
version: '0'
|
104
106
|
segments:
|
105
107
|
- 0
|
106
|
-
hash:
|
108
|
+
hash: 3290065746868731034
|
107
109
|
requirements: []
|
108
110
|
rubyforge_project:
|
109
111
|
rubygems_version: 1.8.23
|
@@ -114,6 +116,7 @@ test_files:
|
|
114
116
|
- spec/business_retrieve_spec.rb
|
115
117
|
- spec/business_search_spec.rb
|
116
118
|
- spec/client_spec.rb
|
119
|
+
- spec/configuration_spec.rb
|
117
120
|
- spec/neighborhood_search_spec.rb
|
118
121
|
- spec/phone_search_spec.rb
|
119
122
|
- spec/review_search_spec.rb
|