Class: Morpheus::TaskSetsInterface
- Inherits:
-
APIClient
- Object
- APIClient
- Morpheus::TaskSetsInterface
- Defined in:
- lib/morpheus/api/task_sets_interface.rb
Instance Method Summary collapse
- #create(options) ⇒ Object
- #destroy(id) ⇒ Object
- #get(options = nil) ⇒ Object
- #list(params = {}) ⇒ Object
- #run(id, options) ⇒ Object
- #update(id, options) ⇒ Object
Instance Method Details
#create(options) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/morpheus/api/task_sets_interface.rb', line 25 def create() url = "#{@base_url}/api/task-sets" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } payload = execute(method: :post, url: url, headers: headers, payload: payload.to_json) end |
#destroy(id) ⇒ Object
39 40 41 42 43 |
# File 'lib/morpheus/api/task_sets_interface.rb', line 39 def destroy(id) url = "#{@base_url}/api/task-sets/#{id}" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } execute(method: :delete, url: url, headers: headers) end |
#get(options = nil) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/morpheus/api/task_sets_interface.rb', line 12 def get(=nil) url = "#{@base_url}/api/task-sets" headers = { params: {}, authorization: "Bearer #{@access_token}" } if .is_a?(Hash) headers[:params].merge!() elsif .is_a?(Numeric) url = "#{@base_url}/api/task-sets/#{}" elsif .is_a?(String) headers[:params]['name'] = end execute(method: :get, url: url, headers: headers) end |
#list(params = {}) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/morpheus/api/task_sets_interface.rb', line 5 def list(params={}) url = "#{@base_url}/api/task-sets" headers = { params: params, authorization: "Bearer #{@access_token}" } opts = {method: :get, url: url, headers: headers} execute(opts) end |
#run(id, options) ⇒ Object
45 46 47 48 49 50 |
# File 'lib/morpheus/api/task_sets_interface.rb', line 45 def run(id, ) url = "#{@base_url}/api/task-sets/#{id}/execute" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } payload = execute(method: :post, url: url, headers: headers, payload: payload.to_json) end |
#update(id, options) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/morpheus/api/task_sets_interface.rb', line 32 def update(id, ) url = "#{@base_url}/api/task-sets/#{id}" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } payload = execute(method: :put, url: url, headers: headers, payload: payload.to_json) end |