Class: Morpheus::SecurityGroupsInterface
- Inherits:
-
APIClient
- Object
- APIClient
- Morpheus::SecurityGroupsInterface
- Defined in:
- lib/morpheus/api/security_groups_interface.rb
Instance Method Summary collapse
- #create(options) ⇒ Object
- #delete(id) ⇒ Object
- #get(options) ⇒ Object
-
#initialize(access_token, refresh_token, expires_at = nil, base_url = nil) ⇒ SecurityGroupsInterface
constructor
A new instance of SecurityGroupsInterface.
- #list(options = nil) ⇒ Object
- #update(id) ⇒ Object
Constructor Details
#initialize(access_token, refresh_token, expires_at = nil, base_url = nil) ⇒ SecurityGroupsInterface
Returns a new instance of SecurityGroupsInterface.
4 5 6 7 8 9 |
# File 'lib/morpheus/api/security_groups_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
29 30 31 32 33 34 |
# File 'lib/morpheus/api/security_groups_interface.rb', line 29 def create() url = "#{@base_url}/api/security-groups" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } payload = execute(method: :post, url: url, headers: headers, payload: payload.to_json) end |
#delete(id) ⇒ Object
42 43 44 45 46 |
# File 'lib/morpheus/api/security_groups_interface.rb', line 42 def delete(id) url = "#{@base_url}/api/security-groups/#{id}" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } execute(method: :delete, url: url, headers: headers) end |
#get(options) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/morpheus/api/security_groups_interface.rb', line 20 def get() url = "#{@base_url}/api/security-groups/#{[:id]}" headers = { params: {}, authorization: "Bearer #{@access_token}" } if .is_a?(Hash) headers[:params].merge!() end execute(method: :get, url: url, headers: headers) end |
#list(options = nil) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/morpheus/api/security_groups_interface.rb', line 11 def list(=nil) url = "#{@base_url}/api/security-groups" headers = { params: {}, authorization: "Bearer #{@access_token}" } if .is_a?(Hash) headers[:params].merge!() end execute(method: :get, url: url, headers: headers) end |
#update(id) ⇒ Object
36 37 38 39 40 |
# File 'lib/morpheus/api/security_groups_interface.rb', line 36 def update(id) url = "#{@base_url}/api/security-groups/#{id}" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } execute(method: :put, url: url, headers: headers) end |