class Puddle::Resources::ShowAccount

Attributes

adapter[R]
options[R]

Public Class Methods

new(http_adapter, options = {}) click to toggle source
# File lib/puddle/resources/show_account.rb, line 6
def initialize(http_adapter, options = {})
  @adapter = http_adapter
  @options = options
end

Public Instance Methods

cli_format(results) click to toggle source
# 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() click to toggle source
# File lib/puddle/resources/show_account.rb, line 11
def execute
  results = adapter.api(:get, 'account', options)
  return results if options['format'] == 'json'

  cli_format(results)
end