Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0d9594d

Browse files
Geostellar Developersferik
Geostellar Developer
authored andcommitted
Convert expires_at to integer
1 parent 19540a7 commit 0d9594d

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

‎lib/oauth2/access_token.rb‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def initialize(client, token, opts={})
4444
end
4545
@expires_in ||= opts.delete('expires')
4646
@expires_in &&= @expires_in.to_i
47+
@expires_at &&= @expires_at.to_i
4748
@expires_at ||= Time.now.to_i + @expires_in if @expires_in
4849
@options = {:mode => opts.delete(:mode) || :header,
4950
:header_format => opts.delete(:header_format) || 'Bearer %s',

‎spec/oauth2/access_token_spec.rb‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ def assert_initialized_token(target)
5959
target.options[:header_format].should == 'Bearer %'
6060
target.options[:mode].should == :body
6161
end
62+
63+
it "initializes with a string expires_at" do
64+
hash = {:access_token => token, :expires_at => '1361396829', 'foo' => 'bar'}
65+
target = AccessToken.from_hash(client, hash)
66+
assert_initialized_token(target)
67+
expect(target.expires_at).to be_a(Integer)
68+
end
6269
end
6370

6471
describe '#request' do

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /