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



181
182
183
184
185
# File 'lib/norikra/client/cli.rb', line 181

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

#list(target) ⇒ Object



169
170
171
172
173
174
175
176
177
178
# File 'lib/norikra/client/cli.rb', line 169

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