Class: Relish::Command::Projects
- Inherits:
-
Base
- Object
- Base
- Relish::Command::Projects
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
Instance Method Details
#add ⇒ Object
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
|
#default ⇒ Object
8
|
# File 'lib/relish/commands/projects.rb', line 8
def default; list end
|
#list ⇒ Object
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
|
#remove ⇒ Object
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
|