license_manager 0.1.1 → 0.3.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.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +152 -0
  3. data/README.md +3 -3
  4. data/docs/BillingPortalSession.md +18 -0
  5. data/docs/CancelLicense.md +22 -0
  6. data/docs/CancellationReason.md +15 -0
  7. data/docs/CancellationStats.md +30 -0
  8. data/docs/CancellationStatsByReasonInner.md +20 -0
  9. data/docs/ConnectStripe.md +1 -1
  10. data/docs/CreateBillingPortalSession.md +18 -0
  11. data/docs/CreateIntegrationMapping.md +1 -1
  12. data/docs/CreateLicense.md +2 -0
  13. data/docs/CreatePolicy.md +3 -1
  14. data/docs/CreateProductWithPolicy.md +1 -1
  15. data/docs/CreateToken.md +1 -1
  16. data/docs/EventActorOneOf.md +1 -1
  17. data/docs/Integration.md +11 -1
  18. data/docs/IntegrationMapping.md +2 -0
  19. data/docs/IntegrationMappingRecurring.md +20 -0
  20. data/docs/IntegrationsApi.md +74 -0
  21. data/docs/License.md +12 -0
  22. data/docs/LicenseSubscription.md +34 -0
  23. data/docs/LicensesApi.md +80 -3
  24. data/docs/Machine.md +3 -1
  25. data/docs/MachinesApi.md +1 -1
  26. data/docs/Mrr.md +26 -0
  27. data/docs/MrrByIntervalInner.md +24 -0
  28. data/docs/MrrByPolicyInner.md +22 -0
  29. data/docs/Policy.md +2 -0
  30. data/docs/PolicySettings.md +3 -1
  31. data/docs/PortalApi.md +80 -1
  32. data/docs/PortalLink.md +2 -2
  33. data/docs/Product.md +2 -0
  34. data/docs/ProductStats.md +8 -4
  35. data/docs/ProductsApi.md +2 -2
  36. data/docs/Revenue.md +10 -2
  37. data/docs/StripeIntegration.md +1 -1
  38. data/docs/StripePermission.md +5 -1
  39. data/docs/StripePrice.md +2 -0
  40. data/docs/StripePriceRecurring.md +20 -0
  41. data/docs/SubscriptionStats.md +38 -0
  42. data/docs/UpdateIntegration.md +20 -0
  43. data/docs/UpdateLicense.md +3 -1
  44. data/docs/UpdatePolicy.md +3 -1
  45. data/docs/UpdateProduct.md +3 -1
  46. data/lib/license_manager/api/integrations_api.rb +74 -0
  47. data/lib/license_manager/api/licenses_api.rb +80 -6
  48. data/lib/license_manager/api/machines_api.rb +3 -3
  49. data/lib/license_manager/api/portal_api.rb +72 -2
  50. data/lib/license_manager/api/products_api.rb +4 -4
  51. data/lib/license_manager/models/billing_portal_session.rb +178 -0
  52. data/lib/license_manager/models/cancel_license.rb +238 -0
  53. data/lib/license_manager/models/cancellation_reason.rb +45 -0
  54. data/lib/license_manager/models/cancellation_stats.rb +347 -0
  55. data/lib/license_manager/models/cancellation_stats_by_reason_inner.rb +225 -0
  56. data/lib/license_manager/models/connect_stripe.rb +1 -1
  57. data/lib/license_manager/models/create_billing_portal_session.rb +161 -0
  58. data/lib/license_manager/models/create_integration_mapping.rb +1 -1
  59. data/lib/license_manager/models/create_license.rb +12 -1
  60. data/lib/license_manager/models/create_policy.rb +40 -5
  61. data/lib/license_manager/models/create_product_with_policy.rb +1 -1
  62. data/lib/license_manager/models/create_token.rb +1 -1
  63. data/lib/license_manager/models/event_type.rb +7 -1
  64. data/lib/license_manager/models/integration.rb +136 -1
  65. data/lib/license_manager/models/integration_mapping.rb +13 -1
  66. data/lib/license_manager/models/integration_mapping_recurring.rb +228 -0
  67. data/lib/license_manager/models/license.rb +91 -1
  68. data/lib/license_manager/models/license_status.rb +2 -1
  69. data/lib/license_manager/models/license_subscription.rb +388 -0
  70. data/lib/license_manager/models/machine.rb +17 -4
  71. data/lib/license_manager/models/mrr.rb +291 -0
  72. data/lib/license_manager/models/mrr_by_interval_inner.rb +279 -0
  73. data/lib/license_manager/models/mrr_by_policy_inner.rb +229 -0
  74. data/lib/license_manager/models/policy.rb +14 -1
  75. data/lib/license_manager/models/policy_settings.rb +40 -5
  76. data/lib/license_manager/models/portal_link.rb +1 -1
  77. data/lib/license_manager/models/product.rb +28 -1
  78. data/lib/license_manager/models/product_stats.rb +31 -5
  79. data/lib/license_manager/models/revenue.rb +112 -4
  80. data/lib/license_manager/models/stripe_integration.rb +1 -1
  81. data/lib/license_manager/models/stripe_permission.rb +58 -4
  82. data/lib/license_manager/models/stripe_price.rb +13 -1
  83. data/lib/license_manager/models/stripe_price_recurring.rb +228 -0
  84. data/lib/license_manager/models/subscription_stats.rb +456 -0
  85. data/lib/license_manager/models/update_integration.rb +199 -0
  86. data/lib/license_manager/models/update_license.rb +16 -5
  87. data/lib/license_manager/models/update_policy.rb +40 -5
  88. data/lib/license_manager/models/update_product.rb +14 -4
  89. data/lib/license_manager/version.rb +1 -1
  90. data/lib/license_manager.rb +14 -0
  91. data/openapi.json +1146 -59
  92. data/spec/api/integrations_api_spec.rb +13 -0
  93. data/spec/api/licenses_api_spec.rb +16 -3
  94. data/spec/api/machines_api_spec.rb +1 -1
  95. data/spec/api/portal_api_spec.rb +14 -1
  96. data/spec/api/products_api_spec.rb +2 -2
  97. data/spec/models/billing_portal_session_spec.rb +36 -0
  98. data/spec/models/cancel_license_spec.rb +48 -0
  99. data/spec/models/cancellation_reason_spec.rb +30 -0
  100. data/spec/models/cancellation_stats_by_reason_inner_spec.rb +42 -0
  101. data/spec/models/cancellation_stats_spec.rb +72 -0
  102. data/spec/models/create_billing_portal_session_spec.rb +36 -0
  103. data/spec/models/create_license_spec.rb +6 -0
  104. data/spec/models/create_policy_spec.rb +6 -0
  105. data/spec/models/create_token_spec.rb +1 -1
  106. data/spec/models/integration_mapping_recurring_spec.rb +46 -0
  107. data/spec/models/integration_mapping_spec.rb +6 -0
  108. data/spec/models/integration_spec.rb +30 -0
  109. data/spec/models/license_spec.rb +36 -0
  110. data/spec/models/license_subscription_spec.rb +88 -0
  111. data/spec/models/machine_spec.rb +7 -1
  112. data/spec/models/mrr_by_interval_inner_spec.rb +58 -0
  113. data/spec/models/mrr_by_policy_inner_spec.rb +48 -0
  114. data/spec/models/mrr_spec.rb +60 -0
  115. data/spec/models/policy_settings_spec.rb +6 -0
  116. data/spec/models/policy_spec.rb +6 -0
  117. data/spec/models/product_spec.rb +6 -0
  118. data/spec/models/product_stats_spec.rb +12 -0
  119. data/spec/models/revenue_spec.rb +24 -0
  120. data/spec/models/stripe_permission_spec.rb +12 -0
  121. data/spec/models/stripe_price_recurring_spec.rb +46 -0
  122. data/spec/models/stripe_price_spec.rb +6 -0
  123. data/spec/models/subscription_stats_spec.rb +96 -0
  124. data/spec/models/token_spec.rb +1 -1
  125. data/spec/models/update_integration_spec.rb +42 -0
  126. data/spec/models/update_license_spec.rb +6 -0
  127. data/spec/models/update_policy_spec.rb +6 -0
  128. data/spec/models/update_product_spec.rb +6 -0
  129. metadata +57 -1
