foursquare2 1.0.0 → 1.1.0
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.
- data/VERSION +1 -1
- data/foursquare2.gemspec +3 -2
- data/lib/foursquare2/venues.rb +20 -0
- data/test/fixtures/explore_venues.json +284 -0
- data/test/test_venues.rb +7 -0
- metadata +5 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.1.0
|
data/foursquare2.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{foursquare2}
|
8
|
-
s.version = "1.
|
8
|
+
s.version = "1.1.0"
|
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 = %q{2011-05-
|
12
|
+
s.date = %q{2011-05-25}
|
13
13
|
s.description = %q{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 = [
|
@@ -36,6 +36,7 @@ Gem::Specification.new do |s|
|
|
36
36
|
"lib/foursquare2/venues.rb",
|
37
37
|
"test/config.rb",
|
38
38
|
"test/fixtures/checkin.json",
|
39
|
+
"test/fixtures/explore_venues.json",
|
39
40
|
"test/fixtures/friend_checkins.json",
|
40
41
|
"test/fixtures/no_venues_by_tip.json",
|
41
42
|
"test/fixtures/photo.json",
|
data/lib/foursquare2/venues.rb
CHANGED
@@ -117,5 +117,25 @@ module Foursquare2
|
|
117
117
|
end
|
118
118
|
return_error_or_body(response, response.body.response)
|
119
119
|
end
|
120
|
+
|
121
|
+
# Explore venues
|
122
|
+
#
|
123
|
+
# @param [Hash] options
|
124
|
+
# @option options String :ll - Latitude and longitude in format LAT,LON
|
125
|
+
# @option options Integer :llAcc - Accuracy of the lat/lon in meters.
|
126
|
+
# @option options Integer :alt - Altitude in meters
|
127
|
+
# @option options Integer :altAcc - Accuracy of the altitude in meters
|
128
|
+
# @option options Integer :radius - Radius to search within, in meters
|
129
|
+
# @option options String :section - One of food, drinks, coffee, shops, or arts. Choosing one of these limits results to venues with categories matching these terms.
|
130
|
+
# @option options String :query - Query to match venues on.
|
131
|
+
# @option options Integer :limit - The limit of results to return.
|
132
|
+
# @option options String :basis - If present and set to friends or me, limits results to only places where friends have visited or user has visited, respectively.
|
133
|
+
|
134
|
+
def explore_venues(options={})
|
135
|
+
response = connection.get do |req|
|
136
|
+
req.url "venues/explore", options
|
137
|
+
end
|
138
|
+
return_error_or_body(response, response.body.response)
|
139
|
+
end
|
120
140
|
end
|
121
141
|
end
|
@@ -0,0 +1,284 @@
|
|
1
|
+
{
|
2
|
+
"meta": {
|
3
|
+
"code": 200
|
4
|
+
},
|
5
|
+
"response": {
|
6
|
+
"keywords": {
|
7
|
+
"count": 30,
|
8
|
+
"items": [
|
9
|
+
{
|
10
|
+
"displayName": "Food Truck",
|
11
|
+
"keyword": "Food Truck"
|
12
|
+
},
|
13
|
+
{
|
14
|
+
"displayName": "Street Food",
|
15
|
+
"keyword": "Street Food"
|
16
|
+
},
|
17
|
+
{
|
18
|
+
"displayName": "American",
|
19
|
+
"keyword": "American"
|
20
|
+
},
|
21
|
+
{
|
22
|
+
"displayName": "Pizza",
|
23
|
+
"keyword": "Pizza"
|
24
|
+
},
|
25
|
+
{
|
26
|
+
"displayName": "Ice Cream",
|
27
|
+
"keyword": "Ice Cream"
|
28
|
+
},
|
29
|
+
{
|
30
|
+
"displayName": "Deli",
|
31
|
+
"keyword": "Deli"
|
32
|
+
},
|
33
|
+
{
|
34
|
+
"displayName": "Bodega",
|
35
|
+
"keyword": "Bodega"
|
36
|
+
},
|
37
|
+
{
|
38
|
+
"displayName": "Italian",
|
39
|
+
"keyword": "Italian"
|
40
|
+
},
|
41
|
+
{
|
42
|
+
"displayName": "Seafood",
|
43
|
+
"keyword": "Seafood"
|
44
|
+
},
|
45
|
+
{
|
46
|
+
"displayName": "Hot Dogs",
|
47
|
+
"keyword": "Hot Dogs"
|
48
|
+
},
|
49
|
+
{
|
50
|
+
"displayName": "Sandwiches",
|
51
|
+
"keyword": "Sandwiches"
|
52
|
+
},
|
53
|
+
{
|
54
|
+
"displayName": "Diner",
|
55
|
+
"keyword": "Diner"
|
56
|
+
},
|
57
|
+
{
|
58
|
+
"displayName": "Burgers",
|
59
|
+
"keyword": "Burgers"
|
60
|
+
},
|
61
|
+
{
|
62
|
+
"displayName": "Falafel",
|
63
|
+
"keyword": "Falafel"
|
64
|
+
},
|
65
|
+
{
|
66
|
+
"displayName": "New American",
|
67
|
+
"keyword": "New American"
|
68
|
+
},
|
69
|
+
{
|
70
|
+
"displayName": "Other - Food",
|
71
|
+
"keyword": "Other - Food"
|
72
|
+
},
|
73
|
+
{
|
74
|
+
"displayName": "Mexican",
|
75
|
+
"keyword": "Mexican"
|
76
|
+
},
|
77
|
+
{
|
78
|
+
"displayName": "Japanese",
|
79
|
+
"keyword": "Japanese"
|
80
|
+
},
|
81
|
+
{
|
82
|
+
"displayName": "Bakery",
|
83
|
+
"keyword": "Bakery"
|
84
|
+
},
|
85
|
+
{
|
86
|
+
"displayName": "Chinese",
|
87
|
+
"keyword": "Chinese"
|
88
|
+
},
|
89
|
+
{
|
90
|
+
"displayName": "Vegetarian",
|
91
|
+
"keyword": "Vegetarian"
|
92
|
+
},
|
93
|
+
{
|
94
|
+
"displayName": "Vegan",
|
95
|
+
"keyword": "Vegan"
|
96
|
+
},
|
97
|
+
{
|
98
|
+
"displayName": "Gastropub",
|
99
|
+
"keyword": "Gastropub"
|
100
|
+
},
|
101
|
+
{
|
102
|
+
"displayName": "Sushi",
|
103
|
+
"keyword": "Sushi"
|
104
|
+
},
|
105
|
+
{
|
106
|
+
"displayName": "Food Court",
|
107
|
+
"keyword": "Food Court"
|
108
|
+
},
|
109
|
+
{
|
110
|
+
"displayName": "African",
|
111
|
+
"keyword": "African"
|
112
|
+
},
|
113
|
+
{
|
114
|
+
"displayName": "Eastern European",
|
115
|
+
"keyword": "Eastern European"
|
116
|
+
},
|
117
|
+
{
|
118
|
+
"displayName": "Bagels",
|
119
|
+
"keyword": "Bagels"
|
120
|
+
},
|
121
|
+
{
|
122
|
+
"displayName": "Cuban",
|
123
|
+
"keyword": "Cuban"
|
124
|
+
},
|
125
|
+
{
|
126
|
+
"displayName": "Australian",
|
127
|
+
"keyword": "Australian"
|
128
|
+
}
|
129
|
+
]
|
130
|
+
},
|
131
|
+
"warning": {
|
132
|
+
"text": "There aren't a lot of results near you. Try expanding the search area by tapping the settings button on the top left of the screen."
|
133
|
+
},
|
134
|
+
"groups": [
|
135
|
+
{
|
136
|
+
"type": "recommended",
|
137
|
+
"name": "Recommended Places",
|
138
|
+
"items": [
|
139
|
+
{
|
140
|
+
"reasons": {
|
141
|
+
"count": 1,
|
142
|
+
"items": [
|
143
|
+
{
|
144
|
+
"type": "general",
|
145
|
+
"message": "This place is popular on foursquare."
|
146
|
+
}
|
147
|
+
]
|
148
|
+
},
|
149
|
+
"venue": {
|
150
|
+
"id": "3fd66200f964a520e9e81ee3",
|
151
|
+
"name": "Grimaldi's Pizzeria",
|
152
|
+
"contact": {
|
153
|
+
"phone": "7188584300"
|
154
|
+
},
|
155
|
+
"location": {
|
156
|
+
"address": "19 Old Fulton St",
|
157
|
+
"crossStreet": "btw Front & Water Sts",
|
158
|
+
"city": "Brooklyn",
|
159
|
+
"state": "NY",
|
160
|
+
"postalCode": "11201",
|
161
|
+
"country": "USA",
|
162
|
+
"lat": 40.7026434,
|
163
|
+
"lng": -73.9934553,
|
164
|
+
"distance": 625
|
165
|
+
},
|
166
|
+
"categories": [
|
167
|
+
{
|
168
|
+
"id": "4bf58dd8d48988d1ca941735",
|
169
|
+
"name": "Pizza Place",
|
170
|
+
"pluralName": "Pizza Places",
|
171
|
+
"icon": "https://foursquare.com/img/categories/food/pizza.png",
|
172
|
+
"parents": [
|
173
|
+
"Food"
|
174
|
+
],
|
175
|
+
"primary": true
|
176
|
+
}
|
177
|
+
],
|
178
|
+
"verified": false,
|
179
|
+
"stats": {
|
180
|
+
"checkinsCount": 5014,
|
181
|
+
"usersCount": 3875
|
182
|
+
},
|
183
|
+
"todos": {
|
184
|
+
"count": 0
|
185
|
+
},
|
186
|
+
"hereNow": {
|
187
|
+
"count": 2
|
188
|
+
}
|
189
|
+
},
|
190
|
+
"tips": [
|
191
|
+
{
|
192
|
+
"id": "4c62b64eedb29c74df3a2ca7",
|
193
|
+
"createdAt": 1281537614,
|
194
|
+
"text": "This famous Brooklyn eatery, a perennial atop the city's best pizza joints, has received eviction papers after falling behind on rent and city taxes.",
|
195
|
+
"url": "http://online.wsj.com/article/SB10001424052748703435104575421652613394906.html?mod=4sq",
|
196
|
+
"todo": {
|
197
|
+
"count": 104
|
198
|
+
},
|
199
|
+
"done": {
|
200
|
+
"count": 190
|
201
|
+
},
|
202
|
+
"user": {
|
203
|
+
"id": "989827",
|
204
|
+
"firstName": "The Wall Street Journal",
|
205
|
+
"photo": "https://playfoursquare.s3.amazonaws.com/userpix_thumbs/RNLQAGZVMSFTB1WG.jpg",
|
206
|
+
"gender": "male",
|
207
|
+
"homeCity": "New York, NY"
|
208
|
+
}
|
209
|
+
}
|
210
|
+
]
|
211
|
+
},
|
212
|
+
{
|
213
|
+
"reasons": {
|
214
|
+
"count": 1,
|
215
|
+
"items": [
|
216
|
+
{
|
217
|
+
"type": "general",
|
218
|
+
"message": "This place is popular on foursquare."
|
219
|
+
}
|
220
|
+
]
|
221
|
+
},
|
222
|
+
"venue": {
|
223
|
+
"id": "4a9c07d1f964a520ca3520e3",
|
224
|
+
"name": "Heights Falafel",
|
225
|
+
"contact": {},
|
226
|
+
"location": {
|
227
|
+
"address": "78 Henry St.",
|
228
|
+
"city": "Brooklyn",
|
229
|
+
"state": "NY",
|
230
|
+
"lat": 40.6985,
|
231
|
+
"lng": -73.9925,
|
232
|
+
"distance": 654
|
233
|
+
},
|
234
|
+
"categories": [
|
235
|
+
{
|
236
|
+
"id": "4bf58dd8d48988d10b941735",
|
237
|
+
"name": "Falafel Restaurant",
|
238
|
+
"pluralName": "Falafel Restaurants",
|
239
|
+
"icon": "https://foursquare.com/img/categories/food/default.png",
|
240
|
+
"parents": [
|
241
|
+
"Food"
|
242
|
+
],
|
243
|
+
"primary": true
|
244
|
+
}
|
245
|
+
],
|
246
|
+
"verified": false,
|
247
|
+
"stats": {
|
248
|
+
"checkinsCount": 281,
|
249
|
+
"usersCount": 143
|
250
|
+
},
|
251
|
+
"todos": {
|
252
|
+
"count": 0
|
253
|
+
},
|
254
|
+
"hereNow": {
|
255
|
+
"count": 0
|
256
|
+
}
|
257
|
+
},
|
258
|
+
"tips": [
|
259
|
+
{
|
260
|
+
"id": "4d457c972e326ea85aa4eea6",
|
261
|
+
"createdAt": 1296399511,
|
262
|
+
"text": "The nicest guys to ever make a falafel.",
|
263
|
+
"todo": {
|
264
|
+
"count": 0
|
265
|
+
},
|
266
|
+
"done": {
|
267
|
+
"count": 4
|
268
|
+
},
|
269
|
+
"user": {
|
270
|
+
"id": "5626664",
|
271
|
+
"firstName": "Andie",
|
272
|
+
"lastName": "O.",
|
273
|
+
"photo": "https://playfoursquare.s3.amazonaws.com/userpix_thumbs/5CHQX5YNEVO13SHY.jpg",
|
274
|
+
"gender": "female",
|
275
|
+
"homeCity": "Long Island, NY"
|
276
|
+
}
|
277
|
+
}
|
278
|
+
]
|
279
|
+
}
|
280
|
+
]
|
281
|
+
}
|
282
|
+
]
|
283
|
+
}
|
284
|
+
}
|
data/test/test_venues.rb
CHANGED
@@ -59,6 +59,13 @@ class TestVenues < Test::Unit::TestCase
|
|
59
59
|
|
60
60
|
tips.items.count.should == 0
|
61
61
|
end
|
62
|
+
|
63
|
+
should "allow venues to be explored" do
|
64
|
+
stub_get("https://api.foursquare.com/v2/venues/explore?section=food&ll=40.7%2C-74&oauth_token=yeehaw&limit=2", "explore_venues.json")
|
65
|
+
venues = @client.explore_venues(:ll => '40.7,-74', :section => 'food', :limit => '2')
|
66
|
+
venues.groups.first.items.count.should == 2
|
67
|
+
end
|
68
|
+
|
62
69
|
|
63
70
|
end
|
64
71
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foursquare2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 1.0.0
|
10
|
+
version: 1.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Matt Mueller
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-05-
|
19
|
+
date: 2011-05-25 00:00:00 -05:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -222,6 +222,7 @@ files:
|
|
222
222
|
- lib/foursquare2/venues.rb
|
223
223
|
- test/config.rb
|
224
224
|
- test/fixtures/checkin.json
|
225
|
+
- test/fixtures/explore_venues.json
|
225
226
|
- test/fixtures/friend_checkins.json
|
226
227
|
- test/fixtures/no_venues_by_tip.json
|
227
228
|
- test/fixtures/photo.json
|