Class: Apidone::Client::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/apidone-client/cli.rb

Instance Method Summary collapse

Instance Method Details

#create(resource) ⇒ Object



28
29
30
31
# File 'lib/apidone-client/cli.rb', line 28

def create(resource)
  connection(options[:domain])
  puts @c.create(resource, options[:data]).data
end

#delete(resource) ⇒ Object



48
49
50
51
# File 'lib/apidone-client/cli.rb', line 48

def delete(resource)
  connection(options[:domain])
  puts @c.update(resource, options[:id])
end

#infoObject



20
21
22
# File 'lib/apidone-client/cli.rb', line 20

def info
  say "Version #{::Apidone::Client::VERSION}"
end

#list(resource) ⇒ Object



56
57
58
59
60
61
# File 'lib/apidone-client/cli.rb', line 56

def list(resource)
  connection(options[:domain])
  @c.list(resource).each do |res|
    puts res.data
  end
end

#show(resource) ⇒ Object



67
68
69
70
# File 'lib/apidone-client/cli.rb', line 67

def show(resource)
  connection(options[:domain])
  puts @c.show(resource, options[:id]).data
end

#update(resource) ⇒ Object



38
39
40
41
# File 'lib/apidone-client/cli.rb', line 38

def update(resource)
  connection(options[:domain])
  puts @c.update(resource, options[:id], options[:data]).data
end