Class: Brightbox::Token
- Inherits:
-
Object
- Object
- Brightbox::Token
- Defined in:
- lib/brightbox-cli/token.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#options ⇒ Object
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
- #access_token ⇒ Object
- #format(output = :text) ⇒ Object
-
#initialize(config, options = {}) ⇒ Token
constructor
A new instance of Token.
- #refresh_token ⇒ Object
Constructor Details
#initialize(config, options = {}) ⇒ Token
Returns a new instance of Token.
11 12 13 14 |
# File 'lib/brightbox-cli/token.rb', line 11 def initialize(config, = {}) @config = config @options = end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
9 10 11 |
# File 'lib/brightbox-cli/token.rb', line 9 def config @config end |
#options ⇒ Object
Returns the value of attribute options.
9 10 11 |
# File 'lib/brightbox-cli/token.rb', line 9 def @options end |
Class Method Details
.show(config, options) ⇒ Object
5 6 7 |
# File 'lib/brightbox-cli/token.rb', line 5 def self.show(config, ) new(config, ) end |
Instance Method Details
#access_token ⇒ Object
16 17 18 |
# File 'lib/brightbox-cli/token.rb', line 16 def access_token config.access_token end |
#format(output = :text) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/brightbox-cli/token.rb', line 20 def format(output = :text) output = output.to_sym case output when :curl curl_output when :json json_output when :token token_output else text_output end end |
#refresh_token ⇒ Object
35 36 37 |
# File 'lib/brightbox-cli/token.rb', line 35 def refresh_token config.refresh_token end |