Class: ZedDB::CLI::Items

Inherits:
Zedkit::CLI::Bottom
  • Object
show all
Defined in:
lib/cli/model_items.rb

Class Method Summary collapse

Class Method Details

.create(opts = {}) ⇒ Object



26
27
28
29
30
31
# File 'lib/cli/model_items.rb', line 26

def create(opts = {})
  opts[:items]['name'] = opts[:argv][1]
  puts ZedDB::ModelItem.new(:user_key => opts[:user_key], :locale => opts[:locale]).replace \
       ZedDB::ModelItems.create(:user_key => opts[:user_key], :locale => opts[:locale],
                                :model => { :uuid => opts[:argv][0] }, :item => opts[:items])
end

.delete(opts = {}) ⇒ Object



39
40
41
42
43
# File 'lib/cli/model_items.rb', line 39

def delete(opts = {})
  mi = ZedDB::ModelItem.new(:user_key => opts[:user_key], :locale => opts[:locale], :uuid => opts[:argv][0])
  mi.delete
  puts "\nDONE.\nZedDB Model Data Item Removed [#{mi['name']}].\n\n"
end

.show(opts = {}) ⇒ Object



22
23
24
# File 'lib/cli/model_items.rb', line 22

def show(opts = {})
  puts ZedDB::ModelItem.new(:user_key => opts[:user_key], :locale => opts[:locale], :uuid => opts[:argv][0])
end

.update(opts = {}) ⇒ Object



33
34
35
36
37
# File 'lib/cli/model_items.rb', line 33

def update(opts = {})
  puts ZedDB::ModelItem.new(:user_key => opts[:user_key], :locale => opts[:locale]).replace \
       ZedDB::ModelItems.update(:user_key => opts[:user_key],
                                :locale => opts[:locale], :uuid => opts[:argv][0], :item => opts[:items])
end