Class: WeixinAuthorize::ClientStorage

Inherits:
Storage
  • Object
show all
Defined in:
lib/weixin_authorize/adapter/client_storage.rb

Instance Attribute Summary

Attributes inherited from Storage

#client

Instance Method Summary collapse

Methods inherited from Storage

#authenticate_headers, #http_get_access_token, init_with, #initialize, #set_access_token_for_client

Constructor Details

This class inherits a constructor from WeixinAuthorize::Storage

Instance Method Details

#access_tokenObject



18
19
20
21
# File 'lib/weixin_authorize/adapter/client_storage.rb', line 18

def access_token
  super
  client.access_token
end

#authenticateObject



14
15
16
# File 'lib/weixin_authorize/adapter/client_storage.rb', line 14

def authenticate
  super
end

#token_expired?Boolean

Returns:

  • (Boolean)


9
10
11
12
# File 'lib/weixin_authorize/adapter/client_storage.rb', line 9

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

#valid?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/weixin_authorize/adapter/client_storage.rb', line 5

def valid?
  super
end