gowalla 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,152 @@
1
+ [
2
+ {
3
+ "city_state": "Frisco, TX",
4
+ "first_visited_at": "2010/01/26 15:31:46 +0000",
5
+ "image_url": "http://static.gowalla.com/categories/186-standard.png",
6
+ "last_visited_at": "2010/01/26 15:31:46 +0000",
7
+ "name": "Bank Of America",
8
+ "tier": 2,
9
+ "url": "/spots/164052",
10
+ "visits_count": 1
11
+ },
12
+ {
13
+ "city_state": "Aubrey, TX",
14
+ "first_visited_at": "2010/01/26 13:02:38 +0000",
15
+ "image_url": "http://static.gowalla.com/categories/16-standard.png",
16
+ "last_visited_at": "2010/01/26 13:02:38 +0000",
17
+ "name": "Betty's Cafe",
18
+ "tier": 2,
19
+ "url": "/spots/455129",
20
+ "visits_count": 1
21
+ },
22
+ {
23
+ "city_state": "Frisco, TX",
24
+ "first_visited_at": "2010/01/23 18:35:02 +0000",
25
+ "image_url": "http://static.gowalla.com/categories/30-standard.png",
26
+ "last_visited_at": "2010/01/23 18:35:02 +0000",
27
+ "name": "AMC Stonebriar 24",
28
+ "tier": 2,
29
+ "url": "/spots/59817",
30
+ "visits_count": 1
31
+ },
32
+ {
33
+ "city_state": "TX",
34
+ "first_visited_at": "2010/01/12 00:55:59 +0000",
35
+ "image_url": "http://static.gowalla.com/categories/64-standard.png",
36
+ "last_visited_at": "2010/01/12 00:55:59 +0000",
37
+ "name": "Londoner Restaurant",
38
+ "tier": 2,
39
+ "url": "/spots/366585",
40
+ "visits_count": 1
41
+ },
42
+ {
43
+ "city_state": "Frisco, TX",
44
+ "first_visited_at": "2010/01/11 17:05:14 +0000",
45
+ "image_url": "http://static.gowalla.com/categories/154-standard.png",
46
+ "last_visited_at": "2010/01/11 17:05:14 +0000",
47
+ "name": "MOOYAH Burgers & Fries",
48
+ "tier": 2,
49
+ "url": "/spots/78953",
50
+ "visits_count": 1
51
+ },
52
+ {
53
+ "city_state": "Dallas, TX",
54
+ "first_visited_at": "2010/01/05 22:55:51 +0000",
55
+ "image_url": "http://static.gowalla.com/categories/96-standard.png",
56
+ "last_visited_at": "2010/01/05 22:55:51 +0000",
57
+ "name": "Barnes and Noble",
58
+ "tier": 2,
59
+ "url": "/spots/11641",
60
+ "visits_count": 1
61
+ },
62
+ {
63
+ "city_state": "Frisco, TX",
64
+ "first_visited_at": "2009/12/30 23:32:30 +0000",
65
+ "image_url": "http://static.gowalla.com/categories/17-standard.png",
66
+ "last_visited_at": "2009/12/30 23:32:30 +0000",
67
+ "name": "Rudy's",
68
+ "tier": 2,
69
+ "url": "/spots/43464",
70
+ "visits_count": 1
71
+ },
72
+ {
73
+ "city_state": "Fredericksburg, TX",
74
+ "first_visited_at": "2009/12/29 18:39:20 +0000",
75
+ "image_url": "http://static.gowalla.com/categories/30-standard.png",
76
+ "last_visited_at": "2009/12/29 18:39:20 +0000",
77
+ "name": "Stagecoach Theater",
78
+ "tier": 2,
79
+ "url": "/spots/136029",
80
+ "visits_count": 1
81
+ },
82
+ {
83
+ "city_state": "Fredericksburg, TX",
84
+ "first_visited_at": "2009/12/29 15:33:11 +0000",
85
+ "image_url": "http://static.gowalla.com/categories/73-standard.png",
86
+ "last_visited_at": "2009/12/29 15:33:11 +0000",
87
+ "name": "National Museum of the Pacific War",
88
+ "tier": 2,
89
+ "url": "/spots/11300",
90
+ "visits_count": 1
91
+ },
92
+ {
93
+ "city_state": "Fredericksburg, TX",
94
+ "first_visited_at": "2009/12/28 23:56:05 +0000",
95
+ "image_url": "http://static.gowalla.com/categories/167-standard.png",
96
+ "last_visited_at": "2009/12/28 23:56:05 +0000",
97
+ "name": "Fredericksburg Brewing Co.",
98
+ "tier": 2,
99
+ "url": "/spots/261180",
100
+ "visits_count": 1
101
+ },
102
+ {
103
+ "city_state": "Boerne, TX",
104
+ "first_visited_at": "2009/12/28 17:16:16 +0000",
105
+ "image_url": "http://static.gowalla.com/categories/157-standard.png",
106
+ "last_visited_at": "2009/12/28 17:16:16 +0000",
107
+ "name": "Sister Creek Vineyards",
108
+ "tier": 2,
109
+ "url": "/spots/284084",
110
+ "visits_count": 1
111
+ },
112
+ {
113
+ "city_state": "Fredericksburg, TX",
114
+ "first_visited_at": "2009/12/28 16:23:46 +0000",
115
+ "image_url": "http://static.gowalla.com/categories/157-standard.png",
116
+ "last_visited_at": "2009/12/28 16:23:46 +0000",
117
+ "name": "Grape Creek Vineyards",
118
+ "tier": 2,
119
+ "url": "/spots/142525",
120
+ "visits_count": 1
121
+ },
122
+ {
123
+ "city_state": "Mckinney, TX",
124
+ "first_visited_at": "2009/10/16 16:04:05 +0000",
125
+ "image_url": "http://static.gowalla.com/categories/73-standard.png",
126
+ "last_visited_at": "2009/10/16 16:04:05 +0000",
127
+ "name": "Heard Museum ",
128
+ "tier": 2,
129
+ "url": "/spots/49747",
130
+ "visits_count": 1
131
+ },
132
+ {
133
+ "city_state": "Celina, TX",
134
+ "first_visited_at": "2009/05/17 17:26:01 +0000",
135
+ "image_url": "http://static.gowalla.com/categories/125-standard.png",
136
+ "last_visited_at": "2009/05/17 17:26:01 +0000",
137
+ "name": "Celina City Hall",
138
+ "tier": 2,
139
+ "url": "/spots/13354",
140
+ "visits_count": 1
141
+ },
142
+ {
143
+ "city_state": null,
144
+ "first_visited_at": "2009/05/17 17:26:01 +0000",
145
+ "image_url": "http://static.gowalla.com/spots/18320-5120ee4f995831b24c67d8d86ae185ae.png",
146
+ "last_visited_at": "2009/05/17 17:26:01 +0000",
147
+ "name": "Texas",
148
+ "tier": 2,
149
+ "url": "/spots/18320",
150
+ "visits_count": 1
151
+ }
152
+ ]
@@ -0,0 +1,63 @@
1
+
2
+ [
3
+ {
4
+ "image_url": "http://static.gowalla.com/categories/186-standard.png",
5
+ "name": "Bank Of America",
6
+ "url": "/spots/164052",
7
+ "visits_count": "1"
8
+ },
9
+ {
10
+ "image_url": "http://static.gowalla.com/categories/16-standard.png",
11
+ "name": "Betty's Cafe",
12
+ "url": "/spots/455129",
13
+ "visits_count": "1"
14
+ },
15
+ {
16
+ "image_url": "http://static.gowalla.com/categories/30-standard.png",
17
+ "name": "AMC Stonebriar 24",
18
+ "url": "/spots/59817",
19
+ "visits_count": "1"
20
+ },
21
+ {
22
+ "image_url": "http://static.gowalla.com/categories/64-standard.png",
23
+ "name": "Londoner Restaurant",
24
+ "url": "/spots/366585",
25
+ "visits_count": "1"
26
+ },
27
+ {
28
+ "image_url": "http://static.gowalla.com/categories/154-standard.png",
29
+ "name": "MOOYAH Burgers & Fries",
30
+ "url": "/spots/78953",
31
+ "visits_count": "1"
32
+ },
33
+ {
34
+ "image_url": "http://static.gowalla.com/categories/96-standard.png",
35
+ "name": "Barnes and Noble",
36
+ "url": "/spots/11641",
37
+ "visits_count": "1"
38
+ },
39
+ {
40
+ "image_url": "http://static.gowalla.com/categories/17-standard.png",
41
+ "name": "Rudy's",
42
+ "url": "/spots/43464",
43
+ "visits_count": "1"
44
+ },
45
+ {
46
+ "image_url": "http://static.gowalla.com/categories/30-standard.png",
47
+ "name": "Stagecoach Theater",
48
+ "url": "/spots/136029",
49
+ "visits_count": "1"
50
+ },
51
+ {
52
+ "image_url": "http://static.gowalla.com/categories/73-standard.png",
53
+ "name": "National Museum of the Pacific War",
54
+ "url": "/spots/11300",
55
+ "visits_count": "1"
56
+ },
57
+ {
58
+ "image_url": "http://static.gowalla.com/categories/167-standard.png",
59
+ "name": "Fredericksburg Brewing Co.",
60
+ "url": "/spots/261180",
61
+ "visits_count": "1"
62
+ }
63
+ ]
@@ -0,0 +1,22 @@
1
+ {
2
+ "completed_users_count": 104779,
3
+ "created_at": "2009/06/22 18:44:46 +0000",
4
+ "creator": {
5
+ "name": "Team Gowalla"
6
+ },
7
+ "description": "",
8
+ "featured": true,
9
+ "image_url": "http://static.gowalla.com/missions/1-ec53eae4b07e222b9a95805d28508986.png",
10
+ "map_bounds": {
11
+ "east": -63.457031000000001,
12
+ "north": 49.496675000000003,
13
+ "south": 24.046464,
14
+ "west": -125.419922
15
+ },
16
+ "name": "I Installed Gowalla!",
17
+ "published": true,
18
+ "spots": [],
19
+ "spots_visited": 0,
20
+ "url": "/trips/1",
21
+ "user_url": "/users/1934"
22
+ }
@@ -0,0 +1,41 @@
1
+ {
2
+ "accept_url": "/friendships/accept?user_id=1707",
3
+ "activity_url": "/users/1707/events",
4
+ "bio": "Web designer and Ruby developer.",
5
+ "events_url": "/users/1707/events",
6
+ "fb_id": 605681706,
7
+ "first_name": "Wynn",
8
+ "friends_count": 27,
9
+ "friends_only": false,
10
+ "friends_url": "/users/1707/friends",
11
+ "hometown": "Aubrey, TX",
12
+ "image_url": "http://s3.amazonaws.com/static.gowalla.com/users/1707-standard.jpg?1262011383",
13
+ "is_friend": false,
14
+ "items_count": 5,
15
+ "items_url": "/users/1707/items",
16
+ "last_name": "Netherland",
17
+ "last_visit": {
18
+ "comment": "Closing every account I have ",
19
+ "created_at": "2010/01/26 15:31:46 +0000",
20
+ "spot": {
21
+ "image_url": "http://static.gowalla.com/categories/186-standard.png",
22
+ "name": "Bank Of America",
23
+ "small_image_url": "http://static.gowalla.com/categories/186-small-standard.png",
24
+ "url": "/spots/164052"
25
+ }
26
+ },
27
+ "name": "Wynn Netherland",
28
+ "pins_count": 3,
29
+ "pins_url": "/users/1707/pins",
30
+ "reject_url": "/friendships/reject?user_id=1707",
31
+ "request_url": "/friendships/request?user_id=1707",
32
+ "stamps_count": 15,
33
+ "stamps_url": "/users/1707/stamps",
34
+ "top_spots_url": "/users/1707/top_spots",
35
+ "twitter_username": "pengwynn",
36
+ "url": "/users/1707",
37
+ "username": "pengwynn",
38
+ "vaulted_kinds_count": 0,
39
+ "visited_spots_count": 15,
40
+ "website": "http://wynnnetherland.com"
41
+ }
@@ -0,0 +1 @@
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/helper.rb ADDED
@@ -0,0 +1,42 @@
1
+ require 'test/unit'
2
+ require 'pathname'
3
+ require 'rubygems'
4
+
5
+ gem 'thoughtbot-shoulda', '>= 2.10.1'
6
+ gem 'jnunemaker-matchy', '0.4.0'
7
+ gem 'fakeweb', '>= 1.2.5'
8
+
9
+ require 'shoulda'
10
+ require 'matchy'
11
+ require 'fakeweb'
12
+
13
+
14
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
15
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
16
+ require 'gowalla'
17
+
18
+ FakeWeb.allow_net_connect = false
19
+
20
+ class Test::Unit::TestCase
21
+ end
22
+
23
+ def fixture_file(filename)
24
+ return '' if filename == ''
25
+ file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/' + filename)
26
+ File.read(file_path)
27
+ end
28
+
29
+ def gowalla_url(url)
30
+ url =~ /^http/ ? url : "http://api.gowalla.com#{url}"
31
+ end
32
+
33
+ def stub_get(url, filename, options={})
34
+ opts = {:body => fixture_file(filename)}.merge(options)
35
+
36
+ FakeWeb.register_uri(:get, gowalla_url(url), opts)
37
+ end
38
+
39
+ def stub_post(url, filename)
40
+ FakeWeb.register_uri(:post, gowalla_url(url), :body => fixture_file(filename))
41
+ end
42
+
@@ -0,0 +1,172 @@
1
+ require 'helper'
2
+
3
+ class TestGowalla < Test::Unit::TestCase
4
+
5
+ context "When hitting the Gowalla API authenticated" do
6
+ setup do
7
+ @client = Gowalla::Client.new('pengwynn', '0U812')
8
+ end
9
+
10
+ should "retrieve details for the current user" do
11
+ stub_get('http://pengwynn:0U812@api.gowalla.com/users/me', 'me.json')
12
+ user = @client.user
13
+ user.can_post_to_twitter?.should == true
14
+ user.can_post_to_facebook?.should == true
15
+ user.bio.should == "Web designer and Ruby developer."
16
+ user.stamps_count.should == 15
17
+ end
18
+
19
+ should "retrieve details for a user" do
20
+ stub_get('http://pengwynn:0U812@api.gowalla.com/users/1707', 'me.json')
21
+ user = @client.user(1707)
22
+ user.can_post_to_twitter?.should == true
23
+ user.can_post_to_facebook?.should == true
24
+ user.bio.should == "Web designer and Ruby developer."
25
+ user.stamps_count.should == 15
26
+ end
27
+
28
+ should "retrieve events for a user" do
29
+ stub_get('http://pengwynn:0U812@api.gowalla.com/users/1707/events', 'events.json')
30
+ events = @client.events(1707)
31
+ events.first.comment.should == 'Closing every account I have '
32
+ events.last.spot.name.should == 'Grape Creek Vineyards'
33
+ end
34
+
35
+ should "retrieve events for a user's friends" do
36
+ stub_get('http://pengwynn:0U812@api.gowalla.com/visits/recent', 'events.json')
37
+ events = @client.friends_events
38
+ events.first.comment.should == 'Closing every account I have '
39
+ events.last.spot.name.should == 'Grape Creek Vineyards'
40
+ end
41
+
42
+ should "retrieve friend requests for a user" do
43
+ stub_get('http://pengwynn:0U812@api.gowalla.com/users/1707/friend_requests', 'friend_requests.json')
44
+ requests = @client.friend_requests(1707)
45
+ requests.first.username.should == 'juanchez'
46
+ end
47
+
48
+ should "retrieve friends for a user" do
49
+ stub_get('http://pengwynn:0U812@api.gowalla.com/users/1707/friends', 'friends.json')
50
+ friends = @client.friends(1707)
51
+ friends.size.should == 0
52
+ end
53
+
54
+ should "retrieve items for a user" do
55
+ stub_get('http://pengwynn:0U812@api.gowalla.com/users/1707/items', 'items.json')
56
+ items = @client.items(1707)
57
+ items.size.should == 5
58
+ items.first.name.should == 'Stationery'
59
+ end
60
+
61
+ should "retrieve pins for a user" do
62
+ stub_get('http://pengwynn:0U812@api.gowalla.com/users/1707/pins', 'pins.json')
63
+ pins = @client.pins(1707)
64
+ pins.size.should == 4
65
+ pins.first.name.should == 'Ranger'
66
+ end
67
+
68
+ should "retrieve stamps for a user" do
69
+ stub_get('http://pengwynn:0U812@api.gowalla.com/users/1707/stamps', 'stamps.json')
70
+ stamps = @client.stamps(1707)
71
+ stamps.size.should == 15
72
+ stamps.first.name.should == 'Bank Of America'
73
+ stamps.first.tier.should == 2
74
+ end
75
+
76
+ should "retrieve top spots for a user" do
77
+ stub_get('http://pengwynn:0U812@api.gowalla.com/users/1707/top_spots', 'top_spots.json')
78
+ top_spots = @client.top_spots(1707)
79
+ top_spots.size.should == 10
80
+ top_spots.first.name.should == 'Bank Of America'
81
+ top_spots.first.visits_count.should == "1"
82
+ end
83
+
84
+ should "retrieve visited spots for a user" do
85
+ stub_get('http://pengwynn:0U812@api.gowalla.com/users/1707/visited_spots', 'visited_spots.json')
86
+ visited_spots = @client.visited_spots(1707)
87
+ visited_spots.size.should == 15
88
+ visited_spots.last.should == "/spots/11300"
89
+ end
90
+
91
+ should_eventually "request a friendship with a user" do
92
+
93
+ end
94
+
95
+ should_eventually "accept a friendship with a user" do
96
+
97
+ end
98
+
99
+ should "retrieve details for a trip" do
100
+ stub_get('http://pengwynn:0U812@api.gowalla.com/trips/1', 'trip.json')
101
+ trip = @client.trip(1)
102
+ trip.creator.name.should == 'Team Gowalla'
103
+ trip.map_bounds.east.should == -63.457031000000001
104
+ end
105
+
106
+ should "retrieve details for a spot" do
107
+ stub_get('http://pengwynn:0U812@api.gowalla.com/spots/452593', 'spot.json')
108
+ spot = @client.spot(452593)
109
+ spot.name.should == 'Paloma Creek Elementary'
110
+ spot.categories.first.name.should == 'Other - College & Education'
111
+ end
112
+
113
+ should "retrieve events for a spot" do
114
+ stub_get('http://pengwynn:0U812@api.gowalla.com/spots/452593/events', 'events.json')
115
+ events = @client.spot_events(452593)
116
+ events.first.comment.should == 'Closing every account I have '
117
+ events.last.spot.name.should == 'Grape Creek Vineyards'
118
+ end
119
+
120
+ should_eventually "drop an item" do
121
+
122
+ end
123
+
124
+ should_eventually "pick up an item" do
125
+
126
+ end
127
+
128
+
129
+ end
130
+
131
+ context "when hitting the Gowalla API unauthenticated" do
132
+
133
+
134
+ should "retrieve details for a user" do
135
+ stub_get('/users/1707', 'user.json')
136
+ user = Gowalla.user(1707)
137
+ user.bio.should == "Web designer and Ruby developer."
138
+ user.stamps_count.should == 15
139
+ end
140
+
141
+ should "retrieve events for a user" do
142
+ stub_get('/users/1707/events', 'events.json')
143
+ events = Gowalla.events(1707)
144
+ events.first.comment.should == 'Closing every account I have '
145
+ events.last.spot.name.should == 'Grape Creek Vineyards'
146
+ end
147
+
148
+ should "retrieve details for a trip" do
149
+ stub_get('/trips/1', 'trip.json')
150
+ trip = Gowalla.trip(1)
151
+ trip.creator.name.should == 'Team Gowalla'
152
+ trip.map_bounds.east.should == -63.457031000000001
153
+ end
154
+
155
+ should "retrieve details for a spot" do
156
+ stub_get('/spots/452593', 'spot.json')
157
+ spot = Gowalla.spot(452593)
158
+ spot.name.should == 'Paloma Creek Elementary'
159
+ spot.categories.first.name.should == 'Other - College & Education'
160
+ end
161
+
162
+ should "retrieve events for a spot" do
163
+ stub_get('/spots/452593/events', 'events.json')
164
+ events = Gowalla.spot_events(452593)
165
+ events.first.comment.should == 'Closing every account I have '
166
+ events.last.spot.name.should == 'Grape Creek Vineyards'
167
+ end
168
+
169
+ end
170
+
171
+
172
+ end