Class: WeixinAuthorize::Token::ObjectStore

Inherits:
Store
  • Object
show all
Defined in:
lib/weixin_authorize/token/object_store.rb

Instance Attribute Summary

Attributes inherited from Store

#client

Instance Method Summary collapse

Methods inherited from Store

#authenticate, #authenticate_headers, #http_get_access_token, init_with, #initialize, #set_access_token

Constructor Details

This class inherits a constructor from WeixinAuthorize::Token::Store

Instance Method Details

#access_tokenObject



19
20
21
22
# File 'lib/weixin_authorize/token/object_store.rb', line 19

def access_token
  super
  client.access_token
end

#refresh_tokenObject



15
16
17
# File 'lib/weixin_authorize/token/object_store.rb', line 15

def refresh_token
  super
end

#token_expired?Boolean

Returns:

  • (Boolean)


10
11
12
13
# File 'lib/weixin_authorize/token/object_store.rb', line 10

def token_expired?
  # 如果当前token过期时间小于现在的时间,则重新获取一次
  client.expired_at <= Time.now.to_i
end

#valid?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/weixin_authorize/token/object_store.rb', line 6

def valid?
  super
end