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, #wrap

Instance Method Details

#add(target, field, type) ⇒ Object



128
129
130
131
132
# File 'lib/norikra/client/cli.rb', line 128

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

#list(target) ⇒ Object



116
117
118
119
120
121
122
123
124
125
# File 'lib/norikra/client/cli.rb', line 116

def list(target)
  wrap do
    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
end