Class: LemonSqueezy::LicenseKey
- Inherits:
-
Object
- Object
- OpenStruct
- Object
- LemonSqueezy::LicenseKey
show all
- Defined in:
- lib/lemon_squeezy/models/license_key.rb
Class Method Summary
collapse
Methods inherited from Object
#initialize, #to_ostruct
Class Method Details
.retrieve(id:) ⇒ Object
11
12
13
14
|
# File 'lib/lemon_squeezy/models/license_key.rb', line 11
def retrieve(id:)
response = Client.get_request("license-keys/#{id}")
LicenseKey.new(response.body["data"]) if response.success?
end
|
.update(id:, **attributes) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/lemon_squeezy/models/license_key.rb', line 16
def update(id:, **attributes)
body = {
data: {
type: "license-keys",
id: id.to_s,
attributes: attributes
}
}
response = Client.patch_request("license-keys/#{id}", body: body.to_json)
LicenseKey.new(response.body["data"]) if response.success?
end
|