Class: Morpheus::LicenseInterface
- Defined in:
- lib/morpheus/api/license_interface.rb
Instance Method Summary collapse
- #apply(key) ⇒ Object
- #get ⇒ Object
-
#initialize(access_token, refresh_token, expires_at = nil, base_url = nil) ⇒ LicenseInterface
constructor
A new instance of LicenseInterface.
Methods inherited from APIClient
#accounts, #app_templates, #apps, #auth, #clouds, #custom_instance_types, #dashboard, #deploy, #deployments, #dry, #dry_run, #execute, #groups, #instance_types, #instances, #key_pairs, #license, #load_balancers, #logs, #options, #provision_types, #roles, #security_group_rules, #security_groups, #servers, #setup, #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 |
#get ⇒ Object
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 |