license_manager 0.2.0 → 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 (69) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +57 -0
  3. data/README.md +1 -1
  4. data/docs/BillingPortalSession.md +18 -0
  5. data/docs/CreateBillingPortalSession.md +18 -0
  6. data/docs/CreateIntegrationMapping.md +1 -1
  7. data/docs/Integration.md +6 -0
  8. data/docs/IntegrationMapping.md +2 -0
  9. data/docs/IntegrationMappingRecurring.md +20 -0
  10. data/docs/License.md +2 -0
  11. data/docs/LicenseSubscription.md +34 -0
  12. data/docs/LicensesApi.md +1 -1
  13. data/docs/Mrr.md +26 -0
  14. data/docs/MrrByIntervalInner.md +24 -0
  15. data/docs/MrrByPolicyInner.md +22 -0
  16. data/docs/PortalApi.md +79 -0
  17. data/docs/ProductStats.md +2 -0
  18. data/docs/Revenue.md +8 -4
  19. data/docs/StripePermission.md +3 -1
  20. data/docs/StripePrice.md +2 -0
  21. data/docs/StripePriceRecurring.md +20 -0
  22. data/docs/SubscriptionStats.md +38 -0
  23. data/docs/UpdateIntegration.md +3 -1
  24. data/lib/license_manager/api/licenses_api.rb +2 -2
  25. data/lib/license_manager/api/portal_api.rb +70 -0
  26. data/lib/license_manager/models/billing_portal_session.rb +178 -0
  27. data/lib/license_manager/models/create_billing_portal_session.rb +161 -0
  28. data/lib/license_manager/models/create_integration_mapping.rb +1 -1
  29. data/lib/license_manager/models/event_type.rb +4 -1
  30. data/lib/license_manager/models/integration.rb +82 -1
  31. data/lib/license_manager/models/integration_mapping.rb +13 -1
  32. data/lib/license_manager/models/integration_mapping_recurring.rb +228 -0
  33. data/lib/license_manager/models/license.rb +13 -1
  34. data/lib/license_manager/models/license_subscription.rb +388 -0
  35. data/lib/license_manager/models/mrr.rb +291 -0
  36. data/lib/license_manager/models/mrr_by_interval_inner.rb +279 -0
  37. data/lib/license_manager/models/mrr_by_policy_inner.rb +229 -0
  38. data/lib/license_manager/models/product_stats.rb +14 -1
  39. data/lib/license_manager/models/revenue.rb +60 -6
  40. data/lib/license_manager/models/stripe_permission.rb +31 -4
  41. data/lib/license_manager/models/stripe_price.rb +13 -1
  42. data/lib/license_manager/models/stripe_price_recurring.rb +228 -0
  43. data/lib/license_manager/models/subscription_stats.rb +456 -0
  44. data/lib/license_manager/models/update_integration.rb +42 -4
  45. data/lib/license_manager/version.rb +1 -1
  46. data/lib/license_manager.rb +9 -0
  47. data/openapi.json +563 -10
  48. data/spec/api/licenses_api_spec.rb +1 -1
  49. data/spec/api/portal_api_spec.rb +13 -0
  50. data/spec/models/billing_portal_session_spec.rb +36 -0
  51. data/spec/models/create_billing_portal_session_spec.rb +36 -0
  52. data/spec/models/create_token_spec.rb +1 -1
  53. data/spec/models/integration_mapping_recurring_spec.rb +46 -0
  54. data/spec/models/integration_mapping_spec.rb +6 -0
  55. data/spec/models/integration_spec.rb +18 -0
  56. data/spec/models/license_spec.rb +6 -0
  57. data/spec/models/license_subscription_spec.rb +88 -0
  58. data/spec/models/mrr_by_interval_inner_spec.rb +58 -0
  59. data/spec/models/mrr_by_policy_inner_spec.rb +48 -0
  60. data/spec/models/mrr_spec.rb +60 -0
  61. data/spec/models/product_stats_spec.rb +6 -0
  62. data/spec/models/revenue_spec.rb +12 -0
  63. data/spec/models/stripe_permission_spec.rb +6 -0
  64. data/spec/models/stripe_price_recurring_spec.rb +46 -0
  65. data/spec/models/stripe_price_spec.rb +6 -0
  66. data/spec/models/subscription_stats_spec.rb +96 -0
  67. data/spec/models/token_spec.rb +1 -1
  68. data/spec/models/update_integration_spec.rb +6 -0
  69. metadata +37 -1
