class Morpheus::GroupsInterface

Public Instance Methods

create(options) click to toggle source
# File lib/morpheus/api/groups_interface.rb, line 27
def create(options)
  url = "#{@base_url}/api/groups"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  payload = options
  opts = {method: :post, url: url, headers: headers, payload: payload.to_json}
  execute(opts)
end
destroy(id) click to toggle source
# File lib/morpheus/api/groups_interface.rb, line 43
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) click to toggle source
# File lib/morpheus/api/groups_interface.rb, line 12
def get(options=nil)
  url = "#{@base_url}/api/groups"
  headers = { params: {}, authorization: "Bearer #{@access_token}" }

  if options.is_a?(Hash)
    headers[:params].merge!(options)
  elsif options.is_a?(Numeric)
    url = "#{@base_url}/api/groups/#{options}"
  elsif options.is_a?(String)
    headers[:params]['name'] = options
  end
  opts = {method: :get, url: url, headers: headers}
  execute(opts)
end
list(params={}) click to toggle source
# 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) click to toggle source
# File lib/morpheus/api/groups_interface.rb, line 35
def update(id, options)
  url = "#{@base_url}/api/groups/#{id}"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  payload = options
  opts = {method: :put, url: url, headers: headers, payload: payload.to_json}
  execute(opts)
end
update_wiki(id, payload) click to toggle source
# File lib/morpheus/api/groups_interface.rb, line 65
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) click to toggle source
# File lib/morpheus/api/groups_interface.rb, line 50
def update_zones(id, options)
  url = "#{@base_url}/api/groups/#{id}/update-zones"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  payload = options
  opts = {method: :put, url: url, headers: headers, payload: payload.to_json}
  execute(opts)
end
wiki(id, params) click to toggle source
# File lib/morpheus/api/groups_interface.rb, line 58
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