license_manager 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +99 -0
- data/README.md +2 -2
- data/docs/CancelLicense.md +22 -0
- data/docs/CancellationReason.md +15 -0
- data/docs/CancellationStats.md +30 -0
- data/docs/CancellationStatsByReasonInner.md +20 -0
- data/docs/ConnectStripe.md +1 -1
- data/docs/CreateLicense.md +2 -0
- data/docs/CreatePolicy.md +3 -1
- data/docs/CreateProductWithPolicy.md +1 -1
- data/docs/CreateToken.md +1 -1
- data/docs/EventActorOneOf.md +1 -1
- data/docs/Integration.md +5 -1
- data/docs/IntegrationsApi.md +74 -0
- data/docs/License.md +10 -0
- data/docs/LicensesApi.md +80 -3
- data/docs/Machine.md +3 -1
- data/docs/MachinesApi.md +1 -1
- data/docs/Policy.md +2 -0
- data/docs/PolicySettings.md +3 -1
- data/docs/PortalApi.md +1 -1
- data/docs/PortalLink.md +2 -2
- data/docs/Product.md +2 -0
- data/docs/ProductStats.md +6 -4
- data/docs/ProductsApi.md +2 -2
- data/docs/Revenue.md +6 -2
- data/docs/StripeIntegration.md +1 -1
- data/docs/StripePermission.md +3 -1
- data/docs/UpdateIntegration.md +18 -0
- data/docs/UpdateLicense.md +3 -1
- data/docs/UpdatePolicy.md +3 -1
- data/docs/UpdateProduct.md +3 -1
- data/lib/license_manager/api/integrations_api.rb +74 -0
- data/lib/license_manager/api/licenses_api.rb +80 -6
- data/lib/license_manager/api/machines_api.rb +3 -3
- data/lib/license_manager/api/portal_api.rb +2 -2
- data/lib/license_manager/api/products_api.rb +4 -4
- data/lib/license_manager/models/cancel_license.rb +238 -0
- data/lib/license_manager/models/cancellation_reason.rb +45 -0
- data/lib/license_manager/models/cancellation_stats.rb +347 -0
- data/lib/license_manager/models/cancellation_stats_by_reason_inner.rb +225 -0
- data/lib/license_manager/models/connect_stripe.rb +1 -1
- data/lib/license_manager/models/create_license.rb +12 -1
- data/lib/license_manager/models/create_policy.rb +40 -5
- data/lib/license_manager/models/create_product_with_policy.rb +1 -1
- data/lib/license_manager/models/create_token.rb +1 -1
- data/lib/license_manager/models/event_type.rb +4 -1
- data/lib/license_manager/models/integration.rb +55 -1
- data/lib/license_manager/models/license.rb +79 -1
- data/lib/license_manager/models/license_status.rb +2 -1
- data/lib/license_manager/models/machine.rb +17 -4
- data/lib/license_manager/models/policy.rb +14 -1
- data/lib/license_manager/models/policy_settings.rb +40 -5
- data/lib/license_manager/models/portal_link.rb +1 -1
- data/lib/license_manager/models/product.rb +28 -1
- data/lib/license_manager/models/product_stats.rb +18 -5
- data/lib/license_manager/models/revenue.rb +58 -4
- data/lib/license_manager/models/stripe_integration.rb +1 -1
- data/lib/license_manager/models/stripe_permission.rb +31 -4
- data/lib/license_manager/models/update_integration.rb +161 -0
- data/lib/license_manager/models/update_license.rb +16 -5
- data/lib/license_manager/models/update_policy.rb +40 -5
- data/lib/license_manager/models/update_product.rb +14 -4
- data/lib/license_manager/version.rb +1 -1
- data/lib/license_manager.rb +5 -0
- data/license_manager.gemspec +1 -1
- data/openapi.json +566 -32
- data/spec/api/integrations_api_spec.rb +13 -0
- data/spec/api/licenses_api_spec.rb +16 -3
- data/spec/api/machines_api_spec.rb +1 -1
- data/spec/api/portal_api_spec.rb +1 -1
- data/spec/api/products_api_spec.rb +2 -2
- data/spec/models/cancel_license_spec.rb +48 -0
- data/spec/models/cancellation_reason_spec.rb +30 -0
- data/spec/models/cancellation_stats_by_reason_inner_spec.rb +42 -0
- data/spec/models/cancellation_stats_spec.rb +72 -0
- data/spec/models/create_license_spec.rb +6 -0
- data/spec/models/create_policy_spec.rb +6 -0
- data/spec/models/create_token_spec.rb +1 -1
- data/spec/models/integration_spec.rb +12 -0
- data/spec/models/license_spec.rb +30 -0
- data/spec/models/machine_spec.rb +7 -1
- data/spec/models/policy_settings_spec.rb +6 -0
- data/spec/models/policy_spec.rb +6 -0
- data/spec/models/product_spec.rb +6 -0
- data/spec/models/product_stats_spec.rb +6 -0
- data/spec/models/revenue_spec.rb +12 -0
- data/spec/models/stripe_permission_spec.rb +6 -0
- data/spec/models/token_spec.rb +1 -1
- data/spec/models/update_integration_spec.rb +36 -0
- data/spec/models/update_license_spec.rb +6 -0
- data/spec/models/update_policy_spec.rb +6 -0
- data/spec/models/update_product_spec.rb +6 -0
- metadata +23 -2
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#LicenseManager API
|
|
3
|
+
|
|
4
|
+
#Public API. Authenticate with an organization API key, or with a token scoped to a customer, license or machine on the endpoints that accept one. ## Conventions - **Errors** answer `{ \"error\": { \"code\", \"message\" } }`. Branch on `code`, which is stable, not on `message`. Each response lists the codes it can return, except `404`, which answers `not_found` unless it says otherwise. Unexpected errors answer `500` with `internal_error`. - **Validation** errors answer `422`, not `400`, with the `validation_error` code and an `issues` array giving the `path` and `message` of each invalid value. - **Unknown body fields are ignored**, not rejected: sending a field an endpoint doesn't accept, like `policyId` to `updateLicense`, changes nothing and doesn't fail. - **Strings** are trimmed before they're validated and stored. Emails are stored lower cased. - **Updates** only change the fields that are sent. A field sent as `null` is cleared, when it can be. - **Dates** can be sent with any offset, and are always returned in UTC, like `2026-01-15T09:30:00.000Z`. Calendar months and days are counted in UTC. - **Ids** are 8 letters and digits, after `test_` for test products and their resources. - **Lists** are paginated with `page` and `pageSize`. Items with the same value for the `sort` field are ordered by id, so pages are stable, but items created or deleted between two requests shift the pages. Items without a value for the `sort` field come last in ascending order, and first in descending order, unless the endpoint says otherwise. - **Test products** are sandboxes of a live product. Test API keys only reach test products, live API keys only live ones: the others answer `404`, as if they didn't exist. Sessions and tokens reach both.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.26.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module LicenseManager
|
|
17
|
+
class CancellationStatsByReasonInner < ApiModelBase
|
|
18
|
+
attr_accessor :reason
|
|
19
|
+
|
|
20
|
+
attr_accessor :count
|
|
21
|
+
|
|
22
|
+
class EnumAttributeValidator
|
|
23
|
+
attr_reader :datatype
|
|
24
|
+
attr_reader :allowable_values
|
|
25
|
+
|
|
26
|
+
def initialize(datatype, allowable_values)
|
|
27
|
+
@allowable_values = allowable_values.map do |value|
|
|
28
|
+
case datatype.to_s
|
|
29
|
+
when /Integer/i
|
|
30
|
+
value.to_i
|
|
31
|
+
when /Float/i
|
|
32
|
+
value.to_f
|
|
33
|
+
else
|
|
34
|
+
value
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def valid?(value)
|
|
40
|
+
!value || allowable_values.include?(value)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
45
|
+
def self.attribute_map
|
|
46
|
+
{
|
|
47
|
+
:'reason' => :'reason',
|
|
48
|
+
:'count' => :'count'
|
|
49
|
+
}
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Returns attribute mapping this model knows about
|
|
53
|
+
def self.acceptable_attribute_map
|
|
54
|
+
attribute_map
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Returns all the JSON keys this model knows about
|
|
58
|
+
def self.acceptable_attributes
|
|
59
|
+
acceptable_attribute_map.values
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Attribute type mapping.
|
|
63
|
+
def self.openapi_types
|
|
64
|
+
{
|
|
65
|
+
:'reason' => :'CancellationReason',
|
|
66
|
+
:'count' => :'Integer'
|
|
67
|
+
}
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# List of attributes with nullable: true
|
|
71
|
+
def self.openapi_nullable
|
|
72
|
+
Set.new([
|
|
73
|
+
])
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Returns attribute type mapping
|
|
77
|
+
def self.acceptable_openapi_types
|
|
78
|
+
openapi_types
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Returns the nullable attributes
|
|
82
|
+
def self.acceptable_openapi_nullable
|
|
83
|
+
openapi_nullable
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Initializes the object
|
|
87
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
88
|
+
def initialize(attributes = {})
|
|
89
|
+
if (!attributes.is_a?(Hash))
|
|
90
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `LicenseManager::CancellationStatsByReasonInner` initialize method"
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
94
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
95
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
96
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
97
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `LicenseManager::CancellationStatsByReasonInner`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
98
|
+
end
|
|
99
|
+
h[k.to_sym] = v
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if attributes.key?(:'reason')
|
|
103
|
+
self.reason = attributes[:'reason']
|
|
104
|
+
else
|
|
105
|
+
self.reason = nil
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
if attributes.key?(:'count')
|
|
109
|
+
self.count = attributes[:'count']
|
|
110
|
+
else
|
|
111
|
+
self.count = nil
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
116
|
+
# @return Array for valid properties with the reasons
|
|
117
|
+
def list_invalid_properties
|
|
118
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
119
|
+
invalid_properties = Array.new
|
|
120
|
+
if @reason.nil?
|
|
121
|
+
invalid_properties.push('invalid value for "reason", reason cannot be nil.')
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
if @count.nil?
|
|
125
|
+
invalid_properties.push('invalid value for "count", count cannot be nil.')
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
invalid_properties
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Check to see if the all the properties in the model are valid
|
|
132
|
+
# @return true if the model is valid
|
|
133
|
+
def valid?
|
|
134
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
135
|
+
return false if @reason.nil?
|
|
136
|
+
return false if @count.nil?
|
|
137
|
+
true
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
# Custom attribute writer method with validation
|
|
141
|
+
# @param [Object] reason Value to be assigned
|
|
142
|
+
def reason=(reason)
|
|
143
|
+
if reason.nil?
|
|
144
|
+
fail ArgumentError, 'reason cannot be nil'
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
@reason = reason
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Custom attribute writer method with validation
|
|
151
|
+
# @param [Object] count Value to be assigned
|
|
152
|
+
def count=(count)
|
|
153
|
+
if count.nil?
|
|
154
|
+
fail ArgumentError, 'count cannot be nil'
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
@count = count
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
# Checks equality by comparing each attribute.
|
|
161
|
+
# @param [Object] Object to be compared
|
|
162
|
+
def ==(o)
|
|
163
|
+
return true if self.equal?(o)
|
|
164
|
+
self.class == o.class &&
|
|
165
|
+
reason == o.reason &&
|
|
166
|
+
count == o.count
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# @see the `==` method
|
|
170
|
+
# @param [Object] Object to be compared
|
|
171
|
+
def eql?(o)
|
|
172
|
+
self == o
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# Calculates hash code according to all attributes.
|
|
176
|
+
# @return [Integer] Hash code
|
|
177
|
+
def hash
|
|
178
|
+
[reason, count].hash
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
# Builds the object from hash
|
|
182
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
183
|
+
# @return [Object] Returns the model itself
|
|
184
|
+
def self.build_from_hash(attributes)
|
|
185
|
+
return nil unless attributes.is_a?(Hash)
|
|
186
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
187
|
+
# include attributes inherited from allOf parents (the nearest declaration wins)
|
|
188
|
+
map = acceptable_attribute_map
|
|
189
|
+
transformed_hash = {}
|
|
190
|
+
acceptable_openapi_types.each_pair do |key, type|
|
|
191
|
+
if attributes.key?(map[key]) && attributes[map[key]].nil?
|
|
192
|
+
transformed_hash["#{key}"] = nil
|
|
193
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
194
|
+
# check to ensure the input is an array given that the attribute
|
|
195
|
+
# is documented as an array but the input is not
|
|
196
|
+
if attributes[map[key]].is_a?(Array)
|
|
197
|
+
transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
|
|
198
|
+
end
|
|
199
|
+
elsif !attributes[map[key]].nil?
|
|
200
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
|
|
201
|
+
end
|
|
202
|
+
end
|
|
203
|
+
new(transformed_hash)
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
# Returns the object in the form of hash
|
|
207
|
+
# @return [Hash] Returns the object in the form of hash
|
|
208
|
+
def to_hash
|
|
209
|
+
hash = {}
|
|
210
|
+
# include attributes inherited from allOf parents (the nearest declaration wins)
|
|
211
|
+
self.class.acceptable_attribute_map.each_pair do |attr, param|
|
|
212
|
+
value = self.send(attr)
|
|
213
|
+
if value.nil?
|
|
214
|
+
is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
|
|
215
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
hash[param] = _to_hash(value)
|
|
219
|
+
end
|
|
220
|
+
hash
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
end
|
|
@@ -15,7 +15,7 @@ require 'time'
|
|
|
15
15
|
|
|
16
16
|
module LicenseManager
|
|
17
17
|
class ConnectStripe < ApiModelBase
|
|
18
|
-
# Restricted API key of the Stripe account (`rk_live_…` for live products, `rk_test_…` for test products), with the `requiredPermissions` of `getStripeIntegration`. A secret key works too, but gives the app more access than it needs.
|
|
18
|
+
# Restricted API key of the Stripe account (`rk_live_…` for live products, `rk_test_…` for test products), with the `requiredPermissions` of `getStripeIntegration`. Without the optional ones, it connects with what they're for turned off. A secret key works too, but gives the app more access than it needs.
|
|
19
19
|
attr_accessor :api_key
|
|
20
20
|
|
|
21
21
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
@@ -40,6 +40,9 @@ module LicenseManager
|
|
|
40
40
|
|
|
41
41
|
attr_accessor :max_version
|
|
42
42
|
|
|
43
|
+
# End of the money back guarantee: until then, the customer can cancel the license from the customer portal, or with a token. `null` to not let them. Defaults to the creation date plus the policy's `moneyBackGuaranteeDays`, or `null` when it has none.
|
|
44
|
+
attr_accessor :cancellable_until
|
|
45
|
+
|
|
43
46
|
# `true` emails the key to the customer once the license is created, like `sendLicenseKeys`. Sent in the background: a failed email doesn't fail the creation. In test products, it's only sent when the customer's email is a member's of the organization. Defaults to `false`.
|
|
44
47
|
attr_accessor :send_key
|
|
45
48
|
|
|
@@ -55,6 +58,7 @@ module LicenseManager
|
|
|
55
58
|
:'max_offline_duration_seconds' => :'maxOfflineDurationSeconds',
|
|
56
59
|
:'price' => :'price',
|
|
57
60
|
:'max_version' => :'maxVersion',
|
|
61
|
+
:'cancellable_until' => :'cancellableUntil',
|
|
58
62
|
:'send_key' => :'sendKey'
|
|
59
63
|
}
|
|
60
64
|
end
|
|
@@ -81,6 +85,7 @@ module LicenseManager
|
|
|
81
85
|
:'max_offline_duration_seconds' => :'Integer',
|
|
82
86
|
:'price' => :'PriceInput',
|
|
83
87
|
:'max_version' => :'LicenseMaxVersionInput',
|
|
88
|
+
:'cancellable_until' => :'Time',
|
|
84
89
|
:'send_key' => :'Boolean'
|
|
85
90
|
}
|
|
86
91
|
end
|
|
@@ -92,6 +97,7 @@ module LicenseManager
|
|
|
92
97
|
:'meta',
|
|
93
98
|
:'max_machines',
|
|
94
99
|
:'price',
|
|
100
|
+
:'cancellable_until',
|
|
95
101
|
])
|
|
96
102
|
end
|
|
97
103
|
|
|
@@ -161,6 +167,10 @@ module LicenseManager
|
|
|
161
167
|
self.max_version = attributes[:'max_version']
|
|
162
168
|
end
|
|
163
169
|
|
|
170
|
+
if attributes.key?(:'cancellable_until')
|
|
171
|
+
self.cancellable_until = attributes[:'cancellable_until']
|
|
172
|
+
end
|
|
173
|
+
|
|
164
174
|
if attributes.key?(:'send_key')
|
|
165
175
|
self.send_key = attributes[:'send_key']
|
|
166
176
|
end
|
|
@@ -299,6 +309,7 @@ module LicenseManager
|
|
|
299
309
|
max_offline_duration_seconds == o.max_offline_duration_seconds &&
|
|
300
310
|
price == o.price &&
|
|
301
311
|
max_version == o.max_version &&
|
|
312
|
+
cancellable_until == o.cancellable_until &&
|
|
302
313
|
send_key == o.send_key
|
|
303
314
|
end
|
|
304
315
|
|
|
@@ -311,7 +322,7 @@ module LicenseManager
|
|
|
311
322
|
# Calculates hash code according to all attributes.
|
|
312
323
|
# @return [Integer] Hash code
|
|
313
324
|
def hash
|
|
314
|
-
[email, key, policy_id, expires_at, meta, max_machines, max_offline_duration_seconds, price, max_version, send_key].hash
|
|
325
|
+
[email, key, policy_id, expires_at, meta, max_machines, max_offline_duration_seconds, price, max_version, cancellable_until, send_key].hash
|
|
315
326
|
end
|
|
316
327
|
|
|
317
328
|
# Builds the object from hash
|
|
@@ -33,6 +33,9 @@ module LicenseManager
|
|
|
33
33
|
|
|
34
34
|
attr_accessor :max_version
|
|
35
35
|
|
|
36
|
+
# Number of days after their creation during which customers can cancel the licenses created with this policy, from the customer portal or with `cancelLicense`, which refunds their Stripe payment. Each license keeps the end of its own period as `cancellableUntil`. `null` for no money back guarantee. Defaults to `null`.
|
|
37
|
+
attr_accessor :money_back_guarantee_days
|
|
38
|
+
|
|
36
39
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
37
40
|
def self.attribute_map
|
|
38
41
|
{
|
|
@@ -42,7 +45,8 @@ module LicenseManager
|
|
|
42
45
|
:'duration' => :'duration',
|
|
43
46
|
:'max_machines' => :'maxMachines',
|
|
44
47
|
:'max_offline_duration_seconds' => :'maxOfflineDurationSeconds',
|
|
45
|
-
:'max_version' => :'maxVersion'
|
|
48
|
+
:'max_version' => :'maxVersion',
|
|
49
|
+
:'money_back_guarantee_days' => :'moneyBackGuaranteeDays'
|
|
46
50
|
}
|
|
47
51
|
end
|
|
48
52
|
|
|
@@ -65,7 +69,8 @@ module LicenseManager
|
|
|
65
69
|
:'duration' => :'PolicySettingsDuration',
|
|
66
70
|
:'max_machines' => :'Integer',
|
|
67
71
|
:'max_offline_duration_seconds' => :'Integer',
|
|
68
|
-
:'max_version' => :'PolicySettingsMaxVersion'
|
|
72
|
+
:'max_version' => :'PolicySettingsMaxVersion',
|
|
73
|
+
:'money_back_guarantee_days' => :'Integer'
|
|
69
74
|
}
|
|
70
75
|
end
|
|
71
76
|
|
|
@@ -74,7 +79,8 @@ module LicenseManager
|
|
|
74
79
|
Set.new([
|
|
75
80
|
:'duration',
|
|
76
81
|
:'max_machines',
|
|
77
|
-
:'max_version'
|
|
82
|
+
:'max_version',
|
|
83
|
+
:'money_back_guarantee_days'
|
|
78
84
|
])
|
|
79
85
|
end
|
|
80
86
|
|
|
@@ -133,6 +139,10 @@ module LicenseManager
|
|
|
133
139
|
if attributes.key?(:'max_version')
|
|
134
140
|
self.max_version = attributes[:'max_version']
|
|
135
141
|
end
|
|
142
|
+
|
|
143
|
+
if attributes.key?(:'money_back_guarantee_days')
|
|
144
|
+
self.money_back_guarantee_days = attributes[:'money_back_guarantee_days']
|
|
145
|
+
end
|
|
136
146
|
end
|
|
137
147
|
|
|
138
148
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -181,6 +191,14 @@ module LicenseManager
|
|
|
181
191
|
invalid_properties.push('invalid value for "max_offline_duration_seconds", must be greater than or equal to 3600.')
|
|
182
192
|
end
|
|
183
193
|
|
|
194
|
+
if !@money_back_guarantee_days.nil? && @money_back_guarantee_days > 3650
|
|
195
|
+
invalid_properties.push('invalid value for "money_back_guarantee_days", must be smaller than or equal to 3650.')
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
if !@money_back_guarantee_days.nil? && @money_back_guarantee_days <= 0
|
|
199
|
+
invalid_properties.push('invalid value for "money_back_guarantee_days", must be greater than 0.')
|
|
200
|
+
end
|
|
201
|
+
|
|
184
202
|
invalid_properties
|
|
185
203
|
end
|
|
186
204
|
|
|
@@ -198,6 +216,8 @@ module LicenseManager
|
|
|
198
216
|
return false if !@max_machines.nil? && @max_machines <= 0
|
|
199
217
|
return false if !@max_offline_duration_seconds.nil? && @max_offline_duration_seconds > 2147483647
|
|
200
218
|
return false if !@max_offline_duration_seconds.nil? && @max_offline_duration_seconds < 3600
|
|
219
|
+
return false if !@money_back_guarantee_days.nil? && @money_back_guarantee_days > 3650
|
|
220
|
+
return false if !@money_back_guarantee_days.nil? && @money_back_guarantee_days <= 0
|
|
201
221
|
true
|
|
202
222
|
end
|
|
203
223
|
|
|
@@ -274,6 +294,20 @@ module LicenseManager
|
|
|
274
294
|
@max_offline_duration_seconds = max_offline_duration_seconds
|
|
275
295
|
end
|
|
276
296
|
|
|
297
|
+
# Custom attribute writer method with validation
|
|
298
|
+
# @param [Object] money_back_guarantee_days Value to be assigned
|
|
299
|
+
def money_back_guarantee_days=(money_back_guarantee_days)
|
|
300
|
+
if !money_back_guarantee_days.nil? && money_back_guarantee_days > 3650
|
|
301
|
+
fail ArgumentError, 'invalid value for "money_back_guarantee_days", must be smaller than or equal to 3650.'
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
if !money_back_guarantee_days.nil? && money_back_guarantee_days <= 0
|
|
305
|
+
fail ArgumentError, 'invalid value for "money_back_guarantee_days", must be greater than 0.'
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
@money_back_guarantee_days = money_back_guarantee_days
|
|
309
|
+
end
|
|
310
|
+
|
|
277
311
|
# Checks equality by comparing each attribute.
|
|
278
312
|
# @param [Object] Object to be compared
|
|
279
313
|
def ==(o)
|
|
@@ -285,7 +319,8 @@ module LicenseManager
|
|
|
285
319
|
duration == o.duration &&
|
|
286
320
|
max_machines == o.max_machines &&
|
|
287
321
|
max_offline_duration_seconds == o.max_offline_duration_seconds &&
|
|
288
|
-
max_version == o.max_version
|
|
322
|
+
max_version == o.max_version &&
|
|
323
|
+
money_back_guarantee_days == o.money_back_guarantee_days
|
|
289
324
|
end
|
|
290
325
|
|
|
291
326
|
# @see the `==` method
|
|
@@ -297,7 +332,7 @@ module LicenseManager
|
|
|
297
332
|
# Calculates hash code according to all attributes.
|
|
298
333
|
# @return [Integer] Hash code
|
|
299
334
|
def hash
|
|
300
|
-
[name, slug, is_default, duration, max_machines, max_offline_duration_seconds, max_version].hash
|
|
335
|
+
[name, slug, is_default, duration, max_machines, max_offline_duration_seconds, max_version, money_back_guarantee_days].hash
|
|
301
336
|
end
|
|
302
337
|
|
|
303
338
|
# Builds the object from hash
|
|
@@ -22,7 +22,7 @@ module LicenseManager
|
|
|
22
22
|
|
|
23
23
|
attr_accessor :default_policy
|
|
24
24
|
|
|
25
|
-
# Creates a test product: a sandbox of this live product of the organization, starting with copies of its policies, releases
|
|
25
|
+
# Creates a test product: a sandbox of this live product of the organization, starting with copies of its policies, releases, portal settings and `autoMachineChange`.
|
|
26
26
|
attr_accessor :is_test_from_product_id
|
|
27
27
|
|
|
28
28
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
@@ -15,7 +15,7 @@ require 'time'
|
|
|
15
15
|
|
|
16
16
|
module LicenseManager
|
|
17
17
|
class CreateToken < ApiModelBase
|
|
18
|
-
# Permissions of the token. A write permission implies the
|
|
18
|
+
# Permissions of the token. A write permission implies the other ones of its resource, like the read one: `license:write` implies `license:read` and `license:cancel`. A token creating a token can only give the permissions it has.
|
|
19
19
|
attr_accessor :scope
|
|
20
20
|
|
|
21
21
|
# How long the token works, in seconds, from 60 (1 minute) to 31536000 (365 days). Defaults to 900 (15 minutes). A token creating a token can't give it a later expiration than its own: it's shortened to it.
|
|
@@ -21,11 +21,14 @@ module LicenseManager
|
|
|
21
21
|
LICENSE_UPDATED = "license.updated".freeze
|
|
22
22
|
LICENSE_VALIDATED = "license.validated".freeze
|
|
23
23
|
LICENSE_VALIDATION_FAILED = "license.validation_failed".freeze
|
|
24
|
+
LICENSE_CANCELED = "license.canceled".freeze
|
|
25
|
+
LICENSE_REFUNDED = "license.refunded".freeze
|
|
26
|
+
LICENSE_REFUND_FAILED = "license.refund_failed".freeze
|
|
24
27
|
MACHINE_DEACTIVATED = "machine.deactivated".freeze
|
|
25
28
|
UNKNOWN_DEFAULT_OPEN_API = "unknown_default_open_api".freeze
|
|
26
29
|
|
|
27
30
|
def self.all_vars
|
|
28
|
-
@all_vars ||= [POLICY_CREATED, POLICY_UPDATED, LICENSE_CREATED, LICENSE_UPDATED, LICENSE_VALIDATED, LICENSE_VALIDATION_FAILED, MACHINE_DEACTIVATED, UNKNOWN_DEFAULT_OPEN_API].freeze
|
|
31
|
+
@all_vars ||= [POLICY_CREATED, POLICY_UPDATED, LICENSE_CREATED, LICENSE_UPDATED, LICENSE_VALIDATED, LICENSE_VALIDATION_FAILED, LICENSE_CANCELED, LICENSE_REFUNDED, LICENSE_REFUND_FAILED, MACHINE_DEACTIVATED, UNKNOWN_DEFAULT_OPEN_API].freeze
|
|
29
32
|
end
|
|
30
33
|
|
|
31
34
|
# Builds the enum from string
|
|
@@ -42,6 +42,12 @@ module LicenseManager
|
|
|
42
42
|
# Last time it received an event from the provider.
|
|
43
43
|
attr_accessor :last_event_at
|
|
44
44
|
|
|
45
|
+
# Whether canceling a license bought through Stripe refunds its payment. On by default, always off when `canRefund` is false.
|
|
46
|
+
attr_accessor :auto_refund
|
|
47
|
+
|
|
48
|
+
# Whether the API key has the optional Refunds: Write permission, checked when connecting and every day. Without it, canceled licenses aren't refunded: refund their payments from Stripe.
|
|
49
|
+
attr_accessor :can_refund
|
|
50
|
+
|
|
45
51
|
attr_accessor :created_at
|
|
46
52
|
|
|
47
53
|
class EnumAttributeValidator
|
|
@@ -79,6 +85,8 @@ module LicenseManager
|
|
|
79
85
|
:'status_reason' => :'statusReason',
|
|
80
86
|
:'last_checked_at' => :'lastCheckedAt',
|
|
81
87
|
:'last_event_at' => :'lastEventAt',
|
|
88
|
+
:'auto_refund' => :'autoRefund',
|
|
89
|
+
:'can_refund' => :'canRefund',
|
|
82
90
|
:'created_at' => :'createdAt'
|
|
83
91
|
}
|
|
84
92
|
end
|
|
@@ -106,6 +114,8 @@ module LicenseManager
|
|
|
106
114
|
:'status_reason' => :'String',
|
|
107
115
|
:'last_checked_at' => :'Time',
|
|
108
116
|
:'last_event_at' => :'Time',
|
|
117
|
+
:'auto_refund' => :'Boolean',
|
|
118
|
+
:'can_refund' => :'Boolean',
|
|
109
119
|
:'created_at' => :'Time'
|
|
110
120
|
}
|
|
111
121
|
end
|
|
@@ -206,6 +216,18 @@ module LicenseManager
|
|
|
206
216
|
self.last_event_at = nil
|
|
207
217
|
end
|
|
208
218
|
|
|
219
|
+
if attributes.key?(:'auto_refund')
|
|
220
|
+
self.auto_refund = attributes[:'auto_refund']
|
|
221
|
+
else
|
|
222
|
+
self.auto_refund = nil
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
if attributes.key?(:'can_refund')
|
|
226
|
+
self.can_refund = attributes[:'can_refund']
|
|
227
|
+
else
|
|
228
|
+
self.can_refund = nil
|
|
229
|
+
end
|
|
230
|
+
|
|
209
231
|
if attributes.key?(:'created_at')
|
|
210
232
|
self.created_at = attributes[:'created_at']
|
|
211
233
|
else
|
|
@@ -242,6 +264,14 @@ module LicenseManager
|
|
|
242
264
|
invalid_properties.push('invalid value for "status", status cannot be nil.')
|
|
243
265
|
end
|
|
244
266
|
|
|
267
|
+
if @auto_refund.nil?
|
|
268
|
+
invalid_properties.push('invalid value for "auto_refund", auto_refund cannot be nil.')
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
if @can_refund.nil?
|
|
272
|
+
invalid_properties.push('invalid value for "can_refund", can_refund cannot be nil.')
|
|
273
|
+
end
|
|
274
|
+
|
|
245
275
|
if @created_at.nil?
|
|
246
276
|
invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
|
|
247
277
|
end
|
|
@@ -261,6 +291,8 @@ module LicenseManager
|
|
|
261
291
|
return false if @api_key_hint.nil?
|
|
262
292
|
return false if @webhook_url.nil?
|
|
263
293
|
return false if @status.nil?
|
|
294
|
+
return false if @auto_refund.nil?
|
|
295
|
+
return false if @can_refund.nil?
|
|
264
296
|
return false if @created_at.nil?
|
|
265
297
|
true
|
|
266
298
|
end
|
|
@@ -325,6 +357,26 @@ module LicenseManager
|
|
|
325
357
|
@status = status
|
|
326
358
|
end
|
|
327
359
|
|
|
360
|
+
# Custom attribute writer method with validation
|
|
361
|
+
# @param [Object] auto_refund Value to be assigned
|
|
362
|
+
def auto_refund=(auto_refund)
|
|
363
|
+
if auto_refund.nil?
|
|
364
|
+
fail ArgumentError, 'auto_refund cannot be nil'
|
|
365
|
+
end
|
|
366
|
+
|
|
367
|
+
@auto_refund = auto_refund
|
|
368
|
+
end
|
|
369
|
+
|
|
370
|
+
# Custom attribute writer method with validation
|
|
371
|
+
# @param [Object] can_refund Value to be assigned
|
|
372
|
+
def can_refund=(can_refund)
|
|
373
|
+
if can_refund.nil?
|
|
374
|
+
fail ArgumentError, 'can_refund cannot be nil'
|
|
375
|
+
end
|
|
376
|
+
|
|
377
|
+
@can_refund = can_refund
|
|
378
|
+
end
|
|
379
|
+
|
|
328
380
|
# Custom attribute writer method with validation
|
|
329
381
|
# @param [Object] created_at Value to be assigned
|
|
330
382
|
def created_at=(created_at)
|
|
@@ -350,6 +402,8 @@ module LicenseManager
|
|
|
350
402
|
status_reason == o.status_reason &&
|
|
351
403
|
last_checked_at == o.last_checked_at &&
|
|
352
404
|
last_event_at == o.last_event_at &&
|
|
405
|
+
auto_refund == o.auto_refund &&
|
|
406
|
+
can_refund == o.can_refund &&
|
|
353
407
|
created_at == o.created_at
|
|
354
408
|
end
|
|
355
409
|
|
|
@@ -362,7 +416,7 @@ module LicenseManager
|
|
|
362
416
|
# Calculates hash code according to all attributes.
|
|
363
417
|
# @return [Integer] Hash code
|
|
364
418
|
def hash
|
|
365
|
-
[id, provider, livemode, account_name, api_key_hint, webhook_url, status, status_reason, last_checked_at, last_event_at, created_at].hash
|
|
419
|
+
[id, provider, livemode, account_name, api_key_hint, webhook_url, status, status_reason, last_checked_at, last_event_at, auto_refund, can_refund, created_at].hash
|
|
366
420
|
end
|
|
367
421
|
|
|
368
422
|
# Builds the object from hash
|