Class: Relish::Command::Projects
- Defined in:
- lib/relish/commands/projects.rb
Constant Summary
Constants inherited from Base
Base::DEFAULT_HOST, Base::GLOBAL_OPTIONS_FILE, Base::LOCAL_OPTIONS_FILE
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#api_token, #get_options, #get_param, #initialize, #organization, #parsed_options_file, #project, #resource, #url
Constructor Details
This class inherits a constructor from Relish::Command::Base
Instance Method Details
#default ⇒ Object
8 9 10 |
# File 'lib/relish/commands/projects.rb', line 8 def default list end |
#format(response) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/relish/commands/projects.rb', line 22 def format(response) json = JSON.parse(response) json.map do |hash| result = hash['project']['handle'] result << " (private)" if hash['project']['private'] result end.join("\n") end |
#list ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/relish/commands/projects.rb', line 12 def list response = resource['projects'].get( :params => {:api_token => api_token}, :accept => :json ) puts format(response) rescue RestClient::Exception => exception warn exception.response exit 1 end |