Class: Norikra::Client::Field

Inherits:
Thor
  • Object
show all
Includes:
CLIUtil
Defined in:
lib/norikra/client/cli.rb

Instance Method Summary collapse

Methods included from CLIUtil

#client, #formatter, #parser

Instance Method Details

#add(target, field, type) ⇒ Object



87
88
89
# File 'lib/norikra/client/cli.rb', line 87

def add(target, field, type)
  client(parent_options).reserve(target, field, type)
end

#list(target) ⇒ Object



77
78
79
80
81
82
83
84
# File 'lib/norikra/client/cli.rb', line 77

def list(target)
  puts "FIELD\tTYPE\tOPTIONAL" unless options[:simple]
  fields = client(parent_options).fields(target)
  fields.each do |f|
    puts "#{f['name']}\t#{f['type']}\t#{f['optional']}"
  end
  puts "#{fields.size} fields found." unless options[:simple]
end