portero 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/.simplecov +3 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +67 -0
- data/Rakefile +2 -0
- data/lib/portero/portero.rb +33 -0
- data/lib/portero/providers/foursquare.rb +39 -0
- data/lib/portero/providers/google_places.rb +41 -0
- data/lib/portero/search_provider.rb +52 -0
- data/lib/portero/search_result.rb +5 -0
- data/lib/portero/version.rb +3 -0
- data/lib/portero.rb +2 -0
- data/portero.gemspec +25 -0
- data/spec/data/foursquare.json +437 -0
- data/spec/data/google_places.json +343 -0
- data/spec/portero_spec.rb +24 -0
- data/spec/providers/foursquare_spec.rb +72 -0
- data/spec/providers/google_places_spec.rb +77 -0
- data/spec/search_provider_spec.rb +46 -0
- data/spec/spec_helper.rb +10 -0
- data/spec/support/fakeweb.rb +6 -0
- metadata +173 -0
@@ -0,0 +1,343 @@
|
|
1
|
+
{
|
2
|
+
"html_attributions" : [],
|
3
|
+
"next_page_token" : "ClRLAAAAvY6XPurzVj8UgeoqqgRSFw-8weeuPhuAsHyosmFeyi4tthtjYQRGPekNZ35t6HQQpD2c1AY5OoAvYRNA3bVoFJ5Hzw2Mo4mx8nHftJ9lL2ASEMGh7sU8YKvTxsBbuzAkGiwaFP8MsLKCkYtGgQvb_cpC-UPR--qE",
|
4
|
+
"results" : [
|
5
|
+
{
|
6
|
+
"formatted_address" : "124 North Kirkwood Road, St. Louis, MO, United States",
|
7
|
+
"geometry" : {
|
8
|
+
"location" : {
|
9
|
+
"lat" : 38.5821480,
|
10
|
+
"lng" : -90.406170
|
11
|
+
}
|
12
|
+
},
|
13
|
+
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
|
14
|
+
"id" : "d5e15c83a543424975a17a7e801f2fc3e2ac9151",
|
15
|
+
"name" : "Dewey's Pizza",
|
16
|
+
"opening_hours" : {
|
17
|
+
"open_now" : false
|
18
|
+
},
|
19
|
+
"rating" : 4.50,
|
20
|
+
"reference" : "CnRsAAAAy3yvOcIOORySFZLtEHbNJbeNdp2KzIm8Ieoqgjs3M-5inWdjRBECZd9KcHi8MlwB0AURKrbOb2a8H43Pe_7EktZ1iZ4vjMvFVABjGknL07pSX8KrOKKiTrEpEi_IHWNh0wW-GmX1Mfm78t1NCJ2TOBIQex03JeQxbOVjAV8rhG9ZixoULPEIRLcrxFaHwd8FboC17Lw8CgM",
|
21
|
+
"types" : [ "restaurant", "food", "establishment" ]
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"formatted_address" : "471 North Kirkwood Road, St. Louis, MO, United States",
|
25
|
+
"geometry" : {
|
26
|
+
"location" : {
|
27
|
+
"lat" : 38.5866580,
|
28
|
+
"lng" : -90.40665799999999
|
29
|
+
}
|
30
|
+
},
|
31
|
+
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
|
32
|
+
"id" : "495167f551e3d63d2c24125c54400f808c82164a",
|
33
|
+
"name" : "Fortel's Pizza Den, Inc.",
|
34
|
+
"opening_hours" : {
|
35
|
+
"open_now" : false
|
36
|
+
},
|
37
|
+
"rating" : 3.50,
|
38
|
+
"reference" : "CoQBdgAAALrX1-0ikxadr6HE0JgMpXlmxA_XzBT8PoufYV7xL6xp0JE3kWKpLkiOn3f3ZHUoRi4QYbL-_cp0Lz3Q4mD6QF8g9qzPNL0wxqTFnfVXiOZxl0ru-8kxG71Pvzv6OGmyMeOpc7oZat_Q7kYgceLsq8PqSW5097E0ki5bRDltv3UiEhDZZISx3nKeBenVcStBuAVwGhRxkaRZ4ApT1MAYZkeDoY0a8KCadQ",
|
39
|
+
"types" : [ "restaurant", "food", "establishment" ]
|
40
|
+
},
|
41
|
+
{
|
42
|
+
"formatted_address" : "111 North Kirkwood Road, St. Louis, MO, United States",
|
43
|
+
"geometry" : {
|
44
|
+
"location" : {
|
45
|
+
"lat" : 38.5817120,
|
46
|
+
"lng" : -90.406470
|
47
|
+
}
|
48
|
+
},
|
49
|
+
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
|
50
|
+
"id" : "ba7a22d90e27ef5c3dc67b479ff0b3979f7b85d5",
|
51
|
+
"name" : "Racanelli's Pizza",
|
52
|
+
"opening_hours" : {
|
53
|
+
"open_now" : false
|
54
|
+
},
|
55
|
+
"rating" : 4.20,
|
56
|
+
"reference" : "CnRwAAAAi2An8vprVFBChgd_xWu8D-Kb_1ZxBZzYXvhM6BuiAOPHsRZoKXeEa0KuHU10cTHDkrVfAcyUwZ_26fehWzs1I0344tFPJ-lXWQmYyqQv6E2rXaRNzN1WiJuXoU-nlKAn5xHEL8Mk7ZKEGa6aY7wvNBIQRahY_03Rn6kFjOx4rg3LeBoUrhmZnU5QuNaZJf9qSp64FjMlmO0",
|
57
|
+
"types" : [ "restaurant", "food", "establishment" ]
|
58
|
+
},
|
59
|
+
{
|
60
|
+
"formatted_address" : "215 South Kirkwood Road, Kirkwood, MO, United States",
|
61
|
+
"geometry" : {
|
62
|
+
"location" : {
|
63
|
+
"lat" : 38.5792770,
|
64
|
+
"lng" : -90.4065590
|
65
|
+
}
|
66
|
+
},
|
67
|
+
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
|
68
|
+
"id" : "b2f8d3f55acf81d2f16f9ef55f3e4ddf74421591",
|
69
|
+
"name" : "Imo's Pizza",
|
70
|
+
"rating" : 3.80,
|
71
|
+
"reference" : "CnRpAAAAXv0qFLnATJQoLoPf10baTYG5kP6b_zCOdTB2Ze7O3FDxOrOd--V2nCCsKPA53SNRK3_XyPJMFh1dpkndQVulYuokY1GGc4nC8_qVa2qYFvlzbgwro-eX8R1LR8D-xd_DEAWzOWj6kviorhB1bilFaRIQWTUxkxFZ1wkxrSSk6xGvXBoU-RxhHCt0ggemZIJuMRtNm38hON8",
|
72
|
+
"types" : [ "restaurant", "food", "establishment" ]
|
73
|
+
},
|
74
|
+
{
|
75
|
+
"formatted_address" : "10935 Manchester Road, St. Louis, MO, United States",
|
76
|
+
"geometry" : {
|
77
|
+
"location" : {
|
78
|
+
"lat" : 38.5995710,
|
79
|
+
"lng" : -90.4107690
|
80
|
+
}
|
81
|
+
},
|
82
|
+
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
|
83
|
+
"id" : "bc9fc8802078cb046cba0d1e3da4072d28e5d6e6",
|
84
|
+
"name" : "Pi Squared Pizza In Kirkwood",
|
85
|
+
"opening_hours" : {
|
86
|
+
"open_now" : false
|
87
|
+
},
|
88
|
+
"rating" : 4.0,
|
89
|
+
"reference" : "CoQBegAAAJ9ceO7Wc226GaMP14CTUcw7HqnSNSj4ML9ySELNd71qwj2NyHf1RJDbk90HP5nghS0y_1adCahtGvJq_ZBU3mPlKUMSBB9izPm17Nje3r1l4jXOkuSKo7mryuO1wS7gL3xqj_bAjTVfJMWxkoteqfJIHgYBqkEBrjW0zMzXBMB7EhCdRdA57kqYQSyuHvYu0x4SGhQ9Lk02QIJyb1f3O8OQPvOADBXYKw",
|
90
|
+
"types" : [ "restaurant", "food", "establishment" ]
|
91
|
+
},
|
92
|
+
{
|
93
|
+
"formatted_address" : "485 South Kirkwood Road #105d, Kirkwood, MO, United States",
|
94
|
+
"geometry" : {
|
95
|
+
"location" : {
|
96
|
+
"lat" : 38.5744550,
|
97
|
+
"lng" : -90.4065140
|
98
|
+
}
|
99
|
+
},
|
100
|
+
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
|
101
|
+
"id" : "63146e099c7bcb04a33ca9aaa367f538d2f76883",
|
102
|
+
"name" : "Domino's Pizza",
|
103
|
+
"opening_hours" : {
|
104
|
+
"open_now" : true
|
105
|
+
},
|
106
|
+
"rating" : 3.0,
|
107
|
+
"reference" : "CnRsAAAAX7JtNV_6DzamQXY4p-fXHs56r6TXD2WxPlSr3pKhTsb23TrC9XXY8TnVpkzFs0j356ptXdzLNT6rI38uSLremMex0GuXJS6XXhbNpYzGHCc3hFHy-SRwX-fkAvMF8q0EY5eHiR4IwvXPip_TI1EA_BIQnKk4EW6fGAmEmTU3XzYM3hoU9PbCGA2h7WPZmyM5jJNd-eDQO-8",
|
108
|
+
"types" : [ "restaurant", "food", "establishment" ]
|
109
|
+
},
|
110
|
+
{
|
111
|
+
"formatted_address" : "124 West Jefferson Avenue, Kirkwood, MO, United States",
|
112
|
+
"geometry" : {
|
113
|
+
"location" : {
|
114
|
+
"lat" : 38.5820170,
|
115
|
+
"lng" : -90.4080190
|
116
|
+
}
|
117
|
+
},
|
118
|
+
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/bar-71.png",
|
119
|
+
"id" : "462eb44d299840932ad559f0a3cdaa398ce0aef9",
|
120
|
+
"name" : "Mike Duffy's Pub & Grill",
|
121
|
+
"opening_hours" : {
|
122
|
+
"open_now" : false
|
123
|
+
},
|
124
|
+
"rating" : 4.0,
|
125
|
+
"reference" : "CoQBdgAAAEJVj4roZ76SqQSii4myoEOIMV5PlB9jCwOLu_DzVQfWF-B-TThwiWv_-gnBnu7JWB6PzUI-TZ1xQ5dPL9B32Kot9tQUJSV5tcNNmjk6S7dIe-VFoYhiSAk-VKZRit2EckYqiRG-6eJwJFLbn-h84o1EfHi6D2wZC-k6qnW9d0DTEhDDWFXnp9u8h-Jg4esiZtszGhRe71ylD2dTk7biNW2Kh2keRHueLA",
|
126
|
+
"types" : [ "bar", "restaurant", "food", "establishment" ]
|
127
|
+
},
|
128
|
+
{
|
129
|
+
"formatted_address" : "10150 Watson Road, St. Louis, MO, United States",
|
130
|
+
"geometry" : {
|
131
|
+
"location" : {
|
132
|
+
"lat" : 38.5559570,
|
133
|
+
"lng" : -90.3990510
|
134
|
+
}
|
135
|
+
},
|
136
|
+
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
|
137
|
+
"id" : "12b9635007ef044f51025424df4179192b481a11",
|
138
|
+
"name" : "Smugala's Pizza Pub",
|
139
|
+
"opening_hours" : {
|
140
|
+
"open_now" : true
|
141
|
+
},
|
142
|
+
"rating" : 2.90,
|
143
|
+
"reference" : "CoQBcgAAAL-y4S_oMIlXCMNV2ZPKIPh8hT_zKlM6BobYMrOroM8opm5TjAkkj6UWTUoy0FR8n_q1OQ8_wCpUSefMZz4uLuIVohVKaSTkcRWdA8xZwZeMKmx1Dzcz-UkWzi5ahGiC8LSw-46ZrMbD3YVk9hsJkDR4LUeWTtfPttq1k8_ZO0UEEhBjJDuwoBJWCXOZ2rXV270uGhRgpoOvVTFUCxm7f7x-20ND6ek7xw",
|
144
|
+
"types" : [ "store", "restaurant", "food", "establishment" ]
|
145
|
+
},
|
146
|
+
{
|
147
|
+
"formatted_address" : "9745 Manchester Road, Rock Hill, MO, United States",
|
148
|
+
"geometry" : {
|
149
|
+
"location" : {
|
150
|
+
"lat" : 38.6074450,
|
151
|
+
"lng" : -90.37209900000001
|
152
|
+
}
|
153
|
+
},
|
154
|
+
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
|
155
|
+
"id" : "e7c43cf3050bf1e0f7face11df6c138bd2b8bbad",
|
156
|
+
"name" : "Cici's Pizza",
|
157
|
+
"rating" : 3.90,
|
158
|
+
"reference" : "CnRrAAAAr1EOyFU7d9tli62Yu-U6TMprx_uWXJmWdWly3NbcyA2ueOWc0qvgAq-zgxsOYjZC5rzbviyBjtRTIvK8Ty6CpOUhJmDzJXWly9puXaJVQncKNG5OvCyUWAZEmJ2Hlf_C7PF093r5gtNObQPx8bworxIQO9PjdBAAZHOxr4WEOjmgoRoUEdN2PlkGEGs--UkVj68enPT8vYg",
|
159
|
+
"types" : [ "restaurant", "food", "establishment" ]
|
160
|
+
},
|
161
|
+
{
|
162
|
+
"formatted_address" : "312 South Kirkwood Road, Kirkwood, MO, United States",
|
163
|
+
"geometry" : {
|
164
|
+
"location" : {
|
165
|
+
"lat" : 38.5783070,
|
166
|
+
"lng" : -90.4059730
|
167
|
+
}
|
168
|
+
},
|
169
|
+
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/bar-71.png",
|
170
|
+
"id" : "e29f06f7bf3d575b1b0b5016919eac124982e1eb",
|
171
|
+
"name" : "Culpepper's Grill & Bar",
|
172
|
+
"opening_hours" : {
|
173
|
+
"open_now" : false
|
174
|
+
},
|
175
|
+
"rating" : 3.40,
|
176
|
+
"reference" : "CoQBdQAAAB_0hxVV2ALIH9vn4pjjQsK1fOBSnKJRA1c93JcO_JmlO7KQxvCxcfV6U3Qrj404XPdIfUBnOzRIFiLB1mpresjmytilrS9xZVsOxVVoFmwGD2bB47SKY03k2-qBo1yuKQYjs0LINrU38XraAPikB1qFJMu8l8-1X4a5nCSaDFIzEhDlpF52vWa78JCh2Z6_2QVcGhTxOUxnwzGxCGTVLU3PPfrsoBdESQ",
|
177
|
+
"types" : [ "bar", "restaurant", "food", "establishment" ]
|
178
|
+
},
|
179
|
+
{
|
180
|
+
"formatted_address" : "11760 Manchester Road, Des Peres, MO, United States",
|
181
|
+
"geometry" : {
|
182
|
+
"location" : {
|
183
|
+
"lat" : 38.6005070,
|
184
|
+
"lng" : -90.42984800000001
|
185
|
+
}
|
186
|
+
},
|
187
|
+
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
|
188
|
+
"id" : "c5fa739101a9fe7ab18c24781b2835cdff599e8d",
|
189
|
+
"name" : "Pizza Hut",
|
190
|
+
"rating" : 3.30,
|
191
|
+
"reference" : "CnRnAAAA1MmA_3BO3Ew3gVPJRB0G1aSO1e2XyplLg-0wbP9hGwhXdrvCOxzfPR2eKREo5alijzmwPrDmPpmXq9eGxpVBFM45y6PxCi1Cdlfoz6cOZlWFOZJxizHQafIaw9MkcmQRMKrwYa2RJMYLFTJpytDLABIQ8k-ywjPa86JE1sHQG7cGWxoUrR45CsdWRKQr6giRt5NyfcJT_ZM",
|
192
|
+
"types" : [ "restaurant", "food", "establishment" ]
|
193
|
+
},
|
194
|
+
{
|
195
|
+
"formatted_address" : "9824 Manchester Road, Webster Groves, MO, United States",
|
196
|
+
"geometry" : {
|
197
|
+
"location" : {
|
198
|
+
"lat" : 38.6061040,
|
199
|
+
"lng" : -90.3746850
|
200
|
+
}
|
201
|
+
},
|
202
|
+
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
|
203
|
+
"id" : "c89d83a8a69f4215dfa8711c9d26f84a7e35a1bf",
|
204
|
+
"name" : "A'mis",
|
205
|
+
"opening_hours" : {
|
206
|
+
"open_now" : false
|
207
|
+
},
|
208
|
+
"rating" : 4.70,
|
209
|
+
"reference" : "CnRjAAAAUnhUrKF_U-YSGOA99yaZt0iOX36gdVIovePatbNvduOiFC1kYpg3_ku0kwcIC6F4Bwoj3J7KrPcnFaXSK56WX4nO_k7vS60TbjOgkd1eyUf6g84S9QeIFOvNxBq5QJMF_FSJjALImQdH5njL4eDF0hIQf2PgguGWVkodTit0Bjjg5RoUa7eqn7WsW7jHHtAc-zhRimajG4A",
|
210
|
+
"types" : [ "store", "meal_takeaway", "restaurant", "food", "establishment" ]
|
211
|
+
},
|
212
|
+
{
|
213
|
+
"formatted_address" : "109 West County Shopping Center, St. Louis, MO, United States",
|
214
|
+
"geometry" : {
|
215
|
+
"location" : {
|
216
|
+
"lat" : 38.6008030,
|
217
|
+
"lng" : -90.44764000000001
|
218
|
+
}
|
219
|
+
},
|
220
|
+
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
|
221
|
+
"id" : "967bcd0767b6b43b6bb4a7d1846f751c1bd43c89",
|
222
|
+
"name" : "California Pizza Kitchen",
|
223
|
+
"rating" : 4.0,
|
224
|
+
"reference" : "CoQBdwAAAIV-jJvrYBxwsdUi5FUb6NbRkzkzNQ1kzOBaYDkKiJOilq6CS0b-zDOOnuU3Yt-r7GY7yCyN7HXItjSdldaT2nQzuLywqw5HYj7eFRm1SN8RDzUWObgvXc12LFeb2iuE6llaAusbTJ8B33g5X3R5I38jCfdq0CtRTOgQ39RjKy_yEhA-fsk3yexDAF-pzvJMZlfVGhSqHZStM7jZ38xWHpuVciZ4XBYllQ",
|
225
|
+
"types" : [ "restaurant", "food", "establishment" ]
|
226
|
+
},
|
227
|
+
{
|
228
|
+
"formatted_address" : "122 East Lockwood Avenue, Webster Groves, MO, United States",
|
229
|
+
"geometry" : {
|
230
|
+
"location" : {
|
231
|
+
"lat" : 38.5921170,
|
232
|
+
"lng" : -90.35365299999999
|
233
|
+
}
|
234
|
+
},
|
235
|
+
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
|
236
|
+
"id" : "299cc23f779b32d36eb2d131fbbdd63f25084bc9",
|
237
|
+
"name" : "Dewey's Pizza",
|
238
|
+
"rating" : 4.20,
|
239
|
+
"reference" : "CnRrAAAATrCl6JY_TFXj10ERA0UOGRW_z0_mwsAWMIQ1gEvOWoWDbi7TyShzLjaG6zxZy_4Bmig7iqSBhc3AXlkNSXDZWmekDqTUWRkoUS8SrUD4skbwrUlyyFjxljPHD0oHGwOT3Qsw6OiFfp376VyGfPyM0BIQYAfLBgWQgWMMx8_PYR28lRoUAQF604x6Kp7KE2CVTXycm8rPAWk",
|
240
|
+
"types" : [ "restaurant", "food", "establishment" ]
|
241
|
+
},
|
242
|
+
{
|
243
|
+
"formatted_address" : "130 South Kirkwood Road, Kirkwood, MO, United States",
|
244
|
+
"geometry" : {
|
245
|
+
"location" : {
|
246
|
+
"lat" : 38.5801770,
|
247
|
+
"lng" : -90.4062680
|
248
|
+
}
|
249
|
+
},
|
250
|
+
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
|
251
|
+
"id" : "e2b5f4875cb31a178cba26cf6bc26b341697560f",
|
252
|
+
"name" : "Pickleman's Gourmet Cafe",
|
253
|
+
"opening_hours" : {
|
254
|
+
"open_now" : true
|
255
|
+
},
|
256
|
+
"reference" : "CoQBdwAAALPq2dsXZZYG2kv9Ym5ZhSAq_Olm9nyrf0S1eaod_Lnzfqm1vdNtme9Ee4J56VdHAQdptB1XulWI2SLYXYfz5D9ejevL_JN5ZbxlTWipX6o0ROUUThcHk5MyCvfZmfzNuzko8-0unZ5LHPVh2mWuIfH5MSLyHzx51RbhfsMO5odQEhBJlSMsqJHx4KgL-l_JwasBGhT6-6UBKa38HZ2V6WZ-Lmunr7IncQ",
|
257
|
+
"types" : [ "establishment" ]
|
258
|
+
},
|
259
|
+
{
|
260
|
+
"formatted_address" : "9525 Manchester Road, St. Louis, MO, United States",
|
261
|
+
"geometry" : {
|
262
|
+
"location" : {
|
263
|
+
"lat" : 38.6092630,
|
264
|
+
"lng" : -90.3651490
|
265
|
+
}
|
266
|
+
},
|
267
|
+
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
|
268
|
+
"id" : "7a21705339e16a4072e4b859eec49ed39935e767",
|
269
|
+
"name" : "Farotto's Italian Restaurant and Pizzeria",
|
270
|
+
"opening_hours" : {
|
271
|
+
"open_now" : false
|
272
|
+
},
|
273
|
+
"rating" : 3.50,
|
274
|
+
"reference" : "CpQBiAAAADej-rh5xGhsdcMZN_o_O6PQT66SU2Trq2xyuxfbXfQTy4CZNSyXTpduAdstw7O9QZMmha1B3yJE4whMyaVpkE7KRAfniAlGgKyvUXR4cwLycrSViKDbiO2AL0LG1cfYIGexu6A-xlY2QRrq4YcUugvR6hXBL5SFbFrxieXV5hE6Yo01BiP2qPl92BsrSXQdmBIQxsMNcxs9FoCMJ-QDCnyAyBoU8GR0s4D4ucIVBGM9SHgYUHbYdls",
|
275
|
+
"types" : [ "restaurant", "food", "establishment" ]
|
276
|
+
},
|
277
|
+
{
|
278
|
+
"formatted_address" : "8570 Watson Road, Webster Groves, MO, United States",
|
279
|
+
"geometry" : {
|
280
|
+
"location" : {
|
281
|
+
"lat" : 38.5648320,
|
282
|
+
"lng" : -90.358750
|
283
|
+
}
|
284
|
+
},
|
285
|
+
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
|
286
|
+
"id" : "d163e384c9ed1d278fee273fdd4ba9e4635feaa8",
|
287
|
+
"name" : "Elicia's E Pizza",
|
288
|
+
"rating" : 3.80,
|
289
|
+
"reference" : "CnRvAAAATcMySCBbW5ecl1Snh3bfyF7ryNwQzxs6ZWEAPO1u3yIoYh6SAwOwKgKR89N1Oj0LBUsNtsQlpduNaO9p43uJrPhND665TZ1DK1HPT6P0FG0QZvhxMseF9vNUsNxeCb_Bh0UvRDCuax6akAPHl1cFVhIQw67ODbMxY25KxGw3DQa3mRoUS0VMFOIl8aIHscy6ZKQcKn5zSZo",
|
290
|
+
"types" : [ "restaurant", "food", "establishment" ]
|
291
|
+
},
|
292
|
+
{
|
293
|
+
"formatted_address" : "9800 Manchester Road, St. Louis, MO, United States",
|
294
|
+
"geometry" : {
|
295
|
+
"location" : {
|
296
|
+
"lat" : 38.6067180,
|
297
|
+
"lng" : -90.37267799999999
|
298
|
+
}
|
299
|
+
},
|
300
|
+
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
|
301
|
+
"id" : "5b7df08c9a769ee949a1854496ed914fe3f05625",
|
302
|
+
"name" : "Papa John's Pizza",
|
303
|
+
"opening_hours" : {
|
304
|
+
"open_now" : false
|
305
|
+
},
|
306
|
+
"reference" : "CnRvAAAAB2S6T_9ZEjlBDpriowkDigbT-JKRq4KP0qSTg2CY9d5OpDLwKj-WCEjJJmMI2rGZA3mlHfLKKsl83gkwTjmMp70MO-dbgX3EZW65v2kC-vWJu4Y1B8boJwJrZAav317skRslFAsf20XSZEW6uUOPSRIQxx8KAtPmI7rNVeqXUkRm2RoUYm-ugQJGX-BdpAAYcYHHrT_q89M",
|
307
|
+
"types" : [ "restaurant", "food", "establishment" ]
|
308
|
+
},
|
309
|
+
{
|
310
|
+
"formatted_address" : "2964 Dougherty Ferry Road, St. Louis, MO, United States",
|
311
|
+
"geometry" : {
|
312
|
+
"location" : {
|
313
|
+
"lat" : 38.5679870,
|
314
|
+
"lng" : -90.474480
|
315
|
+
}
|
316
|
+
},
|
317
|
+
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
|
318
|
+
"id" : "2b17cfaf4119afb5906fd360d5c9e268ee74c269",
|
319
|
+
"name" : "JJ Twig's Pizza & Pub",
|
320
|
+
"opening_hours" : {
|
321
|
+
"open_now" : false
|
322
|
+
},
|
323
|
+
"rating" : 4.20,
|
324
|
+
"reference" : "CoQBcwAAABu8bS8XNhSFJapPGuOhCh0uGX2hm9myJgz1MGsTW4nGC-X_QCFNn0S-o7TjqVulBvpWMi8SskNVNsSuyrVRLb4R0zyHiE4Rwo59VfyijMqI34DmoBZcPcqHPDBMLSgpBBJy7DOrA0VK4sRkMSDrUbsdYfcxICqXMCv--37yuB1hEhBF-ebuXOssD2a-Q1DaCarWGhRwWfbXUaAgfJaV3jOlWsU9sy_VOg",
|
325
|
+
"types" : [ "restaurant", "food", "establishment" ]
|
326
|
+
},
|
327
|
+
{
|
328
|
+
"formatted_address" : "12034 Manchester Road, Des Peres, MO, United States",
|
329
|
+
"geometry" : {
|
330
|
+
"location" : {
|
331
|
+
"lat" : 38.6020360,
|
332
|
+
"lng" : -90.4367740
|
333
|
+
}
|
334
|
+
},
|
335
|
+
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
|
336
|
+
"id" : "6105c31edd8add8e963027806526e1948d87623c",
|
337
|
+
"name" : "Imo's Pizza",
|
338
|
+
"reference" : "CnRpAAAAoDEYfooYdYTGrjLQYqOkuSgyKEEQV_NkabbrOs4rg0UPTVrdOwhlB1OxS_3gdPXTcKdLBDTMp3xeL7k5U5Pm0yUwEfC_csriq6KPkIms7-bmj5jCbjzChtHOC0TnsCC4bLgk7QALuEix5zM4yLoyexIQOAaN64PWUGjOuOMcWZtp5xoUVjAS1VKwotSKGPF8qVWaW9neMMk",
|
339
|
+
"types" : [ "restaurant", "food", "establishment" ]
|
340
|
+
}
|
341
|
+
],
|
342
|
+
"status" : "OK"
|
343
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Portero do
|
4
|
+
|
5
|
+
before do
|
6
|
+
Portero.init!
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'should allow setting of providers' do
|
10
|
+
foursquare_provider = Portero::SearchProvider::Foursquare.new(client_id: 1, client_secret: 1)
|
11
|
+
google_places_provider = Portero::SearchProvider::GooglePlaces.new(key: 1)
|
12
|
+
Portero.providers = [foursquare_provider]
|
13
|
+
Portero.providers.should == [foursquare_provider]
|
14
|
+
Portero.providers += [google_places_provider]
|
15
|
+
Portero.providers.should == [foursquare_provider, google_places_provider]
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should search registered providers' do
|
19
|
+
foursquare_provider = Portero::SearchProvider::Foursquare.new(client_id: 1, client_secret: 1)
|
20
|
+
google_places_provider = Portero::SearchProvider::GooglePlaces.new(key: 1)
|
21
|
+
Portero.providers = [foursquare_provider, google_places_provider]
|
22
|
+
Portero.search("pizza", 38.585287, -90.40936, radius: 1000, limit: 50)
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '..', 'spec_helper')
|
2
|
+
|
3
|
+
describe Portero::SearchProvider::Foursquare do
|
4
|
+
|
5
|
+
it 'should require client_id and client_secret options' do
|
6
|
+
Portero::SearchProvider::Foursquare.required_options.should == [:client_id, :client_secret]
|
7
|
+
end
|
8
|
+
|
9
|
+
describe 'search results' do
|
10
|
+
|
11
|
+
before(:each) do
|
12
|
+
@conn = Faraday.new do |builder|
|
13
|
+
builder.adapter Faraday.default_adapter
|
14
|
+
end
|
15
|
+
@provider = Portero::SearchProvider::Foursquare.new(client_id: 1, client_secret: 1)
|
16
|
+
@results = @provider.search(@conn, "pizza", 38.585287, -90.40936, radius: 1000, limit: 50)
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should return search results when queried' do
|
20
|
+
@results.should_not be_empty
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should return an array of SearchResults' do
|
24
|
+
@results.should be_a(Array)
|
25
|
+
@results.first.should be_a(Portero::SearchResult)
|
26
|
+
end
|
27
|
+
|
28
|
+
describe 'individual' do
|
29
|
+
|
30
|
+
it 'should have a name' do
|
31
|
+
@results.first.name.should == "Bar Louie"
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should have an address' do
|
35
|
+
@results.first.address.should == "110 S Kirkwood Rd"
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should have a latitude' do
|
39
|
+
@results.first.latitude.should == 38.58033319446212
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should have a longitude' do
|
43
|
+
@results.first.longitude.should == -90.40589386753355
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'should have a city' do
|
47
|
+
@results.first.city.should == "St. Louis"
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'should have a state' do
|
51
|
+
@results.first.state.should == "MO"
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'should have a postal code' do
|
55
|
+
@results.first.postal_code.should == "63122"
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'should have a country' do
|
59
|
+
@results.first.country.should == "United States"
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'should have a category name' do
|
63
|
+
@results.first.category.should == "Bar"
|
64
|
+
end
|
65
|
+
|
66
|
+
|
67
|
+
it 'should have an icon' do
|
68
|
+
@results.first.icon.should == "https://foursquare.com/img/categories_v2/nightlife/bar_64.png"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '..', 'spec_helper')
|
2
|
+
|
3
|
+
describe Portero::SearchProvider::GooglePlaces do
|
4
|
+
|
5
|
+
it 'should require a key option' do
|
6
|
+
Portero::SearchProvider::GooglePlaces.required_options.should == [:key]
|
7
|
+
end
|
8
|
+
|
9
|
+
|
10
|
+
describe 'search results' do
|
11
|
+
|
12
|
+
before(:each) do
|
13
|
+
@conn = Faraday.new do |builder|
|
14
|
+
builder.adapter Faraday.default_adapter
|
15
|
+
end
|
16
|
+
@provider = Portero::SearchProvider::GooglePlaces.new(key: 1)
|
17
|
+
@results = @provider.search(@conn, "pizza", 38.585287, -90.40936, radius: 1000, limit: 50)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should return search results when queried' do
|
21
|
+
@results.should_not be_empty
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should return an array of SearchResults' do
|
25
|
+
@results.should be_a(Array)
|
26
|
+
@results.first.should be_a(Portero::SearchResult)
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'individual' do
|
30
|
+
|
31
|
+
it 'should have a name' do
|
32
|
+
@results.first.name.should == "Dewey's Pizza"
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should have an address' do
|
36
|
+
@results.first.address.should == "124 North Kirkwood Road, St. Louis, MO, United States"
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should have a latitude' do
|
40
|
+
@results.first.latitude.should == 38.5821480
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'should have a longitude' do
|
44
|
+
@results.first.longitude.should == -90.406170
|
45
|
+
end
|
46
|
+
|
47
|
+
# it 'should have a city' do
|
48
|
+
# @results.first.city.should == "St. Louis"
|
49
|
+
# end
|
50
|
+
|
51
|
+
# it 'should have a state' do
|
52
|
+
# @results.first.state.should == "MO"
|
53
|
+
# end
|
54
|
+
|
55
|
+
# it 'should have a postal code' do
|
56
|
+
# @results.first.postal_code.should == "63122"
|
57
|
+
# end
|
58
|
+
|
59
|
+
# it 'should have a country' do
|
60
|
+
# @results.first.country.should == "United States"
|
61
|
+
# end
|
62
|
+
|
63
|
+
it 'should have a category name' do
|
64
|
+
@results.first.category.should == "restaurant"
|
65
|
+
end
|
66
|
+
|
67
|
+
|
68
|
+
it 'should have an icon' do
|
69
|
+
@results.first.icon.should == "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png"
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Portero::SearchProvider do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@conn = Faraday.new do |builder|
|
7
|
+
builder.adapter Faraday.default_adapter
|
8
|
+
end
|
9
|
+
|
10
|
+
@provider_class = Class.new do
|
11
|
+
include Portero::SearchProvider
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "requires_option" do
|
16
|
+
|
17
|
+
it "should add the passed symbols to the required_options array" do
|
18
|
+
@provider_class.requires_option(:key)
|
19
|
+
@provider_class.required_options.should == [:key]
|
20
|
+
@provider_class.requires_option(:key_again)
|
21
|
+
@provider_class.required_options.should == [:key, :key_again]
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "validate_options" do
|
27
|
+
|
28
|
+
it "should raise an error if the required keys aren't present on invocation" do
|
29
|
+
@provider_class.requires_option(:key)
|
30
|
+
-> {@provider_class.new}.should raise_error(Portero::SearchProvider::MissingRequirementError, /needs an options hash key of 'key' to function/)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should not raise an error if all required keys are present on invocation" do
|
34
|
+
@provider_class.requires_option(:key)
|
35
|
+
-> {@provider_class.new(key: "blah")}.should_not raise_error(Portero::SearchProvider::MissingRequirementError, /needs an options hash key of 'key' to function/)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe 'interface' do
|
40
|
+
|
41
|
+
it 'should raise an error if the search method is not implemented' do
|
42
|
+
-> {@provider_class.new.search(@conn, "blah", 30, -90)}.should raise_error(Portero::SearchProvider::InterfaceNotImplementedError, /needs to implement 'search'/)
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
require 'fakeweb'
|
2
|
+
|
3
|
+
FakeWeb.allow_net_connect = false
|
4
|
+
|
5
|
+
FakeWeb.register_uri(:get, "https://api.foursquare.com/v2/venues/search?query=pizza&client_id=1&client_secret=1&limit=50&radius=1000&v=20120709&ll=38.585287%2C-90.40936", body: File.read(File.join(File.dirname(__FILE__), '..', 'data', 'foursquare.json')))
|
6
|
+
FakeWeb.register_uri(:get, "https://maps.googleapis.com/maps/api/place/textsearch/json?query=pizza&key=1&radius=1000&location=38.585287%2C-90.40936&sensor=false", body: File.read(File.join(File.dirname(__FILE__), '..', 'data', 'google_places.json')))
|