foursquare2 1.9.1 → 1.9.2

Sign up to get free protection for your applications and to get access to all the features.
data/Readme.md CHANGED
@@ -109,10 +109,12 @@ See [the documentation](http://rubydoc.info/gems/foursquare2/frames) or [foursqu
109
109
  client.venue_photos
110
110
  client.page
111
111
  client.search_pages
112
+ client.herenow
112
113
  client.page_venues
113
114
  client.search_venues
114
115
  client.search_venues_by_tip
115
116
  client.venue_categories
117
+ client.trending_venues
116
118
  client.add_venue
117
119
  client.mark_venue_todo
118
120
  client.flag_venue
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.9.1
1
+ 1.9.2
data/foursquare2.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "foursquare2"
8
- s.version = "1.9.1"
8
+ s.version = "1.9.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Matt Mueller", "Marco Moura"]
12
- s.date = "2012-12-23"
12
+ s.date = "2013-01-13"
13
13
  s.description = "Gives access to all endpoints in version 2 of foursquare's API with syntax that will be familiar to those who used the original foursquare gem by Jeremy Welch."
14
14
  s.email = ["muellermr@gmail.com", "email@marcomoura.com"]
15
15
  s.extra_rdoc_files = [
@@ -72,13 +72,16 @@ Gem::Specification.new do |s|
72
72
  "test/fixtures/users/user_lists.json",
73
73
  "test/fixtures/users/user_mayorships.json",
74
74
  "test/fixtures/users/user_tips.json",
75
+ "test/fixtures/users/user_venuestats.json",
75
76
  "test/fixtures/venues/explore_venues.json",
76
77
  "test/fixtures/venues/managed_venues.json",
77
78
  "test/fixtures/venues/no_venues_by_tip.json",
78
79
  "test/fixtures/venues/search_venues.json",
79
80
  "test/fixtures/venues/search_venues_by_tip.json",
80
81
  "test/fixtures/venues/suggest_completion_venues.json",
82
+ "test/fixtures/venues/trending_venues.json",
81
83
  "test/fixtures/venues/venue.json",
84
+ "test/fixtures/venues/venue_herenow.json",
82
85
  "test/fixtures/venues/venue_links.json",
83
86
  "test/fixtures/venues/venue_menus.json",
84
87
  "test/fixtures/venues/venue_photos.json",
@@ -237,5 +237,16 @@ module Foursquare2
237
237
  return_error_or_body(response, response.body.response)
238
238
  end
239
239
 
240
+ # Summary of venues visited by a user
241
+ #
242
+ # @option options Integer :afterTimestamp - checkins after this epoch time.
243
+ # @option options Integer :beforeTimestamp - checkins before this epoch time.
244
+ def venuestats(options={})
245
+ response = connection.get do |req|
246
+ req.url "users/self/venuestats", options
247
+ end
248
+ return_error_or_body(response, response.body.response)
249
+ end
250
+
240
251
  end
241
252
  end
@@ -27,6 +27,21 @@ module Foursquare2
27
27
  end
28
28
  return_error_or_body(response, response.body.response)
29
29
  end
30
+
31
+ # Search for trending venues
32
+ #
33
+ # @param [String] :ll Latitude and longitude in format LAT,LON
34
+ # @param [Hash] options
35
+ # @option options Integer :limit - Number of results to return, up to 50.
36
+ # @option options Integer :radius - Radius in meters, up to approximately 2000 meters.
37
+
38
+ def trending_venues(ll, options={})
39
+ options[:ll] = ll
40
+ response = connection.get do |req|
41
+ req.url "venues/trending", options
42
+ end
43
+ return_error_or_body(response, response.body.response)
44
+ end
30
45
 
31
46
  # Search for venues by tip
32
47
  #
@@ -174,6 +189,21 @@ module Foursquare2
174
189
  return_error_or_body(response, response.body.response)
175
190
  end
176
191
 
192
+ # Returns a list of users that are currently checked into a venue
193
+ #
194
+ # param [String] venue_id The ID of the venue managed by the current user
195
+ # @param [Hash] options
196
+ # @option options Integer :limit - Number of results to return, up to 500.
197
+ # @option options Integer :offset - Used to page through results.
198
+ # @option options Integer :afterTimestamp - Retrieve the first results to follow these seconds since epoch.
199
+
200
+ def herenow(venue_id, options={})
201
+ response = connection.get do |req|
202
+ req.url "venues/#{venue_id}/herenow", options
203
+ end
204
+ return_error_or_body(response, response.body.response)
205
+ end
206
+
177
207
  #
178
208
  #Returns a list of venues managed
179
209
  #
@@ -0,0 +1,427 @@
1
+ {
2
+ "meta": {
3
+ "code": 200
4
+ },
5
+ "notifications": [
6
+ {
7
+ "type": "notificationTray",
8
+ "item": {
9
+ "unreadCount": 0
10
+ }
11
+ }
12
+ ],
13
+ "response": {
14
+ "venues": [
15
+ {
16
+ "beenHere": 4,
17
+ "beenHereMessage": "4 Check-ins",
18
+ "venue": {
19
+ "id": "506a4ca93950fb884c1a399c",
20
+ "name": "Melt Shop",
21
+ "contact": {
22
+ "twitter": "melt_shop"
23
+ },
24
+ "location": {
25
+ "address": "55 W 26th St",
26
+ "crossStreet": "at 6th Ave",
27
+ "lat": 40.74460714100382,
28
+ "lng": -73.99074196815491,
29
+ "postalCode": "10010",
30
+ "city": "New York",
31
+ "state": "NY",
32
+ "country": "United States",
33
+ "cc": "US"
34
+ },
35
+ "canonicalUrl": "https://foursquare.com/v/melt-shop/506a4ca93950fb884c1a399c",
36
+ "categories": [
37
+ {
38
+ "id": "4bf58dd8d48988d1c5941735",
39
+ "name": "Sandwich Place",
40
+ "pluralName": "Sandwich Places",
41
+ "shortName": "Sandwiches",
42
+ "icon": {
43
+ "prefix": "https://foursquare.com/img/categories_v2/food/sandwiches_",
44
+ "suffix": ".png"
45
+ },
46
+ "primary": true
47
+ }
48
+ ],
49
+ "verified": true,
50
+ "stats": {
51
+ "checkinsCount": 1066,
52
+ "usersCount": 762,
53
+ "tipCount": 25
54
+ },
55
+ "likes": {
56
+ "count": 0,
57
+ "groups": []
58
+ },
59
+ "specials": {
60
+ "count": 0,
61
+ "items": []
62
+ }
63
+ }
64
+ },
65
+ {
66
+ "beenHere": 3,
67
+ "beenHereMessage": "3 Check-ins",
68
+ "venue": {
69
+ "id": "4b97bb2cf964a520541235e3",
70
+ "name": "No. 7 Sub @ The Ace Hotel",
71
+ "contact": {
72
+ "phone": "2125321680",
73
+ "formattedPhone": "(212) 532-1680",
74
+ "twitter": "no7sub"
75
+ },
76
+ "location": {
77
+ "address": "1188 Broadway",
78
+ "crossStreet": "btwn E 28th & E 29th St.",
79
+ "lat": 40.74576898100524,
80
+ "lng": -73.98886704152163,
81
+ "postalCode": "10001",
82
+ "city": "New York",
83
+ "state": "NY",
84
+ "country": "United States",
85
+ "cc": "US"
86
+ },
87
+ "canonicalUrl": "https://foursquare.com/v/no-7-sub--the-ace-hotel/4b97bb2cf964a520541235e3",
88
+ "categories": [
89
+ {
90
+ "id": "4bf58dd8d48988d1c5941735",
91
+ "name": "Sandwich Place",
92
+ "pluralName": "Sandwich Places",
93
+ "shortName": "Sandwiches",
94
+ "icon": {
95
+ "prefix": "https://foursquare.com/img/categories_v2/food/sandwiches_",
96
+ "suffix": ".png"
97
+ },
98
+ "primary": true
99
+ }
100
+ ],
101
+ "verified": true,
102
+ "stats": {
103
+ "checkinsCount": 8033,
104
+ "usersCount": 3429,
105
+ "tipCount": 129
106
+ },
107
+ "url": "http://no7sub.com",
108
+ "likes": {
109
+ "count": 0,
110
+ "groups": []
111
+ },
112
+ "menu": {
113
+ "type": "foodAndBeverage",
114
+ "url": "https://foursquare.com/v/no-7-sub--the-ace-hotel/4b97bb2cf964a520541235e3/menu",
115
+ "mobileUrl": "https://foursquare.com/v/4b97bb2cf964a520541235e3/device_menu"
116
+ },
117
+ "specials": {
118
+ "count": 0,
119
+ "items": []
120
+ },
121
+ "venuePage": {
122
+ "id": "42272458"
123
+ }
124
+ }
125
+ },
126
+ {
127
+ "beenHere": 2,
128
+ "beenHereMessage": "2 Check-ins",
129
+ "venue": {
130
+ "id": "40e74880f964a520150a1fe3",
131
+ "name": "Shake Shack",
132
+ "contact": {
133
+ "phone": "2128896600",
134
+ "formattedPhone": "(212) 889-6600",
135
+ "twitter": "shakeshackfans"
136
+ },
137
+ "location": {
138
+ "address": "11 Madison Ave.",
139
+ "crossStreet": "at W 23rd St.",
140
+ "lat": 40.74140750304299,
141
+ "lng": -73.98843795061111,
142
+ "postalCode": "10010",
143
+ "city": "New York",
144
+ "state": "NY",
145
+ "country": "United States",
146
+ "cc": "US"
147
+ },
148
+ "canonicalUrl": "https://foursquare.com/v/shake-shack/40e74880f964a520150a1fe3",
149
+ "categories": [
150
+ {
151
+ "id": "4bf58dd8d48988d16c941735",
152
+ "name": "Burger Joint",
153
+ "pluralName": "Burger Joints",
154
+ "shortName": "Burgers",
155
+ "icon": {
156
+ "prefix": "https://foursquare.com/img/categories_v2/food/burger_",
157
+ "suffix": ".png"
158
+ },
159
+ "primary": true
160
+ }
161
+ ],
162
+ "verified": true,
163
+ "stats": {
164
+ "checkinsCount": 62452,
165
+ "usersCount": 37818,
166
+ "tipCount": 629
167
+ },
168
+ "url": "http://www.shakeshacknyc.com",
169
+ "likes": {
170
+ "count": 0,
171
+ "groups": []
172
+ },
173
+ "specials": {
174
+ "count": 0,
175
+ "items": []
176
+ }
177
+ }
178
+ },
179
+ {
180
+ "beenHere": 2,
181
+ "beenHereMessage": "2 Check-ins",
182
+ "venue": {
183
+ "id": "49fe10d9f964a520676f1fe3",
184
+ "name": "P.F. Chang's",
185
+ "contact": {
186
+ "phone": "2018667790",
187
+ "formattedPhone": "(201) 866-7790",
188
+ "twitter": "pfchangs"
189
+ },
190
+ "location": {
191
+ "address": "10 Port Imperial Way",
192
+ "crossStreet": "at Riverbend",
193
+ "lat": 40.78009362863879,
194
+ "lng": -74.00982869627268,
195
+ "postalCode": "07093",
196
+ "city": "West New York",
197
+ "state": "NJ",
198
+ "country": "United States",
199
+ "cc": "US"
200
+ },
201
+ "canonicalUrl": "https://foursquare.com/v/pf-changs/49fe10d9f964a520676f1fe3",
202
+ "categories": [
203
+ {
204
+ "id": "4bf58dd8d48988d145941735",
205
+ "name": "Chinese Restaurant",
206
+ "pluralName": "Chinese Restaurants",
207
+ "shortName": "Chinese",
208
+ "icon": {
209
+ "prefix": "https://foursquare.com/img/categories_v2/food/chinese_",
210
+ "suffix": ".png"
211
+ },
212
+ "primary": true
213
+ }
214
+ ],
215
+ "verified": true,
216
+ "stats": {
217
+ "checkinsCount": 4847,
218
+ "usersCount": 2650,
219
+ "tipCount": 50
220
+ },
221
+ "url": "http://www.pfchangs.com",
222
+ "likes": {
223
+ "count": 0,
224
+ "groups": []
225
+ },
226
+ "menu": {
227
+ "type": "foodAndBeverage",
228
+ "url": "https://foursquare.com/v/pf-changs/49fe10d9f964a520676f1fe3/menu",
229
+ "mobileUrl": "https://foursquare.com/v/49fe10d9f964a520676f1fe3/device_menu"
230
+ },
231
+ "specials": {
232
+ "count": 0,
233
+ "items": []
234
+ }
235
+ }
236
+ },
237
+ {
238
+ "beenHere": 2,
239
+ "beenHereMessage": "2 Check-ins",
240
+ "venue": {
241
+ "id": "43504680f964a520af281fe3",
242
+ "name": "Bubby's Brooklyn",
243
+ "contact": {
244
+ "phone": "7182220666",
245
+ "formattedPhone": "(718) 222-0666"
246
+ },
247
+ "location": {
248
+ "address": "1 Main St.",
249
+ "crossStreet": "at Plymouth St.",
250
+ "lat": 40.703932832748045,
251
+ "lng": -73.99048950444671,
252
+ "postalCode": "11201",
253
+ "city": "Brooklyn",
254
+ "state": "NY",
255
+ "country": "United States",
256
+ "cc": "US"
257
+ },
258
+ "canonicalUrl": "https://foursquare.com/v/bubbys-brooklyn/43504680f964a520af281fe3",
259
+ "categories": [
260
+ {
261
+ "id": "4bf58dd8d48988d14e941735",
262
+ "name": "American Restaurant",
263
+ "pluralName": "American Restaurants",
264
+ "shortName": "American",
265
+ "icon": {
266
+ "prefix": "https://foursquare.com/img/categories_v2/food/default_",
267
+ "suffix": ".png"
268
+ },
269
+ "primary": true
270
+ }
271
+ ],
272
+ "verified": true,
273
+ "stats": {
274
+ "checkinsCount": 6149,
275
+ "usersCount": 4300,
276
+ "tipCount": 112
277
+ },
278
+ "likes": {
279
+ "count": 0,
280
+ "groups": []
281
+ },
282
+ "menu": {
283
+ "type": "foodAndBeverage",
284
+ "url": "https://foursquare.com/v/bubbys-brooklyn/43504680f964a520af281fe3/menu",
285
+ "mobileUrl": "https://foursquare.com/v/43504680f964a520af281fe3/device_menu"
286
+ },
287
+ "specials": {
288
+ "count": 0,
289
+ "items": []
290
+ }
291
+ }
292
+ }
293
+ ],
294
+ "categories": [
295
+ {
296
+ "venueCount": 4,
297
+ "category": {
298
+ "id": "4bf58dd8d48988d14e941735",
299
+ "name": "American Restaurant",
300
+ "pluralName": "American Restaurants",
301
+ "shortName": "American",
302
+ "icon": {
303
+ "prefix": "https://foursquare.com/img/categories_v2/food/default_",
304
+ "suffix": ".png"
305
+ }
306
+ }
307
+ },
308
+ {
309
+ "venueCount": 4,
310
+ "category": {
311
+ "id": "4bf58dd8d48988d1f9941735",
312
+ "name": "Food & Drink Shop",
313
+ "pluralName": "Food & Drink Shops",
314
+ "shortName": "Food & Drink",
315
+ "icon": {
316
+ "prefix": "https://foursquare.com/img/categories_v2/shops/foodanddrink_",
317
+ "suffix": ".png"
318
+ }
319
+ }
320
+ },
321
+ {
322
+ "venueCount": 4,
323
+ "category": {
324
+ "id": "4bf58dd8d48988d1c5941735",
325
+ "name": "Sandwich Place",
326
+ "pluralName": "Sandwich Places",
327
+ "shortName": "Sandwiches",
328
+ "icon": {
329
+ "prefix": "https://foursquare.com/img/categories_v2/food/sandwiches_",
330
+ "suffix": ".png"
331
+ }
332
+ }
333
+ },
334
+ {
335
+ "venueCount": 3,
336
+ "category": {
337
+ "id": "4bf58dd8d48988d154941735",
338
+ "name": "Cuban Restaurant",
339
+ "pluralName": "Cuban Restaurants",
340
+ "shortName": "Cuban",
341
+ "icon": {
342
+ "prefix": "https://foursquare.com/img/categories_v2/food/default_",
343
+ "suffix": ".png"
344
+ }
345
+ }
346
+ },
347
+ {
348
+ "venueCount": 3,
349
+ "category": {
350
+ "id": "4bf58dd8d48988d1c1941735",
351
+ "name": "Mexican Restaurant",
352
+ "pluralName": "Mexican Restaurants",
353
+ "shortName": "Mexican",
354
+ "icon": {
355
+ "prefix": "https://foursquare.com/img/categories_v2/food/mexican_",
356
+ "suffix": ".png"
357
+ }
358
+ }
359
+ },
360
+ {
361
+ "venueCount": 3,
362
+ "category": {
363
+ "id": "4bf58dd8d48988d1e0931735",
364
+ "name": "Coffee Shop",
365
+ "pluralName": "Coffee Shops",
366
+ "shortName": "Coffee Shop",
367
+ "icon": {
368
+ "prefix": "https://foursquare.com/img/categories_v2/food/coffeeshop_",
369
+ "suffix": ".png"
370
+ }
371
+ }
372
+ },
373
+ {
374
+ "venueCount": 2,
375
+ "category": {
376
+ "id": "4bf58dd8d48988d16c941735",
377
+ "name": "Burger Joint",
378
+ "pluralName": "Burger Joints",
379
+ "shortName": "Burgers",
380
+ "icon": {
381
+ "prefix": "https://foursquare.com/img/categories_v2/food/burger_",
382
+ "suffix": ".png"
383
+ }
384
+ }
385
+ },
386
+ {
387
+ "venueCount": 2,
388
+ "category": {
389
+ "id": "4bf58dd8d48988d1cb941735",
390
+ "name": "Food Truck",
391
+ "pluralName": "Food Trucks",
392
+ "shortName": "Street Food",
393
+ "icon": {
394
+ "prefix": "https://foursquare.com/img/categories_v2/food/streetfood_",
395
+ "suffix": ".png"
396
+ }
397
+ }
398
+ },
399
+ {
400
+ "venueCount": 2,
401
+ "category": {
402
+ "id": "4bf58dd8d48988d1d2941735",
403
+ "name": "Sushi Restaurant",
404
+ "pluralName": "Sushi Restaurants",
405
+ "shortName": "Sushi",
406
+ "icon": {
407
+ "prefix": "https://foursquare.com/img/categories_v2/food/sushi_",
408
+ "suffix": ".png"
409
+ }
410
+ }
411
+ },
412
+ {
413
+ "venueCount": 2,
414
+ "category": {
415
+ "id": "4d4ae6fc7a7b7dea34424761",
416
+ "name": "Fried Chicken Joint",
417
+ "pluralName": "Fried Chicken Joints",
418
+ "shortName": "Fried Chicken",
419
+ "icon": {
420
+ "prefix": "https://foursquare.com/img/categories_v2/food/friedchicken_",
421
+ "suffix": ".png"
422
+ }
423
+ }
424
+ }
425
+ ]
426
+ }
427
+ }
@@ -0,0 +1,157 @@
1
+ {
2
+ "meta": {
3
+ "code": 200
4
+ },
5
+ "response": {
6
+ "venues": [
7
+ {
8
+ "id": "4a677f82f964a52091c91fe3",
9
+ "name": "McCarran International Airport (LAS)",
10
+ "contact": {
11
+ "phone": "+17022615211",
12
+ "formattedPhone": "+1 702-261-5211",
13
+ "twitter": "lasairport"
14
+ },
15
+ "location": {
16
+ "address": "5757 Wayne Newton Blvd",
17
+ "crossStreet": "at E Russell Rd",
18
+ "lat": 36.083650195482,
19
+ "lng": -115.14985084534,
20
+ "distance": 5477,
21
+ "postalCode": "89119",
22
+ "city": "Las Vegas",
23
+ "state": "NV",
24
+ "country": "United States",
25
+ "cc": "US"
26
+ },
27
+ "canonicalUrl": "https:\/\/foursquare.com\/v\/mccarran-international-airport-las\/4a677f82f964a52091c91fe3",
28
+ "categories": [
29
+ {
30
+ "id": "4bf58dd8d48988d1ed931735",
31
+ "name": "Airport",
32
+ "pluralName": "Airports",
33
+ "shortName": "Airport",
34
+ "icon": {
35
+ "prefix": "https:\/\/foursquare.com\/img\/categories\/travel\/airport_",
36
+ "sizes": [
37
+ 32,
38
+ 44,
39
+ 64,
40
+ 88,
41
+ 256
42
+ ],
43
+ "name": ".png"
44
+ },
45
+ "primary": true
46
+ }
47
+ ],
48
+ "verified": false,
49
+ "stats": {
50
+ "checkinsCount": 543213,
51
+ "usersCount": 231775,
52
+ "tipCount": 1572
53
+ },
54
+ "url": "http:\/\/www.mccarran.com",
55
+ "likes": {
56
+ "count": 0,
57
+ "groups": [
58
+
59
+ ]
60
+ },
61
+ "beenHere": {
62
+ "count": 0
63
+ },
64
+ "specials": [
65
+
66
+ ],
67
+ "hereNow": {
68
+ "count": 65,
69
+ "groups": [
70
+ {
71
+ "type": "others",
72
+ "name": "Other people here",
73
+ "count": 65,
74
+ "items": [
75
+
76
+ ]
77
+ }
78
+ ]
79
+ }
80
+ },
81
+ {
82
+ "id": "4bfe71ede529c928c852bc8c",
83
+ "name": "The Cosmopolitan of Las Vegas",
84
+ "contact": {
85
+ "phone": "+17026987000",
86
+ "formattedPhone": "+1 702-698-7000",
87
+ "twitter": "cosmopolitan_lv"
88
+ },
89
+ "location": {
90
+ "address": "3708 Las Vegas Blvd. S.",
91
+ "crossStreet": "at W. Harmon Ave.",
92
+ "lat": 36.109553662715,
93
+ "lng": -115.17375469208,
94
+ "distance": 3256,
95
+ "postalCode": "89109",
96
+ "city": "Las Vegas",
97
+ "state": "NV",
98
+ "country": "United States",
99
+ "cc": "US"
100
+ },
101
+ "canonicalUrl": "https:\/\/foursquare.com\/v\/the-cosmopolitan-of-las-vegas\/4bfe71ede529c928c852bc8c",
102
+ "categories": [
103
+ {
104
+ "id": "4bf58dd8d48988d17c941735",
105
+ "name": "Casino",
106
+ "pluralName": "Casinos",
107
+ "shortName": "Casino",
108
+ "icon": {
109
+ "prefix": "https:\/\/foursquare.com\/img\/categories\/arts_entertainment\/casino_",
110
+ "sizes": [
111
+ 32,
112
+ 44,
113
+ 64,
114
+ 88,
115
+ 256
116
+ ],
117
+ "name": ".png"
118
+ },
119
+ "primary": true
120
+ }
121
+ ],
122
+ "verified": true,
123
+ "stats": {
124
+ "checkinsCount": 115997,
125
+ "usersCount": 57491,
126
+ "tipCount": 502
127
+ },
128
+ "url": "http:\/\/www.cosmopolitanlasvegas.com",
129
+ "likes": {
130
+ "count": 0,
131
+ "groups": [
132
+
133
+ ]
134
+ },
135
+ "beenHere": {
136
+ "count": 0
137
+ },
138
+ "specials": [
139
+
140
+ ],
141
+ "hereNow": {
142
+ "count": 13,
143
+ "groups": [
144
+ {
145
+ "type": "others",
146
+ "name": "Other people here",
147
+ "count": 13,
148
+ "items": [
149
+
150
+ ]
151
+ }
152
+ ]
153
+ }
154
+ }
155
+ ]
156
+ }
157
+ }
@@ -0,0 +1,67 @@
1
+ {
2
+ "meta": {
3
+ "code": 200
4
+ },
5
+ "response": {
6
+ "hereNow": {
7
+ "count": 2,
8
+ "items": [
9
+ {
10
+ "id": "50e5cde3e4b0c35ae0800043",
11
+ "createdAt": 1357237732,
12
+ "type": "checkin",
13
+ "timeZone": "Europe\/Berlin",
14
+ "timeZoneOffset": 60,
15
+ "user": {
16
+ "id": "444950",
17
+ "firstName": "Sabine",
18
+ "lastName": "Z.",
19
+ "gender": "female",
20
+ "photo": "https:\/\/is1.4sqi.net\/userpix_thumbs\/AWDJ1COKPSKY4XUL.jpg",
21
+ "tips": {
22
+ "count": 3
23
+ },
24
+ "lists": {
25
+ "groups": [
26
+ {
27
+ "type": "created",
28
+ "count": 14,
29
+ "items": [
30
+
31
+ ]
32
+ }
33
+ ]
34
+ },
35
+ "homeCity": "Berlin",
36
+ "bio": "",
37
+ "contact": {
38
+
39
+ }
40
+ }
41
+ },
42
+ {
43
+ "id": "50e5c5f1478e5fb8d88cac95",
44
+ "createdAt": 1357235697,
45
+ "type": "checkin",
46
+ "timeZone": "Europe\/Berlin",
47
+ "timeZoneOffset": 60,
48
+ "user": {
49
+ "id": "5162304",
50
+ "firstName": "Stephan",
51
+ "lastName": "P.",
52
+ "gender": "male",
53
+ "photo": "https:\/\/is1.4sqi.net\/userpix_thumbs\/42W3RD0ACXMMM5AE.jpg",
54
+ "tips": {
55
+ "count": 1
56
+ },
57
+ "homeCity": "Hamburg",
58
+ "bio": "",
59
+ "contact": {
60
+
61
+ }
62
+ }
63
+ }
64
+ ]
65
+ }
66
+ }
67
+ }
data/test/test_users.rb CHANGED
@@ -88,12 +88,20 @@ class TestUsers < Test::Unit::TestCase
88
88
  checkins_after.items.first.createdAt.should > checkins_after.items.last.createdAt
89
89
  end
90
90
 
91
- should "should find a users checkins with beforeTimestamp param" do
91
+ should "find a users checkins with beforeTimestamp param" do
92
92
  stub_get("https://api.foursquare.com/v2/users/self/checkins?oauth_token=#{@client.oauth_token}&limit=5&offset=20&sort=oldestfirst&beforeTimestamp=1355867689", "users/user_checkins_beforetimestamp.json")
93
93
  checkins_before = @client.user_checkins({:limit => 5, :offset => 20, :sort => 'oldestfirst', :beforeTimestamp => 1355867689})
94
94
  checkins_before.items.size.should == 5
95
95
  checkins_before.items.reject { |ci| ci.createdAt < 1355867689 }.empty?.should == true
96
96
  checkins_before.items.first.createdAt.should < checkins_before.items.last.createdAt
97
97
  end
98
+
99
+ should "find a users venuestats" do
100
+ stub_get("https://api.foursquare.com/v2/users/self/venuestats?oauth_token=#{@client.oauth_token}", "users/user_venuestats.json")
101
+ venuestats = @client.venuestats
102
+ venuestats.venues.size.should == 5
103
+ venuestats.categories.size.should == 10
104
+ end
98
105
  end
106
+
99
107
  end
data/test/test_venues.rb CHANGED
@@ -19,6 +19,14 @@ class TestVenues < Test::Unit::TestCase
19
19
  venues = @client.search_venues(:ll => "36.142064,-86.816086", :query => "coffee")
20
20
  venues.groups.first.items.first.name.should == 'Ugly Mugs'
21
21
  end
22
+
23
+ should "search for trending venues around a certain position" do
24
+ stub_get("https://api.foursquare.com/v2/venues/trending?ll=36.132832%2C-115.151827&radius=10000&oauth_token=#{@client.oauth_token}", "venues/trending_venues.json")
25
+ venues = @client.trending_venues("36.132832,-115.151827", { :radius => 10000 })
26
+
27
+ venues.venues.count.should == 2
28
+ venues.venues.first.name == "McCarran International Airport (LAS)"
29
+ end
22
30
 
23
31
  should "search for venues from a tip search" do
24
32
  stub_get("https://api.foursquare.com/v2/tips/search?ll=-23.013968%2C-45.550802&oauth_token=#{@client.oauth_token}&query=rodoviaria", "venues/search_venues_by_tip.json")
@@ -103,6 +111,14 @@ class TestVenues < Test::Unit::TestCase
103
111
  response.menu.menus.items.first.name.should == "Main Menu"
104
112
  response.menu.menus.items.first['entries']['items'].first['entries'].items.count.should == 11
105
113
  end
114
+
115
+ should "get currently checked in users for a venue" do
116
+ stub_get("https://api.foursquare.com/v2/venues/4a1c8506f964a520457b1fe3/herenow?oauth_token=#{@client.oauth_token}", "venues/venue_herenow.json")
117
+ response = @client.herenow('4a1c8506f964a520457b1fe3')
118
+ response.hereNow.count.should == 2
119
+ response.hereNow.items.first.user.firstName.should == "Sabine"
120
+ response.hereNow.items.count.should == 2
121
+ end
106
122
 
107
123
  should "get detailed stats for a venue managed by user" do
108
124
  stub_get("https://api.foursquare.com/v2/venues/4b8c3d87f964a520f7c532e3/stats?oauth_token=#{@client.oauth_token}", "venues/venue_stats.json")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foursquare2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.1
4
+ version: 1.9.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-12-23 00:00:00.000000000 Z
13
+ date: 2013-01-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: faraday
@@ -276,13 +276,16 @@ files:
276
276
  - test/fixtures/users/user_lists.json
277
277
  - test/fixtures/users/user_mayorships.json
278
278
  - test/fixtures/users/user_tips.json
279
+ - test/fixtures/users/user_venuestats.json
279
280
  - test/fixtures/venues/explore_venues.json
280
281
  - test/fixtures/venues/managed_venues.json
281
282
  - test/fixtures/venues/no_venues_by_tip.json
282
283
  - test/fixtures/venues/search_venues.json
283
284
  - test/fixtures/venues/search_venues_by_tip.json
284
285
  - test/fixtures/venues/suggest_completion_venues.json
286
+ - test/fixtures/venues/trending_venues.json
285
287
  - test/fixtures/venues/venue.json
288
+ - test/fixtures/venues/venue_herenow.json
286
289
  - test/fixtures/venues/venue_links.json
287
290
  - test/fixtures/venues/venue_menus.json
288
291
  - test/fixtures/venues/venue_photos.json
@@ -315,7 +318,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
315
318
  version: '0'
316
319
  segments:
317
320
  - 0
318
- hash: 2718760689683095766
321
+ hash: -2763953984418079239
319
322
  required_rubygems_version: !ruby/object:Gem::Requirement
320
323
  none: false
321
324
  requirements: