gowalla 0.5.6 → 0.5.7

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -51,8 +51,20 @@ or if you need read-write access:
51
51
  You'll need a callback route to catch the code coming back from Gowalla after a user grants you access and this must match what you specified when you created your app on Gowalla:
52
52
 
53
53
  get '/auth/gowalla/callback' do
54
- session[:access_token] = client.web_server.get_access_token(params[:code], :redirect_uri => redirect_uri).token
55
-
54
+ access_token = client.web_server.get_access_token(
55
+ params[:code],
56
+ :redirect_uri => gowalla_callback_url
57
+ )
58
+
59
+ if access_token.expires_at < Time.now.utc
60
+ access_token = client.web_server.refresh_access_token(
61
+ session[:refresh_token]
62
+ )
63
+ end
64
+
65
+ session[:access_token] = access_token.token
66
+ session[:refresh_token] = access_token.refresh_token
67
+
56
68
  if session[:access_token]
57
69
  redirect '/auth/gowalla/test'
58
70
  else
@@ -1,4 +1,6 @@
1
1
  # Changelog
2
+ ## 0.5.7 June 19, 2011
3
+ * user events pagination and readme updates from [tylerhunt](https://github.com/tylerhunt) and [ctide](https://github.com/ctide)
2
4
  ## 0.5.6 April 24, 2011
3
5
  * update dependencies on faraday and middleware
4
6
  ## 0.5.5 January 27, 2011
@@ -41,9 +41,14 @@ module Gowalla
41
41
  # Retrieve a list of the user's most recent checkins.
42
42
  #
43
43
  # @param [String] user_id (authenticated basic auth user) User ID (screen name)
44
+ # @option options [Integer] :page Results page number
45
+ # @option options [Integer] :per_page Results page number
44
46
  # @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
+ def user_events(user_id=self.username, options={})
48
+ response = connection.get do |req|
49
+ req.url "/users/#{user_id}/events", options
50
+ end
51
+ response.body.activity
47
52
  end
48
53
 
49
54
  # Retrieve a list of items the user is carrying
@@ -1,3 +1,3 @@
1
1
  module Gowalla
2
- VERSION = '0.5.6'
2
+ VERSION = '0.5.7'
3
3
  end
@@ -52,6 +52,14 @@ class UsersTest < Test::Unit::TestCase
52
52
  user_events.first.spot.name.should == "Barktoberfest"
53
53
  end
54
54
 
55
+ should "retrieve a list of the user's most recent checkins with pagination" do
56
+ stub_get('https://pengwynn:0U812@api.gowalla.com/users/1707/events?page=2&per_page=50', 'user_events.json')
57
+ user_events = @client.user_events(1707, :page => 2, :per_page => 50)
58
+ user_events.size.should == 10
59
+ user_events.first.url.should == '/checkins/18863224'
60
+ user_events.first.spot.name.should == "Barktoberfest"
61
+ end
62
+
55
63
  should "retrieve a list of items the user is carrying" do
56
64
  stub_get('https://pengwynn:0U812@api.gowalla.com/users/sco/items?context=vault', 'items.json')
57
65
  items = @client.user_items('sco', 'vault')
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: gowalla
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.5.6
5
+ version: 0.5.7
6
6
  platform: ruby
7
7
  authors:
8
8
  - Wynn Netherland
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2011-04-24 00:00:00 -05:00
14
+ date: 2011-06-19 00:00:00 -05:00
15
15
  default_executable:
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
@@ -229,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
229
  requirements: []
230
230
 
231
231
  rubyforge_project:
232
- rubygems_version: 1.6.1
232
+ rubygems_version: 1.6.2
233
233
  signing_key:
234
234
  specification_version: 3
235
235
  summary: Wrapper for the Gowalla API