Class: Morpheus::OptionTypesInterface

Inherits:
APIClient
  • Object
show all
Defined in:
lib/morpheus/api/option_types_interface.rb

Instance Method Summary collapse

Instance Method Details

#create(payload) ⇒ Object



21
22
23
24
25
26
# File 'lib/morpheus/api/option_types_interface.rb', line 21

def create(payload)
  url = "#{@base_url}/api/library/option-types"
  headers = { :params => {}, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :post, url: url, headers: headers, payload: payload.to_json}
  execute(opts)
end

#destroy(id) ⇒ Object



35
36
37
38
39
40
# File 'lib/morpheus/api/option_types_interface.rb', line 35

def destroy(id)
  url = "#{@base_url}/api/library/option-types/#{id}"
  headers = { :params => {}, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :delete, url: url, headers: headers}
  execute(opts)
end

#get(id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/morpheus/api/option_types_interface.rb', line 5

def get(id)
  raise "#{self.class}.get() passed a blank id!" if id.to_s == ''
  url = "#{@base_url}/api/library/option-types/#{id}"
  headers = { params: {}, authorization: "Bearer #{@access_token}" }
  opts = {method: :get, url: url, headers: headers}
  execute(opts)
end

#list(params = {}) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/morpheus/api/option_types_interface.rb', line 13

def list(params={})
  url = "#{@base_url}/api/library/option-types"
  headers = { params: {}, authorization: "Bearer #{@access_token}" }
  headers[:params].merge!(params)
  opts = {method: :get, url: url, headers: headers}
  execute(opts)
end

#update(id, payload) ⇒ Object



28
29
30
31
32
33
# File 'lib/morpheus/api/option_types_interface.rb', line 28

def update(id, payload)
  url = "#{@base_url}/api/library/option-types/#{id}"
  headers = { :params => {}, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  opts = {method: :put, url: url, headers: headers, payload: payload.to_json}
  execute(opts)
end