From 0d9594dbded52719bdfd6b9e943fc4f19a403f98 Mon Sep 17 00:00:00 2001 From: Geostellar Developer Date: Wed, 20 Feb 2013 14:06:48 -0800 Subject: [PATCH 1/2] Convert expires_at to integer --- lib/oauth2/access_token.rb | 1 + spec/oauth2/access_token_spec.rb | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/lib/oauth2/access_token.rb b/lib/oauth2/access_token.rb index e320c8cd..38004797 100644 --- a/lib/oauth2/access_token.rb +++ b/lib/oauth2/access_token.rb @@ -44,6 +44,7 @@ def initialize(client, token, opts={}) end @expires_in ||= opts.delete('expires') @expires_in &&= @expires_in.to_i + @expires_at &&= @expires_at.to_i @expires_at ||= Time.now.to_i + @expires_in if @expires_in @options = {:mode => opts.delete(:mode) || :header, :header_format => opts.delete(:header_format) || 'Bearer %s', diff --git a/spec/oauth2/access_token_spec.rb b/spec/oauth2/access_token_spec.rb index aa80b823..637dc9a9 100644 --- a/spec/oauth2/access_token_spec.rb +++ b/spec/oauth2/access_token_spec.rb @@ -59,6 +59,13 @@ def assert_initialized_token(target) target.options[:header_format].should == 'Bearer %' target.options[:mode].should == :body end + + it "initializes with a string expires_at" do + hash = {:access_token => token, :expires_at => '1361396829', 'foo' => 'bar'} + target = AccessToken.from_hash(client, hash) + assert_initialized_token(target) + expect(target.expires_at).to be_a(Integer) + end end describe '#request' do From 9b5054c967a9f76e4fc59ddad93c135f3b1573ba Mon Sep 17 00:00:00 2001 From: Erik Michaels-Ober Date: Wed, 20 Feb 2013 15:35:55 -0800 Subject: [PATCH 2/2] Bump version to 0.8.1 --- lib/oauth2/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/oauth2/version.rb b/lib/oauth2/version.rb index ea921c7e..dc5ecd5e 100644 --- a/lib/oauth2/version.rb +++ b/lib/oauth2/version.rb @@ -2,7 +2,7 @@ module OAuth2 class Version MAJOR = 0 unless defined? MAJOR MINOR = 8 unless defined? MINOR - PATCH = 0 unless defined? PATCH + PATCH = 1 unless defined? PATCH PRE = nil unless defined? PRE class << self