Class: Zencoder::CLI::Command::Account

Inherits:
Base
  • Object
show all
Defined in:
lib/zencoder-cli/commands/account.rb

Class Method Summary collapse

Methods inherited from Base

extract_id, provides

Methods included from Helpers

#ask, #confirm, #display, #error, #format_date, #home_directory, #running_on_a_mac?, #running_on_windows?, #truncate

Class Method Details

.integration(args, global_options, command_options) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/zencoder-cli/commands/account.rb', line 21

def integration(args, global_options, command_options)
  response = Zencoder::Account.integration(:base_url => Zencoder.base_url(global_options[:environment]))
  if response.success?
    puts "Your account is now in integration mode."
  else
    puts "There was an unexpected problem."
  end
end

.live(args, global_options, command_options) ⇒ Object



30
31
32
33
34
35
36
37
# File 'lib/zencoder-cli/commands/account.rb', line 30

def live(args, global_options, command_options)
  response = Zencoder::Account.live(:base_url => Zencoder.base_url(global_options[:environment]))
  if response.success?
    puts "Your account is now able to process live jobs."
  else
    puts "You cannot turn off integration mode for this account."
  end
end

.run(args, global_options, command_options) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/zencoder-cli/commands/account.rb', line 9

def run(args, global_options, command_options)
   = Zencoder::Account.details(:base_url => Zencoder.base_url(global_options[:environment])).body
  rows = []
  rows << ["Minutes Used", ["minutes_used"]]
  rows << ["Minutes Included", ["minutes_included"]]
  rows << ["Account State", ["account_state"].titleize]
  rows << ["Billing State", ["billing_state"].titleize]
  rows << ["Plan", ["plan"]]
  rows << ["Integration Mode", ["integration_mode"] ? "YES" : "NO"]
  puts table([{ :value => "Account", :colspan => 2 }], *rows)
end