Class: Tvdbjson::Authentication
- Inherits:
-
Object
- Object
- Tvdbjson::Authentication
- Defined in:
- lib/tvdbjson/authentication.rb
Constant Summary collapse
- TVDB_API_KEY =
ENV['TVDB_API_KEY']
- TVDB_USER_KEY =
ENV['TVDB_USER_KEY']
- TVDB_USER_NAME =
ENV['TVDB_USER_NAME']
Instance Attribute Summary collapse
-
#expiry ⇒ Object
Returns the value of attribute expiry.
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
-
#initialize ⇒ Authentication
constructor
A new instance of Authentication.
- #new_token ⇒ Object
- #token_expired? ⇒ Boolean
Constructor Details
#initialize ⇒ Authentication
Returns a new instance of Authentication.
10 11 12 |
# File 'lib/tvdbjson/authentication.rb', line 10 def initialize() new_token end |
Instance Attribute Details
#expiry ⇒ Object
Returns the value of attribute expiry.
4 5 6 |
# File 'lib/tvdbjson/authentication.rb', line 4 def expiry @expiry end |
#token ⇒ Object
Returns the value of attribute token.
4 5 6 |
# File 'lib/tvdbjson/authentication.rb', line 4 def token @token end |
Instance Method Details
#new_token ⇒ Object
18 19 20 21 |
# File 'lib/tvdbjson/authentication.rb', line 18 def new_token @expiry = Time.now + 86400 @token = get_token end |
#token_expired? ⇒ Boolean
14 15 16 |
# File 'lib/tvdbjson/authentication.rb', line 14 def token_expired? Time.now >= @expiry end |