Class: Morpheus::GroupsInterface
- Inherits:
-
APIClient
- Object
- APIClient
- Morpheus::GroupsInterface
- Defined in:
- lib/morpheus/api/groups_interface.rb
Instance Method Summary collapse
- #create(options) ⇒ Object
- #destroy(id) ⇒ Object
- #get(options = nil, params = {}) ⇒ Object
- #list(params = {}) ⇒ Object
- #update(id, options) ⇒ Object
- #update_wiki(id, payload) ⇒ Object
- #update_zones(id, options) ⇒ Object
- #wiki(id, params) ⇒ Object
Instance Method Details
#create(options) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/morpheus/api/groups_interface.rb', line 28 def create() url = "#{@base_url}/api/groups" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } payload = opts = {method: :post, url: url, headers: headers, payload: payload.to_json} execute(opts) end |
#destroy(id) ⇒ Object
44 45 46 47 48 49 |
# File 'lib/morpheus/api/groups_interface.rb', line 44 def destroy(id) url = "#{@base_url}/api/groups/#{id}" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } opts = {method: :delete, url: url, headers: headers} execute(opts) end |
#get(options = nil, params = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/morpheus/api/groups_interface.rb', line 12 def get(=nil, params={}) url = "#{@base_url}/api/groups" headers = { params: {}, authorization: "Bearer #{@access_token}" } if .is_a?(Hash) headers[:params].merge!() elsif .is_a?(Numeric) url = "#{@base_url}/api/groups/#{}" headers[:params] = params elsif .is_a?(String) headers[:params]['name'] = end opts = {method: :get, url: url, headers: headers} execute(opts) end |
#list(params = {}) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/morpheus/api/groups_interface.rb', line 5 def list(params={}) url = "#{@base_url}/api/groups" headers = { params: params, authorization: "Bearer #{@access_token}" } opts = {method: :get, url: url, headers: headers} execute(opts) end |
#update(id, options) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/morpheus/api/groups_interface.rb', line 36 def update(id, ) url = "#{@base_url}/api/groups/#{id}" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } payload = opts = {method: :put, url: url, headers: headers, payload: payload.to_json} execute(opts) end |
#update_wiki(id, payload) ⇒ Object
66 67 68 69 70 71 |
# File 'lib/morpheus/api/groups_interface.rb', line 66 def update_wiki(id, payload) url = "#{@base_url}/api/groups/#{id}/wiki" 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(id, options) ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/morpheus/api/groups_interface.rb', line 51 def update_zones(id, ) url = "#{@base_url}/api/groups/#{id}/update-zones" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } payload = opts = {method: :put, url: url, headers: headers, payload: payload.to_json} execute(opts) end |
#wiki(id, params) ⇒ Object
59 60 61 62 63 64 |
# File 'lib/morpheus/api/groups_interface.rb', line 59 def wiki(id, params) url = "#{@base_url}/api/groups/#{id}/wiki" headers = { params: params, authorization: "Bearer #{@access_token}" } opts = {method: :get, url: url, headers: headers} execute(opts) end |