Class: BambooId::ApiKeyFetcher
- Inherits:
-
Object
- Object
- BambooId::ApiKeyFetcher
- Defined in:
- lib/bamboo_id/api_key_fetcher.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
Instance Method Summary collapse
- #fetch ⇒ Object
-
#initialize(code:, subdomain:) ⇒ ApiKeyFetcher
constructor
A new instance of ApiKeyFetcher.
Constructor Details
#initialize(code:, subdomain:) ⇒ ApiKeyFetcher
Returns a new instance of ApiKeyFetcher.
5 6 7 8 9 |
# File 'lib/bamboo_id/api_key_fetcher.rb', line 5 def initialize(code:, subdomain:) self.code = code self.subdomain = subdomain self.error = nil end |
Instance Attribute Details
#error ⇒ Object
Returns the value of attribute error.
3 4 5 |
# File 'lib/bamboo_id/api_key_fetcher.rb', line 3 def error @error end |
Instance Method Details
#fetch ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/bamboo_id/api_key_fetcher.rb', line 11 def fetch unless access_token_request.successful? self.error = "Could not get access token: #{access_token_request.error}" return false end unless api_key_request.successful? self.error = "Could not get API key." return false end api_key_request.key end |