iwannagothere 0.0.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +1 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +22 -0
- data/README.md +9 -9
- data/Rakefile +22 -0
- data/examples/all_methods.rb +6 -11
- data/iwannagothere.gemspec +83 -0
- data/lib/core_ext/hash.rb +5 -0
- data/lib/iwannagothere.rb +29 -9
- data/lib/iwannagothere/client.rb +3 -39
- data/lib/iwannagothere/configuration.rb +37 -0
- data/lib/iwannagothere/guide.rb +23 -0
- data/lib/iwannagothere/item.rb +21 -13
- data/lib/iwannagothere/photo.rb +11 -6
- data/lib/iwannagothere/place.rb +21 -18
- data/lib/iwannagothere/urls.rb +14 -21
- data/test/fixtures/3128760.json +32 -0
- data/test/fixtures/3128760_guides.json +79 -0
- data/test/fixtures/3128760_items.json +1 -0
- data/test/fixtures/3128760_photos.json +16 -0
- data/test/fixtures/item_1659.json +62 -0
- data/test/fixtures/route_215.json +18 -0
- data/test/fixtures/route_215_items.json +289 -0
- data/test/fixtures/routes_215_items.json +289 -0
- data/test/guide_test.rb +21 -0
- data/test/integration/smoke_test.rb +11 -0
- data/test/item_test.rb +16 -0
- data/test/photo_test.rb +12 -0
- data/test/place_test.rb +26 -0
- data/test/test_helper.rb +29 -0
- metadata +107 -56
- data/lib/iwannagothere/element.rb +0 -11
- data/lib/iwannagothere/item_route.rb +0 -11
- data/lib/iwannagothere/user.rb +0 -5
@@ -0,0 +1,289 @@
|
|
1
|
+
{
|
2
|
+
"items":
|
3
|
+
[
|
4
|
+
{
|
5
|
+
"address":"Carrer de la Palla, 8, 08002 Barcelona, Spain",
|
6
|
+
"popularity":5.0,
|
7
|
+
"created_at":"2009-01-07T23:58:31Z",
|
8
|
+
"place_id":7,
|
9
|
+
"title":"Caelum",
|
10
|
+
"delta":false,
|
11
|
+
"coolness":0,
|
12
|
+
"summercontest09":false,
|
13
|
+
"published":true,
|
14
|
+
"updated_at":"2010-07-23T16:32:38Z",
|
15
|
+
"saved_count":1,
|
16
|
+
"highlighted_date":null,
|
17
|
+
"url":null,
|
18
|
+
"country_id":"206",
|
19
|
+
"reviewed":false,
|
20
|
+
"id":1659,
|
21
|
+
"long_guid":"http://iwannagothere.com/eating-drinking-in-barcelona/caelum/1659",
|
22
|
+
"category_id":3,
|
23
|
+
"user_id":7,
|
24
|
+
"itemroute_id":"215",
|
25
|
+
"phone_number":null,
|
26
|
+
"top_1":null,
|
27
|
+
"nicetitle":"caelum",
|
28
|
+
"description":"If you need a break during your walk through the gothic district then you'll probably like this little coffee shop that sells delicious baked goods made in different convents and monasteries. Yummy!\nA big display window makes people stop and look in with desire. The basement is downstairs, a quiet place to complete this experience.",
|
29
|
+
"item_id":"1659",
|
30
|
+
"lat":"41.3831601",
|
31
|
+
"map_id":1568,
|
32
|
+
"long":"2.1743317",
|
33
|
+
"keywords":"barcelona, spain, eating-drinking, caelum, convents, coffee shop, quiet place, monasteries, baked goods, desire"},{"address":"Carrer de l'Arc de Sant Agust\u00ed, 3, 08001 Barcelona, Spain",
|
34
|
+
"popularity":5.0,
|
35
|
+
"created_at":"2009-01-08T00:35:33Z",
|
36
|
+
"place_id":7,
|
37
|
+
"title":"Rita Blue",
|
38
|
+
"delta":false,
|
39
|
+
"coolness":0,
|
40
|
+
"summercontest09":false,
|
41
|
+
"published":true,
|
42
|
+
"updated_at":"2010-10-07T16:00:06Z",
|
43
|
+
"saved_count":1,
|
44
|
+
"highlighted_date":null,
|
45
|
+
"url":"http://www.ritablue.com/",
|
46
|
+
"country_id":"206",
|
47
|
+
"reviewed":false,
|
48
|
+
"id":1661,
|
49
|
+
"long_guid":"http://iwannagothere.com/eating-drinking-in-barcelona/rita-blue/1661",
|
50
|
+
"category_id":3,
|
51
|
+
"user_id":7,
|
52
|
+
"itemroute_id":"215",
|
53
|
+
"phone_number":null,
|
54
|
+
"top_1":null,
|
55
|
+
"nicetitle":"rita-blue",
|
56
|
+
"description":"A nice and cool restaurant near the city center. You will fall in love with the food, the cocktails and the decoration :)\nProbably you will enjoy with the fried green tomatoes and probably you will wait for a while if you do not call before to book a table.\n\nPhone number: +34 933 424 086",
|
57
|
+
"item_id":"1661",
|
58
|
+
"lat":"41.3804007",
|
59
|
+
"map_id":1570,
|
60
|
+
"long":"2.1723588",
|
61
|
+
"keywords":"barcelona, spain, eating-drinking, rita blue, fried green tomatoes, rita blue, number 34, cocktails, phone number, love"},
|
62
|
+
{"address":"Carrer de Sant Pau, 9, 08001 Barcelona, Spain",
|
63
|
+
"popularity":5.0,
|
64
|
+
"created_at":"2009-01-31T17:13:57Z",
|
65
|
+
"place_id":7,
|
66
|
+
"title":"Restaurante del Hotel Espa\u00f1a",
|
67
|
+
"delta":false,
|
68
|
+
"coolness":0,
|
69
|
+
"summercontest09":false,
|
70
|
+
"published":true,
|
71
|
+
"updated_at":"2010-07-23T15:56:20Z",
|
72
|
+
"saved_count":1,
|
73
|
+
"highlighted_date":null,
|
74
|
+
"url":"http://www.hotelespanya.com/eng/bienvenida.htm",
|
75
|
+
"country_id":"206",
|
76
|
+
"reviewed":false,
|
77
|
+
"id":1712,
|
78
|
+
"long_guid":"http://iwannagothere.com/eating-drinking-in-barcelona/restaurante-del-hotel-espana/1712",
|
79
|
+
"category_id":3,
|
80
|
+
"user_id":26,
|
81
|
+
"itemroute_id":"215",
|
82
|
+
"phone_number":null,
|
83
|
+
"top_1":null,
|
84
|
+
"nicetitle":"restaurante-del-hotel-espana",
|
85
|
+
"description":"The restaurant Fonda Espa\u00f1a is part of the Hotel Espa\u00f1a. It is located on small street paralell to the Ramblas. It has the original 1904 modernist decoration, work of the prestigious modernist architect Dom\u00e8nech i Montaner.\nThe Hotel has two stars, so don\u00b4t expect too much from the food, but it is worth the visit just to enjoy the impressive decoration. They have a nice 16\u20ac menu. It\u00b4s probably the cheapest way to enjoy modernism in Barcelona ! ;-) ",
|
86
|
+
"item_id":"1712",
|
87
|
+
"lat":"41.3802191",
|
88
|
+
"map_id":1616,
|
89
|
+
"long":"2.1729356",
|
90
|
+
"keywords":"barcelona, spain, eating-drinking, restaurante del hotel espa\u00f1a, fonda espa\u00f1a, hotel espa\u00f1a, paralell, ramblas, modernist, two stars, modernism, architect, barcelona"},{"address":"Avinguda Meridiana, 2, 08018 Barcelona, Spain",
|
91
|
+
"popularity":5.0,
|
92
|
+
"created_at":"2009-02-13T18:49:06Z",
|
93
|
+
"place_id":7,
|
94
|
+
"title":"Santa ",
|
95
|
+
"delta":false,
|
96
|
+
"coolness":0,
|
97
|
+
"summercontest09":false,
|
98
|
+
"published":true,
|
99
|
+
"updated_at":"2010-10-07T16:00:12Z",
|
100
|
+
"saved_count":1,
|
101
|
+
"highlighted_date":null,
|
102
|
+
"url":null,
|
103
|
+
"country_id":"206",
|
104
|
+
"reviewed":false,
|
105
|
+
"id":1772,
|
106
|
+
"long_guid":"http://iwannagothere.com/eating-drinking-in-barcelona/santa/1772",
|
107
|
+
"category_id":3,
|
108
|
+
"user_id":613,
|
109
|
+
"itemroute_id":"215",
|
110
|
+
"phone_number":null,
|
111
|
+
"top_1":null,
|
112
|
+
"nicetitle":"santa",
|
113
|
+
"description":"Delicious place for daily menu with creative and healthy food perfectly balanced and exquisite. It's marvelous having a good lunch with natural day light.\n\nPhone number: +34 933 097 078",
|
114
|
+
"item_id":"1772",
|
115
|
+
"lat":"41.3914735",
|
116
|
+
"map_id":1663,
|
117
|
+
"long":"2.1871824",
|
118
|
+
"keywords":"barcelona, spain, eating-drinking, santa , delicious place, number 34, healthy food, phone number, lunch"},{"address":"Carrer d'Aribau, 27, 08011 Barcelona, Spain",
|
119
|
+
"popularity":5.0,
|
120
|
+
"created_at":"2009-03-23T07:45:16Z",
|
121
|
+
"place_id":7,
|
122
|
+
"title":"Restaurante Vinotinto",
|
123
|
+
"delta":false,
|
124
|
+
"coolness":0,
|
125
|
+
"summercontest09":false,
|
126
|
+
"published":true,
|
127
|
+
"updated_at":"2010-07-23T16:08:31Z",
|
128
|
+
"saved_count":1,
|
129
|
+
"highlighted_date":null,
|
130
|
+
"url":null,
|
131
|
+
"country_id":"206",
|
132
|
+
"reviewed":false,
|
133
|
+
"id":2027,
|
134
|
+
"long_guid":"http://iwannagothere.com/eating-drinking-in-barcelona/restaurante-vinotinto/2027",
|
135
|
+
"category_id":3,
|
136
|
+
"user_id":468,
|
137
|
+
"itemroute_id":"215",
|
138
|
+
"phone_number":null,
|
139
|
+
"top_1":null,
|
140
|
+
"nicetitle":"restaurante-vinotinto",
|
141
|
+
"description":"Delicious meat, meat, meat. Good grill and excellent selection of wines.",
|
142
|
+
"item_id":"2027",
|
143
|
+
"lat":"41.3870315",
|
144
|
+
"map_id":1896,
|
145
|
+
"long":"2.1609442",
|
146
|
+
"keywords":"barcelona, spain, eating-drinking, restaurante vinotinto, delicious meat, vinotinto, wines"},{"address":"Barcelona, Spain",
|
147
|
+
"popularity":4.4,
|
148
|
+
"created_at":"2009-04-17T10:06:27Z",
|
149
|
+
"place_id":7,
|
150
|
+
"title":"Sant Jordi Day",
|
151
|
+
"delta":false,
|
152
|
+
"coolness":1,
|
153
|
+
"summercontest09":false,
|
154
|
+
"published":true,
|
155
|
+
"updated_at":"2010-07-23T16:02:31Z",
|
156
|
+
"saved_count":1,
|
157
|
+
"highlighted_date":null,
|
158
|
+
"url":null,
|
159
|
+
"country_id":"206",
|
160
|
+
"reviewed":false,
|
161
|
+
"id":2261,
|
162
|
+
"long_guid":"http://iwannagothere.com/travel-tips-in-barcelona/sant-jordi-day/2261",
|
163
|
+
"category_id":2,
|
164
|
+
"user_id":723,
|
165
|
+
"itemroute_id":"215",
|
166
|
+
"phone_number":null,
|
167
|
+
"top_1":null,
|
168
|
+
"nicetitle":"sant-jordi-day",
|
169
|
+
"description":"Sant Jordi, the 23 of April, is a special day in Catalunya. It's a romantic day similar to the American Valentine's day, but instead of sweet candies and chocolate, couples and friends give books and roses to each other. The street gets full (I mean, FULL) of people walking around with roses and the book stores open markets with discounted price. \n\nIf you're a single, don't be miserable on a romantic day by yourself. You can be as happy as couples if you find your favorite book in good price.",
|
170
|
+
"item_id":"2261",
|
171
|
+
"lat":"41.3879170",
|
172
|
+
"map_id":2092,
|
173
|
+
"long":"2.1699187",
|
174
|
+
"keywords":"barcelona, spain, travel-tips, sant jordi day, sweet candies, sant jordi, valentine s day, open markets, favorite book, catalunya, roses, couples, chocolate"},{"address":"Barcelona, Passeig de Gr\u00e0cia, 107, 08008 Barcelona, Spain",
|
175
|
+
"popularity":4.25,
|
176
|
+
"created_at":"2009-01-07T23:32:39Z",
|
177
|
+
"place_id":7,
|
178
|
+
"title":"Casa Batll\u00f3",
|
179
|
+
"delta":false,
|
180
|
+
"coolness":1,
|
181
|
+
"summercontest09":false,
|
182
|
+
"published":true,
|
183
|
+
"updated_at":"2010-07-23T16:05:26Z",
|
184
|
+
"saved_count":1,
|
185
|
+
"highlighted_date":"2009-01-08T08:44:36Z",
|
186
|
+
"url":"http://www.casabatllo.es/",
|
187
|
+
"country_id":"206",
|
188
|
+
"reviewed":false,
|
189
|
+
"id":1657,
|
190
|
+
"long_guid":"http://iwannagothere.com/things-to-do-in-barcelona/casa-batllo/1657",
|
191
|
+
"category_id":1,
|
192
|
+
"user_id":7,
|
193
|
+
"itemroute_id":"215",
|
194
|
+
"phone_number":null,
|
195
|
+
"top_1":null,
|
196
|
+
"nicetitle":"casa-batllo",
|
197
|
+
"description":"This building from 1877 was entirely remodeled by Antonio Gaud\u00ed in 1905-1907. It is a jewel and you need to see the entire building at least once if you go to the 'Ciutat Comtal'. I'm sure you will like the organic facade, the interior designs and especially the terrace.\nGaudi was the most remarkable Modernist architect in Catalonia and you will recognize his particular style in other buildings in the city.",
|
198
|
+
"item_id":"1657",
|
199
|
+
"lat":"41.3959149",
|
200
|
+
"map_id":1566,
|
201
|
+
"long":"2.1599332",
|
202
|
+
"keywords":"barcelona, spain, things-to-do, casa batll\u00f3, ciutat comtal, interior designs, catalonia, facade, jewel, architect"},{"address":"Carrer de Sant Josep Oriol, 7, 08001 Barcelona, Spain",
|
203
|
+
"popularity":4.0,
|
204
|
+
"created_at":"2009-01-07T23:11:38Z",
|
205
|
+
"place_id":7,
|
206
|
+
"title":"La Condoner\u00eda",
|
207
|
+
"delta":false,
|
208
|
+
"coolness":0,
|
209
|
+
"summercontest09":false,
|
210
|
+
"published":true,
|
211
|
+
"updated_at":"2010-07-23T15:56:23Z",
|
212
|
+
"saved_count":1,
|
213
|
+
"highlighted_date":null,
|
214
|
+
"url":"http://www.condoneria-bcn.com/",
|
215
|
+
"country_id":"206",
|
216
|
+
"reviewed":false,
|
217
|
+
"id":1656,
|
218
|
+
"long_guid":"http://iwannagothere.com/shopping-in-barcelona/la-condoneria/1656",
|
219
|
+
"category_id":5,
|
220
|
+
"user_id":7,
|
221
|
+
"itemroute_id":"215",
|
222
|
+
"phone_number":null,
|
223
|
+
"top_1":null,
|
224
|
+
"nicetitle":"la-condoneria",
|
225
|
+
"description":"This is a little funny place on the gothic. You always can see a lot of people looking at all their sexy products because the shop do not have door. A new concept that invites you to ask, touch... and laugh.\n\nIt's worth go inside :)",
|
226
|
+
"item_id":"1656",
|
227
|
+
"lat":"41.3787900",
|
228
|
+
"map_id":1565,
|
229
|
+
"long":"2.1708444",
|
230
|
+
"keywords":"barcelona, spain, shopping, la condoner\u00eda, sexy products, funny place"},{"address":"La Rambla, 91, 08002 Barcelona, Spain",
|
231
|
+
"popularity":4.0,
|
232
|
+
"created_at":"2009-01-08T00:21:28Z",
|
233
|
+
"place_id":7,
|
234
|
+
"title":"Mercat de la Boqueria",
|
235
|
+
"delta":false,
|
236
|
+
"coolness":2,
|
237
|
+
"summercontest09":false,
|
238
|
+
"published":true,
|
239
|
+
"updated_at":"2010-07-23T16:12:25Z",
|
240
|
+
"saved_count":1,
|
241
|
+
"highlighted_date":"2009-01-08T08:44:36Z",
|
242
|
+
"url":"http://www.boqueria.info/",
|
243
|
+
"country_id":"206",
|
244
|
+
"reviewed":false,
|
245
|
+
"id":1660,
|
246
|
+
"long_guid":"http://iwannagothere.com/eating-drinking-in-barcelona/mercat-la-boqueria/1660",
|
247
|
+
"category_id":3,
|
248
|
+
"user_id":7,
|
249
|
+
"itemroute_id":"215",
|
250
|
+
"phone_number":null,
|
251
|
+
"top_1":null,
|
252
|
+
"nicetitle":"mercat-la-boqueria",
|
253
|
+
"description":"This market is also known as Mercat de Sant Josep and is placed on the heart of La Rambla. You will get into shock.\nYou can find fresh products like fruits, vegetables, meat or fish, but also delicatessen and curious products as scorpions candies. Spend your time walking through the market corridors and buy some fresh fruits to continue your visit.\nYou also find some nice restaurants inside the market.\nIt's a 'must see' of Barcelona.",
|
254
|
+
"item_id":"1660",
|
255
|
+
"lat":"41.3821521",
|
256
|
+
"map_id":1569,
|
257
|
+
"long":"2.1721273",
|
258
|
+
"keywords":"barcelona, spain, eating-drinking, mercat de la boqueria, mercat de sant josep, fruits vegetables, nice restaurants, fresh fruits, fresh products, scorpions, corridors, candies, shock, barcelona, fish, heart"},{"address":"Carrer dels Banys Nous, 14, 08002 Barcelona, Spain",
|
259
|
+
"popularity":4.0,
|
260
|
+
"created_at":"2009-01-11T14:09:10Z",
|
261
|
+
"place_id":7,
|
262
|
+
"title":"Heritage",
|
263
|
+
"delta":false,
|
264
|
+
"coolness":0,
|
265
|
+
"summercontest09":false,
|
266
|
+
"published":true,
|
267
|
+
"updated_at":"2010-07-23T15:56:20Z",
|
268
|
+
"saved_count":1,
|
269
|
+
"highlighted_date":null,
|
270
|
+
"url":"http://heritagebarcelona.com/",
|
271
|
+
"country_id":"206",
|
272
|
+
"reviewed":false,
|
273
|
+
"id":1669,
|
274
|
+
"long_guid":"http://iwannagothere.com/shopping-in-barcelona/heritage/1669",
|
275
|
+
"category_id":5,
|
276
|
+
"user_id":613,
|
277
|
+
"itemroute_id":"215",
|
278
|
+
"phone_number":null,
|
279
|
+
"top_1":null,
|
280
|
+
"nicetitle":"heritage",
|
281
|
+
"description":"Amazing vintage store. ",
|
282
|
+
"item_id":"1669",
|
283
|
+
"lat":"41.3824974",
|
284
|
+
"map_id":1578,
|
285
|
+
"long":"2.1747947",
|
286
|
+
"keywords":"barcelona, spain, shopping, heritage, vintage store, heritage"
|
287
|
+
}
|
288
|
+
]
|
289
|
+
}
|
data/test/guide_test.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
%w{test_helper}.each{ |file| require File.join(File.dirname(__FILE__), file) }
|
3
|
+
|
4
|
+
class GuideTest < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
@guide = IWannaGoThere::Guide.search(215)
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_search_returns_Guide_class
|
10
|
+
assert_equal @guide.class, IWannaGoThere::Guide
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_search_returns_Madrid_to_Barcelona
|
14
|
+
assert_equal "Madrid to Barcelona", @guide.name
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_items_by_route_id_returns_array_of_Item
|
18
|
+
assert_equal Array, @guide.items.class
|
19
|
+
assert_equal IWannaGoThere::Item, @guide.items.first.class
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
%w{rubygems rest-client json test/unit}.each { |x| require x }
|
2
|
+
%w{iwannagothere}.each{ |file| require File.join(File.dirname(__FILE__), '../..', 'lib', file) }
|
3
|
+
|
4
|
+
class SmokeTest < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def test_simple_geoname_id_search
|
7
|
+
IWannaGoThere::Client.new("2a1d90dd2aafcae3a1ba3dd0a6cde6a8")
|
8
|
+
result = IWannaGoThere::Place.search "3128760"
|
9
|
+
assert_equal "Barcelona", result.name
|
10
|
+
end
|
11
|
+
end
|
data/test/item_test.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
%w{test_helper}.each{ |file| require File.join(File.dirname(__FILE__), file) }
|
3
|
+
|
4
|
+
class ItemTest < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
@item = IWannaGoThere::Item.search(1659)
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_search_returns_Item_class
|
10
|
+
assert_equal @item.class, IWannaGoThere::Item
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_search_returns_Caelum
|
14
|
+
assert_equal "Caelum", @item.title
|
15
|
+
end
|
16
|
+
end
|
data/test/photo_test.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
%w{test_helper}.each{ |file| require File.join(File.dirname(__FILE__), file) }
|
3
|
+
|
4
|
+
class PhotoTest < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
@photos = IWannaGoThere::Photo.search(3128760)
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_search_returns_photo_class
|
10
|
+
assert_equal @photos.first.class, IWannaGoThere::Photo
|
11
|
+
end
|
12
|
+
end
|
data/test/place_test.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
%w{test_helper}.each{ |file| require File.join(File.dirname(__FILE__), file) }
|
3
|
+
|
4
|
+
class PlaceTest < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
@place = IWannaGoThere::Place.search(3128760)
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_search_returns_Place_class
|
10
|
+
assert_equal @place.class, IWannaGoThere::Place
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_search_returns_Barcelona
|
14
|
+
assert_equal "Barcelona", @place.name
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_guides_by_geoname_id_returns_array_of_Guide
|
18
|
+
assert_equal Array, @place.guides.class
|
19
|
+
assert_equal IWannaGoThere::Guide, @place.guides.first.class
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_items_by_geoname_id_returns_array_of_Item
|
23
|
+
assert_equal Array, @place.items.class
|
24
|
+
assert_equal IWannaGoThere::Item, @place.items.first.class
|
25
|
+
end
|
26
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
%w{rubygems rest-client json test/unit}.each { |x| require x }
|
2
|
+
%w{iwannagothere}.each{ |file| require File.join(File.dirname(__FILE__), '..', 'lib', file) }
|
3
|
+
|
4
|
+
module IWannaGoThere
|
5
|
+
|
6
|
+
def self.get(uri, uri_params = nil)
|
7
|
+
uri = IWannaGoThere::Urls[uri.to_sym].params(uri_params)
|
8
|
+
|
9
|
+
response = if uri =~ /\/places\/(\d*)\.json/
|
10
|
+
File.read(File.join(File.dirname(__FILE__), 'fixtures', "#{$1}.json"))
|
11
|
+
elsif uri =~ /\/places\/(\d*)\/get_photos\.json/
|
12
|
+
File.read(File.join(File.dirname(__FILE__), 'fixtures', "#{$1}_photos.json"))
|
13
|
+
elsif uri =~ /\/places\/(\d*)\/get_routes\.json/
|
14
|
+
File.read(File.join(File.dirname(__FILE__), 'fixtures', "#{$1}_guides.json"))
|
15
|
+
elsif uri =~ /\/places\/(\d*)\/items\.json/
|
16
|
+
File.read(File.join(File.dirname(__FILE__), 'fixtures', "#{$1}_items.json"))
|
17
|
+
elsif uri =~ /\/routes\/(\d*)\.json/
|
18
|
+
File.read(File.join(File.dirname(__FILE__), 'fixtures', "route_#{$1}.json"))
|
19
|
+
elsif uri =~ /\/routes\/(\d*)\/items\.json/
|
20
|
+
File.read(File.join(File.dirname(__FILE__), 'fixtures', "route_#{$1}_items.json"))
|
21
|
+
elsif uri =~ /\/items\/(\d*)\.json/
|
22
|
+
File.read(File.join(File.dirname(__FILE__), 'fixtures', "item_#{$1}.json"))
|
23
|
+
else
|
24
|
+
"{}"
|
25
|
+
end
|
26
|
+
|
27
|
+
filter_results JSON.parse(response)
|
28
|
+
end
|
29
|
+
end
|
metadata
CHANGED
@@ -1,91 +1,142 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: iwannagothere
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 3
|
10
|
-
version: 0.0.3
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Jordi Villar
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
12
|
+
date: 2012-02-05 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: json
|
16
|
+
requirement: &70298032647220 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70298032647220
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: bundler
|
27
|
+
requirement: &70298032641040 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.0.0
|
33
|
+
type: :development
|
23
34
|
prerelease: false
|
24
|
-
|
35
|
+
version_requirements: *70298032641040
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: jeweler
|
38
|
+
requirement: &70298032639100 !ruby/object:Gem::Requirement
|
25
39
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.6.4
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70298032639100
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rest-client
|
49
|
+
requirement: &70298032636880 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70298032636880
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: rest-client
|
60
|
+
requirement: &70298032619380 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :runtime
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70298032619380
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: json
|
71
|
+
requirement: &70298032613680 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
33
77
|
type: :runtime
|
34
|
-
|
35
|
-
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *70298032613680
|
80
|
+
description: ! 'Ruby wrapper for iwannagothere API '
|
36
81
|
email: jrdi.villar@gmail.com
|
37
82
|
executables: []
|
38
|
-
|
39
83
|
extensions: []
|
40
|
-
|
41
|
-
extra_rdoc_files:
|
84
|
+
extra_rdoc_files:
|
42
85
|
- README.md
|
43
|
-
files:
|
86
|
+
files:
|
87
|
+
- .rvmrc
|
88
|
+
- Gemfile
|
89
|
+
- Gemfile.lock
|
44
90
|
- README.md
|
91
|
+
- Rakefile
|
45
92
|
- examples/all_methods.rb
|
93
|
+
- iwannagothere.gemspec
|
94
|
+
- lib/core_ext/hash.rb
|
46
95
|
- lib/core_ext/string.rb
|
47
96
|
- lib/iwannagothere.rb
|
48
97
|
- lib/iwannagothere/client.rb
|
49
|
-
- lib/iwannagothere/
|
98
|
+
- lib/iwannagothere/configuration.rb
|
99
|
+
- lib/iwannagothere/guide.rb
|
50
100
|
- lib/iwannagothere/item.rb
|
51
|
-
- lib/iwannagothere/item_route.rb
|
52
101
|
- lib/iwannagothere/photo.rb
|
53
102
|
- lib/iwannagothere/place.rb
|
54
103
|
- lib/iwannagothere/urls.rb
|
55
|
-
-
|
56
|
-
|
104
|
+
- test/fixtures/3128760.json
|
105
|
+
- test/fixtures/3128760_guides.json
|
106
|
+
- test/fixtures/3128760_items.json
|
107
|
+
- test/fixtures/3128760_photos.json
|
108
|
+
- test/fixtures/item_1659.json
|
109
|
+
- test/fixtures/route_215.json
|
110
|
+
- test/fixtures/route_215_items.json
|
111
|
+
- test/fixtures/routes_215_items.json
|
112
|
+
- test/guide_test.rb
|
113
|
+
- test/integration/smoke_test.rb
|
114
|
+
- test/item_test.rb
|
115
|
+
- test/photo_test.rb
|
116
|
+
- test/place_test.rb
|
117
|
+
- test/test_helper.rb
|
57
118
|
homepage: https://github.com/jrdi/iwannagothere
|
58
119
|
licenses: []
|
59
|
-
|
60
120
|
post_install_message:
|
61
121
|
rdoc_options: []
|
62
|
-
|
63
|
-
require_paths:
|
122
|
+
require_paths:
|
64
123
|
- lib
|
65
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
124
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
66
125
|
none: false
|
67
|
-
requirements:
|
68
|
-
- -
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
|
71
|
-
|
72
|
-
- 0
|
73
|
-
version: "0"
|
74
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - ! '>='
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
130
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
131
|
none: false
|
76
|
-
requirements:
|
77
|
-
- -
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
|
80
|
-
segments:
|
81
|
-
- 0
|
82
|
-
version: "0"
|
132
|
+
requirements:
|
133
|
+
- - ! '>='
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
83
136
|
requirements: []
|
84
|
-
|
85
137
|
rubyforge_project:
|
86
|
-
rubygems_version: 1.6
|
138
|
+
rubygems_version: 1.8.6
|
87
139
|
signing_key:
|
88
140
|
specification_version: 3
|
89
141
|
summary: Ruby wrapper for iwannagothere API
|
90
|
-
test_files:
|
91
|
-
- examples/all_methods.rb
|
142
|
+
test_files: []
|