@@ -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.
18
+ class StripePriceRecurring < 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::StripePriceRecurring` 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::StripePriceRecurring`. 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
@@ -0,0 +1,456 @@
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
+ # Subscriptions to recurring Stripe prices, each with its subscription license.
18
+ class SubscriptionStats < ApiModelBase
19
+ # Number of ongoing subscriptions: `active`, `trialing` or `past_due`.
20
+ attr_accessor :active_count
21
+
22
+ attr_accessor :trialing_count
23
+
24
+ # Number of them whose renewal failed, as Stripe retries it: their licenses stay valid for the integration's grace days.
25
+ attr_accessor :past_due_count
26
+
27
+ # Number of them set to end at the end of their period.
28
+ attr_accessor :canceling_count
29
+
30
+ # Number of subscriptions started in the last 30 days.
31
+ attr_accessor :new_count
32
+
33
+ # Number of subscriptions that ended in the last 30 days.
34
+ attr_accessor :ended_count
35
+
36
+ # Share of the subscriptions ongoing 30 days ago that ended since, from 0 to 1.
37
+ attr_accessor :churn_rate
38
+
39
+ # Number of subscriptions started each month, aligned on `months`.
40
+ attr_accessor :new_by_month
41
+
42
+ # Number of subscriptions that ended each month, aligned on `months`.
43
+ attr_accessor :ended_by_month
44
+
45
+ # Number of ongoing subscriptions at the end of each month, aligned on `months`, today for this month.
46
+ attr_accessor :active_by_month
47
+
48
+ # MRR in each currency, from the highest number of subscriptions. Amounts aren't converted between currencies.
49
+ attr_accessor :mrr
50
+
51
+ # Attribute mapping from ruby-style variable name to JSON key.
52
+ def self.attribute_map
53
+ {
54
+ :'active_count' => :'activeCount',
55
+ :'trialing_count' => :'trialingCount',
56
+ :'past_due_count' => :'pastDueCount',
57
+ :'canceling_count' => :'cancelingCount',
58
+ :'new_count' => :'newCount',
59
+ :'ended_count' => :'endedCount',
60
+ :'churn_rate' => :'churnRate',
61
+ :'new_by_month' => :'newByMonth',
62
+ :'ended_by_month' => :'endedByMonth',
63
+ :'active_by_month' => :'activeByMonth',
64
+ :'mrr' => :'mrr'
65
+ }
66
+ end
67
+
68
+ # Returns attribute mapping this model knows about
69
+ def self.acceptable_attribute_map
70
+ attribute_map
71
+ end
72
+
73
+ # Returns all the JSON keys this model knows about
74
+ def self.acceptable_attributes
75
+ acceptable_attribute_map.values
76
+ end
77
+
78
+ # Attribute type mapping.
79
+ def self.openapi_types
80
+ {
81
+ :'active_count' => :'Integer',
82
+ :'trialing_count' => :'Integer',
83
+ :'past_due_count' => :'Integer',
84
+ :'canceling_count' => :'Integer',
85
+ :'new_count' => :'Integer',
86
+ :'ended_count' => :'Integer',
87
+ :'churn_rate' => :'Float',
88
+ :'new_by_month' => :'Array<Integer>',
89
+ :'ended_by_month' => :'Array<Integer>',
90
+ :'active_by_month' => :'Array<Integer>',
91
+ :'mrr' => :'Array<Mrr>'
92
+ }
93
+ end
94
+
95
+ # List of attributes with nullable: true
96
+ def self.openapi_nullable
97
+ Set.new([
98
+ ])
99
+ end
100
+
101
+ # Returns attribute type mapping
102
+ def self.acceptable_openapi_types
103
+ openapi_types
104
+ end
105
+
106
+ # Returns the nullable attributes
107
+ def self.acceptable_openapi_nullable
108
+ openapi_nullable
109
+ end
110
+
111
+ # Initializes the object
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ def initialize(attributes = {})
114
+ if (!attributes.is_a?(Hash))
115
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LicenseManager::SubscriptionStats` initialize method"
116
+ end
117
+
118
+ # check to see if the attribute exists and convert string to symbol for hash key
119
+ acceptable_attribute_map = self.class.acceptable_attribute_map
120
+ attributes = attributes.each_with_object({}) { |(k, v), h|
121
+ if (!acceptable_attribute_map.key?(k.to_sym))
122
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LicenseManager::SubscriptionStats`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
123
+ end
124
+ h[k.to_sym] = v
125
+ }
126
+
127
+ if attributes.key?(:'active_count')
128
+ self.active_count = attributes[:'active_count']
129
+ else
130
+ self.active_count = nil
131
+ end
132
+
133
+ if attributes.key?(:'trialing_count')
134
+ self.trialing_count = attributes[:'trialing_count']
135
+ else
136
+ self.trialing_count = nil
137
+ end
138
+
139
+ if attributes.key?(:'past_due_count')
140
+ self.past_due_count = attributes[:'past_due_count']
141
+ else
142
+ self.past_due_count = nil
143
+ end
144
+
145
+ if attributes.key?(:'canceling_count')
146
+ self.canceling_count = attributes[:'canceling_count']
147
+ else
148
+ self.canceling_count = nil
149
+ end
150
+
151
+ if attributes.key?(:'new_count')
152
+ self.new_count = attributes[:'new_count']
153
+ else
154
+ self.new_count = nil
155
+ end
156
+
157
+ if attributes.key?(:'ended_count')
158
+ self.ended_count = attributes[:'ended_count']
159
+ else
160
+ self.ended_count = nil
161
+ end
162
+
163
+ if attributes.key?(:'churn_rate')
164
+ self.churn_rate = attributes[:'churn_rate']
165
+ else
166
+ self.churn_rate = nil
167
+ end
168
+
169
+ if attributes.key?(:'new_by_month')
170
+ if (value = attributes[:'new_by_month']).is_a?(Array)
171
+ self.new_by_month = value
172
+ end
173
+ else
174
+ self.new_by_month = nil
175
+ end
176
+
177
+ if attributes.key?(:'ended_by_month')
178
+ if (value = attributes[:'ended_by_month']).is_a?(Array)
179
+ self.ended_by_month = value
180
+ end
181
+ else
182
+ self.ended_by_month = nil
183
+ end
184
+
185
+ if attributes.key?(:'active_by_month')
186
+ if (value = attributes[:'active_by_month']).is_a?(Array)
187
+ self.active_by_month = value
188
+ end
189
+ else
190
+ self.active_by_month = nil
191
+ end
192
+
193
+ if attributes.key?(:'mrr')
194
+ if (value = attributes[:'mrr']).is_a?(Array)
195
+ self.mrr = value
196
+ end
197
+ else
198
+ self.mrr = nil
199
+ end
200
+ end
201
+
202
+ # Show invalid properties with the reasons. Usually used together with valid?
203
+ # @return Array for valid properties with the reasons
204
+ def list_invalid_properties
205
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
206
+ invalid_properties = Array.new
207
+ if @active_count.nil?
208
+ invalid_properties.push('invalid value for "active_count", active_count cannot be nil.')
209
+ end
210
+
211
+ if @trialing_count.nil?
212
+ invalid_properties.push('invalid value for "trialing_count", trialing_count cannot be nil.')
213
+ end
214
+
215
+ if @past_due_count.nil?
216
+ invalid_properties.push('invalid value for "past_due_count", past_due_count cannot be nil.')
217
+ end
218
+
219
+ if @canceling_count.nil?
220
+ invalid_properties.push('invalid value for "canceling_count", canceling_count cannot be nil.')
221
+ end
222
+
223
+ if @new_count.nil?
224
+ invalid_properties.push('invalid value for "new_count", new_count cannot be nil.')
225
+ end
226
+
227
+ if @ended_count.nil?
228
+ invalid_properties.push('invalid value for "ended_count", ended_count cannot be nil.')
229
+ end
230
+
231
+ if @churn_rate.nil?
232
+ invalid_properties.push('invalid value for "churn_rate", churn_rate cannot be nil.')
233
+ end
234
+
235
+ if @new_by_month.nil?
236
+ invalid_properties.push('invalid value for "new_by_month", new_by_month cannot be nil.')
237
+ end
238
+
239
+ if @ended_by_month.nil?
240
+ invalid_properties.push('invalid value for "ended_by_month", ended_by_month cannot be nil.')
241
+ end
242
+
243
+ if @active_by_month.nil?
244
+ invalid_properties.push('invalid value for "active_by_month", active_by_month cannot be nil.')
245
+ end
246
+
247
+ if @mrr.nil?
248
+ invalid_properties.push('invalid value for "mrr", mrr cannot be nil.')
249
+ end
250
+
251
+ invalid_properties
252
+ end
253
+
254
+ # Check to see if the all the properties in the model are valid
255
+ # @return true if the model is valid
256
+ def valid?
257
+ warn '[DEPRECATED] the `valid?` method is obsolete'
258
+ return false if @active_count.nil?
259
+ return false if @trialing_count.nil?
260
+ return false if @past_due_count.nil?
261
+ return false if @canceling_count.nil?
262
+ return false if @new_count.nil?
263
+ return false if @ended_count.nil?
264
+ return false if @churn_rate.nil?
265
+ return false if @new_by_month.nil?
266
+ return false if @ended_by_month.nil?
267
+ return false if @active_by_month.nil?
268
+ return false if @mrr.nil?
269
+ true
270
+ end
271
+
272
+ # Custom attribute writer method with validation
273
+ # @param [Object] active_count Value to be assigned
274
+ def active_count=(active_count)
275
+ if active_count.nil?
276
+ fail ArgumentError, 'active_count cannot be nil'
277
+ end
278
+
279
+ @active_count = active_count
280
+ end
281
+
282
+ # Custom attribute writer method with validation
283
+ # @param [Object] trialing_count Value to be assigned
284
+ def trialing_count=(trialing_count)
285
+ if trialing_count.nil?
286
+ fail ArgumentError, 'trialing_count cannot be nil'
287
+ end
288
+
289
+ @trialing_count = trialing_count
290
+ end
291
+
292
+ # Custom attribute writer method with validation
293
+ # @param [Object] past_due_count Value to be assigned
294
+ def past_due_count=(past_due_count)
295
+ if past_due_count.nil?
296
+ fail ArgumentError, 'past_due_count cannot be nil'
297
+ end
298
+
299
+ @past_due_count = past_due_count
300
+ end
301
+
302
+ # Custom attribute writer method with validation
303
+ # @param [Object] canceling_count Value to be assigned
304
+ def canceling_count=(canceling_count)
305
+ if canceling_count.nil?
306
+ fail ArgumentError, 'canceling_count cannot be nil'
307
+ end
308
+
309
+ @canceling_count = canceling_count
310
+ end
311
+
312
+ # Custom attribute writer method with validation
313
+ # @param [Object] new_count Value to be assigned
314
+ def new_count=(new_count)
315
+ if new_count.nil?
316
+ fail ArgumentError, 'new_count cannot be nil'
317
+ end
318
+
319
+ @new_count = new_count
320
+ end
321
+
322
+ # Custom attribute writer method with validation
323
+ # @param [Object] ended_count Value to be assigned
324
+ def ended_count=(ended_count)
325
+ if ended_count.nil?
326
+ fail ArgumentError, 'ended_count cannot be nil'
327
+ end
328
+
329
+ @ended_count = ended_count
330
+ end
331
+
332
+ # Custom attribute writer method with validation
333
+ # @param [Object] churn_rate Value to be assigned
334
+ def churn_rate=(churn_rate)
335
+ if churn_rate.nil?
336
+ fail ArgumentError, 'churn_rate cannot be nil'
337
+ end
338
+
339
+ @churn_rate = churn_rate
340
+ end
341
+
342
+ # Custom attribute writer method with validation
343
+ # @param [Object] new_by_month Value to be assigned
344
+ def new_by_month=(new_by_month)
345
+ if new_by_month.nil?
346
+ fail ArgumentError, 'new_by_month cannot be nil'
347
+ end
348
+
349
+ @new_by_month = new_by_month
350
+ end
351
+
352
+ # Custom attribute writer method with validation
353
+ # @param [Object] ended_by_month Value to be assigned
354
+ def ended_by_month=(ended_by_month)
355
+ if ended_by_month.nil?
356
+ fail ArgumentError, 'ended_by_month cannot be nil'
357
+ end
358
+
359
+ @ended_by_month = ended_by_month
360
+ end
361
+
362
+ # Custom attribute writer method with validation
363
+ # @param [Object] active_by_month Value to be assigned
364
+ def active_by_month=(active_by_month)
365
+ if active_by_month.nil?
366
+ fail ArgumentError, 'active_by_month cannot be nil'
367
+ end
368
+
369
+ @active_by_month = active_by_month
370
+ end
371
+
372
+ # Custom attribute writer method with validation
373
+ # @param [Object] mrr Value to be assigned
374
+ def mrr=(mrr)
375
+ if mrr.nil?
376
+ fail ArgumentError, 'mrr cannot be nil'
377
+ end
378
+
379
+ @mrr = mrr
380
+ end
381
+
382
+ # Checks equality by comparing each attribute.
383
+ # @param [Object] Object to be compared
384
+ def ==(o)
385
+ return true if self.equal?(o)
386
+ self.class == o.class &&
387
+ active_count == o.active_count &&
388
+ trialing_count == o.trialing_count &&
389
+ past_due_count == o.past_due_count &&
390
+ canceling_count == o.canceling_count &&
391
+ new_count == o.new_count &&
392
+ ended_count == o.ended_count &&
393
+ churn_rate == o.churn_rate &&
394
+ new_by_month == o.new_by_month &&
395
+ ended_by_month == o.ended_by_month &&
396
+ active_by_month == o.active_by_month &&
397
+ mrr == o.mrr
398
+ end
399
+
400
+ # @see the `==` method
401
+ # @param [Object] Object to be compared
402
+ def eql?(o)
403
+ self == o
404
+ end
405
+
406
+ # Calculates hash code according to all attributes.
407
+ # @return [Integer] Hash code
408
+ def hash
409
+ [active_count, trialing_count, past_due_count, canceling_count, new_count, ended_count, churn_rate, new_by_month, ended_by_month, active_by_month, mrr].hash
410
+ end
411
+
412
+ # Builds the object from hash
413
+ # @param [Hash] attributes Model attributes in the form of hash
414
+ # @return [Object] Returns the model itself
415
+ def self.build_from_hash(attributes)
416
+ return nil unless attributes.is_a?(Hash)
417
+ attributes = attributes.transform_keys(&:to_sym)
418
+ # include attributes inherited from allOf parents (the nearest declaration wins)
419
+ map = acceptable_attribute_map
420
+ transformed_hash = {}
421
+ acceptable_openapi_types.each_pair do |key, type|
422
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
423
+ transformed_hash["#{key}"] = nil
424
+ elsif type =~ /\AArray<(.*)>/i
425
+ # check to ensure the input is an array given that the attribute
426
+ # is documented as an array but the input is not
427
+ if attributes[map[key]].is_a?(Array)
428
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
429
+ end
430
+ elsif !attributes[map[key]].nil?
431
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
432
+ end
433
+ end
434
+ new(transformed_hash)
435
+ end
436
+
437
+ # Returns the object in the form of hash
438
+ # @return [Hash] Returns the object in the form of hash
439
+ def to_hash
440
+ hash = {}
441
+ # include attributes inherited from allOf parents (the nearest declaration wins)
442
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
443
+ value = self.send(attr)
444
+ if value.nil?
445
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
446
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
447
+ end
448
+
449
+ hash[param] = _to_hash(value)
450
+ end
451
+ hash
452
+ end
453
+
454
+ end
455
+
456
+ end