yelp-fusion 0.1.pre.beta

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.
Files changed (48) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.rubocop.yml +1 -0
  4. data/.rubocop_todo.yml +210 -0
  5. data/CODE_OF_CONDUCT.md +74 -0
  6. data/Gemfile +8 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +180 -0
  9. data/Rakefile +9 -0
  10. data/Test::vcr_casettes/business.yml +75 -0
  11. data/Test::vcr_casettes/match.yml +61 -0
  12. data/Test::vcr_casettes/phone.yml +65 -0
  13. data/Test::vcr_casettes/review.yml +72 -0
  14. data/Test::vcr_casettes/search.yml +263 -0
  15. data/Test::vcr_casettes/search_by_coordinates.yml +57 -0
  16. data/Test::vcr_casettes/transaction.yml +254 -0
  17. data/Test::vcr_casettes/transaction_by_coordinates.yml +56 -0
  18. data/bin/console +14 -0
  19. data/bin/setup +8 -0
  20. data/lib/yelp/fusion.rb +36 -0
  21. data/lib/yelp/fusion/client.rb +86 -0
  22. data/lib/yelp/fusion/configuration.rb +37 -0
  23. data/lib/yelp/fusion/endpoint/business.rb +70 -0
  24. data/lib/yelp/fusion/endpoint/match.rb +64 -0
  25. data/lib/yelp/fusion/endpoint/phone.rb +71 -0
  26. data/lib/yelp/fusion/endpoint/review.rb +72 -0
  27. data/lib/yelp/fusion/endpoint/search.rb +104 -0
  28. data/lib/yelp/fusion/endpoint/transaction.rb +97 -0
  29. data/lib/yelp/fusion/error.rb +105 -0
  30. data/lib/yelp/fusion/responses/base.rb +43 -0
  31. data/lib/yelp/fusion/responses/business.rb +36 -0
  32. data/lib/yelp/fusion/responses/match.rb +36 -0
  33. data/lib/yelp/fusion/responses/models/business.rb +48 -0
  34. data/lib/yelp/fusion/responses/models/categories.rb +34 -0
  35. data/lib/yelp/fusion/responses/models/center.rb +34 -0
  36. data/lib/yelp/fusion/responses/models/hours.rb +38 -0
  37. data/lib/yelp/fusion/responses/models/location.rb +36 -0
  38. data/lib/yelp/fusion/responses/models/openHours.rb +34 -0
  39. data/lib/yelp/fusion/responses/models/region.rb +38 -0
  40. data/lib/yelp/fusion/responses/models/reviews.rb +38 -0
  41. data/lib/yelp/fusion/responses/models/user.rb +36 -0
  42. data/lib/yelp/fusion/responses/phone.rb +36 -0
  43. data/lib/yelp/fusion/responses/review.rb +36 -0
  44. data/lib/yelp/fusion/responses/search.rb +38 -0
  45. data/lib/yelp/fusion/responses/transaction.rb +36 -0
  46. data/lib/yelp/fusion/version.rb +25 -0
  47. data/yelp-fusion.gemspec +44 -0
  48. metadata +192 -0
