Class: Morpheus::DeploymentsInterface
- Inherits:
-
APIClient
- Object
- APIClient
- Morpheus::DeploymentsInterface
- Defined in:
- lib/morpheus/api/deployments_interface.rb
Instance Method Summary collapse
- #create(options) ⇒ Object
- #destroy(id) ⇒ Object
- #get(options = nil) ⇒ Object
- #get_version(deployment_id, version_id) ⇒ Object
-
#initialize(access_token, refresh_token, expires_at = nil, base_url = nil) ⇒ DeploymentsInterface
constructor
A new instance of DeploymentsInterface.
- #list_versions(deployment_id, options = nil) ⇒ Object
- #update(id, options) ⇒ Object
Constructor Details
#initialize(access_token, refresh_token, expires_at = nil, base_url = nil) ⇒ DeploymentsInterface
Returns a new instance of DeploymentsInterface.
4 5 6 7 8 9 |
# File 'lib/morpheus/api/deployments_interface.rb', line 4 def initialize(access_token, refresh_token,expires_at = nil, base_url=nil) @access_token = access_token @refresh_token = refresh_token @base_url = base_url @expires_at = expires_at end |
Instance Method Details
#create(options) ⇒ Object
45 46 47 48 49 50 |
# File 'lib/morpheus/api/deployments_interface.rb', line 45 def create() url = "#{@base_url}/api/deployments" 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
59 60 61 62 63 |
# File 'lib/morpheus/api/deployments_interface.rb', line 59 def destroy(id) url = "#{@base_url}/api/deployments/#{id}" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } execute(method: :delete, url: url, headers: headers) end |
#get(options = nil) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/morpheus/api/deployments_interface.rb', line 11 def get(=nil) url = "#{@base_url}/api/deployments" headers = { params: {}, authorization: "Bearer #{@access_token}" } if .is_a?(Hash) headers[:params].merge!() elsif .is_a?(Numeric) url = "#{@base_url}/api/deployments/#{}" elsif .is_a?(String) headers[:params]['name'] = end execute(method: :get, url: url, headers: headers) end |
#get_version(deployment_id, version_id) ⇒ Object
38 39 40 41 42 |
# File 'lib/morpheus/api/deployments_interface.rb', line 38 def get_version(deployment_id,version_id) url = "#{@base_url}/api/deployments/#{deployment_id}/versions/#{version_id}" headers = { params: {}, authorization: "Bearer #{@access_token}" } execute(method: :get, url: url, headers: headers) end |
#list_versions(deployment_id, options = nil) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/morpheus/api/deployments_interface.rb', line 24 def list_versions(deployment_id,=nil) url = "#{@base_url}/api/deployments/#{deployment_id}/versions" headers = { params: {}, authorization: "Bearer #{@access_token}" } if .is_a?(Hash) headers[:params].merge!() elsif .is_a?(Numeric) url = "#{@base_url}/api/deployments/#{deployment_id}/versions/#{}" elsif .is_a?(String) headers[:params]['name'] = end execute(method: :get, url: url, headers: headers) end |
#update(id, options) ⇒ Object
52 53 54 55 56 57 |
# File 'lib/morpheus/api/deployments_interface.rb', line 52 def update(id, ) url = "#{@base_url}/api/deployments/#{id}" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } payload = execute(method: :put, url: url, headers: headers, payload: payload.to_json) end |