Class: Relish::Command::Projects

Inherits:
Base
  • Object
show all
Defined in:
lib/relish/commands/projects.rb

Instance Attribute Summary

Attributes inherited from Base

#args, #cli_options

Instance Method Summary collapse

Methods inherited from Base

#get_param, #initialize, #url

Methods included from Dsl

#option, #option_names, #option_names_to_display

Constructor Details

This class inherits a constructor from Relish::Command::Base

Instance Method Details

#addObject



20
21
22
23
24
25
# File 'lib/relish/commands/projects.rb', line 20

def add
  puts resource['projects'].post(:api_token => api_token, :handle => @param)
rescue RestClient::Exception => exception
  warn exception.response
  exit 1
end

#defaultObject



8
# File 'lib/relish/commands/projects.rb', line 8

def default; list end

#listObject



10
11
12
13
14
15
16
17
18
# File 'lib/relish/commands/projects.rb', line 10

def list
  response = resource['projects'].get(
    :params => {:api_token => api_token}, :accept => :json
  )
  puts format(response)
rescue RestClient::Exception => exception
  warn exception.response
  exit exception.http_code
end

#removeObject



27
28
29
30
31
32
# File 'lib/relish/commands/projects.rb', line 27

def remove
  puts resource["projects/#{@param}?api_token=#{api_token}"].delete
rescue RestClient::Exception => exception
  warn exception.response
  exit 1
end