Class: Apidone::Client::CLI
- Inherits:
-
Thor
- Object
- Thor
- Apidone::Client::CLI
- Includes:
- Thor::Actions
- Defined in:
- lib/apidone-client/cli.rb
Instance Method Summary collapse
- #create(resource) ⇒ Object
- #delete(resource) ⇒ Object
- #info ⇒ Object
- #list(resource) ⇒ Object
- #show(resource) ⇒ Object
- #update(resource) ⇒ Object
Instance Method Details
#create(resource) ⇒ Object
28 29 30 31 |
# File 'lib/apidone-client/cli.rb', line 28 def create(resource) connection([:domain]) puts @c.create(resource, [:data]).data end |
#delete(resource) ⇒ Object
48 49 50 51 |
# File 'lib/apidone-client/cli.rb', line 48 def delete(resource) connection([:domain]) puts @c.update(resource, [:id]) end |
#info ⇒ Object
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([: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([:domain]) puts @c.show(resource, [:id]).data end |
#update(resource) ⇒ Object
38 39 40 41 |
# File 'lib/apidone-client/cli.rb', line 38 def update(resource) connection([:domain]) puts @c.update(resource, [:id], [:data]).data end |