Class: MythicBeasts::Auth
- Inherits:
-
Object
- Object
- MythicBeasts::Auth
- Defined in:
- lib/mythic_beasts/auth.rb
Constant Summary collapse
- AUTH_URL =
"https://auth.mythic-beasts.com/login"
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#api_secret ⇒ Object
readonly
Returns the value of attribute api_secret.
Instance Method Summary collapse
-
#initialize(api_key:, api_secret:) ⇒ Auth
constructor
A new instance of Auth.
- #token ⇒ Object
Constructor Details
#initialize(api_key:, api_secret:) ⇒ Auth
Returns a new instance of Auth.
7 8 9 10 11 12 |
# File 'lib/mythic_beasts/auth.rb', line 7 def initialize(api_key:, api_secret:) @api_key = api_key @api_secret = api_secret @token = nil @token_expires_at = nil end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
5 6 7 |
# File 'lib/mythic_beasts/auth.rb', line 5 def api_key @api_key end |
#api_secret ⇒ Object (readonly)
Returns the value of attribute api_secret.
5 6 7 |
# File 'lib/mythic_beasts/auth.rb', line 5 def api_secret @api_secret end |
Instance Method Details
#token ⇒ Object
14 15 16 17 18 19 |
# File 'lib/mythic_beasts/auth.rb', line 14 def token return @token if @token && !token_expired? fetch_token @token end |