Class: Morpheus::AccountGroupsInterface
- Inherits:
-
APIClient
- Object
- APIClient
- Morpheus::AccountGroupsInterface
- Defined in:
- lib/morpheus/api/account_groups_interface.rb
Instance Method Summary collapse
- #create(account_id, payload) ⇒ Object
- #destroy(account_id, id, params = {}) ⇒ Object
- #get(account_id, id, params = {}) ⇒ Object
-
#initialize(access_token, refresh_token, expires_at = nil, base_url = nil) ⇒ AccountGroupsInterface
constructor
A new instance of AccountGroupsInterface.
- #list(account_id, params = {}) ⇒ Object
- #update(account_id, id, payload) ⇒ Object
- #update_zones(account_id, id, payload) ⇒ Object
Constructor Details
#initialize(access_token, refresh_token, expires_at = nil, base_url = nil) ⇒ AccountGroupsInterface
Returns a new instance of AccountGroupsInterface.
4 5 6 7 8 9 |
# File 'lib/morpheus/api/account_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(account_id, payload) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/morpheus/api/account_groups_interface.rb', line 26 def create(account_id, payload) url = "#{@base_url}/api/accounts/#{account_id}/groups" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } opts = {method: :post, url: url, headers: headers, payload: payload.to_json} execute(opts) end |
#destroy(account_id, id, params = {}) ⇒ Object
40 41 42 43 44 45 |
# File 'lib/morpheus/api/account_groups_interface.rb', line 40 def destroy(account_id, id, params={}) url = "#{@base_url}/api/accounts/#{account_id}/groups/#{id}" headers = { :params => params, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } opts = {method: :delete, url: url, headers: headers} execute(opts) end |
#get(account_id, id, params = {}) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/morpheus/api/account_groups_interface.rb', line 11 def get(account_id, id, params={}) raise "#{self.class}.get() passed a blank id!" if id.to_s == '' url = "#{@base_url}/api/accounts/#{account_id}/groups/#{id}" headers = { params: params, authorization: "Bearer #{@access_token}" } opts = {method: :get, url: url, headers: headers} execute(opts) end |
#list(account_id, params = {}) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/morpheus/api/account_groups_interface.rb', line 19 def list(account_id, params={}) url = "#{@base_url}/api/accounts/#{account_id}/groups" headers = { params: params, authorization: "Bearer #{@access_token}" } opts = {method: :get, url: url, headers: headers} execute(opts) end |
#update(account_id, id, payload) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/morpheus/api/account_groups_interface.rb', line 33 def update(account_id, id, payload) url = "#{@base_url}/api/accounts/#{account_id}/groups/#{id}" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } opts = {method: :put, url: url, headers: headers, payload: payload.to_json} execute(opts) end |
#update_zones(account_id, id, payload) ⇒ Object
47 48 49 50 51 52 |
# File 'lib/morpheus/api/account_groups_interface.rb', line 47 def update_zones(account_id, id, payload) url = "#{@base_url}/api/accounts/#{account_id}/groups/#{id}/update-zones" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } opts = {method: :put, url: url, headers: headers, payload: payload.to_json} execute(opts) end |