class CollinsShell::AssetType
Public Class Methods
Public Instance Methods
create()
click to toggle source
# 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)
click to toggle source
# 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)
click to toggle source
# File lib/collins_shell/asset_type.rb, line 47 def get atype call_collins get_collins_client, "asset_type_get" do |client| header = [["Name", "Label"]] atype = client.asset_type_get(atype) table = header + [[atype.name, atype.label]] print_table table end end
list()
click to toggle source
# File lib/collins_shell/asset_type.rb, line 58 def list call_collins get_collins_client, "asset_type_get_all" do |client| header = [["Name", "Label"]] atypes = header + client.asset_type_get_all.map do |atype| [atype.name, atype.label] end print_table atypes end end
update(atype)
click to toggle source
# 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