@@ -0,0 +1,347 @@
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
+ # Cancellations of the licenses with a money back guarantee. Licenses canceled without one are left out.
18
+ class CancellationStats < ApiModelBase
19
+ # Number of licenses with a money back guarantee: a `cancellableUntil`.
20
+ attr_accessor :license_count
21
+
22
+ # Number of them that were canceled.
23
+ attr_accessor :canceled_license_count
24
+
25
+ # Number of them whose money back guarantee hasn't ended, and that weren't canceled: they can still be.
26
+ attr_accessor :cancellable_license_count
27
+
28
+ # Share of them that were canceled, from 0 to 1: `canceledLicenseCount` over `licenseCount`.
29
+ attr_accessor :rate
30
+
31
+ # Number of them canceled each day, aligned on `days`, on the day of their cancellation.
32
+ attr_accessor :canceled_by_day
33
+
34
+ # Number of them canceled each month, aligned on `months`, on the month of their cancellation.
35
+ attr_accessor :canceled_by_month
36
+
37
+ # Number of them canceled for each reason, from the most given one. Reasons never given are left out.
38
+ attr_accessor :by_reason
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'license_count' => :'licenseCount',
44
+ :'canceled_license_count' => :'canceledLicenseCount',
45
+ :'cancellable_license_count' => :'cancellableLicenseCount',
46
+ :'rate' => :'rate',
47
+ :'canceled_by_day' => :'canceledByDay',
48
+ :'canceled_by_month' => :'canceledByMonth',
49
+ :'by_reason' => :'byReason'
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
+ :'license_count' => :'Integer',
67
+ :'canceled_license_count' => :'Integer',
68
+ :'cancellable_license_count' => :'Integer',
69
+ :'rate' => :'Float',
70
+ :'canceled_by_day' => :'Array<Integer>',
71
+ :'canceled_by_month' => :'Array<Integer>',
72
+ :'by_reason' => :'Array<CancellationStatsByReasonInner>'
73
+ }
74
+ end
75
+
76
+ # List of attributes with nullable: true
77
+ def self.openapi_nullable
78
+ Set.new([
79
+ ])
80
+ end
81
+
82
+ # Returns attribute type mapping
83
+ def self.acceptable_openapi_types
84
+ openapi_types
85
+ end
86
+
87
+ # Returns the nullable attributes
88
+ def self.acceptable_openapi_nullable
89
+ openapi_nullable
90
+ end
91
+
92
+ # Initializes the object
93
+ # @param [Hash] attributes Model attributes in the form of hash
94
+ def initialize(attributes = {})
95
+ if (!attributes.is_a?(Hash))
96
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LicenseManager::CancellationStats` initialize method"
97
+ end
98
+
99
+ # check to see if the attribute exists and convert string to symbol for hash key
100
+ acceptable_attribute_map = self.class.acceptable_attribute_map
101
+ attributes = attributes.each_with_object({}) { |(k, v), h|
102
+ if (!acceptable_attribute_map.key?(k.to_sym))
103
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LicenseManager::CancellationStats`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
104
+ end
105
+ h[k.to_sym] = v
106
+ }
107
+
108
+ if attributes.key?(:'license_count')
109
+ self.license_count = attributes[:'license_count']
110
+ else
111
+ self.license_count = nil
112
+ end
113
+
114
+ if attributes.key?(:'canceled_license_count')
115
+ self.canceled_license_count = attributes[:'canceled_license_count']
116
+ else
117
+ self.canceled_license_count = nil
118
+ end
119
+
120
+ if attributes.key?(:'cancellable_license_count')
121
+ self.cancellable_license_count = attributes[:'cancellable_license_count']
122
+ else
123
+ self.cancellable_license_count = nil
124
+ end
125
+
126
+ if attributes.key?(:'rate')
127
+ self.rate = attributes[:'rate']
128
+ else
129
+ self.rate = nil
130
+ end
131
+
132
+ if attributes.key?(:'canceled_by_day')
133
+ if (value = attributes[:'canceled_by_day']).is_a?(Array)
134
+ self.canceled_by_day = value
135
+ end
136
+ else
137
+ self.canceled_by_day = nil
138
+ end
139
+
140
+ if attributes.key?(:'canceled_by_month')
141
+ if (value = attributes[:'canceled_by_month']).is_a?(Array)
142
+ self.canceled_by_month = value
143
+ end
144
+ else
145
+ self.canceled_by_month = nil
146
+ end
147
+
148
+ if attributes.key?(:'by_reason')
149
+ if (value = attributes[:'by_reason']).is_a?(Array)
150
+ self.by_reason = value
151
+ end
152
+ else
153
+ self.by_reason = nil
154
+ end
155
+ end
156
+
157
+ # Show invalid properties with the reasons. Usually used together with valid?
158
+ # @return Array for valid properties with the reasons
159
+ def list_invalid_properties
160
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
161
+ invalid_properties = Array.new
162
+ if @license_count.nil?
163
+ invalid_properties.push('invalid value for "license_count", license_count cannot be nil.')
164
+ end
165
+
166
+ if @canceled_license_count.nil?
167
+ invalid_properties.push('invalid value for "canceled_license_count", canceled_license_count cannot be nil.')
168
+ end
169
+
170
+ if @cancellable_license_count.nil?
171
+ invalid_properties.push('invalid value for "cancellable_license_count", cancellable_license_count cannot be nil.')
172
+ end
173
+
174
+ if @rate.nil?
175
+ invalid_properties.push('invalid value for "rate", rate cannot be nil.')
176
+ end
177
+
178
+ if @canceled_by_day.nil?
179
+ invalid_properties.push('invalid value for "canceled_by_day", canceled_by_day cannot be nil.')
180
+ end
181
+
182
+ if @canceled_by_month.nil?
183
+ invalid_properties.push('invalid value for "canceled_by_month", canceled_by_month cannot be nil.')
184
+ end
185
+
186
+ if @by_reason.nil?
187
+ invalid_properties.push('invalid value for "by_reason", by_reason cannot be nil.')
188
+ end
189
+
190
+ invalid_properties
191
+ end
192
+
193
+ # Check to see if the all the properties in the model are valid
194
+ # @return true if the model is valid
195
+ def valid?
196
+ warn '[DEPRECATED] the `valid?` method is obsolete'
197
+ return false if @license_count.nil?
198
+ return false if @canceled_license_count.nil?
199
+ return false if @cancellable_license_count.nil?
200
+ return false if @rate.nil?
201
+ return false if @canceled_by_day.nil?
202
+ return false if @canceled_by_month.nil?
203
+ return false if @by_reason.nil?
204
+ true
205
+ end
206
+
207
+ # Custom attribute writer method with validation
208
+ # @param [Object] license_count Value to be assigned
209
+ def license_count=(license_count)
210
+ if license_count.nil?
211
+ fail ArgumentError, 'license_count cannot be nil'
212
+ end
213
+
214
+ @license_count = license_count
215
+ end
216
+
217
+ # Custom attribute writer method with validation
218
+ # @param [Object] canceled_license_count Value to be assigned
219
+ def canceled_license_count=(canceled_license_count)
220
+ if canceled_license_count.nil?
221
+ fail ArgumentError, 'canceled_license_count cannot be nil'
222
+ end
223
+
224
+ @canceled_license_count = canceled_license_count
225
+ end
226
+
227
+ # Custom attribute writer method with validation
228
+ # @param [Object] cancellable_license_count Value to be assigned
229
+ def cancellable_license_count=(cancellable_license_count)
230
+ if cancellable_license_count.nil?
231
+ fail ArgumentError, 'cancellable_license_count cannot be nil'
232
+ end
233
+
234
+ @cancellable_license_count = cancellable_license_count
235
+ end
236
+
237
+ # Custom attribute writer method with validation
238
+ # @param [Object] rate Value to be assigned
239
+ def rate=(rate)
240
+ if rate.nil?
241
+ fail ArgumentError, 'rate cannot be nil'
242
+ end
243
+
244
+ @rate = rate
245
+ end
246
+
247
+ # Custom attribute writer method with validation
248
+ # @param [Object] canceled_by_day Value to be assigned
249
+ def canceled_by_day=(canceled_by_day)
250
+ if canceled_by_day.nil?
251
+ fail ArgumentError, 'canceled_by_day cannot be nil'
252
+ end
253
+
254
+ @canceled_by_day = canceled_by_day
255
+ end
256
+
257
+ # Custom attribute writer method with validation
258
+ # @param [Object] canceled_by_month Value to be assigned
259
+ def canceled_by_month=(canceled_by_month)
260
+ if canceled_by_month.nil?
261
+ fail ArgumentError, 'canceled_by_month cannot be nil'
262
+ end
263
+
264
+ @canceled_by_month = canceled_by_month
265
+ end
266
+
267
+ # Custom attribute writer method with validation
268
+ # @param [Object] by_reason Value to be assigned
269
+ def by_reason=(by_reason)
270
+ if by_reason.nil?
271
+ fail ArgumentError, 'by_reason cannot be nil'
272
+ end
273
+
274
+ @by_reason = by_reason
275
+ end
276
+
277
+ # Checks equality by comparing each attribute.
278
+ # @param [Object] Object to be compared
279
+ def ==(o)
280
+ return true if self.equal?(o)
281
+ self.class == o.class &&
282
+ license_count == o.license_count &&
283
+ canceled_license_count == o.canceled_license_count &&
284
+ cancellable_license_count == o.cancellable_license_count &&
285
+ rate == o.rate &&
286
+ canceled_by_day == o.canceled_by_day &&
287
+ canceled_by_month == o.canceled_by_month &&
288
+ by_reason == o.by_reason
289
+ end
290
+
291
+ # @see the `==` method
292
+ # @param [Object] Object to be compared
293
+ def eql?(o)
294
+ self == o
295
+ end
296
+
297
+ # Calculates hash code according to all attributes.
298
+ # @return [Integer] Hash code
299
+ def hash
300
+ [license_count, canceled_license_count, cancellable_license_count, rate, canceled_by_day, canceled_by_month, by_reason].hash
301
+ end
302
+
303
+ # Builds the object from hash
304
+ # @param [Hash] attributes Model attributes in the form of hash
305
+ # @return [Object] Returns the model itself
306
+ def self.build_from_hash(attributes)
307
+ return nil unless attributes.is_a?(Hash)
308
+ attributes = attributes.transform_keys(&:to_sym)
309
+ # include attributes inherited from allOf parents (the nearest declaration wins)
310
+ map = acceptable_attribute_map
311
+ transformed_hash = {}
312
+ acceptable_openapi_types.each_pair do |key, type|
313
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
314
+ transformed_hash["#{key}"] = nil
315
+ elsif type =~ /\AArray<(.*)>/i
316
+ # check to ensure the input is an array given that the attribute
317
+ # is documented as an array but the input is not
318
+ if attributes[map[key]].is_a?(Array)
319
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
320
+ end
321
+ elsif !attributes[map[key]].nil?
322
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
323
+ end
324
+ end
325
+ new(transformed_hash)
326
+ end
327
+
328
+ # Returns the object in the form of hash
329
+ # @return [Hash] Returns the object in the form of hash
330
+ def to_hash
331
+ hash = {}
332
+ # include attributes inherited from allOf parents (the nearest declaration wins)
333
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
334
+ value = self.send(attr)
335
+ if value.nil?
336
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
337
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
338
+ end
339
+
340
+ hash[param] = _to_hash(value)
341
+ end
342
+ hash
343
+ end
344
+
345
+ end
346
+
347
+ end
@@ -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.