Class: CollinsShell::AssetType
- Inherits:
-
Thor
- Object
- Thor
- CollinsShell::AssetType
show all
- Includes:
- ThorHelper, Util
- Defined in:
- lib/collins_shell/asset_type.rb
Constant Summary
Constants included
from Util
Util::SIZABLE_ATTRIBUTES
Constants included
from ThorHelper
ThorHelper::COLLINS_OPTIONS, ThorHelper::PAGE_OPTIONS
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Util
#asset_exec, #asset_get, #call_collins, #finalize_exec, #format_asset_tags, #format_asset_value, #get_selector, #is_array?, #print_find_results, #run_command_in_thread, #say_status, #thread_mgr
Methods included from ThorHelper
#appropriate_answer?, #batch_selector_operation, #collins_config_from_file, #ensure_password, #get_collins_client, #get_collins_config, #get_password, included, #require_valid_collins_config, #require_yes, #say_error, #say_success, #selector_or_tag, #try_config_merge, #use_collins_options, #use_nuke_option, #use_page_options, #use_selector_option, #use_tag_option
Class Method Details
.banner(task, namespace = true, subcommand = false) ⇒ Object
13
14
15
|
# File 'lib/collins_shell/asset_type.rb', line 13
def self.banner task, namespace = true, subcommand = false
"#{basename} #{task.formatted_usage(self, true, subcommand).gsub(':',' ')}"
end
|
Instance Method Details
#create ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/collins_shell/asset_type.rb', line 21
def create
name = options.name.upcase
label = options.label
call_collins get_collins_client, "asset_type_create!" do |client|
if client.asset_type_create!(name, label) then
say_success "Successfully created asset type '#{name}'"
else
say_error "Failed creating asset type '#{name}'"
end
end
end
|
#delete(atype) ⇒ Object
35
36
37
38
39
40
41
42
43
|
# File 'lib/collins_shell/asset_type.rb', line 35
def delete atype
call_collins get_collins_client, "asset_type_delete!" do |client|
if client.asset_type_delete!(atype) then
say_success "Successfully deleted asset type '#{atype}'"
else
say_error "Failed deleting asset type '#{atype}'"
end
end
end
|
#get(atype) ⇒ Object
47
48
49
50
51
52
53
54
|
# File 'lib/collins_shell/asset_type.rb', line 47
def get atype
call_collins get_collins_client, "asset_type_get" do |client|
= [["Name", "Label"]]
atype = client.asset_type_get(atype)
table = + [[atype.name, atype.label]]
print_table table
end
end
|
#list ⇒ Object
58
59
60
61
62
63
64
65
66
|
# File 'lib/collins_shell/asset_type.rb', line 58
def list
call_collins get_collins_client, "asset_type_get_all" do |client|
= [["Name", "Label"]]
atypes = + client.asset_type_get_all.map do |atype|
[atype.name, atype.label]
end
print_table atypes
end
end
|
#update(atype) ⇒ Object
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/collins_shell/asset_type.rb', line 72
def update atype
name = options.name.upcase if options.name?
label = options.label if options.label?
call_collins get_collins_client, "asset_type_update!" do |client|
opts = { :name => name, :label => label }
if client.asset_type_update!(atype, opts) then
say_success "Successfully updated asset type '#{atype}'"
else
say_error "Failed creating asset type '#{atype}'"
end
end
end
|