@@ -0,0 +1,57 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.yelp.com/v3/businesses/search?latitude=37.6&longitude=38.6
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.15.2
12
+ Authorization:
13
+ - Bearer
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Server:
24
+ - nginx
25
+ Content-Type:
26
+ - application/json
27
+ Ratelimit-Dailylimit:
28
+ - '5000'
29
+ Ratelimit-Remaining:
30
+ - '4999'
31
+ Ratelimit-Resettime:
32
+ - '2018-06-19T00:00:00+00:00'
33
+ X-Proxied:
34
+ - 10-65-81-72-useast1aprod
35
+ Transfer-Encoding:
36
+ - chunked
37
+ Accept-Ranges:
38
+ - bytes
39
+ Date:
40
+ - Mon, 18 Jun 2018 19:04:34 GMT
41
+ Via:
42
+ - 1.1 varnish
43
+ Connection:
44
+ - keep-alive
45
+ X-Served-By:
46
+ - cache-iad2143-IAD
47
+ X-Cache:
48
+ - MISS
49
+ X-Cache-Hits:
50
+ - '0'
51
+ body:
52
+ encoding: ASCII-8BIT
53
+ string: '{"businesses": [], "total": 0, "region": {"center": {"longitude": 38.6,
54
+ "latitude": 37.6}}}'
55
+ http_version:
56
+ recorded_at: Mon, 18 Jun 2018 19:04:34 GMT
57
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,254 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.yelp.com/v3/transactions/delivery/search?location=San%20Francisco
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.15.2
12
+ Authorization:
13
+ - Bearer
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Server:
24
+ - nginx
25
+ Content-Type:
26
+ - application/json
27
+ Ratelimit-Dailylimit:
28
+ - '5000'
29
+ Ratelimit-Remaining:
30
+ - '4994'
31
+ Ratelimit-Resettime:
32
+ - '2018-06-27T00:00:00+00:00'
33
+ X-Proxied:
34
+ - 10-65-81-72-useast1aprod
35
+ Transfer-Encoding:
36
+ - chunked
37
+ Accept-Ranges:
38
+ - bytes
39
+ Date:
40
+ - Tue, 26 Jun 2018 19:32:51 GMT
41
+ Via:
42
+ - 1.1 varnish
43
+ Connection:
44
+ - keep-alive
45
+ X-Served-By:
46
+ - cache-bos8225-BOS
47
+ X-Cache:
48
+ - MISS
49
+ X-Cache-Hits:
50
+ - '0'
51
+ body:
52
+ encoding: ASCII-8BIT
53
+ string: '{"businesses": [{"id": "DAiqwrmv19Uv-I1bOoAJCQ", "alias": "baiano-pizzeria-san-francisco-3",
54
+ "name": "Baiano Pizzeria", "image_url": "https://s3-media2.fl.yelpcdn.com/bphoto/1UBizBJVlcfGcicFRNj3hw/o.jpg",
55
+ "is_closed": false, "url": "https://www.yelp.com/biz/baiano-pizzeria-san-francisco-3?adjust_creative=-pz45lFH4aD0aS0s94dStQ&utm_campaign=yelp_api_v3&utm_medium=api_v3_transactions_search_delivery&utm_source=-pz45lFH4aD0aS0s94dStQ",
56
+ "review_count": 150, "categories": [{"alias": "pizza", "title": "Pizza"},
57
+ {"alias": "salad", "title": "Salad"}], "rating": 4.0, "coordinates": {"latitude":
58
+ 37.7741681941565, "longitude": -122.422267710877}, "transactions": ["pickup",
59
+ "delivery"], "price": "$", "location": {"address1": "100 Gough St", "address2":
60
+ "1234", "address3": "1234", "city": "San Francisco", "zip_code": "94102", "country":
61
+ "US", "state": "CA", "display_address": ["100 Gough St", "San Francisco, CA
62
+ 94102"]}, "phone": "+14156211401", "display_phone": "(415) 621-1401"}, {"id":
63
+ "QWZO1RdLbG5h0RGDiItoAA", "alias": "zaoh-restaurant-san-francisco", "name":
64
+ "Zaoh Restaurant", "image_url": "https://s3-media2.fl.yelpcdn.com/bphoto/M9ZRVjDuFqUz7dHjJVhGEg/o.jpg",
65
+ "is_closed": false, "url": "https://www.yelp.com/biz/zaoh-restaurant-san-francisco?adjust_creative=-pz45lFH4aD0aS0s94dStQ&utm_campaign=yelp_api_v3&utm_medium=api_v3_transactions_search_delivery&utm_source=-pz45lFH4aD0aS0s94dStQ",
66
+ "review_count": 240, "categories": [{"alias": "sushi", "title": "Sushi Bars"},
67
+ {"alias": "japanese", "title": "Japanese"}], "rating": 3.5, "coordinates":
68
+ {"latitude": 37.77317, "longitude": -122.41787}, "transactions": ["pickup",
69
+ "delivery"], "price": "$$", "location": {"address1": "1555 Mission St", "address2":
70
+ "", "address3": "", "city": "San Francisco", "zip_code": "94103", "country":
71
+ "US", "state": "CA", "display_address": ["1555 Mission St", "San Francisco,
72
+ CA 94103"]}, "phone": "+14154313930", "display_phone": "(415) 431-3930"},
73
+ {"id": "qqUqgHS2K20ePDQ-nJzM7w", "alias": "v-cafe-san-francisco", "name":
74
+ "V Cafe", "image_url": "https://s3-media3.fl.yelpcdn.com/bphoto/wDho3GPN_IK5oUhoZIExgA/o.jpg",
75
+ "is_closed": false, "url": "https://www.yelp.com/biz/v-cafe-san-francisco?adjust_creative=-pz45lFH4aD0aS0s94dStQ&utm_campaign=yelp_api_v3&utm_medium=api_v3_transactions_search_delivery&utm_source=-pz45lFH4aD0aS0s94dStQ",
76
+ "review_count": 242, "categories": [{"alias": "cheesesteaks", "title": "Cheesesteaks"},
77
+ {"alias": "burgers", "title": "Burgers"}], "rating": 4.0, "coordinates": {"latitude":
78
+ 37.77143, "longitude": -122.41428}, "transactions": ["pickup", "delivery"],
79
+ "price": "$", "location": {"address1": "1525 Folsom St", "address2": "", "address3":
80
+ "", "city": "San Francisco", "zip_code": "94103", "country": "US", "state":
81
+ "CA", "display_address": ["1525 Folsom St", "San Francisco, CA 94103"]}, "phone":
82
+ "+14158633620", "display_phone": "(415) 863-3620"}, {"id": "nik97G8-H0rFoJKO4X3ZIA",
83
+ "alias": "7-mission-restaurant-san-francisco-2", "name": "7 Mission Restaurant",
84
+ "image_url": "https://s3-media3.fl.yelpcdn.com/bphoto/THSMpCqmMoYZOoOpcR6yBA/o.jpg",
85
+ "is_closed": false, "url": "https://www.yelp.com/biz/7-mission-restaurant-san-francisco-2?adjust_creative=-pz45lFH4aD0aS0s94dStQ&utm_campaign=yelp_api_v3&utm_medium=api_v3_transactions_search_delivery&utm_source=-pz45lFH4aD0aS0s94dStQ",
86
+ "review_count": 216, "categories": [{"alias": "vietnamese", "title": "Vietnamese"},
87
+ {"alias": "chinese", "title": "Chinese"}], "rating": 3.5, "coordinates": {"latitude":
88
+ 37.7783966064453, "longitude": -122.410293579102}, "transactions": ["pickup",
89
+ "delivery"], "price": "$", "location": {"address1": "150 7th St", "address2":
90
+ null, "address3": "", "city": "San Francisco", "zip_code": "94103", "country":
91
+ "US", "state": "CA", "display_address": ["150 7th St", "San Francisco, CA
92
+ 94103"]}, "phone": "+14158613298", "display_phone": "(415) 861-3298"}, {"id":
93
+ "KRO4PzfmbRgCu1Ayt1LE1g", "alias": "mortys-delicatessen-san-francisco", "name":
94
+ "Morty''s Delicatessen", "image_url": "https://s3-media3.fl.yelpcdn.com/bphoto/NW5NwtCk404qF-UJd-OlVg/o.jpg",
95
+ "is_closed": false, "url": "https://www.yelp.com/biz/mortys-delicatessen-san-francisco?adjust_creative=-pz45lFH4aD0aS0s94dStQ&utm_campaign=yelp_api_v3&utm_medium=api_v3_transactions_search_delivery&utm_source=-pz45lFH4aD0aS0s94dStQ",
96
+ "review_count": 492, "categories": [{"alias": "sandwiches", "title": "Sandwiches"},
97
+ {"alias": "delis", "title": "Delis"}, {"alias": "vegetarian", "title": "Vegetarian"}],
98
+ "rating": 4.0, "coordinates": {"latitude": 37.78188, "longitude": -122.41522},
99
+ "transactions": ["pickup", "delivery"], "price": "$", "location": {"address1":
100
+ "280 Golden Gate Ave", "address2": null, "address3": "", "city": "San Francisco",
101
+ "zip_code": "94102", "country": "US", "state": "CA", "display_address": ["280
102
+ Golden Gate Ave", "San Francisco, CA 94102"]}, "phone": "+14155673354", "display_phone":
103
+ "(415) 567-3354"}, {"id": "Y2tRPJxl0nvRJ3BsZUzAkQ", "alias": "pizza-zone-n-grill-san-francisco-3",
104
+ "name": "Pizza Zone N Grill", "image_url": "https://s3-media1.fl.yelpcdn.com/bphoto/1EKSaFlzZIj9hTW3ceU7uw/o.jpg",
105
+ "is_closed": false, "url": "https://www.yelp.com/biz/pizza-zone-n-grill-san-francisco-3?adjust_creative=-pz45lFH4aD0aS0s94dStQ&utm_campaign=yelp_api_v3&utm_medium=api_v3_transactions_search_delivery&utm_source=-pz45lFH4aD0aS0s94dStQ",
106
+ "review_count": 286, "categories": [{"alias": "pizza", "title": "Pizza"},
107
+ {"alias": "burgers", "title": "Burgers"}, {"alias": "sandwiches", "title":
108
+ "Sandwiches"}], "rating": 3.0, "coordinates": {"latitude": 37.7702881, "longitude":
109
+ -122.4225688}, "transactions": ["pickup", "delivery"], "price": "$", "location":
110
+ {"address1": "178 Valencia St", "address2": "", "address3": "", "city": "San
111
+ Francisco", "zip_code": "94103", "country": "US", "state": "CA", "display_address":
112
+ ["178 Valencia St", "San Francisco, CA 94103"]}, "phone": "+14157017300",
113
+ "display_phone": "(415) 701-7300"}, {"id": "ZajCfjeJaHdakadUMYT9Dw", "alias":
114
+ "golden-kim-tar-san-francisco", "name": "Golden Kim Tar", "image_url": "https://s3-media1.fl.yelpcdn.com/bphoto/ZWSMmOGQQnCg9Jnrhee_Yw/o.jpg",
115
+ "is_closed": false, "url": "https://www.yelp.com/biz/golden-kim-tar-san-francisco?adjust_creative=-pz45lFH4aD0aS0s94dStQ&utm_campaign=yelp_api_v3&utm_medium=api_v3_transactions_search_delivery&utm_source=-pz45lFH4aD0aS0s94dStQ",
116
+ "review_count": 257, "categories": [{"alias": "chinese", "title": "Chinese"}],
117
+ "rating": 3.5, "coordinates": {"latitude": 37.7818482, "longitude": -122.4170559},
118
+ "transactions": ["pickup", "delivery"], "price": "$", "location": {"address1":
119
+ "434 Larkin St", "address2": null, "address3": "", "city": "San Francisco",
120
+ "zip_code": "94102", "country": "US", "state": "CA", "display_address": ["434
121
+ Larkin St", "San Francisco, CA 94102"]}, "phone": "+14153468889", "display_phone":
122
+ "(415) 346-8889"}, {"id": "xSWJlaiXDSMHyNpOAIYJqg", "alias": "metro-caffe-san-francisco",
123
+ "name": "Metro Caffe", "image_url": "https://s3-media4.fl.yelpcdn.com/bphoto/F9f5N4wc61YFK1rhF5_nhA/o.jpg",
124
+ "is_closed": false, "url": "https://www.yelp.com/biz/metro-caffe-san-francisco?adjust_creative=-pz45lFH4aD0aS0s94dStQ&utm_campaign=yelp_api_v3&utm_medium=api_v3_transactions_search_delivery&utm_source=-pz45lFH4aD0aS0s94dStQ",
125
+ "review_count": 275, "categories": [{"alias": "burgers", "title": "Burgers"},
126
+ {"alias": "cheesesteaks", "title": "Cheesesteaks"}, {"alias": "hotdog", "title":
127
+ "Hot Dogs"}], "rating": 4.0, "coordinates": {"latitude": 37.7718234819883,
128
+ "longitude": -122.430553196817}, "transactions": ["pickup", "delivery"], "price":
129
+ "$", "location": {"address1": "247 Fillmore St", "address2": "", "address3":
130
+ "", "city": "San Francisco", "zip_code": "94117", "country": "US", "state":
131
+ "CA", "display_address": ["247 Fillmore St", "San Francisco, CA 94117"]},
132
+ "phone": "+14156219536", "display_phone": "(415) 621-9536"}, {"id": "ZD5-5Gu44WrcsYtw7qMgiw",
133
+ "alias": "palmyra-san-francisco", "name": "Palmyra", "image_url": "https://s3-media4.fl.yelpcdn.com/bphoto/Hj2TsvNEprFYhXV6Qu3kwg/o.jpg",
134
+ "is_closed": false, "url": "https://www.yelp.com/biz/palmyra-san-francisco?adjust_creative=-pz45lFH4aD0aS0s94dStQ&utm_campaign=yelp_api_v3&utm_medium=api_v3_transactions_search_delivery&utm_source=-pz45lFH4aD0aS0s94dStQ",
135
+ "review_count": 778, "categories": [{"alias": "mediterranean", "title": "Mediterranean"},
136
+ {"alias": "mideastern", "title": "Middle Eastern"}, {"alias": "syrian", "title":
137
+ "Syrian"}], "rating": 4.0, "coordinates": {"latitude": 37.771851, "longitude":
138
+ -122.433937}, "transactions": ["pickup", "delivery"], "price": "$", "location":
139
+ {"address1": "700 Haight St", "address2": "", "address3": "", "city": "San
140
+ Francisco", "zip_code": "94117", "country": "US", "state": "CA", "display_address":
141
+ ["700 Haight St", "San Francisco, CA 94117"]}, "phone": "+14158964172", "display_phone":
142
+ "(415) 896-4172"}, {"id": "M5xcWgfoGtvYUaYysujWdA", "alias": "cheers-on-demand-san-francisco-5",
143
+ "name": "Cheers On Demand", "image_url": "https://s3-media2.fl.yelpcdn.com/bphoto/jZG2XNS1iXmvsQoTsLPh6g/o.jpg",
144
+ "is_closed": false, "url": "https://www.yelp.com/biz/cheers-on-demand-san-francisco-5?adjust_creative=-pz45lFH4aD0aS0s94dStQ&utm_campaign=yelp_api_v3&utm_medium=api_v3_transactions_search_delivery&utm_source=-pz45lFH4aD0aS0s94dStQ",
145
+ "review_count": 47, "categories": [{"alias": "beer_and_wine", "title": "Beer,
146
+ Wine & Spirits"}], "rating": 4.5, "coordinates": {"latitude": 37.7773321823714,
147
+ "longitude": -122.431544454087}, "transactions": ["pickup", "delivery"], "price":
148
+ "$", "location": {"address1": "867 Fillmore St", "address2": "", "address3":
149
+ "", "city": "San Francisco", "zip_code": "94117", "country": "US", "state":
150
+ "CA", "display_address": ["867 Fillmore St", "San Francisco, CA 94117"]},
151
+ "phone": "+14158852898", "display_phone": "(415) 885-2898"}, {"id": "9jW6WTeK3BrXuZKvHyqrsA",
152
+ "alias": "newa-san-francisco-4", "name": "Newa", "image_url": "https://s3-media3.fl.yelpcdn.com/bphoto/T_MZJw-0jLRMz_rheHJhMA/o.jpg",
153
+ "is_closed": false, "url": "https://www.yelp.com/biz/newa-san-francisco-4?adjust_creative=-pz45lFH4aD0aS0s94dStQ&utm_campaign=yelp_api_v3&utm_medium=api_v3_transactions_search_delivery&utm_source=-pz45lFH4aD0aS0s94dStQ",
154
+ "review_count": 146, "categories": [{"alias": "indpak", "title": "Indian"},
155
+ {"alias": "himalayan", "title": "Himalayan/Nepalese"}, {"alias": "halal",
156
+ "title": "Halal"}], "rating": 4.0, "coordinates": {"latitude": 37.7847215,
157
+ "longitude": -122.4130263}, "transactions": ["pickup", "delivery"], "price":
158
+ "$$", "location": {"address1": "407 Ellis St", "address2": "", "address3":
159
+ null, "city": "San Francisco", "zip_code": "94102", "country": "US", "state":
160
+ "CA", "display_address": ["407 Ellis St", "San Francisco, CA 94102"]}, "phone":
161
+ "+14154473876", "display_phone": "(415) 447-3876"}, {"id": "0w6dNMrpBQFLxhVYqx_J5Q",
162
+ "alias": "red-jade-san-francisco", "name": "Red Jade", "image_url": "https://s3-media2.fl.yelpcdn.com/bphoto/-C_mhBn9TdpiCjYNWKfMwg/o.jpg",
163
+ "is_closed": false, "url": "https://www.yelp.com/biz/red-jade-san-francisco?adjust_creative=-pz45lFH4aD0aS0s94dStQ&utm_campaign=yelp_api_v3&utm_medium=api_v3_transactions_search_delivery&utm_source=-pz45lFH4aD0aS0s94dStQ",
164
+ "review_count": 688, "categories": [{"alias": "chinese", "title": "Chinese"}],
165
+ "rating": 3.5, "coordinates": {"latitude": 37.7668495178223, "longitude":
166
+ -122.428527832031}, "transactions": ["pickup", "delivery"], "price": "$",
167
+ "location": {"address1": "245 Church St", "address2": null, "address3": "",
168
+ "city": "San Francisco", "zip_code": "94114", "country": "US", "state": "CA",
169
+ "display_address": ["245 Church St", "San Francisco, CA 94114"]}, "phone":
170
+ "+14156213020", "display_phone": "(415) 621-3020"}, {"id": "nL40RmgMcFjyAX-QwJ8klw",
171
+ "alias": "l-acajou-bakery-and-cafe-san-francisco-2", "name": "L''acajou Bakery
172
+ & Cafe", "image_url": "https://s3-media4.fl.yelpcdn.com/bphoto/1jcM9_blr9sUzMqdbRitPw/o.jpg",
173
+ "is_closed": false, "url": "https://www.yelp.com/biz/l-acajou-bakery-and-cafe-san-francisco-2?adjust_creative=-pz45lFH4aD0aS0s94dStQ&utm_campaign=yelp_api_v3&utm_medium=api_v3_transactions_search_delivery&utm_source=-pz45lFH4aD0aS0s94dStQ",
174
+ "review_count": 316, "categories": [{"alias": "coffee", "title": "Coffee &
175
+ Tea"}, {"alias": "bakeries", "title": "Bakeries"}, {"alias": "sandwiches",
176
+ "title": "Sandwiches"}], "rating": 4.0, "coordinates": {"latitude": 37.7713164,
177
+ "longitude": -122.4087526}, "transactions": ["pickup", "delivery"], "price":
178
+ "$", "location": {"address1": "498 9th St", "address2": "", "address3": "",
179
+ "city": "San Francisco", "zip_code": "94103", "country": "US", "state": "CA",
180
+ "display_address": ["498 9th St", "San Francisco, CA 94103"]}, "phone": "+14156263683",
181
+ "display_phone": "(415) 626-3683"}, {"id": "WLqqZYTeo6wFXuCFtlweqA", "alias":
182
+ "patxis-pizza-san-francisco-2", "name": "Patxi''s Pizza", "image_url": "https://s3-media2.fl.yelpcdn.com/bphoto/EOEfNgRIFDiLv-UHnWK_eQ/o.jpg",
183
+ "is_closed": false, "url": "https://www.yelp.com/biz/patxis-pizza-san-francisco-2?adjust_creative=-pz45lFH4aD0aS0s94dStQ&utm_campaign=yelp_api_v3&utm_medium=api_v3_transactions_search_delivery&utm_source=-pz45lFH4aD0aS0s94dStQ",
184
+ "review_count": 2081, "categories": [{"alias": "pizza", "title": "Pizza"},
185
+ {"alias": "salad", "title": "Salad"}, {"alias": "italian", "title": "Italian"}],
186
+ "rating": 3.5, "coordinates": {"latitude": 37.77649, "longitude": -122.425},
187
+ "transactions": ["pickup", "delivery"], "price": "$$", "location": {"address1":
188
+ "511 Hayes St", "address2": "", "address3": "", "city": "San Francisco", "zip_code":
189
+ "94102", "country": "US", "state": "CA", "display_address": ["511 Hayes St",
190
+ "San Francisco, CA 94102"]}, "phone": "+14155589991", "display_phone": "(415)
191
+ 558-9991"}, {"id": "N-vfl3FXnj4M7N6jW-1EGA", "alias": "frena-san-francisco-3",
192
+ "name": "Frena", "image_url": "https://s3-media3.fl.yelpcdn.com/bphoto/aVjHuyHA3kjg26msJHb_xA/o.jpg",
193
+ "is_closed": false, "url": "https://www.yelp.com/biz/frena-san-francisco-3?adjust_creative=-pz45lFH4aD0aS0s94dStQ&utm_campaign=yelp_api_v3&utm_medium=api_v3_transactions_search_delivery&utm_source=-pz45lFH4aD0aS0s94dStQ",
194
+ "review_count": 249, "categories": [{"alias": "bakeries", "title": "Bakeries"},
195
+ {"alias": "kosher", "title": "Kosher"}, {"alias": "mediterranean", "title":
196
+ "Mediterranean"}], "rating": 4.5, "coordinates": {"latitude": 37.780321, "longitude":
197
+ -122.408274}, "transactions": ["pickup", "delivery"], "price": "$", "location":
198
+ {"address1": "132 6th St", "address2": null, "address3": "", "city": "San
199
+ Francisco", "zip_code": "94103", "country": "US", "state": "CA", "display_address":
200
+ ["132 6th St", "San Francisco, CA 94103"]}, "phone": "+16284443666", "display_phone":
201
+ "(628) 444-3666"}, {"id": "Z9U5KiRooSqSN4Dggoycww", "alias": "dirty-water-san-francisco-4",
202
+ "name": "Dirty Water", "image_url": "https://s3-media1.fl.yelpcdn.com/bphoto/t1Q4pA9F6oNW98LdEeJBww/o.jpg",
203
+ "is_closed": false, "url": "https://www.yelp.com/biz/dirty-water-san-francisco-4?adjust_creative=-pz45lFH4aD0aS0s94dStQ&utm_campaign=yelp_api_v3&utm_medium=api_v3_transactions_search_delivery&utm_source=-pz45lFH4aD0aS0s94dStQ",
204
+ "review_count": 336, "categories": [{"alias": "wine_bars", "title": "Wine
205
+ Bars"}, {"alias": "cocktailbars", "title": "Cocktail Bars"}, {"alias": "newamerican",
206
+ "title": "American (New)"}], "rating": 3.5, "coordinates": {"latitude": 37.77674,
207
+ "longitude": -122.41636}, "transactions": ["restaurant_reservation", "pickup",
208
+ "delivery"], "price": "$$", "location": {"address1": "1355 Market St", "address2":
209
+ null, "address3": "", "city": "San Francisco", "zip_code": "94103", "country":
210
+ "US", "state": "CA", "display_address": ["1355 Market St", "San Francisco,
211
+ CA 94103"]}, "phone": "+14157925101", "display_phone": "(415) 792-5101"},
212
+ {"id": "d2upo6I2R4bbMF35tyBKFA", "alias": "split-pea-seduction-san-francisco",
213
+ "name": "Split Pea Seduction", "image_url": "https://s3-media3.fl.yelpcdn.com/bphoto/JRANSrIq0RoFVIA-yq4SHQ/o.jpg",
214
+ "is_closed": false, "url": "https://www.yelp.com/biz/split-pea-seduction-san-francisco?adjust_creative=-pz45lFH4aD0aS0s94dStQ&utm_campaign=yelp_api_v3&utm_medium=api_v3_transactions_search_delivery&utm_source=-pz45lFH4aD0aS0s94dStQ",
215
+ "review_count": 277, "categories": [{"alias": "sandwiches", "title": "Sandwiches"},
216
+ {"alias": "soup", "title": "Soup"}, {"alias": "salad", "title": "Salad"}],
217
+ "rating": 4.0, "coordinates": {"latitude": 37.7803635, "longitude": -122.4081286},
218
+ "transactions": ["pickup", "delivery"], "price": "$$", "location": {"address1":
219
+ "138 6th St", "address2": "", "address3": "", "city": "San Francisco", "zip_code":
220
+ "94103", "country": "US", "state": "CA", "display_address": ["138 6th St",
221
+ "San Francisco, CA 94103"]}, "phone": "+14155512223", "display_phone": "(415)
222
+ 551-2223"}, {"id": "IF6C4SvyWWx1li9S2xt_CQ", "alias": "piccolo-pizza-san-francisco-15",
223
+ "name": "Piccolo Pizza", "image_url": "https://s3-media2.fl.yelpcdn.com/bphoto/wP-nl-Vew8dqYhwLPYDapg/o.jpg",
224
+ "is_closed": false, "url": "https://www.yelp.com/biz/piccolo-pizza-san-francisco-15?adjust_creative=-pz45lFH4aD0aS0s94dStQ&utm_campaign=yelp_api_v3&utm_medium=api_v3_transactions_search_delivery&utm_source=-pz45lFH4aD0aS0s94dStQ",
225
+ "review_count": 243, "categories": [{"alias": "italian", "title": "Italian"},
226
+ {"alias": "pizza", "title": "Pizza"}], "rating": 3.5, "coordinates": {"latitude":
227
+ 37.7850558, "longitude": -122.4177129}, "transactions": ["pickup", "delivery"],
228
+ "price": "$", "location": {"address1": "799 O''Farrell St", "address2": null,
229
+ "address3": "", "city": "San Francisco", "zip_code": "94109", "country": "US",
230
+ "state": "CA", "display_address": ["799 O''Farrell St", "San Francisco, CA
231
+ 94109"]}, "phone": "+14154093300", "display_phone": "(415) 409-3300"}, {"id":
232
+ "bucF7GBwlIUJbPFdoLhxNA", "alias": "supreme-pizza-san-francisco", "name":
233
+ "Supreme Pizza", "image_url": "https://s3-media1.fl.yelpcdn.com/bphoto/JdRfGFHKmd7RQ0FdsQNLSg/o.jpg",
234
+ "is_closed": false, "url": "https://www.yelp.com/biz/supreme-pizza-san-francisco?adjust_creative=-pz45lFH4aD0aS0s94dStQ&utm_campaign=yelp_api_v3&utm_medium=api_v3_transactions_search_delivery&utm_source=-pz45lFH4aD0aS0s94dStQ",
235
+ "review_count": 109, "categories": [{"alias": "pizza", "title": "Pizza"},
236
+ {"alias": "italian", "title": "Italian"}], "rating": 3.5, "coordinates": {"latitude":
237
+ 37.7619213, "longitude": -122.4182987}, "transactions": ["pickup", "delivery"],
238
+ "price": "$", "location": {"address1": "3348 18th St", "address2": "", "address3":
239
+ "", "city": "San Francisco", "zip_code": "94110", "country": "US", "state":
240
+ "CA", "display_address": ["3348 18th St", "San Francisco, CA 94110"]}, "phone":
241
+ "+14154379400", "display_phone": "(415) 437-9400"}, {"id": "vKBW6SWFrIYXW1kIOFY_Ng",
242
+ "alias": "house-of-thai-san-francisco-2", "name": "House of Thai", "image_url":
243
+ "https://s3-media2.fl.yelpcdn.com/bphoto/A4Hpgax63Z3-mtrmU1U4XA/o.jpg", "is_closed":
244
+ false, "url": "https://www.yelp.com/biz/house-of-thai-san-francisco-2?adjust_creative=-pz45lFH4aD0aS0s94dStQ&utm_campaign=yelp_api_v3&utm_medium=api_v3_transactions_search_delivery&utm_source=-pz45lFH4aD0aS0s94dStQ",
245
+ "review_count": 1191, "categories": [{"alias": "thai", "title": "Thai"}],
246
+ "rating": 4.0, "coordinates": {"latitude": 37.7862824, "longitude": -122.4183383},
247
+ "transactions": ["pickup", "delivery"], "price": "$$", "location": {"address1":
248
+ "901 Larkin St", "address2": "", "address3": "", "city": "San Francisco",
249
+ "zip_code": "94109", "country": "US", "state": "CA", "display_address": ["901
250
+ Larkin St", "San Francisco, CA 94109"]}, "phone": "+14154412248", "display_phone":
251
+ "(415) 441-2248"}], "total": 127}'
252
+ http_version:
253
+ recorded_at: Tue, 26 Jun 2018 19:32:51 GMT
254
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,56 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.yelp.com/v3/transactions/delivery/search?latitude=37.6&longitude=38.6
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.15.2
12
+ Authorization:
13
+ - Bearer
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Server:
24
+ - nginx
25
+ Content-Type:
26
+ - application/json
27
+ Ratelimit-Dailylimit:
28
+ - '5000'
29
+ Ratelimit-Remaining:
30
+ - '4993'
31
+ Ratelimit-Resettime:
32
+ - '2018-06-27T00:00:00+00:00'
33
+ X-Proxied:
34
+ - 10-65-81-72-useast1aprod
35
+ Transfer-Encoding:
36
+ - chunked
37
+ Accept-Ranges:
38
+ - bytes
39
+ Date:
40
+ - Tue, 26 Jun 2018 19:33:17 GMT
41
+ Via:
42
+ - 1.1 varnish
43
+ Connection:
44
+ - keep-alive
45
+ X-Served-By:
46
+ - cache-bos8225-BOS
47
+ X-Cache:
48
+ - MISS
49
+ X-Cache-Hits:
50
+ - '0'
51
+ body:
52
+ encoding: ASCII-8BIT
53
+ string: '{"businesses": [], "total": 0}'
54
+ http_version:
55
+ recorded_at: Tue, 26 Jun 2018 19:33:17 GMT
56
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'yelp/fusion'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require 'irb'
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,36 @@
1
+ # Copyright (c) Jobcase, Inc. All rights reserved.
2
+
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ require 'yelp/fusion/client'
22
+
23
+ module Yelp
24
+ module Fusion
25
+ # Returns an initially-unconfigured instance of the client.
26
+ # @return [Client] an instance of the client
27
+ #
28
+ # @example Configuring and using the client
29
+ # Yelp::Fusion.client.configure do |config|
30
+ # config.api_key = 'abc'
31
+ # end
32
+ def self.client
33
+ @client ||= Yelp::Fusion::Client.new
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,86 @@
1
+ # Copyright (c) Jobcase, Inc. All rights reserved.
2
+
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+ require 'faraday'
21
+ require 'faraday_middleware'
22
+ require 'yelp/fusion/configuration'
23
+ require 'yelp/fusion/error'
24
+ require 'yelp/fusion/endpoint/search'
25
+ require 'yelp/fusion/endpoint/review'
26
+ require 'yelp/fusion/endpoint/business'
27
+ require 'yelp/fusion/endpoint/phone'
28
+ require 'yelp/fusion/endpoint/match'
29
+ require 'yelp/fusion/endpoint/transaction'
30
+
31
+ module Yelp
32
+ module Fusion
33
+ class Client
34
+ API_HOST = 'https://api.yelp.com'.freeze
35
+
36
+ attr_accessor :configuration
37
+
38
+ # Creates an instance of the fusion client
39
+ # @param options [String, nil] a consumer key
40
+ # @return [Client] a new client initialized with the keys
41
+ def initialize(option = nil)
42
+ @configuration = nil
43
+ return if option.nil?
44
+ @configuration = Configuration.new(option)
45
+ end
46
+
47
+ # Creates a configuration with API keys
48
+ # @return [@configuration] a frozen configuration
49
+ def configure
50
+ raise Error::AlreadyConfigured unless @configuration.nil?
51
+ @configuration = Configuration.new
52
+ yield(@configuration)
53
+ check_api_keys
54
+ end
55
+
56
+ # Checks that all the keys needed were given
57
+ # @return [@configuration] a frozen configuration
58
+ def check_api_keys
59
+ if @configuration.nil? ||
60
+ @configuration.api_key.nil? ||
61
+ defined?(@configuration.api_key).nil?
62
+ @configuration = nil
63
+ raise Error::MissingAPIKeys
64
+ else
65
+ # Freeze the configuration so it cannot be modified once the gem is
66
+ # configured. This prevents the configuration changing while the gem
67
+ # is operating, which would necessitate invalidating various caches
68
+ @configuration.freeze
69
+ end
70
+ end
71
+
72
+ # API connection
73
+ def connection
74
+ return @connection if instance_variable_defined?(:@connection)
75
+
76
+ check_api_keys
77
+ @connection = Faraday.new(API_HOST) do |conn|
78
+ # this guy uses oauth2 and bearer? maybe? to authorize the key
79
+ conn.request :oauth2, @configuration.api_key, token_type: :bearer
80
+ # Using default http library
81
+ conn.adapter :net_http
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end