yelp 2.1.1 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/yelp/endpoint/business.rb +6 -4
- data/lib/yelp/error.rb +1 -0
- data/lib/yelp/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/business_locale.yml +89 -0
- data/spec/yelp/endpoint/business_spec.rb +14 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d7b25abb238f773d41b4c56348c28cf1dd8875f
|
4
|
+
data.tar.gz: c36ca4257db000965d16861e1457e49b3d0e4414
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c21ab0c24f81659212d35bb298e6155dd1fbe6efff623bd5fdcb0de76e67fd5a597bbfdf71f4c8d53bdd6fccc0cf789119b6ba9d6e5b02b1e5c52efe03e8003
|
7
|
+
data.tar.gz: b7bef05e2332c99bf2842d069086255598610907395ab860d1a285f6635fde274f2d792dc88e08116e2ddd199c5f05e571bcb5b8203bb2b0059903b1fd4cc151
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
This is a Ruby Gem for the Yelp API. It'll simplify the process of consuming data from the Yelp API for developers using Ruby. The library encompasses both Search and Business API functions.
|
6
6
|
|
7
|
-
Please remember to read and follow the [Terms of Use](http://www.yelp.com/developers/getting_started/api_terms) and [display requirements](
|
7
|
+
Please remember to read and follow the [Terms of Use](http://www.yelp.com/developers/getting_started/api_terms) and [display requirements](https://www.yelp.com/developers/display_requirements) before creating your applications.
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
@@ -14,14 +14,15 @@ module Yelp
|
|
14
14
|
# Make a request to the business endpoint on the API
|
15
15
|
#
|
16
16
|
# @param id [String] the business id
|
17
|
+
# @param locale [Hash] a hash of supported locale-related parameters
|
17
18
|
# @return [Response::Business] the parsed response object from the API
|
18
19
|
#
|
19
20
|
# @example Get business
|
20
21
|
# business = client.business('yelp-san-francisco')
|
21
22
|
# business.name # => 'Yelp'
|
22
23
|
# buinesss.url # => 'http://www.yelp.com/biz/yelp-san-francisco'
|
23
|
-
def business(id)
|
24
|
-
Response::Business.new(JSON.parse(business_request(id).body))
|
24
|
+
def business(id, locale = {})
|
25
|
+
Response::Business.new(JSON.parse(business_request(id, locale).body))
|
25
26
|
end
|
26
27
|
|
27
28
|
private
|
@@ -33,9 +34,10 @@ module Yelp
|
|
33
34
|
# and raises the relevant one if there is.
|
34
35
|
#
|
35
36
|
# @param id [String, Integer] the business id
|
37
|
+
# @param locale [Hash] a hash of supported locale-related parameters
|
36
38
|
# @return [Faraday::Response] the raw response back from the connection
|
37
|
-
def business_request(id)
|
38
|
-
result = @client.connection.get PATH + id
|
39
|
+
def business_request(id, locale = {})
|
40
|
+
result = @client.connection.get PATH + id, locale
|
39
41
|
Error.check_for_error(result)
|
40
42
|
result
|
41
43
|
end
|
data/lib/yelp/error.rb
CHANGED
data/lib/yelp/version.rb
CHANGED
@@ -0,0 +1,89 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.yelp.com/v2/business/yelp-san-francisco?lang=fr
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.9.2
|
12
|
+
Authorization:
|
13
|
+
- OAuth oauth_consumer_key="<YELP_CONSUMER_KEY>", oauth_nonce="6eb6de8df6010e234ced9f23251a1504",
|
14
|
+
oauth_signature="Pad7yjs1LriaUU2FP6eB6t2R3eQ%3D", oauth_signature_method="HMAC-SHA1",
|
15
|
+
oauth_timestamp="1458591358", oauth_token="<YELP_TOKEN>", oauth_version="1.0"
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
+
Accept:
|
19
|
+
- "*/*"
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
Server:
|
26
|
+
- cloudflare-nginx
|
27
|
+
Date:
|
28
|
+
- Mon, 21 Mar 2016 20:15:59 GMT
|
29
|
+
Content-Type:
|
30
|
+
- application/json; charset=UTF-8
|
31
|
+
Transfer-Encoding:
|
32
|
+
- chunked
|
33
|
+
Connection:
|
34
|
+
- keep-alive
|
35
|
+
Set-Cookie:
|
36
|
+
- __cfduid=d7e727899e57a184b3dd579782a22dbda1458591358; expires=Tue, 21-Mar-17
|
37
|
+
20:15:58 GMT; path=/; domain=.yelp.com; HttpOnly
|
38
|
+
- bse=2b976b9f4722ec3eaee7649b1330e617; Domain=.yelp.com; Path=/; HttpOnly
|
39
|
+
- yuv=yPVXCeozEMoibD_fT0zxXiN4X46CVbvNrykpeM_iIPJ_IZQqdsXz9Owjx9qrT3hYmBwMHHNL1mf_BdNYAuO2aWFmLIObp0eB;
|
40
|
+
Domain=.yelp.com; Max-Age=630720000; Path=/; expires=Sun, 16-Mar-2036 20:15:58
|
41
|
+
GMT
|
42
|
+
X-Node:
|
43
|
+
- api_com
|
44
|
+
- web7-r1-sfo2
|
45
|
+
Cache-Control:
|
46
|
+
- max-age=0, must-revalidate, no-cache, no-store, private
|
47
|
+
Expires:
|
48
|
+
- Mon, 21 Mar 2016 20:15:58 GMT
|
49
|
+
Pragma:
|
50
|
+
- no-cache
|
51
|
+
Vary:
|
52
|
+
- Accept-Encoding,User-Agent
|
53
|
+
X-Mode:
|
54
|
+
- ro
|
55
|
+
X-Proxied:
|
56
|
+
- extlb8-r11-sfo2
|
57
|
+
Cf-Ray:
|
58
|
+
- 28741438b12f1e9b-SJC
|
59
|
+
body:
|
60
|
+
encoding: UTF-8
|
61
|
+
string: '{"is_claimed": true, "rating": 2.5, "mobile_url": "http://m.yelp.fr/biz/yelp-san-francisco?utm_campaign=yelp_api\u0026utm_medium=api_v2_business\u0026utm_source=<YELP_CONSUMER_KEY>",
|
62
|
+
"rating_img_url": "https://s3-media4.fl.yelpcdn.com/assets/2/www/img/c7fb9aff59f9/ico/stars/v1/stars_2_half.png",
|
63
|
+
"review_count": 8091, "name": "Yelp", "rating_img_url_small": "https://s3-media4.fl.yelpcdn.com/assets/2/www/img/8e8633e5f8f0/ico/stars/v1/stars_small_2_half.png",
|
64
|
+
"url": "http://www.yelp.fr/biz/yelp-san-francisco?utm_campaign=yelp_api\u0026utm_medium=api_v2_business\u0026utm_source=<YELP_CONSUMER_KEY>",
|
65
|
+
"categories": [["Couleur locale", "localflavor"], ["M\u00e9dia", "massmedia"]],
|
66
|
+
"reviews": [{"rating": 5, "excerpt": "I needed help with my business listing, I
|
67
|
+
spoke to Joel Baerra and he was a big help. There was a difficulty with my
|
68
|
+
business page. Joel did his very...", "time_created": 1458252608, "rating_image_url":
|
69
|
+
"https://s3-media1.fl.yelpcdn.com/assets/2/www/img/f1def11e4e79/ico/stars/v1/stars_5.png",
|
70
|
+
"rating_image_small_url": "https://s3-media1.fl.yelpcdn.com/assets/2/www/img/c7623205d5cd/ico/stars/v1/stars_small_5.png",
|
71
|
+
"user": {"image_url": "http://s3-media4.fl.yelpcdn.com/photo/zeM4J1h3AjeYFVyTeBRElQ/ms.jpg",
|
72
|
+
"id": "0dVrwVNTr-3KiC_-32O02g", "name": "Francis B."}, "rating_image_large_url":
|
73
|
+
"https://s3-media3.fl.yelpcdn.com/assets/2/www/img/22affc4e6c38/ico/stars/v1/stars_large_5.png",
|
74
|
+
"id": "Q_YCvhSFLeW3uDn5bz0iwA"}], "phone": "+14159083801", "snippet_text":
|
75
|
+
"Yelp m\u00e9rite ais\u00e9ment 5 \u00e9toiles !\n\nCe site permet de faire
|
76
|
+
de belles d\u00e9couvertes et de donner son avis sur tout, les commentaires
|
77
|
+
donn\u00e9s par les autres...", "image_url": "https://s3-media3.fl.yelpcdn.com/bphoto/nQK-6_vZMt5n88zsAS94ew/ms.jpg",
|
78
|
+
"snippet_image_url": "http://s3-media2.fl.yelpcdn.com/photo/2AnuU_tbyu9IoSI7LwJ8QA/ms.jpg",
|
79
|
+
"display_phone": "+1-415-908-3801", "rating_img_url_large": "https://s3-media2.fl.yelpcdn.com/assets/2/www/img/d63e3add9901/ico/stars/v1/stars_large_2_half.png",
|
80
|
+
"id": "yelp-san-francisco", "is_closed": false, "location": {"cross_streets":
|
81
|
+
"Natoma St \u0026 Minna St", "city": "San Francisco", "display_address": ["140
|
82
|
+
New Montgomery St", "Financial District", "San Francisco, CA 94105", "USA"],
|
83
|
+
"geo_accuracy": 9.5, "neighborhoods": ["Financial District", "SoMa"], "postal_code":
|
84
|
+
"94105", "country_code": "US", "address": ["140 New Montgomery St"], "coordinate":
|
85
|
+
{"latitude": 37.7867703362929, "longitude": -122.399958372115}, "state_code":
|
86
|
+
"CA"}}'
|
87
|
+
http_version:
|
88
|
+
recorded_at: Mon, 21 Mar 2016 20:15:59 GMT
|
89
|
+
recorded_with: VCR 2.9.3
|
@@ -6,6 +6,7 @@ describe Yelp::Endpoint::Business do
|
|
6
6
|
let(:api_keys) { real_api_keys }
|
7
7
|
let(:business) { 'yelp-san-francisco' }
|
8
8
|
let(:client) { Yelp::Client.new(api_keys) }
|
9
|
+
let(:locale) { Hash[lang: 'fr'] }
|
9
10
|
|
10
11
|
describe '#business' do
|
11
12
|
subject {
|
@@ -16,6 +17,19 @@ describe Yelp::Endpoint::Business do
|
|
16
17
|
|
17
18
|
it { should be_a(Yelp::Response::Business) }
|
18
19
|
its('business.name') { should eql('Yelp') }
|
20
|
+
its('business.url') { should include('yelp.com') }
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '#business locale' do
|
24
|
+
subject {
|
25
|
+
VCR.use_cassette('business_locale') do
|
26
|
+
client.business(business, locale)
|
27
|
+
end
|
28
|
+
}
|
29
|
+
|
30
|
+
it { should be_a(Yelp::Response::Business) }
|
31
|
+
its('business.name') { should eql('Yelp') }
|
32
|
+
its('business.url') { should include('yelp.fr') }
|
19
33
|
end
|
20
34
|
|
21
35
|
describe 'errors' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yelp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomer Elmalem
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2016-03-22 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -244,6 +244,7 @@ files:
|
|
244
244
|
- lib/yelp/responses/search.rb
|
245
245
|
- lib/yelp/version.rb
|
246
246
|
- spec/fixtures/vcr_cassettes/business.yml
|
247
|
+
- spec/fixtures/vcr_cassettes/business_locale.yml
|
247
248
|
- spec/fixtures/vcr_cassettes/phone_search.yml
|
248
249
|
- spec/fixtures/vcr_cassettes/search.yml
|
249
250
|
- spec/fixtures/vcr_cassettes/search_bounding_box.yml
|
@@ -287,6 +288,7 @@ specification_version: 4
|
|
287
288
|
summary: Ruby client library for the Yelp API
|
288
289
|
test_files:
|
289
290
|
- spec/fixtures/vcr_cassettes/business.yml
|
291
|
+
- spec/fixtures/vcr_cassettes/business_locale.yml
|
290
292
|
- spec/fixtures/vcr_cassettes/phone_search.yml
|
291
293
|
- spec/fixtures/vcr_cassettes/search.yml
|
292
294
|
- spec/fixtures/vcr_cassettes/search_bounding_box.yml
|