Class: Morpheus::LicenseInterface
- Inherits:
-
APIClient
- Object
- APIClient
- Morpheus::LicenseInterface
- Defined in:
- lib/morpheus/api/license_interface.rb
Instance Method Summary collapse
- #apply(key) ⇒ Object
- #decode(key) ⇒ Object
- #get ⇒ Object
-
#initialize(access_token, refresh_token, expires_at = nil, base_url = nil) ⇒ LicenseInterface
constructor
A new instance of LicenseInterface.
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 |
#decode(key) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/morpheus/api/license_interface.rb', line 24 def decode(key) url = "#{@base_url}/api/license/decode" 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 |