Class: ShopExpress::Client
- Inherits:
-
Object
- Object
- ShopExpress::Client
- Defined in:
- lib/shop_express.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.
17 18 19 20 21 22 23 |
# File 'lib/shop_express.rb', line 17 def initialize(url:, login:, password:) @url = url @login = login @password = password @token = nil = nil end |
Instance Attribute Details
#expiration_timestamp ⇒ Object
Returns the value of attribute expiration_timestamp.
12 13 14 |
# File 'lib/shop_express.rb', line 12 def end |
#login ⇒ Object
Returns the value of attribute login.
12 13 14 |
# File 'lib/shop_express.rb', line 12 def login @login end |
#password ⇒ Object
Returns the value of attribute password.
12 13 14 |
# File 'lib/shop_express.rb', line 12 def password @password end |
#token ⇒ Object
Returns the value of attribute token.
12 13 14 |
# File 'lib/shop_express.rb', line 12 def token @token end |
#url ⇒ Object
Returns the value of attribute url.
12 13 14 |
# File 'lib/shop_express.rb', line 12 def url @url end |
Instance Method Details
#refresh_token! ⇒ Object
31 32 33 |
# File 'lib/shop_express.rb', line 31 def refresh_token! ShopExpress::Authorization.new(self). end |
#token_valid? ⇒ Boolean
25 26 27 28 29 |
# File 'lib/shop_express.rb', line 25 def token_valid? return false if token.nil? > Time.now end |