foursquare2 1.9.2 → 1.9.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.9.2
1
+ 1.9.3
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.2"
8
+ s.version = "1.9.3"
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 = "2013-01-13"
12
+ s.date = "2013-02-02"
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 = [
@@ -73,6 +73,7 @@ Gem::Specification.new do |s|
73
73
  "test/fixtures/users/user_mayorships.json",
74
74
  "test/fixtures/users/user_tips.json",
75
75
  "test/fixtures/users/user_venuestats.json",
76
+ "test/fixtures/users/user_venuestats_friend_id.json",
76
77
  "test/fixtures/venues/explore_venues.json",
77
78
  "test/fixtures/venues/managed_venues.json",
78
79
  "test/fixtures/venues/no_venues_by_tip.json",
@@ -238,12 +238,13 @@ module Foursquare2
238
238
  end
239
239
 
240
240
  # Summary of venues visited by a user
241
+ # optional @param [String] user_id - The user to get venue stats for.
241
242
  #
242
243
  # @option options Integer :afterTimestamp - checkins after this epoch time.
243
244
  # @option options Integer :beforeTimestamp - checkins before this epoch time.
244
- def venuestats(options={})
245
+ def venuestats(user_id="self", options={})
245
246
  response = connection.get do |req|
246
- req.url "users/self/venuestats", options
247
+ req.url "users/#{user_id}/venuestats", options
247
248
  end
248
249
  return_error_or_body(response, response.body.response)
249
250
  end
@@ -0,0 +1,376 @@
1
+ {
2
+ "meta": {
3
+ "code": 200
4
+ },
5
+ "notifications": [
6
+ {
7
+ "type": "notificationTray",
8
+ "item": {
9
+ "unreadCount": 2
10
+ }
11
+ }
12
+ ],
13
+ "response": {
14
+ "venues": [
15
+ {
16
+ "beenHere": 1,
17
+ "beenHereMessage": "1 Check-ins",
18
+ "venue": {
19
+ "id": "406dfe80f964a52048f21ee3",
20
+ "name": "Flatiron Lounge",
21
+ "contact": {
22
+ "phone": "2127277741",
23
+ "formattedPhone": "(212) 727-7741"
24
+ },
25
+ "location": {
26
+ "address": "37 W 19th St.",
27
+ "crossStreet": "btwn 5th & 6th",
28
+ "lat": 40.739977397073,
29
+ "lng": -73.99332451104736,
30
+ "postalCode": "10011",
31
+ "city": "New York",
32
+ "state": "NY",
33
+ "country": "United States",
34
+ "cc": "US"
35
+ },
36
+ "canonicalUrl": "https://foursquare.com/v/flatiron-lounge/406dfe80f964a52048f21ee3",
37
+ "categories": [
38
+ {
39
+ "id": "4bf58dd8d48988d11e941735",
40
+ "name": "Cocktail Bar",
41
+ "pluralName": "Cocktail Bars",
42
+ "shortName": "Cocktail",
43
+ "icon": {
44
+ "prefix": "https://foursquare.com/img/categories_v2/nightlife/cocktails_",
45
+ "suffix": ".png"
46
+ },
47
+ "primary": true
48
+ }
49
+ ],
50
+ "verified": false,
51
+ "stats": {
52
+ "checkinsCount": 7601,
53
+ "usersCount": 5694,
54
+ "tipCount": 71
55
+ },
56
+ "url": "http://www.flatironlounge.com",
57
+ "likes": {
58
+ "count": 0,
59
+ "groups": []
60
+ },
61
+ "menu": {
62
+ "type": "foodAndBeverage",
63
+ "url": "https://foursquare.com/v/flatiron-lounge/406dfe80f964a52048f21ee3/menu",
64
+ "mobileUrl": "https://foursquare.com/v/406dfe80f964a52048f21ee3/device_menu"
65
+ }
66
+ }
67
+ },
68
+ {
69
+ "beenHere": 1,
70
+ "beenHereMessage": "1 Check-ins",
71
+ "venue": {
72
+ "id": "49dfb616f964a52002611fe3",
73
+ "name": "Bin 14",
74
+ "contact": {
75
+ "phone": "2019639463",
76
+ "formattedPhone": "(201) 963-9463"
77
+ },
78
+ "location": {
79
+ "address": "1314 Washington St.",
80
+ "crossStreet": "13th St.",
81
+ "lat": 40.752975451759006,
82
+ "lng": -74.02613636991552,
83
+ "postalCode": "07030",
84
+ "city": "Hoboken",
85
+ "state": "NJ",
86
+ "country": "United States",
87
+ "cc": "US"
88
+ },
89
+ "canonicalUrl": "https://foursquare.com/v/bin-14/49dfb616f964a52002611fe3",
90
+ "categories": [
91
+ {
92
+ "id": "4bf58dd8d48988d123941735",
93
+ "name": "Wine Bar",
94
+ "pluralName": "Wine Bars",
95
+ "shortName": "Wine Bar",
96
+ "icon": {
97
+ "prefix": "https://foursquare.com/img/categories_v2/nightlife/wine_",
98
+ "suffix": ".png"
99
+ },
100
+ "primary": true
101
+ }
102
+ ],
103
+ "verified": false,
104
+ "stats": {
105
+ "checkinsCount": 2168,
106
+ "usersCount": 1210,
107
+ "tipCount": 28
108
+ },
109
+ "url": "http://www.bin14.com",
110
+ "likes": {
111
+ "count": 0,
112
+ "groups": []
113
+ },
114
+ "reservations": {
115
+ "url": "http://www.opentable.com/single.aspx?rid=44107&ref=1040"
116
+ },
117
+ "menu": {
118
+ "type": "foodAndBeverage",
119
+ "url": "https://foursquare.com/v/bin-14/49dfb616f964a52002611fe3/menu",
120
+ "mobileUrl": "https://foursquare.com/v/49dfb616f964a52002611fe3/device_menu"
121
+ }
122
+ }
123
+ },
124
+ {
125
+ "beenHere": 1,
126
+ "beenHereMessage": "1 Check-ins",
127
+ "venue": {
128
+ "id": "4afcad9ff964a520052522e3",
129
+ "name": "Costco Wholesale Club",
130
+ "contact": {
131
+ "phone": "2128965873",
132
+ "formattedPhone": "(212) 896-5873"
133
+ },
134
+ "location": {
135
+ "address": "517 E 117th St",
136
+ "crossStreet": "Pleasant Ave",
137
+ "lat": 40.79515543869133,
138
+ "lng": -73.93099638731043,
139
+ "postalCode": "10035",
140
+ "city": "New York",
141
+ "state": "NY",
142
+ "country": "United States",
143
+ "cc": "US"
144
+ },
145
+ "canonicalUrl": "https://foursquare.com/v/costco-wholesale-club/4afcad9ff964a520052522e3",
146
+ "categories": [
147
+ {
148
+ "id": "4bf58dd8d48988d118951735",
149
+ "name": "Grocery Store",
150
+ "pluralName": "Grocery Stores",
151
+ "shortName": "Grocery Store",
152
+ "icon": {
153
+ "prefix": "https://foursquare.com/img/categories_v2/shops/food_grocery_",
154
+ "suffix": ".png"
155
+ },
156
+ "primary": true
157
+ }
158
+ ],
159
+ "verified": false,
160
+ "stats": {
161
+ "checkinsCount": 9337,
162
+ "usersCount": 3448,
163
+ "tipCount": 60
164
+ },
165
+ "likes": {
166
+ "count": 0,
167
+ "groups": []
168
+ }
169
+ }
170
+ },
171
+ {
172
+ "beenHere": 1,
173
+ "beenHereMessage": "1 Check-ins",
174
+ "venue": {
175
+ "id": "4b4b80aff964a520469e26e3",
176
+ "name": "John's Deli",
177
+ "contact": {
178
+ "phone": "7183727481",
179
+ "formattedPhone": "(718) 372-7481"
180
+ },
181
+ "location": {
182
+ "address": "2033 Stillwell Ave.",
183
+ "crossStreet": "at 86th St.",
184
+ "lat": 40.59694477642726,
185
+ "lng": -73.98532390594482,
186
+ "postalCode": "11223",
187
+ "city": "Brooklyn",
188
+ "state": "NY",
189
+ "country": "United States",
190
+ "cc": "US"
191
+ },
192
+ "canonicalUrl": "https://foursquare.com/v/johns-deli/4b4b80aff964a520469e26e3",
193
+ "categories": [
194
+ {
195
+ "id": "4bf58dd8d48988d1c5941735",
196
+ "name": "Sandwich Place",
197
+ "pluralName": "Sandwich Places",
198
+ "shortName": "Sandwiches",
199
+ "icon": {
200
+ "prefix": "https://foursquare.com/img/categories_v2/food/sandwiches_",
201
+ "suffix": ".png"
202
+ },
203
+ "primary": true
204
+ }
205
+ ],
206
+ "verified": false,
207
+ "stats": {
208
+ "checkinsCount": 1343,
209
+ "usersCount": 559,
210
+ "tipCount": 15
211
+ },
212
+ "url": "http://johnsdeli.com",
213
+ "likes": {
214
+ "count": 0,
215
+ "groups": []
216
+ },
217
+ "menu": {
218
+ "type": "foodAndBeverage",
219
+ "url": "https://foursquare.com/v/johns-deli/4b4b80aff964a520469e26e3/menu",
220
+ "mobileUrl": "https://foursquare.com/v/4b4b80aff964a520469e26e3/device_menu"
221
+ }
222
+ }
223
+ },
224
+ {
225
+ "beenHere": 1,
226
+ "beenHereMessage": "1 Check-ins",
227
+ "venue": {
228
+ "id": "4530db29f964a520613b1fe3",
229
+ "name": "Whole Foods",
230
+ "contact": {},
231
+ "location": {
232
+ "address": "10 Columbus Circle",
233
+ "crossStreet": "Lower Level of the Time Warner Center",
234
+ "lat": 40.76806170936614,
235
+ "lng": -73.98184776306152,
236
+ "postalCode": "10023",
237
+ "city": "New York",
238
+ "state": "NY",
239
+ "country": "United States",
240
+ "cc": "US"
241
+ },
242
+ "canonicalUrl": "https://foursquare.com/v/whole-foods/4530db29f964a520613b1fe3",
243
+ "categories": [
244
+ {
245
+ "id": "4bf58dd8d48988d118951735",
246
+ "name": "Grocery Store",
247
+ "pluralName": "Grocery Stores",
248
+ "shortName": "Grocery Store",
249
+ "icon": {
250
+ "prefix": "https://foursquare.com/img/categories_v2/shops/food_grocery_",
251
+ "suffix": ".png"
252
+ },
253
+ "primary": true
254
+ }
255
+ ],
256
+ "verified": true,
257
+ "stats": {
258
+ "checkinsCount": 44282,
259
+ "usersCount": 15607,
260
+ "tipCount": 192
261
+ },
262
+ "likes": {
263
+ "count": 0,
264
+ "groups": []
265
+ }
266
+ }
267
+ }
268
+ ],
269
+ "categories": [
270
+ {
271
+ "venueCount": 2,
272
+ "category": {
273
+ "id": "4bf58dd8d48988d1f9941735",
274
+ "name": "Food & Drink Shop",
275
+ "pluralName": "Food & Drink Shops",
276
+ "shortName": "Food & Drink",
277
+ "icon": {
278
+ "prefix": "https://foursquare.com/img/categories_v2/shops/foodanddrink_",
279
+ "suffix": ".png"
280
+ }
281
+ }
282
+ },
283
+ {
284
+ "venueCount": 2,
285
+ "category": {
286
+ "id": "4bf58dd8d48988d14e941735",
287
+ "name": "American Restaurant",
288
+ "pluralName": "American Restaurants",
289
+ "shortName": "American",
290
+ "icon": {
291
+ "prefix": "https://foursquare.com/img/categories_v2/food/default_",
292
+ "suffix": ".png"
293
+ }
294
+ }
295
+ },
296
+ {
297
+ "venueCount": 1,
298
+ "category": {
299
+ "id": "4bf58dd8d48988d1c5941735",
300
+ "name": "Sandwich Place",
301
+ "pluralName": "Sandwich Places",
302
+ "shortName": "Sandwiches",
303
+ "icon": {
304
+ "prefix": "https://foursquare.com/img/categories_v2/food/sandwiches_",
305
+ "suffix": ".png"
306
+ }
307
+ }
308
+ },
309
+ {
310
+ "venueCount": 1,
311
+ "category": {
312
+ "id": "4bf58dd8d48988d16f941735",
313
+ "name": "Hot Dog Joint",
314
+ "pluralName": "Hot Dog Joints",
315
+ "shortName": "Hot Dogs",
316
+ "icon": {
317
+ "prefix": "https://foursquare.com/img/categories_v2/food/hotdog_",
318
+ "suffix": ".png"
319
+ }
320
+ }
321
+ },
322
+ {
323
+ "venueCount": 1,
324
+ "category": {
325
+ "id": "4bf58dd8d48988d117941735",
326
+ "name": "Beer Garden",
327
+ "pluralName": "Beer Gardens",
328
+ "shortName": "Beer Garden",
329
+ "icon": {
330
+ "prefix": "https://foursquare.com/img/categories_v2/nightlife/beergarden_",
331
+ "suffix": ".png"
332
+ }
333
+ }
334
+ },
335
+ {
336
+ "venueCount": 1,
337
+ "category": {
338
+ "id": "4bf58dd8d48988d111941735",
339
+ "name": "Japanese Restaurant",
340
+ "pluralName": "Japanese Restaurants",
341
+ "shortName": "Japanese",
342
+ "icon": {
343
+ "prefix": "https://foursquare.com/img/categories_v2/food/japanese_",
344
+ "suffix": ".png"
345
+ }
346
+ }
347
+ },
348
+ {
349
+ "venueCount": 1,
350
+ "category": {
351
+ "id": "4bf58dd8d48988d11e941735",
352
+ "name": "Cocktail Bar",
353
+ "pluralName": "Cocktail Bars",
354
+ "shortName": "Cocktail",
355
+ "icon": {
356
+ "prefix": "https://foursquare.com/img/categories_v2/nightlife/cocktails_",
357
+ "suffix": ".png"
358
+ }
359
+ }
360
+ },
361
+ {
362
+ "venueCount": 1,
363
+ "category": {
364
+ "id": "4bf58dd8d48988d123941735",
365
+ "name": "Wine Bar",
366
+ "pluralName": "Wine Bars",
367
+ "shortName": "Wine Bar",
368
+ "icon": {
369
+ "prefix": "https://foursquare.com/img/categories_v2/nightlife/wine_",
370
+ "suffix": ".png"
371
+ }
372
+ }
373
+ }
374
+ ]
375
+ }
376
+ }
data/test/test_users.rb CHANGED
@@ -96,12 +96,19 @@ class TestUsers < Test::Unit::TestCase
96
96
  checkins_before.items.first.createdAt.should < checkins_before.items.last.createdAt
97
97
  end
98
98
 
99
- should "find a users venuestats" do
99
+ should "find a users venuestats by self" do
100
100
  stub_get("https://api.foursquare.com/v2/users/self/venuestats?oauth_token=#{@client.oauth_token}", "users/user_venuestats.json")
101
101
  venuestats = @client.venuestats
102
102
  venuestats.venues.size.should == 5
103
103
  venuestats.categories.size.should == 10
104
104
  end
105
+
106
+ should "find a users venuestats by inputting friends user_id" do
107
+ stub_get("https://api.foursquare.com/v2/users/555555/venuestats?oauth_token=#{@client.oauth_token}", "users/user_venuestats_friend_id.json")
108
+ friends_venuestats = @client.venuestats(555555)
109
+ friends_venuestats.venues.size.should == 5
110
+ friends_venuestats.categories.size.should == 8
111
+ end
105
112
  end
106
113
 
107
114
  end
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.2
4
+ version: 1.9.3
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: 2013-01-13 00:00:00.000000000 Z
13
+ date: 2013-02-02 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: faraday
@@ -277,6 +277,7 @@ files:
277
277
  - test/fixtures/users/user_mayorships.json
278
278
  - test/fixtures/users/user_tips.json
279
279
  - test/fixtures/users/user_venuestats.json
280
+ - test/fixtures/users/user_venuestats_friend_id.json
280
281
  - test/fixtures/venues/explore_venues.json
281
282
  - test/fixtures/venues/managed_venues.json
282
283
  - test/fixtures/venues/no_venues_by_tip.json
@@ -318,7 +319,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
318
319
  version: '0'
319
320
  segments:
320
321
  - 0
321
- hash: -2763953984418079239
322
+ hash: -789124476079947728
322
323
  required_rubygems_version: !ruby/object:Gem::Requirement
323
324
  none: false
324
325
  requirements: