license_manager 0.2.0 → 0.3.1
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 +68 -0
- data/README.md +1 -1
- data/docs/BillingPortalSession.md +18 -0
- data/docs/CreateBillingPortalSession.md +18 -0
- data/docs/CreateIntegrationMapping.md +1 -1
- data/docs/Integration.md +6 -0
- data/docs/IntegrationMapping.md +2 -0
- data/docs/IntegrationMappingRecurring.md +20 -0
- data/docs/License.md +4 -0
- data/docs/LicenseCustomer.md +22 -0
- data/docs/LicenseSubscription.md +34 -0
- data/docs/LicensesApi.md +5 -5
- data/docs/Mrr.md +26 -0
- data/docs/MrrByIntervalInner.md +24 -0
- data/docs/MrrByPolicyInner.md +22 -0
- data/docs/PortalApi.md +79 -0
- data/docs/ProductStats.md +2 -0
- data/docs/Revenue.md +8 -4
- data/docs/StripePermission.md +3 -1
- data/docs/StripePrice.md +2 -0
- data/docs/StripePriceRecurring.md +20 -0
- data/docs/SubscriptionStats.md +38 -0
- data/docs/UpdateIntegration.md +3 -1
- data/lib/license_manager/api/licenses_api.rb +6 -6
- data/lib/license_manager/api/portal_api.rb +70 -0
- data/lib/license_manager/models/billing_portal_session.rb +178 -0
- data/lib/license_manager/models/create_billing_portal_session.rb +161 -0
- data/lib/license_manager/models/create_integration_mapping.rb +1 -1
- data/lib/license_manager/models/event_type.rb +4 -1
- data/lib/license_manager/models/integration.rb +82 -1
- data/lib/license_manager/models/integration_mapping.rb +13 -1
- data/lib/license_manager/models/integration_mapping_recurring.rb +228 -0
- data/lib/license_manager/models/license.rb +39 -1
- data/lib/license_manager/models/license_customer.rb +217 -0
- data/lib/license_manager/models/license_subscription.rb +388 -0
- data/lib/license_manager/models/mrr.rb +291 -0
- data/lib/license_manager/models/mrr_by_interval_inner.rb +279 -0
- data/lib/license_manager/models/mrr_by_policy_inner.rb +229 -0
- data/lib/license_manager/models/product_stats.rb +14 -1
- data/lib/license_manager/models/revenue.rb +60 -6
- data/lib/license_manager/models/stripe_permission.rb +31 -4
- data/lib/license_manager/models/stripe_price.rb +13 -1
- data/lib/license_manager/models/stripe_price_recurring.rb +228 -0
- data/lib/license_manager/models/subscription_stats.rb +456 -0
- data/lib/license_manager/models/update_integration.rb +42 -4
- data/lib/license_manager/version.rb +1 -1
- data/lib/license_manager.rb +10 -0
- data/openapi.json +599 -14
- data/spec/api/licenses_api_spec.rb +3 -3
- data/spec/api/portal_api_spec.rb +13 -0
- data/spec/models/billing_portal_session_spec.rb +36 -0
- data/spec/models/create_billing_portal_session_spec.rb +36 -0
- data/spec/models/create_token_spec.rb +1 -1
- data/spec/models/integration_mapping_recurring_spec.rb +46 -0
- data/spec/models/integration_mapping_spec.rb +6 -0
- data/spec/models/integration_spec.rb +18 -0
- data/spec/models/license_customer_spec.rb +48 -0
- data/spec/models/license_spec.rb +12 -0
- data/spec/models/license_subscription_spec.rb +88 -0
- data/spec/models/mrr_by_interval_inner_spec.rb +58 -0
- data/spec/models/mrr_by_policy_inner_spec.rb +48 -0
- data/spec/models/mrr_spec.rb +60 -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/stripe_price_recurring_spec.rb +46 -0
- data/spec/models/stripe_price_spec.rb +6 -0
- data/spec/models/subscription_stats_spec.rb +96 -0
- data/spec/models/token_spec.rb +1 -1
- data/spec/models/update_integration_spec.rb +6 -0
- metadata +41 -1
|
@@ -48,6 +48,15 @@ module LicenseManager
|
|
|
48
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
49
|
attr_accessor :can_refund
|
|
50
50
|
|
|
51
|
+
# Whether the API key has the optional Subscriptions: Write permission, checked when connecting and every day. Without it, subscription licenses can't be canceled from the app: cancel their subscriptions from Stripe.
|
|
52
|
+
attr_accessor :can_manage_subscriptions
|
|
53
|
+
|
|
54
|
+
# Whether the API key has the optional Customer portal: Write permission, checked when connecting and every day. Without it, the license portal doesn't link to the Stripe customer portal.
|
|
55
|
+
attr_accessor :can_billing_portal
|
|
56
|
+
|
|
57
|
+
# Days a subscription license stays valid after its period ends while its renewal is unpaid, as Stripe retries the payment. 7 by default.
|
|
58
|
+
attr_accessor :subscription_grace_days
|
|
59
|
+
|
|
51
60
|
attr_accessor :created_at
|
|
52
61
|
|
|
53
62
|
class EnumAttributeValidator
|
|
@@ -87,6 +96,9 @@ module LicenseManager
|
|
|
87
96
|
:'last_event_at' => :'lastEventAt',
|
|
88
97
|
:'auto_refund' => :'autoRefund',
|
|
89
98
|
:'can_refund' => :'canRefund',
|
|
99
|
+
:'can_manage_subscriptions' => :'canManageSubscriptions',
|
|
100
|
+
:'can_billing_portal' => :'canBillingPortal',
|
|
101
|
+
:'subscription_grace_days' => :'subscriptionGraceDays',
|
|
90
102
|
:'created_at' => :'createdAt'
|
|
91
103
|
}
|
|
92
104
|
end
|
|
@@ -116,6 +128,9 @@ module LicenseManager
|
|
|
116
128
|
:'last_event_at' => :'Time',
|
|
117
129
|
:'auto_refund' => :'Boolean',
|
|
118
130
|
:'can_refund' => :'Boolean',
|
|
131
|
+
:'can_manage_subscriptions' => :'Boolean',
|
|
132
|
+
:'can_billing_portal' => :'Boolean',
|
|
133
|
+
:'subscription_grace_days' => :'Integer',
|
|
119
134
|
:'created_at' => :'Time'
|
|
120
135
|
}
|
|
121
136
|
end
|
|
@@ -228,6 +243,24 @@ module LicenseManager
|
|
|
228
243
|
self.can_refund = nil
|
|
229
244
|
end
|
|
230
245
|
|
|
246
|
+
if attributes.key?(:'can_manage_subscriptions')
|
|
247
|
+
self.can_manage_subscriptions = attributes[:'can_manage_subscriptions']
|
|
248
|
+
else
|
|
249
|
+
self.can_manage_subscriptions = nil
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
if attributes.key?(:'can_billing_portal')
|
|
253
|
+
self.can_billing_portal = attributes[:'can_billing_portal']
|
|
254
|
+
else
|
|
255
|
+
self.can_billing_portal = nil
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
if attributes.key?(:'subscription_grace_days')
|
|
259
|
+
self.subscription_grace_days = attributes[:'subscription_grace_days']
|
|
260
|
+
else
|
|
261
|
+
self.subscription_grace_days = nil
|
|
262
|
+
end
|
|
263
|
+
|
|
231
264
|
if attributes.key?(:'created_at')
|
|
232
265
|
self.created_at = attributes[:'created_at']
|
|
233
266
|
else
|
|
@@ -272,6 +305,18 @@ module LicenseManager
|
|
|
272
305
|
invalid_properties.push('invalid value for "can_refund", can_refund cannot be nil.')
|
|
273
306
|
end
|
|
274
307
|
|
|
308
|
+
if @can_manage_subscriptions.nil?
|
|
309
|
+
invalid_properties.push('invalid value for "can_manage_subscriptions", can_manage_subscriptions cannot be nil.')
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
if @can_billing_portal.nil?
|
|
313
|
+
invalid_properties.push('invalid value for "can_billing_portal", can_billing_portal cannot be nil.')
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
if @subscription_grace_days.nil?
|
|
317
|
+
invalid_properties.push('invalid value for "subscription_grace_days", subscription_grace_days cannot be nil.')
|
|
318
|
+
end
|
|
319
|
+
|
|
275
320
|
if @created_at.nil?
|
|
276
321
|
invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
|
|
277
322
|
end
|
|
@@ -293,6 +338,9 @@ module LicenseManager
|
|
|
293
338
|
return false if @status.nil?
|
|
294
339
|
return false if @auto_refund.nil?
|
|
295
340
|
return false if @can_refund.nil?
|
|
341
|
+
return false if @can_manage_subscriptions.nil?
|
|
342
|
+
return false if @can_billing_portal.nil?
|
|
343
|
+
return false if @subscription_grace_days.nil?
|
|
296
344
|
return false if @created_at.nil?
|
|
297
345
|
true
|
|
298
346
|
end
|
|
@@ -377,6 +425,36 @@ module LicenseManager
|
|
|
377
425
|
@can_refund = can_refund
|
|
378
426
|
end
|
|
379
427
|
|
|
428
|
+
# Custom attribute writer method with validation
|
|
429
|
+
# @param [Object] can_manage_subscriptions Value to be assigned
|
|
430
|
+
def can_manage_subscriptions=(can_manage_subscriptions)
|
|
431
|
+
if can_manage_subscriptions.nil?
|
|
432
|
+
fail ArgumentError, 'can_manage_subscriptions cannot be nil'
|
|
433
|
+
end
|
|
434
|
+
|
|
435
|
+
@can_manage_subscriptions = can_manage_subscriptions
|
|
436
|
+
end
|
|
437
|
+
|
|
438
|
+
# Custom attribute writer method with validation
|
|
439
|
+
# @param [Object] can_billing_portal Value to be assigned
|
|
440
|
+
def can_billing_portal=(can_billing_portal)
|
|
441
|
+
if can_billing_portal.nil?
|
|
442
|
+
fail ArgumentError, 'can_billing_portal cannot be nil'
|
|
443
|
+
end
|
|
444
|
+
|
|
445
|
+
@can_billing_portal = can_billing_portal
|
|
446
|
+
end
|
|
447
|
+
|
|
448
|
+
# Custom attribute writer method with validation
|
|
449
|
+
# @param [Object] subscription_grace_days Value to be assigned
|
|
450
|
+
def subscription_grace_days=(subscription_grace_days)
|
|
451
|
+
if subscription_grace_days.nil?
|
|
452
|
+
fail ArgumentError, 'subscription_grace_days cannot be nil'
|
|
453
|
+
end
|
|
454
|
+
|
|
455
|
+
@subscription_grace_days = subscription_grace_days
|
|
456
|
+
end
|
|
457
|
+
|
|
380
458
|
# Custom attribute writer method with validation
|
|
381
459
|
# @param [Object] created_at Value to be assigned
|
|
382
460
|
def created_at=(created_at)
|
|
@@ -404,6 +482,9 @@ module LicenseManager
|
|
|
404
482
|
last_event_at == o.last_event_at &&
|
|
405
483
|
auto_refund == o.auto_refund &&
|
|
406
484
|
can_refund == o.can_refund &&
|
|
485
|
+
can_manage_subscriptions == o.can_manage_subscriptions &&
|
|
486
|
+
can_billing_portal == o.can_billing_portal &&
|
|
487
|
+
subscription_grace_days == o.subscription_grace_days &&
|
|
407
488
|
created_at == o.created_at
|
|
408
489
|
end
|
|
409
490
|
|
|
@@ -416,7 +497,7 @@ module LicenseManager
|
|
|
416
497
|
# Calculates hash code according to all attributes.
|
|
417
498
|
# @return [Integer] Hash code
|
|
418
499
|
def 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
|
|
500
|
+
[id, provider, livemode, account_name, api_key_hint, webhook_url, status, status_reason, last_checked_at, last_event_at, auto_refund, can_refund, can_manage_subscriptions, can_billing_portal, subscription_grace_days, created_at].hash
|
|
420
501
|
end
|
|
421
502
|
|
|
422
503
|
# Builds the object from hash
|
|
@@ -32,6 +32,8 @@ module LicenseManager
|
|
|
32
32
|
|
|
33
33
|
attr_accessor :price
|
|
34
34
|
|
|
35
|
+
attr_accessor :recurring
|
|
36
|
+
|
|
35
37
|
# `error` when the price can no longer be paid, explained by `statusReason`.
|
|
36
38
|
attr_accessor :status
|
|
37
39
|
|
|
@@ -72,6 +74,7 @@ module LicenseManager
|
|
|
72
74
|
:'stripe_price_id' => :'stripePriceId',
|
|
73
75
|
:'product_name' => :'productName',
|
|
74
76
|
:'price' => :'price',
|
|
77
|
+
:'recurring' => :'recurring',
|
|
75
78
|
:'status' => :'status',
|
|
76
79
|
:'status_reason' => :'statusReason',
|
|
77
80
|
:'created_at' => :'createdAt'
|
|
@@ -99,6 +102,7 @@ module LicenseManager
|
|
|
99
102
|
:'stripe_price_id' => :'String',
|
|
100
103
|
:'product_name' => :'String',
|
|
101
104
|
:'price' => :'Price',
|
|
105
|
+
:'recurring' => :'IntegrationMappingRecurring',
|
|
102
106
|
:'status' => :'String',
|
|
103
107
|
:'status_reason' => :'String',
|
|
104
108
|
:'created_at' => :'Time'
|
|
@@ -109,6 +113,7 @@ module LicenseManager
|
|
|
109
113
|
def self.openapi_nullable
|
|
110
114
|
Set.new([
|
|
111
115
|
:'price',
|
|
116
|
+
:'recurring',
|
|
112
117
|
:'status_reason',
|
|
113
118
|
])
|
|
114
119
|
end
|
|
@@ -187,6 +192,12 @@ module LicenseManager
|
|
|
187
192
|
self.price = nil
|
|
188
193
|
end
|
|
189
194
|
|
|
195
|
+
if attributes.key?(:'recurring')
|
|
196
|
+
self.recurring = attributes[:'recurring']
|
|
197
|
+
else
|
|
198
|
+
self.recurring = nil
|
|
199
|
+
end
|
|
200
|
+
|
|
190
201
|
if attributes.key?(:'status')
|
|
191
202
|
self.status = attributes[:'status']
|
|
192
203
|
else
|
|
@@ -371,6 +382,7 @@ module LicenseManager
|
|
|
371
382
|
stripe_price_id == o.stripe_price_id &&
|
|
372
383
|
product_name == o.product_name &&
|
|
373
384
|
price == o.price &&
|
|
385
|
+
recurring == o.recurring &&
|
|
374
386
|
status == o.status &&
|
|
375
387
|
status_reason == o.status_reason &&
|
|
376
388
|
created_at == o.created_at
|
|
@@ -385,7 +397,7 @@ module LicenseManager
|
|
|
385
397
|
# Calculates hash code according to all attributes.
|
|
386
398
|
# @return [Integer] Hash code
|
|
387
399
|
def hash
|
|
388
|
-
[id, integration_id, product_id, policy_id, stripe_product_id, stripe_price_id, product_name, price, status, status_reason, created_at].hash
|
|
400
|
+
[id, integration_id, product_id, policy_id, stripe_product_id, stripe_price_id, product_name, price, recurring, status, status_reason, created_at].hash
|
|
389
401
|
end
|
|
390
402
|
|
|
391
403
|
# Builds the object from hash
|
|
@@ -0,0 +1,228 @@
|
|
|
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
|
+
# Billing period of a recurring price, `null` for a one-time price. Subscribing to a recurring price creates one subscription license, valid while it's paid.
|
|
18
|
+
class IntegrationMappingRecurring < ApiModelBase
|
|
19
|
+
attr_accessor :interval
|
|
20
|
+
|
|
21
|
+
attr_accessor :interval_count
|
|
22
|
+
|
|
23
|
+
class EnumAttributeValidator
|
|
24
|
+
attr_reader :datatype
|
|
25
|
+
attr_reader :allowable_values
|
|
26
|
+
|
|
27
|
+
def initialize(datatype, allowable_values)
|
|
28
|
+
@allowable_values = allowable_values.map do |value|
|
|
29
|
+
case datatype.to_s
|
|
30
|
+
when /Integer/i
|
|
31
|
+
value.to_i
|
|
32
|
+
when /Float/i
|
|
33
|
+
value.to_f
|
|
34
|
+
else
|
|
35
|
+
value
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def valid?(value)
|
|
41
|
+
!value || allowable_values.include?(value)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
46
|
+
def self.attribute_map
|
|
47
|
+
{
|
|
48
|
+
:'interval' => :'interval',
|
|
49
|
+
:'interval_count' => :'intervalCount'
|
|
50
|
+
}
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Returns attribute mapping this model knows about
|
|
54
|
+
def self.acceptable_attribute_map
|
|
55
|
+
attribute_map
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Returns all the JSON keys this model knows about
|
|
59
|
+
def self.acceptable_attributes
|
|
60
|
+
acceptable_attribute_map.values
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Attribute type mapping.
|
|
64
|
+
def self.openapi_types
|
|
65
|
+
{
|
|
66
|
+
:'interval' => :'String',
|
|
67
|
+
:'interval_count' => :'Integer'
|
|
68
|
+
}
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# List of attributes with nullable: true
|
|
72
|
+
def self.openapi_nullable
|
|
73
|
+
Set.new([
|
|
74
|
+
])
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Returns attribute type mapping
|
|
78
|
+
def self.acceptable_openapi_types
|
|
79
|
+
openapi_types
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Returns the nullable attributes
|
|
83
|
+
def self.acceptable_openapi_nullable
|
|
84
|
+
openapi_nullable
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Initializes the object
|
|
88
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
89
|
+
def initialize(attributes = {})
|
|
90
|
+
if (!attributes.is_a?(Hash))
|
|
91
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `LicenseManager::IntegrationMappingRecurring` initialize method"
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
95
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
96
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
97
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
98
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `LicenseManager::IntegrationMappingRecurring`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
99
|
+
end
|
|
100
|
+
h[k.to_sym] = v
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if attributes.key?(:'interval')
|
|
104
|
+
self.interval = attributes[:'interval']
|
|
105
|
+
else
|
|
106
|
+
self.interval = nil
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
if attributes.key?(:'interval_count')
|
|
110
|
+
self.interval_count = attributes[:'interval_count']
|
|
111
|
+
else
|
|
112
|
+
self.interval_count = nil
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
117
|
+
# @return Array for valid properties with the reasons
|
|
118
|
+
def list_invalid_properties
|
|
119
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
120
|
+
invalid_properties = Array.new
|
|
121
|
+
if @interval.nil?
|
|
122
|
+
invalid_properties.push('invalid value for "interval", interval cannot be nil.')
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
if @interval_count.nil?
|
|
126
|
+
invalid_properties.push('invalid value for "interval_count", interval_count cannot be nil.')
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
invalid_properties
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# Check to see if the all the properties in the model are valid
|
|
133
|
+
# @return true if the model is valid
|
|
134
|
+
def valid?
|
|
135
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
136
|
+
return false if @interval.nil?
|
|
137
|
+
interval_validator = EnumAttributeValidator.new('String', ["day", "week", "month", "year", "unknown_default_open_api"])
|
|
138
|
+
return false unless interval_validator.valid?(@interval)
|
|
139
|
+
return false if @interval_count.nil?
|
|
140
|
+
true
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
144
|
+
# @param [Object] interval Object to be assigned
|
|
145
|
+
def interval=(interval)
|
|
146
|
+
validator = EnumAttributeValidator.new('String', ["day", "week", "month", "year", "unknown_default_open_api"])
|
|
147
|
+
unless validator.valid?(interval)
|
|
148
|
+
fail ArgumentError, "invalid value for \"interval\", must be one of #{validator.allowable_values}."
|
|
149
|
+
end
|
|
150
|
+
@interval = interval
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# Custom attribute writer method with validation
|
|
154
|
+
# @param [Object] interval_count Value to be assigned
|
|
155
|
+
def interval_count=(interval_count)
|
|
156
|
+
if interval_count.nil?
|
|
157
|
+
fail ArgumentError, 'interval_count cannot be nil'
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
@interval_count = interval_count
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# Checks equality by comparing each attribute.
|
|
164
|
+
# @param [Object] Object to be compared
|
|
165
|
+
def ==(o)
|
|
166
|
+
return true if self.equal?(o)
|
|
167
|
+
self.class == o.class &&
|
|
168
|
+
interval == o.interval &&
|
|
169
|
+
interval_count == o.interval_count
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# @see the `==` method
|
|
173
|
+
# @param [Object] Object to be compared
|
|
174
|
+
def eql?(o)
|
|
175
|
+
self == o
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
# Calculates hash code according to all attributes.
|
|
179
|
+
# @return [Integer] Hash code
|
|
180
|
+
def hash
|
|
181
|
+
[interval, interval_count].hash
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# Builds the object from hash
|
|
185
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
186
|
+
# @return [Object] Returns the model itself
|
|
187
|
+
def self.build_from_hash(attributes)
|
|
188
|
+
return nil unless attributes.is_a?(Hash)
|
|
189
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
190
|
+
# include attributes inherited from allOf parents (the nearest declaration wins)
|
|
191
|
+
map = acceptable_attribute_map
|
|
192
|
+
transformed_hash = {}
|
|
193
|
+
acceptable_openapi_types.each_pair do |key, type|
|
|
194
|
+
if attributes.key?(map[key]) && attributes[map[key]].nil?
|
|
195
|
+
transformed_hash["#{key}"] = nil
|
|
196
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
197
|
+
# check to ensure the input is an array given that the attribute
|
|
198
|
+
# is documented as an array but the input is not
|
|
199
|
+
if attributes[map[key]].is_a?(Array)
|
|
200
|
+
transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
|
|
201
|
+
end
|
|
202
|
+
elsif !attributes[map[key]].nil?
|
|
203
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
|
|
204
|
+
end
|
|
205
|
+
end
|
|
206
|
+
new(transformed_hash)
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
# Returns the object in the form of hash
|
|
210
|
+
# @return [Hash] Returns the object in the form of hash
|
|
211
|
+
def to_hash
|
|
212
|
+
hash = {}
|
|
213
|
+
# include attributes inherited from allOf parents (the nearest declaration wins)
|
|
214
|
+
self.class.acceptable_attribute_map.each_pair do |attr, param|
|
|
215
|
+
value = self.send(attr)
|
|
216
|
+
if value.nil?
|
|
217
|
+
is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
|
|
218
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
hash[param] = _to_hash(value)
|
|
222
|
+
end
|
|
223
|
+
hash
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
end
|
|
@@ -23,6 +23,8 @@ module LicenseManager
|
|
|
23
23
|
|
|
24
24
|
attr_accessor :customer_id
|
|
25
25
|
|
|
26
|
+
attr_accessor :customer
|
|
27
|
+
|
|
26
28
|
# Unique within the product. Case sensitive: `validateKey` compares keys exactly.
|
|
27
29
|
attr_accessor :key
|
|
28
30
|
|
|
@@ -63,6 +65,8 @@ module LicenseManager
|
|
|
63
65
|
|
|
64
66
|
attr_accessor :cancellation_reason
|
|
65
67
|
|
|
68
|
+
attr_accessor :subscription
|
|
69
|
+
|
|
66
70
|
# Comment given when the license was canceled. `null` when there's none.
|
|
67
71
|
attr_accessor :cancellation_comment
|
|
68
72
|
|
|
@@ -101,6 +105,7 @@ module LicenseManager
|
|
|
101
105
|
:'product_id' => :'productId',
|
|
102
106
|
:'policy_id' => :'policyId',
|
|
103
107
|
:'customer_id' => :'customerId',
|
|
108
|
+
:'customer' => :'customer',
|
|
104
109
|
:'key' => :'key',
|
|
105
110
|
:'created_at' => :'createdAt',
|
|
106
111
|
:'expires_at' => :'expiresAt',
|
|
@@ -116,6 +121,7 @@ module LicenseManager
|
|
|
116
121
|
:'cancellable_until' => :'cancellableUntil',
|
|
117
122
|
:'canceled_at' => :'canceledAt',
|
|
118
123
|
:'cancellation_reason' => :'cancellationReason',
|
|
124
|
+
:'subscription' => :'subscription',
|
|
119
125
|
:'cancellation_comment' => :'cancellationComment',
|
|
120
126
|
:'stripe_refund_id' => :'stripeRefundId',
|
|
121
127
|
:'updated_at' => :'updatedAt'
|
|
@@ -139,6 +145,7 @@ module LicenseManager
|
|
|
139
145
|
:'product_id' => :'String',
|
|
140
146
|
:'policy_id' => :'String',
|
|
141
147
|
:'customer_id' => :'String',
|
|
148
|
+
:'customer' => :'LicenseCustomer',
|
|
142
149
|
:'key' => :'String',
|
|
143
150
|
:'created_at' => :'Time',
|
|
144
151
|
:'expires_at' => :'Time',
|
|
@@ -154,6 +161,7 @@ module LicenseManager
|
|
|
154
161
|
:'cancellable_until' => :'Time',
|
|
155
162
|
:'canceled_at' => :'Time',
|
|
156
163
|
:'cancellation_reason' => :'CancellationReason',
|
|
164
|
+
:'subscription' => :'LicenseSubscription',
|
|
157
165
|
:'cancellation_comment' => :'String',
|
|
158
166
|
:'stripe_refund_id' => :'String',
|
|
159
167
|
:'updated_at' => :'Time'
|
|
@@ -171,6 +179,7 @@ module LicenseManager
|
|
|
171
179
|
:'price',
|
|
172
180
|
:'cancellable_until',
|
|
173
181
|
:'canceled_at',
|
|
182
|
+
:'subscription',
|
|
174
183
|
:'cancellation_comment',
|
|
175
184
|
:'stripe_refund_id',
|
|
176
185
|
])
|
|
@@ -226,6 +235,12 @@ module LicenseManager
|
|
|
226
235
|
self.customer_id = nil
|
|
227
236
|
end
|
|
228
237
|
|
|
238
|
+
if attributes.key?(:'customer')
|
|
239
|
+
self.customer = attributes[:'customer']
|
|
240
|
+
else
|
|
241
|
+
self.customer = nil
|
|
242
|
+
end
|
|
243
|
+
|
|
229
244
|
if attributes.key?(:'key')
|
|
230
245
|
self.key = attributes[:'key']
|
|
231
246
|
else
|
|
@@ -318,6 +333,12 @@ module LicenseManager
|
|
|
318
333
|
self.cancellation_reason = nil
|
|
319
334
|
end
|
|
320
335
|
|
|
336
|
+
if attributes.key?(:'subscription')
|
|
337
|
+
self.subscription = attributes[:'subscription']
|
|
338
|
+
else
|
|
339
|
+
self.subscription = nil
|
|
340
|
+
end
|
|
341
|
+
|
|
321
342
|
if attributes.key?(:'cancellation_comment')
|
|
322
343
|
self.cancellation_comment = attributes[:'cancellation_comment']
|
|
323
344
|
else
|
|
@@ -358,6 +379,10 @@ module LicenseManager
|
|
|
358
379
|
invalid_properties.push('invalid value for "customer_id", customer_id cannot be nil.')
|
|
359
380
|
end
|
|
360
381
|
|
|
382
|
+
if @customer.nil?
|
|
383
|
+
invalid_properties.push('invalid value for "customer", customer cannot be nil.')
|
|
384
|
+
end
|
|
385
|
+
|
|
361
386
|
if @key.nil?
|
|
362
387
|
invalid_properties.push('invalid value for "key", key cannot be nil.')
|
|
363
388
|
end
|
|
@@ -401,6 +426,7 @@ module LicenseManager
|
|
|
401
426
|
return false if @product_id.nil?
|
|
402
427
|
return false if @policy_id.nil?
|
|
403
428
|
return false if @customer_id.nil?
|
|
429
|
+
return false if @customer.nil?
|
|
404
430
|
return false if @key.nil?
|
|
405
431
|
return false if @created_at.nil?
|
|
406
432
|
return false if @max_offline_duration_seconds.nil?
|
|
@@ -452,6 +478,16 @@ module LicenseManager
|
|
|
452
478
|
@customer_id = customer_id
|
|
453
479
|
end
|
|
454
480
|
|
|
481
|
+
# Custom attribute writer method with validation
|
|
482
|
+
# @param [Object] customer Value to be assigned
|
|
483
|
+
def customer=(customer)
|
|
484
|
+
if customer.nil?
|
|
485
|
+
fail ArgumentError, 'customer cannot be nil'
|
|
486
|
+
end
|
|
487
|
+
|
|
488
|
+
@customer = customer
|
|
489
|
+
end
|
|
490
|
+
|
|
455
491
|
# Custom attribute writer method with validation
|
|
456
492
|
# @param [Object] key Value to be assigned
|
|
457
493
|
def key=(key)
|
|
@@ -541,6 +577,7 @@ module LicenseManager
|
|
|
541
577
|
product_id == o.product_id &&
|
|
542
578
|
policy_id == o.policy_id &&
|
|
543
579
|
customer_id == o.customer_id &&
|
|
580
|
+
customer == o.customer &&
|
|
544
581
|
key == o.key &&
|
|
545
582
|
created_at == o.created_at &&
|
|
546
583
|
expires_at == o.expires_at &&
|
|
@@ -556,6 +593,7 @@ module LicenseManager
|
|
|
556
593
|
cancellable_until == o.cancellable_until &&
|
|
557
594
|
canceled_at == o.canceled_at &&
|
|
558
595
|
cancellation_reason == o.cancellation_reason &&
|
|
596
|
+
subscription == o.subscription &&
|
|
559
597
|
cancellation_comment == o.cancellation_comment &&
|
|
560
598
|
stripe_refund_id == o.stripe_refund_id &&
|
|
561
599
|
updated_at == o.updated_at
|
|
@@ -570,7 +608,7 @@ module LicenseManager
|
|
|
570
608
|
# Calculates hash code according to all attributes.
|
|
571
609
|
# @return [Integer] Hash code
|
|
572
610
|
def hash
|
|
573
|
-
[id, product_id, policy_id, customer_id, key, created_at, expires_at, meta, stripe_payment_intent_id, max_machines, max_offline_duration_seconds, active_machine_count, last_activated_at, max_version, price, status, cancellable_until, canceled_at, cancellation_reason, cancellation_comment, stripe_refund_id, updated_at].hash
|
|
611
|
+
[id, product_id, policy_id, customer_id, customer, key, created_at, expires_at, meta, stripe_payment_intent_id, max_machines, max_offline_duration_seconds, active_machine_count, last_activated_at, max_version, price, status, cancellable_until, canceled_at, cancellation_reason, subscription, cancellation_comment, stripe_refund_id, updated_at].hash
|
|
574
612
|
end
|
|
575
613
|
|
|
576
614
|
# Builds the object from hash
|