Class: LemonSqueezy::License

Inherits:
Object
  • Object
show all
Defined in:
lib/lemon_squeezy/models/license.rb

Class Method Summary collapse

Methods inherited from Object

#initialize, #to_ostruct

Constructor Details

This class inherits a constructor from LemonSqueezy::Object

Class Method Details

.activate(key:, instance:) ⇒ Object



11
12
13
14
# File 'lib/lemon_squeezy/models/license.rb', line 11

def activate(key:, instance:)
  response = Client.post_request("licenses/activate", body: { license_key: key, instance_name: instance })
  License.new(response.body) if response.success?
end

.deactivate(key:, instance:) ⇒ Object



16
17
18
19
# File 'lib/lemon_squeezy/models/license.rb', line 16

def deactivate(key:, instance:)
  response = Client.post_request("licenses/deactivate", body: { license_key: key, instance_id: instance })
  License.new(response.body) if response.success?
end

.validate(key:, instance: nil) ⇒ Object



6
7
8
9
# File 'lib/lemon_squeezy/models/license.rb', line 6

def validate(key:, instance: nil)
  response = Client.post_request("licenses/validate", body: { license_key: key, instance_id: instance })
  License.new(response.body) if response.success?
end