Class: ScalrApiV2::Script

Inherits:
Thor
  • Object
show all
Defined in:
lib/scalr_api_v2/cli.rb

Overview

define CLI class that extends Thor

Instance Method Summary collapse

Instance Method Details

#createObject



21
22
23
# File 'lib/scalr_api_v2/cli.rb', line 21

def create
  puts JSON.generate(ScalrApiV2::Scripts.new.create(options[:script_object]))
end

#create_versionObject



28
29
30
# File 'lib/scalr_api_v2/cli.rb', line 28

def create_version
  puts JSON.generate(ScalrApiV2::Scripts.new.create_version(options[:script_id], options[:script_object]))
end

#executeObject



44
45
46
47
48
49
50
# File 'lib/scalr_api_v2/cli.rb', line 44

def execute
  if options[script_version].nil?
    puts JSON.generate(ScalrApiV2::Scripts.new.execute(options[:script_id], options[:script_execution_object]))
  else
    puts JSON.generate(ScalrApiV2::Scripts.new.execute_version(options[:script_id], options[:script_version], ooptions[:script_execution_object]))
  end
end

#listObject



9
10
11
# File 'lib/scalr_api_v2/cli.rb', line 9

def list
  puts JSON.generate(ScalrApiV2::Scripts.new.list)
end

#updateObject



36
37
38
# File 'lib/scalr_api_v2/cli.rb', line 36

def update
  puts JSON.generate(ScalrApiV2::Scripts.new.update_version(options[:script_id], options[:script_version], options[:script_object]))
end

#versionsObject



15
16
17
# File 'lib/scalr_api_v2/cli.rb', line 15

def versions
  puts JSON.generate(ScalrApiV2::Scripts.new.versions(options[:script_id]))
end