Class: Horoshop::Client
- Inherits:
-
Object
- Object
- Horoshop::Client
- Defined in:
- lib/horoshop.rb
Overview
Base class used to store data about authentication
Instance Attribute Summary collapse
-
#expiration_timestamp ⇒ Object
Returns the value of attribute expiration_timestamp.
-
#login ⇒ Object
Returns the value of attribute login.
-
#password ⇒ Object
Returns the value of attribute password.
-
#token ⇒ Object
Returns the value of attribute token.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(url:, login:, password:) ⇒ Client
constructor
A new instance of Client.
- #refresh_token! ⇒ Object
- #token_valid? ⇒ Boolean
Constructor Details
#initialize(url:, login:, password:) ⇒ Client
Returns a new instance of Client.
16 17 18 19 20 21 22 |
# File 'lib/horoshop.rb', line 16 def initialize(url:, login:, password:) @url = url @login = login @password = password @token = nil @expiration_timestamp = nil end |
Instance Attribute Details
#expiration_timestamp ⇒ Object
Returns the value of attribute expiration_timestamp.
11 12 13 |
# File 'lib/horoshop.rb', line 11 def @expiration_timestamp end |
#login ⇒ Object
Returns the value of attribute login.
11 12 13 |
# File 'lib/horoshop.rb', line 11 def login @login end |
#password ⇒ Object
Returns the value of attribute password.
11 12 13 |
# File 'lib/horoshop.rb', line 11 def password @password end |
#token ⇒ Object
Returns the value of attribute token.
11 12 13 |
# File 'lib/horoshop.rb', line 11 def token @token end |
#url ⇒ Object
Returns the value of attribute url.
11 12 13 |
# File 'lib/horoshop.rb', line 11 def url @url end |
Instance Method Details
#refresh_token! ⇒ Object
30 31 32 |
# File 'lib/horoshop.rb', line 30 def refresh_token! Horoshop::Authorization.new(self). end |
#token_valid? ⇒ Boolean
24 25 26 27 28 |
# File 'lib/horoshop.rb', line 24 def token_valid? return false if token.nil? < Time.now end |