Class: Morpheus::LicenseInterface

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

Instance Method Summary collapse

Methods inherited from APIClient

#accounts, #app_templates, #apps, #archive_buckets, #archive_files, #auth, #clouds, #containers, #custom_instance_types, #dashboard, #deploy, #deployments, #dry, #dry_run, #execute, #groups, #image_builder, #instance_types, #instances, #key_pairs, #license, #load_balancers, #logs, #monitoring, #option_type_lists, #option_types, #options, #provision_types, #roles, #security_group_rules, #security_groups, #servers, #set_ssl_verification_enabled, #setup, #ssl_verification_enabled?, #task_sets, #tasks, #users, #virtual_images, #whoami

Constructor Details

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

Returns a new instance of LicenseInterface.



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

#apply(key) ⇒ Object



17
18
19
20
21
22
# File 'lib/morpheus/api/license_interface.rb', line 17

def apply(key)
  url = "#{@base_url}/api/license"
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
  payload = {license: key}
  execute(method: :post, url: url, headers: headers, payload: payload.to_json)
end

#getObject



11
12
13
14
15
# File 'lib/morpheus/api/license_interface.rb', line 11

def get()
  url = "#{@base_url}/api/license"
  headers = { params: {}, authorization: "Bearer #{@access_token}" }
  execute(method: :get, url: url, headers: headers)
end