Class: Puddle::Resources::ShowAccount
- Inherits:
-
Object
- Object
- Puddle::Resources::ShowAccount
- Defined in:
- lib/puddle/resources/show_account.rb
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #cli_format(results) ⇒ Object
- #execute ⇒ Object
-
#initialize(http_adapter, options = {}) ⇒ ShowAccount
constructor
A new instance of ShowAccount.
Constructor Details
#initialize(http_adapter, options = {}) ⇒ ShowAccount
Returns a new instance of ShowAccount.
6 7 8 9 |
# File 'lib/puddle/resources/show_account.rb', line 6 def initialize(http_adapter, = {}) @adapter = http_adapter @options = end |
Instance Attribute Details
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
4 5 6 |
# File 'lib/puddle/resources/show_account.rb', line 4 def adapter @adapter end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/puddle/resources/show_account.rb', line 4 def @options end |
Instance Method Details
#cli_format(results) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/puddle/resources/show_account.rb', line 18 def cli_format(results) results = results['account'] data = '' data << sprintf("droplet limit: %-s\n", results['droplet_limit']) data << sprintf("email: %-s\n", results['email']) data << sprintf("uuid: %-s\n", results['uuid']) data << sprintf("email verified: %-s\n", results['email_verified']) data end |
#execute ⇒ Object
11 12 13 14 15 16 |
# File 'lib/puddle/resources/show_account.rb', line 11 def execute results = adapter.api(:get, 'account', ) return results if ['format'] == 'json' cli_format(results) end |