gowalla 0.4.2 → 0.5.1
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/Gemfile.lock +1 -1
- data/changelog.md +3 -0
- data/lib/gowalla.rb +2 -11
- data/lib/gowalla/client.rb +12 -2
- data/lib/gowalla/users.rb +8 -0
- data/lib/gowalla/version.rb +1 -1
- data/test/checkins_test.rb +1 -1
- data/test/client_test.rb +23 -1
- data/test/fixtures/{events.json → spot_events.json} +0 -0
- data/test/fixtures/user_events.json +194 -0
- data/test/flags_test.rb +4 -4
- data/test/items_test.rb +2 -2
- data/test/spots_test.rb +8 -8
- data/test/trips_test.rb +2 -2
- data/test/users_test.rb +18 -10
- metadata +18 -6
data/Gemfile.lock
CHANGED
data/changelog.md
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
# Changelog
|
2
|
+
## 0.5.1 October 10, 2010
|
3
|
+
* Patch from [jasonrudolph](http://github.com/jasonrudolph) for #user_events
|
4
|
+
* Patch from [jasonrudolph](http://github.com/jasonrudolph) to authenticate via HTTPS
|
2
5
|
## 0.4.2 October 2, 2010
|
3
6
|
* Patch from [sferik](http://github.com/sferik) for faraday_middleware
|
4
7
|
## 0.4.1 September 28, 2010
|
data/lib/gowalla.rb
CHANGED
@@ -13,17 +13,8 @@ module Gowalla
|
|
13
13
|
attr_accessor :api_secret
|
14
14
|
attr_accessor :test_mode
|
15
15
|
|
16
|
-
#
|
17
|
-
#
|
18
|
-
# Gowalla.configure do |config|
|
19
|
-
# config.api_key = 'api_key'
|
20
|
-
# config.username = 'username'
|
21
|
-
# config.password = 'password'
|
22
|
-
# end
|
23
|
-
#
|
24
|
-
# elsewhere
|
25
|
-
#
|
26
|
-
# client = Gowalla::Client.new
|
16
|
+
# Configures default credentials easily
|
17
|
+
# @yield [api_key, username, password]
|
27
18
|
def configure
|
28
19
|
yield self
|
29
20
|
true
|
data/lib/gowalla/client.rb
CHANGED
@@ -36,10 +36,9 @@ module Gowalla
|
|
36
36
|
#
|
37
37
|
# @return [Faraday::Connection]
|
38
38
|
def connection
|
39
|
-
url = @access_token ? "https://api.gowalla.com" : "http://api.gowalla.com"
|
40
39
|
params = {}
|
41
40
|
params[:access_token] = @access_token if @access_token
|
42
|
-
@connection ||= Faraday::Connection.new(:url =>
|
41
|
+
@connection ||= Faraday::Connection.new(:url => api_url, :params => params, :headers => default_headers) do |builder|
|
43
42
|
builder.adapter Faraday.default_adapter
|
44
43
|
builder.use Faraday::Response::ParseJson
|
45
44
|
builder.use Faraday::Response::Mashify
|
@@ -47,6 +46,13 @@ module Gowalla
|
|
47
46
|
|
48
47
|
end
|
49
48
|
|
49
|
+
# Provides the URL for accessing the API
|
50
|
+
#
|
51
|
+
# @return [String]
|
52
|
+
def api_url
|
53
|
+
authentication_credentials_provided? ? "https://api.gowalla.com" : "http://api.gowalla.com"
|
54
|
+
end
|
55
|
+
|
50
56
|
# Provides raw access to the OAuth2 Client
|
51
57
|
#
|
52
58
|
# @return [OAuth2::Client]
|
@@ -89,6 +95,10 @@ module Gowalla
|
|
89
95
|
}
|
90
96
|
end
|
91
97
|
|
98
|
+
# @private
|
99
|
+
def authentication_credentials_provided?
|
100
|
+
@api_key || @api_secret || @username || @access_token
|
101
|
+
end
|
92
102
|
|
93
103
|
end
|
94
104
|
|
data/lib/gowalla/users.rb
CHANGED
@@ -38,6 +38,14 @@ module Gowalla
|
|
38
38
|
connection.get("/users/#{user_id}/visited_spots_urls").body.urls
|
39
39
|
end
|
40
40
|
|
41
|
+
# Retrieve a list of the user's most recent checkins.
|
42
|
+
#
|
43
|
+
# @param [String] user_id (authenticated basic auth user) User ID (screen name)
|
44
|
+
# @return [Hashie::Mash] Array of checkin events
|
45
|
+
def user_events(user_id=self.username)
|
46
|
+
connection.get("/users/#{user_id}/events").body.activity
|
47
|
+
end
|
48
|
+
|
41
49
|
# Retrieve a list of items the user is carrying
|
42
50
|
# WARNING: This method uses calls not officially supported by Gowalla.
|
43
51
|
#
|
data/lib/gowalla/version.rb
CHANGED
data/test/checkins_test.rb
CHANGED
@@ -8,7 +8,7 @@ class CheckinsTest < Test::Unit::TestCase
|
|
8
8
|
end
|
9
9
|
|
10
10
|
should "fetch info for a checkin" do
|
11
|
-
stub_get("
|
11
|
+
stub_get("https://pengwynn:0U812@api.gowalla.com/checkins/88", "checkin.json")
|
12
12
|
checkin = @client.checkin_info(88)
|
13
13
|
checkin.spot.name.should == 'Movie Tavern'
|
14
14
|
checkin.message.should == 'There sending us Back-- to the Future!'
|
data/test/client_test.rb
CHANGED
@@ -10,6 +10,13 @@ class ClientTest < Test::Unit::TestCase
|
|
10
10
|
|
11
11
|
end
|
12
12
|
|
13
|
+
context "when accessing the API anonymously" do
|
14
|
+
should "send requests unencrypted over plain HTTP" do
|
15
|
+
@client = Gowalla::Client.new
|
16
|
+
@client.api_url.should == 'http://api.gowalla.com'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
13
20
|
context "when using basic auth" do
|
14
21
|
should "configure api_key, username, and password for easy access" do
|
15
22
|
|
@@ -22,11 +29,22 @@ class ClientTest < Test::Unit::TestCase
|
|
22
29
|
|
23
30
|
@client = Gowalla::Client.new
|
24
31
|
|
25
|
-
stub_get('
|
32
|
+
stub_get('https://username:password@api.gowalla.com/trips', 'trips.json')
|
26
33
|
trips = @client.trips
|
27
34
|
|
28
35
|
@client.username.should == 'username'
|
29
36
|
end
|
37
|
+
|
38
|
+
should "use HTTPS to avoid sending password in plain text" do
|
39
|
+
Gowalla.configure do |config|
|
40
|
+
config.api_key = 'api_key'
|
41
|
+
config.username = 'username'
|
42
|
+
config.password = 'password'
|
43
|
+
end
|
44
|
+
|
45
|
+
@client = Gowalla::Client.new
|
46
|
+
@client.api_url.should == 'https://api.gowalla.com'
|
47
|
+
end
|
30
48
|
|
31
49
|
should "configure test mode" do
|
32
50
|
Gowalla.configure do |config|
|
@@ -58,6 +76,10 @@ class ClientTest < Test::Unit::TestCase
|
|
58
76
|
@client.oauth_client.id.should == 'api_key'
|
59
77
|
end
|
60
78
|
|
79
|
+
should "use HTTPS to avoid sending credentials in plain text" do
|
80
|
+
@client.api_url.should == 'https://api.gowalla.com'
|
81
|
+
end
|
82
|
+
|
61
83
|
should "create an OAuth2 client" do
|
62
84
|
@client.oauth_client.class.to_s.should == "OAuth2::Client"
|
63
85
|
end
|
File without changes
|
@@ -0,0 +1,194 @@
|
|
1
|
+
{
|
2
|
+
"activity": [
|
3
|
+
{
|
4
|
+
"type": "checkin",
|
5
|
+
"_comments_count": 0,
|
6
|
+
"url": "/checkins/18863224",
|
7
|
+
"_photos_count": 1,
|
8
|
+
"created_at": "2010-10-10T19:00:30Z",
|
9
|
+
"message": "",
|
10
|
+
"activity_url": "/checkins/18863224/activity",
|
11
|
+
"spot": {
|
12
|
+
"lat": 33.236283164,
|
13
|
+
"lng": -96.963132806,
|
14
|
+
"image_url": "http://static.gowalla.com/categories/372-36fde6fbcef1326270d821925f5bc8a2-100.png?1",
|
15
|
+
"url": "/spots/5294067",
|
16
|
+
"description": "Doggie Halloween",
|
17
|
+
"city_state": "Aubrey, TX",
|
18
|
+
"name": "Barktoberfest"
|
19
|
+
},
|
20
|
+
"item": null
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"type": "checkin",
|
24
|
+
"_comments_count": 0,
|
25
|
+
"url": "/checkins/18841423",
|
26
|
+
"_photos_count": 0,
|
27
|
+
"created_at": "2010-10-10T13:48:26Z",
|
28
|
+
"message": "",
|
29
|
+
"activity_url": "/checkins/18841423/activity",
|
30
|
+
"spot": {
|
31
|
+
"lat": 33.234945482,
|
32
|
+
"lng": -97.1040451527,
|
33
|
+
"image_url": "http://static.gowalla.com/categories/68-97f92f05f9c89ac1318acbed6e8756d7-100.png?1",
|
34
|
+
"url": "/spots/148001",
|
35
|
+
"description": "",
|
36
|
+
"city_state": "Denton, TX",
|
37
|
+
"name": "Denton Bible Church"
|
38
|
+
},
|
39
|
+
"item": null
|
40
|
+
},
|
41
|
+
{
|
42
|
+
"type": "checkin",
|
43
|
+
"_comments_count": 0,
|
44
|
+
"url": "/checkins/18761602",
|
45
|
+
"_photos_count": 0,
|
46
|
+
"created_at": "2010-10-09T13:49:19Z",
|
47
|
+
"message": "Cheering for flag football",
|
48
|
+
"activity_url": "/checkins/18761602/activity",
|
49
|
+
"spot": {
|
50
|
+
"lat": 33.2414638833,
|
51
|
+
"lng": -97.1543097333,
|
52
|
+
"image_url": "http://static.gowalla.com/categories/38-69fb37a4291ebf8e325eb9ecf67f4a51-100.png?1",
|
53
|
+
"url": "/spots/12710",
|
54
|
+
"description": "Jogging trails, sports fields, playgrounds, fishing lakes, batting cage, driving range, model airplane field, and much more.",
|
55
|
+
"city_state": "Denton, TX",
|
56
|
+
"name": "North Lakes Park"
|
57
|
+
},
|
58
|
+
"item": null
|
59
|
+
},
|
60
|
+
{
|
61
|
+
"type": "checkin",
|
62
|
+
"_comments_count": 0,
|
63
|
+
"url": "/checkins/18716653",
|
64
|
+
"_photos_count": 0,
|
65
|
+
"created_at": "2010-10-08T21:53:01Z",
|
66
|
+
"message": "",
|
67
|
+
"activity_url": "/checkins/18716653/activity",
|
68
|
+
"spot": {
|
69
|
+
"lat": 33.22220165,
|
70
|
+
"lng": -96.96178115,
|
71
|
+
"image_url": "http://static.gowalla.com/categories/15-86c95944931ab87b5af70d9cf48de40e-100.png?1",
|
72
|
+
"url": "/spots/548312",
|
73
|
+
"description": null,
|
74
|
+
"city_state": "Little Elm, TX",
|
75
|
+
"name": "Raphael's"
|
76
|
+
},
|
77
|
+
"item": null
|
78
|
+
},
|
79
|
+
{
|
80
|
+
"type": "checkin",
|
81
|
+
"_comments_count": 0,
|
82
|
+
"url": "/checkins/18342058",
|
83
|
+
"_photos_count": 0,
|
84
|
+
"created_at": "2010-10-03T13:52:40Z",
|
85
|
+
"message": "",
|
86
|
+
"activity_url": "/checkins/18342058/activity",
|
87
|
+
"spot": {
|
88
|
+
"lat": 33.234945482,
|
89
|
+
"lng": -97.1040451527,
|
90
|
+
"image_url": "http://static.gowalla.com/categories/68-97f92f05f9c89ac1318acbed6e8756d7-100.png?1",
|
91
|
+
"url": "/spots/148001",
|
92
|
+
"description": "",
|
93
|
+
"city_state": "Denton, TX",
|
94
|
+
"name": "Denton Bible Church"
|
95
|
+
},
|
96
|
+
"item": null
|
97
|
+
},
|
98
|
+
{
|
99
|
+
"type": "checkin",
|
100
|
+
"_comments_count": 0,
|
101
|
+
"url": "/checkins/17931703",
|
102
|
+
"_photos_count": 0,
|
103
|
+
"created_at": "2010-09-27T17:06:57Z",
|
104
|
+
"message": "Loved the cream corn, @glv's recommendation ",
|
105
|
+
"activity_url": "/checkins/17931703/activity",
|
106
|
+
"spot": {
|
107
|
+
"lat": 33.1597476135,
|
108
|
+
"lng": -96.8392467499,
|
109
|
+
"image_url": "http://static.gowalla.com/categories/17-65ff6fdefa899c5b215485e87ec8a89e-100.png?1",
|
110
|
+
"url": "/spots/43464",
|
111
|
+
"description": "Real Texas Bar-B-Q",
|
112
|
+
"city_state": "Frisco, TX",
|
113
|
+
"name": "Rudy's"
|
114
|
+
},
|
115
|
+
"item": null
|
116
|
+
},
|
117
|
+
{
|
118
|
+
"type": "checkin",
|
119
|
+
"_comments_count": 0,
|
120
|
+
"url": "/checkins/17915508",
|
121
|
+
"_photos_count": 1,
|
122
|
+
"created_at": "2010-09-27T12:43:26Z",
|
123
|
+
"message": "",
|
124
|
+
"activity_url": "/checkins/17915508/activity",
|
125
|
+
"spot": {
|
126
|
+
"lat": 33.226585803,
|
127
|
+
"lng": -96.952728502,
|
128
|
+
"image_url": "http://static.gowalla.com/categories/114-dfa8b00854ef26823d8b0d2b998568ff-100.png?1",
|
129
|
+
"url": "/spots/4530278",
|
130
|
+
"description": null,
|
131
|
+
"city_state": "Little Elm, TX",
|
132
|
+
"name": "Providence Lake"
|
133
|
+
},
|
134
|
+
"item": null
|
135
|
+
},
|
136
|
+
{
|
137
|
+
"type": "checkin",
|
138
|
+
"_comments_count": 0,
|
139
|
+
"url": "/checkins/17858609",
|
140
|
+
"_photos_count": 0,
|
141
|
+
"created_at": "2010-09-26T15:28:55Z",
|
142
|
+
"message": "",
|
143
|
+
"activity_url": "/checkins/17858609/activity",
|
144
|
+
"spot": {
|
145
|
+
"lat": 33.234945482,
|
146
|
+
"lng": -97.1040451527,
|
147
|
+
"image_url": "http://static.gowalla.com/categories/68-97f92f05f9c89ac1318acbed6e8756d7-100.png?1",
|
148
|
+
"url": "/spots/148001",
|
149
|
+
"description": "",
|
150
|
+
"city_state": "Denton, TX",
|
151
|
+
"name": "Denton Bible Church"
|
152
|
+
},
|
153
|
+
"item": null
|
154
|
+
},
|
155
|
+
{
|
156
|
+
"type": "checkin",
|
157
|
+
"_comments_count": 0,
|
158
|
+
"url": "/checkins/17731583",
|
159
|
+
"_photos_count": 0,
|
160
|
+
"created_at": "2010-09-24T23:19:18Z",
|
161
|
+
"message": "Waiting on Bob & Larry",
|
162
|
+
"activity_url": "/checkins/17731583/activity",
|
163
|
+
"spot": {
|
164
|
+
"lat": 33.028165038,
|
165
|
+
"lng": -96.84656915,
|
166
|
+
"image_url": "http://static.gowalla.com/categories/387-5bc1a08e12564a38fc119abf8865ffde-100.png?1",
|
167
|
+
"url": "/spots/4373116",
|
168
|
+
"description": null,
|
169
|
+
"city_state": "Plano, TX",
|
170
|
+
"name": "VeggieTales Live"
|
171
|
+
},
|
172
|
+
"item": null
|
173
|
+
},
|
174
|
+
{
|
175
|
+
"type": "checkin",
|
176
|
+
"_comments_count": 0,
|
177
|
+
"url": "/checkins/17726509",
|
178
|
+
"_photos_count": 0,
|
179
|
+
"created_at": "2010-09-24T21:58:49Z",
|
180
|
+
"message": "",
|
181
|
+
"activity_url": "/checkins/17726509/activity",
|
182
|
+
"spot": {
|
183
|
+
"lat": 33.0269792167,
|
184
|
+
"lng": -96.82855735,
|
185
|
+
"image_url": "http://static.gowalla.com/categories/15-86c95944931ab87b5af70d9cf48de40e-100.png?1",
|
186
|
+
"url": "/spots/32973",
|
187
|
+
"description": "Fine Mexican Food! ",
|
188
|
+
"city_state": "Plano, TX",
|
189
|
+
"name": "Los Cucos"
|
190
|
+
},
|
191
|
+
"item": null
|
192
|
+
}
|
193
|
+
]
|
194
|
+
}
|
data/test/flags_test.rb
CHANGED
@@ -8,7 +8,7 @@ class FlagsTest < Test::Unit::TestCase
|
|
8
8
|
end
|
9
9
|
|
10
10
|
should "retrieve a list of flags" do
|
11
|
-
stub_get("
|
11
|
+
stub_get("https://pengwynn:0U812@api.gowalla.com/flags", "flags.json")
|
12
12
|
flags = @client.list_flags
|
13
13
|
flags.first.spot.name.should == 'Wild Gowallaby #1'
|
14
14
|
flags.first.user.url.should == '/users/340897'
|
@@ -17,7 +17,7 @@ class FlagsTest < Test::Unit::TestCase
|
|
17
17
|
end
|
18
18
|
|
19
19
|
should "retrieve information about a specific flag" do
|
20
|
-
stub_get("
|
20
|
+
stub_get("https://pengwynn:0U812@api.gowalla.com/flags/1", "flag.json")
|
21
21
|
flag = @client.flag(1)
|
22
22
|
flag.spot.name.should == 'Wild Gowallaby #1'
|
23
23
|
flag.user.url.should == '/users/340897'
|
@@ -27,7 +27,7 @@ class FlagsTest < Test::Unit::TestCase
|
|
27
27
|
|
28
28
|
|
29
29
|
should "retrieve flags associated with that spot" do
|
30
|
-
stub_get("
|
30
|
+
stub_get("https://pengwynn:0U812@api.gowalla.com/spots/1/flags", "flags.json")
|
31
31
|
flags = @client.spot_flags(1)
|
32
32
|
flags.first.spot.name.should == 'Wild Gowallaby #1'
|
33
33
|
flags.first.user.url.should == '/users/340897'
|
@@ -36,7 +36,7 @@ class FlagsTest < Test::Unit::TestCase
|
|
36
36
|
end
|
37
37
|
|
38
38
|
should "set a flag on a specific spot" do
|
39
|
-
url = "
|
39
|
+
url = "https://pengwynn:0U812@api.gowalla.com/spots/1/flags/invalid"
|
40
40
|
FakeWeb.register_uri(:post, url, :body => '{"result": "flag created"}')
|
41
41
|
response = @client.flag_spot(1, 'invalid', 'my problem description')
|
42
42
|
response.result.should == 'flag created'
|
data/test/items_test.rb
CHANGED
@@ -8,7 +8,7 @@ class ItemsTest < Test::Unit::TestCase
|
|
8
8
|
end
|
9
9
|
|
10
10
|
should "retrieve information about a specific item" do
|
11
|
-
stub_get('
|
11
|
+
stub_get('https://pengwynn:0U812@api.gowalla.com/items/607583', 'item.json')
|
12
12
|
item = @client.item(607583)
|
13
13
|
item.issue_number.should == 13998
|
14
14
|
item.name.should == 'Sweets'
|
@@ -16,7 +16,7 @@ class ItemsTest < Test::Unit::TestCase
|
|
16
16
|
end
|
17
17
|
|
18
18
|
should "retrieve events associated with a specific item" do
|
19
|
-
stub_get('
|
19
|
+
stub_get('https://pengwynn:0U812@api.gowalla.com/items/607583/events', 'item_events.json')
|
20
20
|
events = @client.item_events(607583)
|
21
21
|
events.first.spot.name = 'Jerusalem Bakery'
|
22
22
|
events.first.user.first_name = 'Scott'
|
data/test/spots_test.rb
CHANGED
@@ -8,20 +8,20 @@ class SpotsTest < Test::Unit::TestCase
|
|
8
8
|
end
|
9
9
|
|
10
10
|
should "Retrieve a list of spots within a specified distance of a location" do
|
11
|
-
stub_get("
|
11
|
+
stub_get("https://pengwynn:0U812@api.gowalla.com/spots?lat=%2B33.237593417&lng=-96.960559033&radius=50", "spots.json")
|
12
12
|
spots = @client.list_spots(:lat => 33.237593417, :lng => -96.960559033, :radius => 50)
|
13
13
|
spots.first.name.should == 'Gnomb Bar'
|
14
14
|
spots.first.radius_meters.should == 50
|
15
15
|
end
|
16
16
|
|
17
17
|
should "Retrieve a list of spots within a specified bounds" do
|
18
|
-
stub_get("
|
18
|
+
stub_get("https://pengwynn:0U812@api.gowalla.com/spots?sw=%2839.25565142103586%2C%20-8.717308044433594%29&nw=%2839.31411296530539%2C%20-8.490715026855469%29", "spots.json")
|
19
19
|
spots = @client.list_spots(:sw => "(39.25565142103586, -8.717308044433594)", :nw => "(39.31411296530539, -8.490715026855469)")
|
20
20
|
spots.first.name.should == 'Gnomb Bar'
|
21
21
|
end
|
22
22
|
|
23
23
|
should "Retrieve information about a specific spot" do
|
24
|
-
stub_get('
|
24
|
+
stub_get('https://pengwynn:0U812@api.gowalla.com/spots/18568', 'spot.json')
|
25
25
|
spot = @client.spot(18568)
|
26
26
|
spot.name.should == "Wahoo's"
|
27
27
|
spot.twitter_username.should == 'Wahoos512'
|
@@ -29,21 +29,21 @@ class SpotsTest < Test::Unit::TestCase
|
|
29
29
|
end
|
30
30
|
|
31
31
|
should "retrieve a list of check-ins at a particular spot. Shows only the activity that is visible to a given user" do
|
32
|
-
stub_get('
|
32
|
+
stub_get('https://pengwynn:0U812@api.gowalla.com/spots/452593/events', 'spot_events.json')
|
33
33
|
events = @client.spot_events(452593)
|
34
34
|
events.first[:type].should == 'checkin'
|
35
35
|
events.first.user.last_name.should == 'Mack'
|
36
36
|
end
|
37
37
|
|
38
38
|
should "retrieve a list of items available at a particular spot" do
|
39
|
-
stub_get('
|
39
|
+
stub_get('https://pengwynn:0U812@api.gowalla.com/spots/18568/items', 'items.json')
|
40
40
|
items = @client.spot_items(18568)
|
41
41
|
items.first.issue_number.should == 27868
|
42
42
|
items.first.name.should == 'Bowl of Noodles'
|
43
43
|
end
|
44
44
|
|
45
45
|
should "lists all spot categories" do
|
46
|
-
stub_get("
|
46
|
+
stub_get("https://pengwynn:0U812@api.gowalla.com/categories", "categories.json")
|
47
47
|
categories = @client.categories
|
48
48
|
categories.size.should == 9
|
49
49
|
categories.first.name.should == 'Architecture & Buildings'
|
@@ -53,13 +53,13 @@ class SpotsTest < Test::Unit::TestCase
|
|
53
53
|
end
|
54
54
|
|
55
55
|
should "retrieve information about a specific category" do
|
56
|
-
stub_get("
|
56
|
+
stub_get("https://pengwynn:0U812@api.gowalla.com/categories/1", "category.json")
|
57
57
|
category = @client.category(1)
|
58
58
|
category.name.should == 'Coffee Shop'
|
59
59
|
end
|
60
60
|
|
61
61
|
should "retrieve photos taken at a spot" do
|
62
|
-
stub_get('
|
62
|
+
stub_get('https://pengwynn:0U812@api.gowalla.com/spots/18568/photos', 'photos.json')
|
63
63
|
photos = @client.spot_photos(18568)
|
64
64
|
#photos.first.type.should == 'photo'
|
65
65
|
photos.first.photo_urls.square_50.should == 'http://static.gowalla.com/photos/912078_square_50.jpg'
|
data/test/trips_test.rb
CHANGED
@@ -8,14 +8,14 @@ class TripsTest < Test::Unit::TestCase
|
|
8
8
|
end
|
9
9
|
|
10
10
|
should "retrieve a list of trips" do
|
11
|
-
stub_get('
|
11
|
+
stub_get('https://pengwynn:0U812@api.gowalla.com/trips', 'trips.json')
|
12
12
|
trips = @client.trips
|
13
13
|
trips.first.name.should == 'London Pub Crawl'
|
14
14
|
trips.first.spots.first.url.should == '/spots/164009'
|
15
15
|
end
|
16
16
|
|
17
17
|
should "retrieve information about a specific trip" do
|
18
|
-
stub_get('
|
18
|
+
stub_get('https://pengwynn:0U812@api.gowalla.com/trips/1', 'trip.json')
|
19
19
|
trip = @client.trip(1)
|
20
20
|
trip.creator.last_name.should == 'Gowalla'
|
21
21
|
trip.map_bounds.east.should == -63.457031
|
data/test/users_test.rb
CHANGED
@@ -8,21 +8,21 @@ class UsersTest < Test::Unit::TestCase
|
|
8
8
|
end
|
9
9
|
|
10
10
|
should "retrive information about the current user if no user specified" do
|
11
|
-
stub_get('
|
11
|
+
stub_get('https://pengwynn:0U812@api.gowalla.com/users/pengwynn', 'user.json')
|
12
12
|
user = @client.user
|
13
13
|
user.bio.should == "CTO & co-founder of Gowalla. Ruby/Cocoa/JavaScript developer. Game designer. Author. Indoorsman."
|
14
14
|
user.stamps_count.should == 506
|
15
15
|
end
|
16
16
|
|
17
17
|
should "retrieve information about a specific user" do
|
18
|
-
stub_get('
|
18
|
+
stub_get('https://pengwynn:0U812@api.gowalla.com/users/sco', 'user.json')
|
19
19
|
user = @client.user('sco')
|
20
20
|
user.bio.should == "CTO & co-founder of Gowalla. Ruby/Cocoa/JavaScript developer. Game designer. Author. Indoorsman."
|
21
21
|
user.stamps_count.should == 506
|
22
22
|
end
|
23
23
|
|
24
24
|
should "retrieve a list of the stamps the user has collected" do
|
25
|
-
stub_get('
|
25
|
+
stub_get('https://pengwynn:0U812@api.gowalla.com/users/1707/stamps?limit=20', 'stamps.json')
|
26
26
|
stamps = @client.stamps(1707)
|
27
27
|
stamps.size.should == 20
|
28
28
|
stamps.first.spot.name.should == "Muck-N-Dave's Texas BBQ"
|
@@ -30,7 +30,7 @@ class UsersTest < Test::Unit::TestCase
|
|
30
30
|
end
|
31
31
|
|
32
32
|
should "retrieve a list of spots the user has visited most often" do
|
33
|
-
stub_get('
|
33
|
+
stub_get('https://pengwynn:0U812@api.gowalla.com/users/1707/top_spots', 'top_spots.json')
|
34
34
|
top_spots = @client.top_spots(1707)
|
35
35
|
top_spots.size.should == 10
|
36
36
|
top_spots.first.name.should == 'Juan Pelota Cafe'
|
@@ -38,41 +38,49 @@ class UsersTest < Test::Unit::TestCase
|
|
38
38
|
end
|
39
39
|
|
40
40
|
should "retrieve a list of spot urls the user has visited" do
|
41
|
-
stub_get('
|
41
|
+
stub_get('https://pengwynn:0U812@api.gowalla.com/users/sco/visited_spots_urls', 'spots_urls.json')
|
42
42
|
spot_urls = @client.visited_spots_urls('sco')
|
43
43
|
spot_urls.size.should == 22
|
44
44
|
spot_urls.first.should == '/spots/682460'
|
45
45
|
end
|
46
46
|
|
47
|
+
should "retrieve a list of the user's most recent checkins" do
|
48
|
+
stub_get('https://pengwynn:0U812@api.gowalla.com/users/1707/events', 'user_events.json')
|
49
|
+
user_events = @client.user_events(1707)
|
50
|
+
user_events.size.should == 10
|
51
|
+
user_events.first.url.should == '/checkins/18863224'
|
52
|
+
user_events.first.spot.name.should == "Barktoberfest"
|
53
|
+
end
|
54
|
+
|
47
55
|
should "retrieve a list of items the user is carrying" do
|
48
|
-
stub_get('
|
56
|
+
stub_get('https://pengwynn:0U812@api.gowalla.com/users/sco/items?context=vault', 'items.json')
|
49
57
|
items = @client.user_items('sco', 'vault')
|
50
58
|
items.first.issue_number.should == 27868
|
51
59
|
items.first.name.should == 'Bowl of Noodles'
|
52
60
|
end
|
53
61
|
|
54
62
|
should "retrieve a list of friends for the user" do
|
55
|
-
stub_get('
|
63
|
+
stub_get('https://pengwynn:0U812@api.gowalla.com/users/sco/friends', 'users.json')
|
56
64
|
users = @client.friends('sco')
|
57
65
|
users.first.first_name.should == 'Chalkbot'
|
58
66
|
end
|
59
67
|
|
60
68
|
should "retrieve a list of trips created by the user" do
|
61
|
-
stub_get('
|
69
|
+
stub_get('https://pengwynn:0U812@api.gowalla.com/users/sco/trips', 'trips.json')
|
62
70
|
trips = @client.user_trips('sco')
|
63
71
|
trips.first.name.should == 'London Pub Crawl'
|
64
72
|
trips.first.spots.first.url.should == '/spots/164009'
|
65
73
|
end
|
66
74
|
|
67
75
|
should "retrieve a list of photos taken by the user" do
|
68
|
-
stub_get('
|
76
|
+
stub_get('https://pengwynn:0U812@api.gowalla.com/users/sco/photos', 'photos.json')
|
69
77
|
photos = @client.user_photos('sco')
|
70
78
|
#photos.first.type.should == 'photo'
|
71
79
|
photos.first.photo_urls.square_50.should == 'http://static.gowalla.com/photos/912078_square_50.jpg'
|
72
80
|
end
|
73
81
|
|
74
82
|
should "retrieve a list of pins collected by the user" do
|
75
|
-
stub_get('
|
83
|
+
stub_get('https://pengwynn:0U812@api.gowalla.com/users/sco/pins', 'pins.json')
|
76
84
|
pins = @client.user_pins('sco')
|
77
85
|
pins.first.name.should == '110 Film'
|
78
86
|
#pins.first.trip.type.should == 'challenge'
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gowalla
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 9
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
8
|
+
- 5
|
9
|
+
- 1
|
10
|
+
version: 0.5.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Wynn Netherland
|
@@ -15,7 +16,7 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2010-10-
|
19
|
+
date: 2010-10-10 00:00:00 -05:00
|
19
20
|
default_executable:
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
@@ -26,6 +27,7 @@ dependencies:
|
|
26
27
|
requirements:
|
27
28
|
- - ">="
|
28
29
|
- !ruby/object:Gem::Version
|
30
|
+
hash: 3
|
29
31
|
segments:
|
30
32
|
- 0
|
31
33
|
version: "0"
|
@@ -39,6 +41,7 @@ dependencies:
|
|
39
41
|
requirements:
|
40
42
|
- - ~>
|
41
43
|
- !ruby/object:Gem::Version
|
44
|
+
hash: 5
|
42
45
|
segments:
|
43
46
|
- 0
|
44
47
|
- 4
|
@@ -54,6 +57,7 @@ dependencies:
|
|
54
57
|
requirements:
|
55
58
|
- - ~>
|
56
59
|
- !ruby/object:Gem::Version
|
60
|
+
hash: 27
|
57
61
|
segments:
|
58
62
|
- 0
|
59
63
|
- 1
|
@@ -69,6 +73,7 @@ dependencies:
|
|
69
73
|
requirements:
|
70
74
|
- - ~>
|
71
75
|
- !ruby/object:Gem::Version
|
76
|
+
hash: 39
|
72
77
|
segments:
|
73
78
|
- 2
|
74
79
|
- 10
|
@@ -84,6 +89,7 @@ dependencies:
|
|
84
89
|
requirements:
|
85
90
|
- - ~>
|
86
91
|
- !ruby/object:Gem::Version
|
92
|
+
hash: 15
|
87
93
|
segments:
|
88
94
|
- 0
|
89
95
|
- 4
|
@@ -99,6 +105,7 @@ dependencies:
|
|
99
105
|
requirements:
|
100
106
|
- - ">="
|
101
107
|
- !ruby/object:Gem::Version
|
108
|
+
hash: 3
|
102
109
|
segments:
|
103
110
|
- 0
|
104
111
|
version: "0"
|
@@ -112,6 +119,7 @@ dependencies:
|
|
112
119
|
requirements:
|
113
120
|
- - ">="
|
114
121
|
- !ruby/object:Gem::Version
|
122
|
+
hash: 23
|
115
123
|
segments:
|
116
124
|
- 1
|
117
125
|
- 0
|
@@ -152,7 +160,6 @@ files:
|
|
152
160
|
- test/fixtures/category.json
|
153
161
|
- test/fixtures/challenges.json
|
154
162
|
- test/fixtures/checkin.json
|
155
|
-
- test/fixtures/events.json
|
156
163
|
- test/fixtures/find_spots.json
|
157
164
|
- test/fixtures/find_trips.json
|
158
165
|
- test/fixtures/flag.json
|
@@ -170,6 +177,7 @@ files:
|
|
170
177
|
- test/fixtures/pins.json
|
171
178
|
- test/fixtures/potential_twitter_friends.json
|
172
179
|
- test/fixtures/spot.json
|
180
|
+
- test/fixtures/spot_events.json
|
173
181
|
- test/fixtures/spots.json
|
174
182
|
- test/fixtures/spots_by_category.json
|
175
183
|
- test/fixtures/spots_urls.json
|
@@ -178,6 +186,7 @@ files:
|
|
178
186
|
- test/fixtures/trip.json
|
179
187
|
- test/fixtures/trips.json
|
180
188
|
- test/fixtures/user.json
|
189
|
+
- test/fixtures/user_events.json
|
181
190
|
- test/fixtures/users.json
|
182
191
|
- test/fixtures/vaulted_items.json
|
183
192
|
- test/fixtures/visited_spots.json
|
@@ -201,6 +210,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
201
210
|
requirements:
|
202
211
|
- - ">="
|
203
212
|
- !ruby/object:Gem::Version
|
213
|
+
hash: 3
|
204
214
|
segments:
|
205
215
|
- 0
|
206
216
|
version: "0"
|
@@ -209,6 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
209
219
|
requirements:
|
210
220
|
- - ">="
|
211
221
|
- !ruby/object:Gem::Version
|
222
|
+
hash: 23
|
212
223
|
segments:
|
213
224
|
- 1
|
214
225
|
- 3
|
@@ -228,7 +239,6 @@ test_files:
|
|
228
239
|
- test/fixtures/category.json
|
229
240
|
- test/fixtures/challenges.json
|
230
241
|
- test/fixtures/checkin.json
|
231
|
-
- test/fixtures/events.json
|
232
242
|
- test/fixtures/find_spots.json
|
233
243
|
- test/fixtures/find_trips.json
|
234
244
|
- test/fixtures/flag.json
|
@@ -246,6 +256,7 @@ test_files:
|
|
246
256
|
- test/fixtures/pins.json
|
247
257
|
- test/fixtures/potential_twitter_friends.json
|
248
258
|
- test/fixtures/spot.json
|
259
|
+
- test/fixtures/spot_events.json
|
249
260
|
- test/fixtures/spots.json
|
250
261
|
- test/fixtures/spots_by_category.json
|
251
262
|
- test/fixtures/spots_urls.json
|
@@ -254,6 +265,7 @@ test_files:
|
|
254
265
|
- test/fixtures/trip.json
|
255
266
|
- test/fixtures/trips.json
|
256
267
|
- test/fixtures/user.json
|
268
|
+
- test/fixtures/user_events.json
|
257
269
|
- test/fixtures/users.json
|
258
270
|
- test/fixtures/vaulted_items.json
|
259
271
|
- test/fixtures/visited_spots.json
|