Class: Appetize::Commands::Delete
- Inherits:
-
Appetize::Command
- Object
- Appetize::Command
- Appetize::Commands::Delete
- Defined in:
- lib/appetize/commands/delete.rb
Instance Method Summary collapse
- #execute(input: $stdin, output: $stdout) ⇒ Object
-
#initialize(public_key, token = nil, api_host = nil, options = {}) ⇒ Delete
constructor
A new instance of Delete.
Methods inherited from Appetize::Command
#command, #cursor, #editor, #exec_exist?, #generator, #pager, #platform, #prompt, #screen, #which
Constructor Details
#initialize(public_key, token = nil, api_host = nil, options = {}) ⇒ Delete
Returns a new instance of Delete.
9 10 11 12 13 |
# File 'lib/appetize/commands/delete.rb', line 9 def initialize(public_key, token = nil, api_host = nil, = {}) @api = Appetize::API.new(token, api_host) @public_key = public_key @options = end |
Instance Method Details
#execute(input: $stdin, output: $stdout) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/appetize/commands/delete.rb', line 15 def execute(input: $stdin, output: $stdout) response = @api.delete(@public_key) raise "Delete failed: #{response.code}" unless response.code == 200 output.puts response.body end |