gowalla 0.1.4 → 0.2.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/lib/gowalla.rb +6 -1
- data/lib/gowalla/client.rb +153 -94
- data/test/gowalla_test.rb +168 -0
- data/test/helper.rb +0 -3
- metadata +52 -102
- data/.document +0 -5
- data/.gitignore +0 -21
- data/LICENSE +0 -20
- data/README.md +0 -59
- data/Rakefile +0 -58
- data/VERSION +0 -1
- data/changelog.md +0 -19
- data/gowalla.gemspec +0 -98
- data/test/fixtures/categories.json +0 -1826
- data/test/fixtures/category.json +0 -8
- data/test/fixtures/challenges.json +0 -191
- data/test/fixtures/checkin.json +0 -67
- data/test/fixtures/events.json +0 -185
- data/test/fixtures/find_spots.json +0 -620
- data/test/fixtures/find_trips.json +0 -695
- data/test/fixtures/friend_requests.json +0 -21
- data/test/fixtures/friends.json +0 -3
- data/test/fixtures/friends_recent.json +0 -243
- data/test/fixtures/item.json +0 -8
- data/test/fixtures/items.json +0 -100
- data/test/fixtures/me.json +0 -49
- data/test/fixtures/missing_items.json +0 -1
- data/test/fixtures/new_spot.json +0 -49
- data/test/fixtures/pins.json +0 -36
- data/test/fixtures/potential_twitter_friends.json +0 -2090
- data/test/fixtures/spot.json +0 -251
- data/test/fixtures/spots.json +0 -557
- data/test/fixtures/spots_by_category.json +0 -620
- data/test/fixtures/stamps.json +0 -284
- data/test/fixtures/top_spots.json +0 -64
- data/test/fixtures/trip.json +0 -22
- data/test/fixtures/trips.json +0 -881
- data/test/fixtures/user.json +0 -43
- data/test/fixtures/vaulted_items.json +0 -12
- data/test/fixtures/visited_spots.json +0 -1
- data/test/test_gowalla.rb +0 -305
data/test/fixtures/user.json
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"bookmarked_spots_url": "/spots?bookmarks_user_id=1",
|
3
|
-
"activity_url": "/users/1/events",
|
4
|
-
"bio": "CTO & co-founder of Gowalla. Ruby/Cocoa/JavaScript developer. Game designer. Author. Indoorsman.",
|
5
|
-
"image_url": "http://s3.amazonaws.com/static.gowalla.com/users/1-standard.jpg?1263521844",
|
6
|
-
"pins_url": "/users/1/pins",
|
7
|
-
"trips_count": 3,
|
8
|
-
"bookmarked_spots_count": 2,
|
9
|
-
"friends_count": 444,
|
10
|
-
"trips_url": "/users/1/trips",
|
11
|
-
"items_url": "/users/1/items",
|
12
|
-
"_bookmarked_spots_urls_url": "/users/1/bookmarked_spots_urls",
|
13
|
-
"twitter_username": "",
|
14
|
-
"last_checkins": [
|
15
|
-
{
|
16
|
-
"type": "checkin",
|
17
|
-
"created_at": "2010-03-06T21:15:22+00:00",
|
18
|
-
"message": "Trying the new BBQ trailer. ",
|
19
|
-
"url": "/checkins/4342021",
|
20
|
-
"spot": {
|
21
|
-
"image_url": "http://static.gowalla.com/categories/17-standard.png",
|
22
|
-
"name": "Muck-N-Dave's Texas BBQ",
|
23
|
-
"url": "/spots/646423"
|
24
|
-
}
|
25
|
-
}
|
26
|
-
],
|
27
|
-
"pins_count": 21,
|
28
|
-
"stamps_count": 506,
|
29
|
-
"facebook_id": 505421674,
|
30
|
-
"photos_url": "/users/1/photos",
|
31
|
-
"top_spots_url": "/users/1/top_spots",
|
32
|
-
"add_friend_url": "/friendships/request?user_id=1",
|
33
|
-
"last_name": "Raymond",
|
34
|
-
"url": "/users/1",
|
35
|
-
"photos_count": 24,
|
36
|
-
"friends_url": "/users/1/friends",
|
37
|
-
"website": "",
|
38
|
-
"hometown": "Austin, Texas",
|
39
|
-
"first_name": "Scott",
|
40
|
-
"stamps_url": "/users/1/stamps",
|
41
|
-
"items_count": 8,
|
42
|
-
"_is_friend": false
|
43
|
-
}
|
@@ -1,12 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"items": [{
|
3
|
-
"image_url": "http://static.gowalla.com/kinds/1661-799838260b4873e99d07fd9c1fe64757.png",
|
4
|
-
"drop_url": "/items/1501734/drop",
|
5
|
-
"name": "Football Helmet",
|
6
|
-
"activity_url": "/items/1501734/events",
|
7
|
-
"determiner": "a",
|
8
|
-
"issue_number": 9932,
|
9
|
-
"url": "/items/1501734",
|
10
|
-
"pick_up_url": "/items/1501734/pick_up"
|
11
|
-
}]
|
12
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
["/spots/49747", "/spots/136029", "/spots/142525", "/spots/11641", "/spots/43464", "/spots/18320", "/spots/455129", "/spots/59817", "/spots/78953", "/spots/261180", "/spots/284084", "/spots/164052", "/spots/13354", "/spots/366585", "/spots/11300"]
|
data/test/test_gowalla.rb
DELETED
@@ -1,305 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
class TestGowalla < Test::Unit::TestCase
|
4
|
-
|
5
|
-
context "When using the documented Gowalla API" do
|
6
|
-
setup do
|
7
|
-
@client = Gowalla::Client.new(:username => 'pengwynn', :password => '0U812', :api_key => 'gowallawallabingbang')
|
8
|
-
end
|
9
|
-
|
10
|
-
context "and working with Spots" do
|
11
|
-
should "Retrieve a list of spots within a specified distance of a location" do
|
12
|
-
stub_get("http://pengwynn:0U812@api.gowalla.com/spots?lat=%2B33.237593417&lng=-96.960559033&radius=50", "spots.json")
|
13
|
-
spots = @client.list_spots(:lat => 33.237593417, :lng => -96.960559033, :radius => 50)
|
14
|
-
spots.first.name.should == 'Gnomb Bar'
|
15
|
-
spots.first.radius_meters.should == 50
|
16
|
-
end
|
17
|
-
|
18
|
-
should "Retrieve a list of spots within a specified bounds" do
|
19
|
-
stub_get("http://pengwynn:0U812@api.gowalla.com/spots?sw=(39.25565142103586%2C%20-8.717308044433594)&nw=(39.31411296530539%2C%20-8.490715026855469)", "spots.json")
|
20
|
-
spots = @client.list_spots(:sw => "(39.25565142103586, -8.717308044433594)", :nw => "(39.31411296530539, -8.490715026855469)")
|
21
|
-
spots.first.name.should == 'Gnomb Bar'
|
22
|
-
end
|
23
|
-
|
24
|
-
should "Retrieve information about a specific spot" do
|
25
|
-
stub_get('http://pengwynn:0U812@api.gowalla.com/spots/18568', 'spot.json')
|
26
|
-
spot = @client.spot(18568)
|
27
|
-
spot.name.should == "Wahoo's"
|
28
|
-
spot.twitter_username.should == 'Wahoos512'
|
29
|
-
spot.spot_categories.first.name.should == 'Mexican'
|
30
|
-
end
|
31
|
-
|
32
|
-
should "retrieve a list of check-ins at a particular spot. Shows only the activity that is visible to a given user" do
|
33
|
-
stub_get('http://pengwynn:0U812@api.gowalla.com/spots/452593/events', 'events.json')
|
34
|
-
events = @client.spot_events(452593)
|
35
|
-
events.first[:type].should == 'checkin'
|
36
|
-
events.first.user.last_name.should == 'Mack'
|
37
|
-
end
|
38
|
-
|
39
|
-
should "retrieve a list of items available at a particular spot" do
|
40
|
-
stub_get('http://pengwynn:0U812@api.gowalla.com/spots/18568/items', 'items.json')
|
41
|
-
items = @client.spot_items(18568)
|
42
|
-
items.first.issue_number.should == 27868
|
43
|
-
items.first.name.should == 'Bowl of Noodles'
|
44
|
-
end
|
45
|
-
|
46
|
-
should "lists all spot categories" do
|
47
|
-
stub_get("http://pengwynn:0U812@api.gowalla.com/categories", "categories.json")
|
48
|
-
categories = @client.categories
|
49
|
-
categories.size.should == 9
|
50
|
-
categories.first.name.should == 'Architecture & Buildings'
|
51
|
-
categories.first.description.should == 'Bridge, Corporate, Home, Church, etc.'
|
52
|
-
categories.first.spot_categories.size.should == 15
|
53
|
-
categories.first.spot_categories.first.name.should == 'Bridge'
|
54
|
-
end
|
55
|
-
|
56
|
-
should "retrieve information about a specific category" do
|
57
|
-
stub_get("http://pengwynn:0U812@api.gowalla.com/categories/1", "category.json")
|
58
|
-
category = @client.category(1)
|
59
|
-
category.name.should == 'Coffee Shop'
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
context "and working with Users" do
|
64
|
-
|
65
|
-
should "retrieve information about a specific user" do
|
66
|
-
stub_get('http://pengwynn:0U812@api.gowalla.com/users/sco', 'user.json')
|
67
|
-
user = @client.user('sco')
|
68
|
-
user.bio.should == "CTO & co-founder of Gowalla. Ruby/Cocoa/JavaScript developer. Game designer. Author. Indoorsman."
|
69
|
-
user.stamps_count.should == 506
|
70
|
-
end
|
71
|
-
|
72
|
-
should "retrieve a list of the stamps the user has collected" do
|
73
|
-
stub_get('http://pengwynn:0U812@api.gowalla.com/users/1707/stamps?limit=20', 'stamps.json')
|
74
|
-
stamps = @client.stamps(1707)
|
75
|
-
stamps.size.should == 20
|
76
|
-
stamps.first.spot.name.should == "Muck-N-Dave's Texas BBQ"
|
77
|
-
stamps.first.spot.address.locality.should == 'Austin'
|
78
|
-
end
|
79
|
-
|
80
|
-
should "retrieve a list of spots the user has visited most often" do
|
81
|
-
stub_get('http://pengwynn:0U812@api.gowalla.com/users/1707/top_spots', 'top_spots.json')
|
82
|
-
top_spots = @client.top_spots(1707)
|
83
|
-
top_spots.size.should == 10
|
84
|
-
top_spots.first.name.should == 'Juan Pelota Cafe'
|
85
|
-
top_spots.first.user_checkins_count.should == 30
|
86
|
-
end
|
87
|
-
|
88
|
-
end
|
89
|
-
|
90
|
-
context "and working with Items" do
|
91
|
-
should "retrieve information about a specific item" do
|
92
|
-
stub_get('http://pengwynn:0U812@api.gowalla.com/items/607583', 'item.json')
|
93
|
-
item = @client.item(607583)
|
94
|
-
item.issue_number.should == 13998
|
95
|
-
item.name.should == 'Sweets'
|
96
|
-
item.determiner.should == 'some'
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
context "and working with Trips" do
|
101
|
-
should "retrieve a list of trips" do
|
102
|
-
stub_get('http://pengwynn:0U812@api.gowalla.com/trips', 'trips.json')
|
103
|
-
trips = @client.trips
|
104
|
-
trips.first.name.should == 'London Pub Crawl'
|
105
|
-
trips.first.spots.first.url.should == '/spots/164009'
|
106
|
-
end
|
107
|
-
|
108
|
-
should "retrieve information about a specific trip" do
|
109
|
-
stub_get('http://pengwynn:0U812@api.gowalla.com/trips/1', 'trip.json')
|
110
|
-
trip = @client.trip(1)
|
111
|
-
trip.creator.last_name.should == 'Gowalla'
|
112
|
-
trip.map_bounds.east.should == -63.457031
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
end
|
117
|
-
|
118
|
-
context "When using the UNDOCUMENTED Gowalla API" do
|
119
|
-
setup do
|
120
|
-
@client = Gowalla::Client.new(:username => 'pengwynn', :password => '0U812', :api_key => 'gowallawallabingbang')
|
121
|
-
end
|
122
|
-
|
123
|
-
|
124
|
-
should "retrieve details for the current user" do
|
125
|
-
stub_get('http://pengwynn:0U812@api.gowalla.com/users/pengwynn', 'me.json')
|
126
|
-
user = @client.user
|
127
|
-
user.can_post_to_twitter?.should == true
|
128
|
-
user.can_post_to_facebook?.should == true
|
129
|
-
user.bio.should == "Web designer and Ruby developer."
|
130
|
-
user.stamps_count.should == 15
|
131
|
-
end
|
132
|
-
|
133
|
-
should "retrieve details for a user" do
|
134
|
-
stub_get('http://pengwynn:0U812@api.gowalla.com/users/1707', 'me.json')
|
135
|
-
user = @client.user(1707)
|
136
|
-
user.can_post_to_twitter?.should == true
|
137
|
-
user.can_post_to_facebook?.should == true
|
138
|
-
user.bio.should == "Web designer and Ruby developer."
|
139
|
-
user.stamps_count.should == 15
|
140
|
-
end
|
141
|
-
|
142
|
-
should "retrieve events for a user" do
|
143
|
-
stub_get('http://pengwynn:0U812@api.gowalla.com/users/1707/events', 'events.json')
|
144
|
-
events = @client.events(1707)
|
145
|
-
events.first[:type].should == 'checkin'
|
146
|
-
events.first.user.last_name.should == 'Mack'
|
147
|
-
end
|
148
|
-
|
149
|
-
should "retrieve events for a user's friends" do
|
150
|
-
stub_get('http://pengwynn:0U812@api.gowalla.com/visits/recent', 'events.json')
|
151
|
-
events = @client.friends_events
|
152
|
-
events.first[:type].should == 'checkin'
|
153
|
-
events.first.user.last_name.should == 'Mack'
|
154
|
-
end
|
155
|
-
|
156
|
-
should "retrieve friend requests for a user" do
|
157
|
-
stub_get('http://pengwynn:0U812@api.gowalla.com/users/1707/friend_requests', 'friend_requests.json')
|
158
|
-
requests = @client.friend_requests(1707)
|
159
|
-
requests.first.username.should == 'juanchez'
|
160
|
-
end
|
161
|
-
|
162
|
-
should "retrieve friends for a user" do
|
163
|
-
stub_get('http://pengwynn:0U812@api.gowalla.com/users/1707/friends', 'friends.json')
|
164
|
-
friends = @client.friends(1707)
|
165
|
-
friends.size.should == 0
|
166
|
-
end
|
167
|
-
|
168
|
-
should "retrieve items for a user" do
|
169
|
-
stub_get('http://pengwynn:0U812@api.gowalla.com/users/1707/items', 'items.json')
|
170
|
-
items = @client.items(1707)
|
171
|
-
items.first.issue_number.should == 27868
|
172
|
-
items.first.name.should == 'Bowl of Noodles'
|
173
|
-
end
|
174
|
-
|
175
|
-
should "retrieve missing items for a user" do
|
176
|
-
stub_get('http://pengwynn:0U812@api.gowalla.com/users/1707/items/missing', 'missing_items.json')
|
177
|
-
items = @client.missing_items(1707)
|
178
|
-
items.first.name.should == 'Torch'
|
179
|
-
end
|
180
|
-
|
181
|
-
should "retrieve vaulted items for a user" do
|
182
|
-
stub_get('http://pengwynn:0U812@api.gowalla.com/users/1707/items/vault', 'vaulted_items.json')
|
183
|
-
items = @client.vaulted_items(1707)
|
184
|
-
items.first.issue_number.should == 9932
|
185
|
-
items.first.name.should == 'Football Helmet'
|
186
|
-
end
|
187
|
-
|
188
|
-
should "retrieve pins for a user" do
|
189
|
-
stub_get('http://pengwynn:0U812@api.gowalla.com/users/1707/pins', 'pins.json')
|
190
|
-
pins = @client.pins(1707)
|
191
|
-
pins.size.should == 4
|
192
|
-
pins.first.name.should == 'Ranger'
|
193
|
-
end
|
194
|
-
|
195
|
-
should "retrieve visited spots for a user" do
|
196
|
-
stub_get('http://pengwynn:0U812@api.gowalla.com/users/1707/visited_spots', 'visited_spots.json')
|
197
|
-
visited_spots = @client.visited_spots(1707)
|
198
|
-
visited_spots.size.should == 15
|
199
|
-
visited_spots.last.should == "/spots/11300"
|
200
|
-
end
|
201
|
-
|
202
|
-
should_eventually "request a friendship with a user" do
|
203
|
-
# POST http://api.gowalla.com/friendships/accept?user_id=104421
|
204
|
-
end
|
205
|
-
|
206
|
-
should_eventually "accept a friendship with a user" do
|
207
|
-
|
208
|
-
end
|
209
|
-
|
210
|
-
should "retrieve details for a spot" do
|
211
|
-
stub_get('http://pengwynn:0U812@api.gowalla.com/spots/452593', 'spot.json')
|
212
|
-
spot = @client.spot(452593)
|
213
|
-
spot.name.should == "Wahoo's"
|
214
|
-
spot.twitter_username.should == 'Wahoos512'
|
215
|
-
spot.spot_categories.first.name.should == 'Mexican'
|
216
|
-
end
|
217
|
-
|
218
|
-
|
219
|
-
should_eventually "drop an item" do
|
220
|
-
# POST http://api.gowalla.com/items/899654/drop
|
221
|
-
# BODY spot_url=/spots/472093
|
222
|
-
end
|
223
|
-
|
224
|
-
should_eventually "pick up an item" do
|
225
|
-
|
226
|
-
end
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
should "find featured spots by latitude and longitude" do
|
231
|
-
stub_get("http://pengwynn:0U812@api.gowalla.com/spots?featured=1&lat=%2B33.237593417&lng=-96.960559033", "spots.json")
|
232
|
-
spots = @client.featured_spots(:lat => 33.237593417, :lng => -96.960559033)
|
233
|
-
spots.first.name.should == 'Gnomb Bar'
|
234
|
-
spots.first.radius_meters.should == 50
|
235
|
-
end
|
236
|
-
|
237
|
-
should "find bookmarked spots by latitude and longitude" do
|
238
|
-
stub_get("http://pengwynn:0U812@api.gowalla.com/spots?bookmarked=1&lat=%2B33.237593417&lng=-96.960559033", "spots.json")
|
239
|
-
spots = @client.bookmarked_spots(:lat => 33.237593417, :lng => -96.960559033)
|
240
|
-
spots.first.name.should == 'Gnomb Bar'
|
241
|
-
spots.first.radius_meters.should == 50
|
242
|
-
end
|
243
|
-
|
244
|
-
should "find spots by category, latitude, and longitude" do
|
245
|
-
stub_get("http://pengwynn:0U812@api.gowalla.com/spots?category_id=13&lat=%2B33.237593417&lng=-96.960559033", "spots.json")
|
246
|
-
spots = @client.list_spots(:lat => 33.237593417, :lng => -96.960559033, :category_id => 13)
|
247
|
-
spots.first.name.should == 'Gnomb Bar'
|
248
|
-
spots.first.radius_meters.should == 50
|
249
|
-
end
|
250
|
-
|
251
|
-
should "find trips by latitude and longitude" do
|
252
|
-
stub_get("http://pengwynn:0U812@api.gowalla.com/trips?user_url=%2Fusers%2F1707&lat=%2B33.23404216&lng=-96.95513802", "find_trips.json")
|
253
|
-
trips = @client.trips(:lat => 33.234042160, :lng => -96.955138020, :user_id => 1707)
|
254
|
-
trips.first.name.should == 'Dallas Championship Chase'
|
255
|
-
trips.first.spots.size.should == 3
|
256
|
-
end
|
257
|
-
|
258
|
-
should "find featured trips by latitude, longitude, and user" do
|
259
|
-
stub_get("http://pengwynn:0U812@api.gowalla.com/trips?context=featured&user_url=%2Fusers%2F1707&lat=%2B33.23404216&lng=-96.95513802", "find_trips.json")
|
260
|
-
trips = @client.featured_trips(:lat => 33.234042160, :lng => -96.955138020, :user_id => 1707, :context => 'featured')
|
261
|
-
trips.first.name.should == 'Dallas Championship Chase'
|
262
|
-
trips.first.spots.size.should == 3
|
263
|
-
end
|
264
|
-
|
265
|
-
should "find friends trips by latitude, longitude, and user" do
|
266
|
-
stub_get("http://pengwynn:0U812@api.gowalla.com/trips?context=friends&user_url=%2Fusers%2F1707&lat=%2B33.23404216&lng=-96.95513802", "find_trips.json")
|
267
|
-
trips = @client.friends_trips(:lat => 33.234042160, :lng => -96.955138020, :user_id => 1707, :context => 'featured')
|
268
|
-
trips.first.name.should == 'Dallas Championship Chase'
|
269
|
-
trips.first.spots.size.should == 3
|
270
|
-
end
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
should_eventually "create a spot" do
|
275
|
-
# POST http://api.gowalla.com/spots
|
276
|
-
# BODY lat=33.23404216&name=TreeFrog%20Studios&category_url=/categories/217&description=Children%20and%20family%20photography%20studio&lng=-96.95513802000001
|
277
|
-
end
|
278
|
-
|
279
|
-
should "check in at a spot" do
|
280
|
-
stub_post("http://pengwynn:0U812@api.gowalla.com/checkins?spot_id=124261", "checkin.json")
|
281
|
-
checkin = @client.checkin(124261, :lat => 39.24180603027344, :lng => -8.695899963378906)
|
282
|
-
checkin.detail_html.should_not be_nil
|
283
|
-
end
|
284
|
-
|
285
|
-
|
286
|
-
end
|
287
|
-
|
288
|
-
should "configure api_key, username, and password for easy access" do
|
289
|
-
|
290
|
-
Gowalla.configure do |config|
|
291
|
-
config.api_key = 'api_key'
|
292
|
-
config.username = 'username'
|
293
|
-
config.password = 'password'
|
294
|
-
end
|
295
|
-
|
296
|
-
@client = Gowalla::Client.new
|
297
|
-
|
298
|
-
stub_get('http://username:password@api.gowalla.com/trips', 'trips.json')
|
299
|
-
trips = @client.trips
|
300
|
-
|
301
|
-
@client.username.should == 'username'
|
302
|
-
end
|
303
|
-
|
304
|
-
|
305
|
-
end
|