Class: Morpheus::ProvisionTypesInterface

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

Instance Method Summary collapse

Constructor Details

#initialize(access_token, refresh_token, expires_at = nil, base_url = nil) ⇒ ProvisionTypesInterface

Returns a new instance of ProvisionTypesInterface.



4
5
6
7
8
9
# File 'lib/morpheus/api/provision_types_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

#get(options = nil) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/morpheus/api/provision_types_interface.rb', line 11

def get(options=nil)
  url = "#{@base_url}/api/provision-types"
  headers = { params: {}, authorization: "Bearer #{@access_token}" }

  if options.is_a?(Hash)
    headers[:params].merge!(options)
  elsif options.is_a?(Numeric)
    url = "#{@base_url}/api/provision-types/#{options}"
  elsif options.is_a?(String)
    headers[:params]['name'] = options
  end
  execute(method: :get, url: url, headers: headers)
end