smplkit 3.0.8 → 3.0.9

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 (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb +0 -469
  3. data/lib/smplkit/_generated/app/lib/smplkit_app_client/api/subscription_api.rb +289 -0
  4. data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/{subscription_list_response.rb → admin_subscription_request.rb} +9 -20
  5. data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/admin_subscription_request_attributes.rb +190 -0
  6. data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/{create_subscription_data.rb → admin_subscription_request_resource.rb} +46 -12
  7. data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/{next_tier_meta.rb → next_tier_response.rb} +6 -6
  8. data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/subscription_change_projection.rb +321 -0
  9. data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/{create_subscription_attributes.rb → subscription_item_request.rb} +10 -21
  10. data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/{subscription_attributes.rb → subscription_item_response.rb} +66 -77
  11. data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/subscription_preview_attributes.rb +390 -0
  12. data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/subscription_preview_resource.rb +241 -0
  13. data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/{plan_change_request.rb → subscription_preview_response.rb} +20 -21
  14. data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/{create_subscription_body.rb → subscription_request.rb} +5 -5
  15. data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/subscription_request_attributes.rb +179 -0
  16. data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/subscription_request_resource.rb +227 -0
  17. data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/subscription_resource.rb +4 -2
  18. data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/subscription_response.rb +1 -1
  19. data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/{subscription_list_meta.rb → subscription_response_attributes.rb} +135 -62
  20. data/lib/smplkit/_generated/app/lib/smplkit_app_client.rb +15 -8
  21. data/lib/smplkit/_generated/app/spec/api/billing_api_spec.rb +0 -86
  22. data/lib/smplkit/_generated/app/spec/api/subscription_api_spec.rb +83 -0
  23. data/lib/smplkit/_generated/app/spec/models/{create_subscription_attributes_spec.rb → admin_subscription_request_attributes_spec.rb} +9 -9
  24. data/lib/smplkit/_generated/app/spec/models/admin_subscription_request_resource_spec.rb +52 -0
  25. data/lib/smplkit/_generated/app/spec/models/{plan_change_request_spec.rb → admin_subscription_request_spec.rb} +7 -7
  26. data/lib/smplkit/_generated/app/spec/models/{next_tier_meta_spec.rb → next_tier_response_spec.rb} +6 -6
  27. data/lib/smplkit/_generated/app/spec/models/{subscription_list_meta_spec.rb → subscription_change_projection_spec.rb} +20 -14
  28. data/lib/smplkit/_generated/app/spec/models/{create_subscription_data_spec.rb → subscription_item_request_spec.rb} +8 -8
  29. data/lib/smplkit/_generated/app/spec/models/{subscription_attributes_spec.rb → subscription_item_response_spec.rb} +12 -18
  30. data/lib/smplkit/_generated/app/spec/models/subscription_preview_attributes_spec.rb +88 -0
  31. data/lib/smplkit/_generated/app/spec/models/subscription_preview_resource_spec.rb +56 -0
  32. data/lib/smplkit/_generated/app/spec/models/subscription_preview_response_spec.rb +36 -0
  33. data/lib/smplkit/_generated/app/spec/models/{subscription_list_response_spec.rb → subscription_request_attributes_spec.rb} +8 -8
  34. data/lib/smplkit/_generated/app/spec/models/subscription_request_resource_spec.rb +52 -0
  35. data/lib/smplkit/_generated/app/spec/models/{create_subscription_body_spec.rb → subscription_request_spec.rb} +6 -6
  36. data/lib/smplkit/_generated/app/spec/models/subscription_response_attributes_spec.rb +100 -0
  37. metadata +31 -17
@@ -14,39 +14,35 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module SmplkitGeneratedClient::App
17
- # A subscription that grants the account access to a product on a plan.
18
- class SubscriptionAttributes < ApiModelBase
19
- # Product key the subscription is for, e.g. `flags`.
17
+ # One product enrollment as exposed in subscription responses.
18
+ class SubscriptionItemResponse < ApiModelBase
19
+ # Unique identifier for this enrollment.
20
+ attr_accessor :id
21
+
22
+ # Product key (e.g. `audit`, `config`, `flags`, `logging`).
20
23
  attr_accessor :product
21
24
 
22
- # Plan key the subscription is on, e.g. `pro`.
25
+ # Current plan for this product (e.g. `STANDARD`, `PRO`).
23
26
  attr_accessor :plan
24
27
 
25
- # Lifecycle state of the subscription, e.g. `active`, `trialing`, `past_due`, `canceled`.
26
- attr_accessor :status
27
-
28
- # When `true`, the subscription is complimentary and is not billed through the billing provider.
29
- attr_accessor :comped
28
+ # Monthly list price for this enrollment, in cents. This value is locked at the time the enrollment was created or last had its plan changed; subsequent changes to the public price list do not affect this enrollment until the customer themselves changes their plan.
29
+ attr_accessor :price_monthly_cents
30
30
 
31
- # When `true`, the subscription is billed through Stripe; otherwise it is a free or complimentary subscription that does not produce invoices.
32
- attr_accessor :stripe_managed
31
+ # When a plan change is scheduled for the end of the current billing period, this is the plan that will take effect. Otherwise `null`. The value `FREE` indicates the enrollment will be dropped.
32
+ attr_accessor :pending_plan_change
33
33
 
34
- # End of the current billing period (ISO 8601 timestamp).
35
- attr_accessor :current_period_end
36
-
37
- # Stripe payment intent client secret returned when a subscription create requires additional authentication (3DS). Returned only on create.
38
- attr_accessor :client_secret
34
+ # ISO-8601 timestamp at which the pending plan change takes effect. Matches the subscription's `current_period_end`.
35
+ attr_accessor :scheduled_change_effective_at
39
36
 
40
37
  # Attribute mapping from ruby-style variable name to JSON key.
41
38
  def self.attribute_map
42
39
  {
40
+ :'id' => :'id',
43
41
  :'product' => :'product',
44
42
  :'plan' => :'plan',
45
- :'status' => :'status',
46
- :'comped' => :'comped',
47
- :'stripe_managed' => :'stripe_managed',
48
- :'current_period_end' => :'current_period_end',
49
- :'client_secret' => :'client_secret'
43
+ :'price_monthly_cents' => :'price_monthly_cents',
44
+ :'pending_plan_change' => :'pending_plan_change',
45
+ :'scheduled_change_effective_at' => :'scheduled_change_effective_at'
50
46
  }
51
47
  end
52
48
 
@@ -63,22 +59,20 @@ module SmplkitGeneratedClient::App
63
59
  # Attribute type mapping.
64
60
  def self.openapi_types
65
61
  {
62
+ :'id' => :'String',
66
63
  :'product' => :'String',
67
64
  :'plan' => :'String',
68
- :'status' => :'String',
69
- :'comped' => :'Boolean',
70
- :'stripe_managed' => :'Boolean',
71
- :'current_period_end' => :'String',
72
- :'client_secret' => :'String'
65
+ :'price_monthly_cents' => :'Integer',
66
+ :'pending_plan_change' => :'String',
67
+ :'scheduled_change_effective_at' => :'String'
73
68
  }
74
69
  end
75
70
 
76
71
  # List of attributes with nullable: true
77
72
  def self.openapi_nullable
78
73
  Set.new([
79
- :'status',
80
- :'current_period_end',
81
- :'client_secret'
74
+ :'pending_plan_change',
75
+ :'scheduled_change_effective_at'
82
76
  ])
83
77
  end
84
78
 
@@ -86,18 +80,24 @@ module SmplkitGeneratedClient::App
86
80
  # @param [Hash] attributes Model attributes in the form of hash
87
81
  def initialize(attributes = {})
88
82
  if (!attributes.is_a?(Hash))
89
- fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::App::SubscriptionAttributes` initialize method"
83
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::App::SubscriptionItemResponse` initialize method"
90
84
  end
91
85
 
92
86
  # check to see if the attribute exists and convert string to symbol for hash key
93
87
  acceptable_attribute_map = self.class.acceptable_attribute_map
94
88
  attributes = attributes.each_with_object({}) { |(k, v), h|
95
89
  if (!acceptable_attribute_map.key?(k.to_sym))
96
- fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::App::SubscriptionAttributes`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
90
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::App::SubscriptionItemResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
97
91
  end
98
92
  h[k.to_sym] = v
99
93
  }
100
94
 
95
+ if attributes.key?(:'id')
96
+ self.id = attributes[:'id']
97
+ else
98
+ self.id = nil
99
+ end
100
+
101
101
  if attributes.key?(:'product')
102
102
  self.product = attributes[:'product']
103
103
  else
@@ -110,28 +110,18 @@ module SmplkitGeneratedClient::App
110
110
  self.plan = nil
111
111
  end
112
112
 
113
- if attributes.key?(:'status')
114
- self.status = attributes[:'status']
115
- end
116
-
117
- if attributes.key?(:'comped')
118
- self.comped = attributes[:'comped']
119
- else
120
- self.comped = nil
121
- end
122
-
123
- if attributes.key?(:'stripe_managed')
124
- self.stripe_managed = attributes[:'stripe_managed']
113
+ if attributes.key?(:'price_monthly_cents')
114
+ self.price_monthly_cents = attributes[:'price_monthly_cents']
125
115
  else
126
- self.stripe_managed = nil
116
+ self.price_monthly_cents = nil
127
117
  end
128
118
 
129
- if attributes.key?(:'current_period_end')
130
- self.current_period_end = attributes[:'current_period_end']
119
+ if attributes.key?(:'pending_plan_change')
120
+ self.pending_plan_change = attributes[:'pending_plan_change']
131
121
  end
132
122
 
133
- if attributes.key?(:'client_secret')
134
- self.client_secret = attributes[:'client_secret']
123
+ if attributes.key?(:'scheduled_change_effective_at')
124
+ self.scheduled_change_effective_at = attributes[:'scheduled_change_effective_at']
135
125
  end
136
126
  end
137
127
 
@@ -140,6 +130,10 @@ module SmplkitGeneratedClient::App
140
130
  def list_invalid_properties
141
131
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
142
132
  invalid_properties = Array.new
133
+ if @id.nil?
134
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
135
+ end
136
+
143
137
  if @product.nil?
144
138
  invalid_properties.push('invalid value for "product", product cannot be nil.')
145
139
  end
@@ -148,12 +142,8 @@ module SmplkitGeneratedClient::App
148
142
  invalid_properties.push('invalid value for "plan", plan cannot be nil.')
149
143
  end
150
144
 
151
- if @comped.nil?
152
- invalid_properties.push('invalid value for "comped", comped cannot be nil.')
153
- end
154
-
155
- if @stripe_managed.nil?
156
- invalid_properties.push('invalid value for "stripe_managed", stripe_managed cannot be nil.')
145
+ if @price_monthly_cents.nil?
146
+ invalid_properties.push('invalid value for "price_monthly_cents", price_monthly_cents cannot be nil.')
157
147
  end
158
148
 
159
149
  invalid_properties
@@ -163,13 +153,23 @@ module SmplkitGeneratedClient::App
163
153
  # @return true if the model is valid
164
154
  def valid?
165
155
  warn '[DEPRECATED] the `valid?` method is obsolete'
156
+ return false if @id.nil?
166
157
  return false if @product.nil?
167
158
  return false if @plan.nil?
168
- return false if @comped.nil?
169
- return false if @stripe_managed.nil?
159
+ return false if @price_monthly_cents.nil?
170
160
  true
171
161
  end
172
162
 
163
+ # Custom attribute writer method with validation
164
+ # @param [Object] id Value to be assigned
165
+ def id=(id)
166
+ if id.nil?
167
+ fail ArgumentError, 'id cannot be nil'
168
+ end
169
+
170
+ @id = id
171
+ end
172
+
173
173
  # Custom attribute writer method with validation
174
174
  # @param [Object] product Value to be assigned
175
175
  def product=(product)
@@ -191,23 +191,13 @@ module SmplkitGeneratedClient::App
191
191
  end
192
192
 
193
193
  # Custom attribute writer method with validation
194
- # @param [Object] comped Value to be assigned
195
- def comped=(comped)
196
- if comped.nil?
197
- fail ArgumentError, 'comped cannot be nil'
198
- end
199
-
200
- @comped = comped
201
- end
202
-
203
- # Custom attribute writer method with validation
204
- # @param [Object] stripe_managed Value to be assigned
205
- def stripe_managed=(stripe_managed)
206
- if stripe_managed.nil?
207
- fail ArgumentError, 'stripe_managed cannot be nil'
194
+ # @param [Object] price_monthly_cents Value to be assigned
195
+ def price_monthly_cents=(price_monthly_cents)
196
+ if price_monthly_cents.nil?
197
+ fail ArgumentError, 'price_monthly_cents cannot be nil'
208
198
  end
209
199
 
210
- @stripe_managed = stripe_managed
200
+ @price_monthly_cents = price_monthly_cents
211
201
  end
212
202
 
213
203
  # Checks equality by comparing each attribute.
@@ -215,13 +205,12 @@ module SmplkitGeneratedClient::App
215
205
  def ==(o)
216
206
  return true if self.equal?(o)
217
207
  self.class == o.class &&
208
+ id == o.id &&
218
209
  product == o.product &&
219
210
  plan == o.plan &&
220
- status == o.status &&
221
- comped == o.comped &&
222
- stripe_managed == o.stripe_managed &&
223
- current_period_end == o.current_period_end &&
224
- client_secret == o.client_secret
211
+ price_monthly_cents == o.price_monthly_cents &&
212
+ pending_plan_change == o.pending_plan_change &&
213
+ scheduled_change_effective_at == o.scheduled_change_effective_at
225
214
  end
226
215
 
227
216
  # @see the `==` method
@@ -233,7 +222,7 @@ module SmplkitGeneratedClient::App
233
222
  # Calculates hash code according to all attributes.
234
223
  # @return [Integer] Hash code
235
224
  def hash
236
- [product, plan, status, comped, stripe_managed, current_period_end, client_secret].hash
225
+ [id, product, plan, price_monthly_cents, pending_plan_change, scheduled_change_effective_at].hash
237
226
  end
238
227
 
239
228
  # Builds the object from hash
@@ -0,0 +1,390 @@
1
+ =begin
2
+ #smplkit API
3
+
4
+ #API for the smplkit platform.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module SmplkitGeneratedClient::App
17
+ # Projected totals and per-change breakdown for a hypothetical change.
18
+ class SubscriptionPreviewAttributes < ApiModelBase
19
+ # Projected sum of item monthly list prices after the change.
20
+ attr_accessor :projected_subtotal_cents
21
+
22
+ # Projected discount percentage that will apply after the change.
23
+ attr_accessor :projected_discount_pct
24
+
25
+ # `VOLUME` when the projected discount comes from the multi-product schedule; `OVERRIDE` when an administrator's discount applies.
26
+ attr_accessor :projected_discount_source
27
+
28
+ # Projected discount amount in cents after the change.
29
+ attr_accessor :projected_discount_amount_cents
30
+
31
+ # Projected final monthly total in cents after the change.
32
+ attr_accessor :projected_total_cents
33
+
34
+ attr_accessor :projected_next_tier
35
+
36
+ # Per-product breakdown of changes the desired state would produce. Products that would remain unchanged are omitted.
37
+ attr_accessor :changes
38
+
39
+ # Total amount that would be charged at confirmation time, in cents. The sum of `prorated_charge_today_cents` across `IMMEDIATE` changes.
40
+ attr_accessor :total_charge_today_cents
41
+
42
+ # Projected total of the next monthly invoice in cents, after all scheduled changes have taken effect.
43
+ attr_accessor :next_invoice_total_cents
44
+
45
+ class EnumAttributeValidator
46
+ attr_reader :datatype
47
+ attr_reader :allowable_values
48
+
49
+ def initialize(datatype, allowable_values)
50
+ @allowable_values = allowable_values.map do |value|
51
+ case datatype.to_s
52
+ when /Integer/i
53
+ value.to_i
54
+ when /Float/i
55
+ value.to_f
56
+ else
57
+ value
58
+ end
59
+ end
60
+ end
61
+
62
+ def valid?(value)
63
+ !value || allowable_values.include?(value)
64
+ end
65
+ end
66
+
67
+ # Attribute mapping from ruby-style variable name to JSON key.
68
+ def self.attribute_map
69
+ {
70
+ :'projected_subtotal_cents' => :'projected_subtotal_cents',
71
+ :'projected_discount_pct' => :'projected_discount_pct',
72
+ :'projected_discount_source' => :'projected_discount_source',
73
+ :'projected_discount_amount_cents' => :'projected_discount_amount_cents',
74
+ :'projected_total_cents' => :'projected_total_cents',
75
+ :'projected_next_tier' => :'projected_next_tier',
76
+ :'changes' => :'changes',
77
+ :'total_charge_today_cents' => :'total_charge_today_cents',
78
+ :'next_invoice_total_cents' => :'next_invoice_total_cents'
79
+ }
80
+ end
81
+
82
+ # Returns attribute mapping this model knows about
83
+ def self.acceptable_attribute_map
84
+ attribute_map
85
+ end
86
+
87
+ # Returns all the JSON keys this model knows about
88
+ def self.acceptable_attributes
89
+ acceptable_attribute_map.values
90
+ end
91
+
92
+ # Attribute type mapping.
93
+ def self.openapi_types
94
+ {
95
+ :'projected_subtotal_cents' => :'Integer',
96
+ :'projected_discount_pct' => :'Integer',
97
+ :'projected_discount_source' => :'String',
98
+ :'projected_discount_amount_cents' => :'Integer',
99
+ :'projected_total_cents' => :'Integer',
100
+ :'projected_next_tier' => :'NextTierResponse',
101
+ :'changes' => :'Array<SubscriptionChangeProjection>',
102
+ :'total_charge_today_cents' => :'Integer',
103
+ :'next_invoice_total_cents' => :'Integer'
104
+ }
105
+ end
106
+
107
+ # List of attributes with nullable: true
108
+ def self.openapi_nullable
109
+ Set.new([
110
+ ])
111
+ end
112
+
113
+ # Initializes the object
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ def initialize(attributes = {})
116
+ if (!attributes.is_a?(Hash))
117
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::App::SubscriptionPreviewAttributes` initialize method"
118
+ end
119
+
120
+ # check to see if the attribute exists and convert string to symbol for hash key
121
+ acceptable_attribute_map = self.class.acceptable_attribute_map
122
+ attributes = attributes.each_with_object({}) { |(k, v), h|
123
+ if (!acceptable_attribute_map.key?(k.to_sym))
124
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::App::SubscriptionPreviewAttributes`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
125
+ end
126
+ h[k.to_sym] = v
127
+ }
128
+
129
+ if attributes.key?(:'projected_subtotal_cents')
130
+ self.projected_subtotal_cents = attributes[:'projected_subtotal_cents']
131
+ else
132
+ self.projected_subtotal_cents = nil
133
+ end
134
+
135
+ if attributes.key?(:'projected_discount_pct')
136
+ self.projected_discount_pct = attributes[:'projected_discount_pct']
137
+ else
138
+ self.projected_discount_pct = nil
139
+ end
140
+
141
+ if attributes.key?(:'projected_discount_source')
142
+ self.projected_discount_source = attributes[:'projected_discount_source']
143
+ else
144
+ self.projected_discount_source = nil
145
+ end
146
+
147
+ if attributes.key?(:'projected_discount_amount_cents')
148
+ self.projected_discount_amount_cents = attributes[:'projected_discount_amount_cents']
149
+ else
150
+ self.projected_discount_amount_cents = nil
151
+ end
152
+
153
+ if attributes.key?(:'projected_total_cents')
154
+ self.projected_total_cents = attributes[:'projected_total_cents']
155
+ else
156
+ self.projected_total_cents = nil
157
+ end
158
+
159
+ if attributes.key?(:'projected_next_tier')
160
+ self.projected_next_tier = attributes[:'projected_next_tier']
161
+ end
162
+
163
+ if attributes.key?(:'changes')
164
+ if (value = attributes[:'changes']).is_a?(Array)
165
+ self.changes = value
166
+ end
167
+ else
168
+ self.changes = nil
169
+ end
170
+
171
+ if attributes.key?(:'total_charge_today_cents')
172
+ self.total_charge_today_cents = attributes[:'total_charge_today_cents']
173
+ else
174
+ self.total_charge_today_cents = nil
175
+ end
176
+
177
+ if attributes.key?(:'next_invoice_total_cents')
178
+ self.next_invoice_total_cents = attributes[:'next_invoice_total_cents']
179
+ else
180
+ self.next_invoice_total_cents = nil
181
+ end
182
+ end
183
+
184
+ # Show invalid properties with the reasons. Usually used together with valid?
185
+ # @return Array for valid properties with the reasons
186
+ def list_invalid_properties
187
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
188
+ invalid_properties = Array.new
189
+ if @projected_subtotal_cents.nil?
190
+ invalid_properties.push('invalid value for "projected_subtotal_cents", projected_subtotal_cents cannot be nil.')
191
+ end
192
+
193
+ if @projected_discount_pct.nil?
194
+ invalid_properties.push('invalid value for "projected_discount_pct", projected_discount_pct cannot be nil.')
195
+ end
196
+
197
+ if @projected_discount_source.nil?
198
+ invalid_properties.push('invalid value for "projected_discount_source", projected_discount_source cannot be nil.')
199
+ end
200
+
201
+ if @projected_discount_amount_cents.nil?
202
+ invalid_properties.push('invalid value for "projected_discount_amount_cents", projected_discount_amount_cents cannot be nil.')
203
+ end
204
+
205
+ if @projected_total_cents.nil?
206
+ invalid_properties.push('invalid value for "projected_total_cents", projected_total_cents cannot be nil.')
207
+ end
208
+
209
+ if @changes.nil?
210
+ invalid_properties.push('invalid value for "changes", changes cannot be nil.')
211
+ end
212
+
213
+ if @total_charge_today_cents.nil?
214
+ invalid_properties.push('invalid value for "total_charge_today_cents", total_charge_today_cents cannot be nil.')
215
+ end
216
+
217
+ if @next_invoice_total_cents.nil?
218
+ invalid_properties.push('invalid value for "next_invoice_total_cents", next_invoice_total_cents cannot be nil.')
219
+ end
220
+
221
+ invalid_properties
222
+ end
223
+
224
+ # Check to see if the all the properties in the model are valid
225
+ # @return true if the model is valid
226
+ def valid?
227
+ warn '[DEPRECATED] the `valid?` method is obsolete'
228
+ return false if @projected_subtotal_cents.nil?
229
+ return false if @projected_discount_pct.nil?
230
+ return false if @projected_discount_source.nil?
231
+ projected_discount_source_validator = EnumAttributeValidator.new('String', ["VOLUME", "OVERRIDE"])
232
+ return false unless projected_discount_source_validator.valid?(@projected_discount_source)
233
+ return false if @projected_discount_amount_cents.nil?
234
+ return false if @projected_total_cents.nil?
235
+ return false if @changes.nil?
236
+ return false if @total_charge_today_cents.nil?
237
+ return false if @next_invoice_total_cents.nil?
238
+ true
239
+ end
240
+
241
+ # Custom attribute writer method with validation
242
+ # @param [Object] projected_subtotal_cents Value to be assigned
243
+ def projected_subtotal_cents=(projected_subtotal_cents)
244
+ if projected_subtotal_cents.nil?
245
+ fail ArgumentError, 'projected_subtotal_cents cannot be nil'
246
+ end
247
+
248
+ @projected_subtotal_cents = projected_subtotal_cents
249
+ end
250
+
251
+ # Custom attribute writer method with validation
252
+ # @param [Object] projected_discount_pct Value to be assigned
253
+ def projected_discount_pct=(projected_discount_pct)
254
+ if projected_discount_pct.nil?
255
+ fail ArgumentError, 'projected_discount_pct cannot be nil'
256
+ end
257
+
258
+ @projected_discount_pct = projected_discount_pct
259
+ end
260
+
261
+ # Custom attribute writer method checking allowed values (enum).
262
+ # @param [Object] projected_discount_source Object to be assigned
263
+ def projected_discount_source=(projected_discount_source)
264
+ validator = EnumAttributeValidator.new('String', ["VOLUME", "OVERRIDE"])
265
+ unless validator.valid?(projected_discount_source)
266
+ fail ArgumentError, "invalid value for \"projected_discount_source\", must be one of #{validator.allowable_values}."
267
+ end
268
+ @projected_discount_source = projected_discount_source
269
+ end
270
+
271
+ # Custom attribute writer method with validation
272
+ # @param [Object] projected_discount_amount_cents Value to be assigned
273
+ def projected_discount_amount_cents=(projected_discount_amount_cents)
274
+ if projected_discount_amount_cents.nil?
275
+ fail ArgumentError, 'projected_discount_amount_cents cannot be nil'
276
+ end
277
+
278
+ @projected_discount_amount_cents = projected_discount_amount_cents
279
+ end
280
+
281
+ # Custom attribute writer method with validation
282
+ # @param [Object] projected_total_cents Value to be assigned
283
+ def projected_total_cents=(projected_total_cents)
284
+ if projected_total_cents.nil?
285
+ fail ArgumentError, 'projected_total_cents cannot be nil'
286
+ end
287
+
288
+ @projected_total_cents = projected_total_cents
289
+ end
290
+
291
+ # Custom attribute writer method with validation
292
+ # @param [Object] changes Value to be assigned
293
+ def changes=(changes)
294
+ if changes.nil?
295
+ fail ArgumentError, 'changes cannot be nil'
296
+ end
297
+
298
+ @changes = changes
299
+ end
300
+
301
+ # Custom attribute writer method with validation
302
+ # @param [Object] total_charge_today_cents Value to be assigned
303
+ def total_charge_today_cents=(total_charge_today_cents)
304
+ if total_charge_today_cents.nil?
305
+ fail ArgumentError, 'total_charge_today_cents cannot be nil'
306
+ end
307
+
308
+ @total_charge_today_cents = total_charge_today_cents
309
+ end
310
+
311
+ # Custom attribute writer method with validation
312
+ # @param [Object] next_invoice_total_cents Value to be assigned
313
+ def next_invoice_total_cents=(next_invoice_total_cents)
314
+ if next_invoice_total_cents.nil?
315
+ fail ArgumentError, 'next_invoice_total_cents cannot be nil'
316
+ end
317
+
318
+ @next_invoice_total_cents = next_invoice_total_cents
319
+ end
320
+
321
+ # Checks equality by comparing each attribute.
322
+ # @param [Object] Object to be compared
323
+ def ==(o)
324
+ return true if self.equal?(o)
325
+ self.class == o.class &&
326
+ projected_subtotal_cents == o.projected_subtotal_cents &&
327
+ projected_discount_pct == o.projected_discount_pct &&
328
+ projected_discount_source == o.projected_discount_source &&
329
+ projected_discount_amount_cents == o.projected_discount_amount_cents &&
330
+ projected_total_cents == o.projected_total_cents &&
331
+ projected_next_tier == o.projected_next_tier &&
332
+ changes == o.changes &&
333
+ total_charge_today_cents == o.total_charge_today_cents &&
334
+ next_invoice_total_cents == o.next_invoice_total_cents
335
+ end
336
+
337
+ # @see the `==` method
338
+ # @param [Object] Object to be compared
339
+ def eql?(o)
340
+ self == o
341
+ end
342
+
343
+ # Calculates hash code according to all attributes.
344
+ # @return [Integer] Hash code
345
+ def hash
346
+ [projected_subtotal_cents, projected_discount_pct, projected_discount_source, projected_discount_amount_cents, projected_total_cents, projected_next_tier, changes, total_charge_today_cents, next_invoice_total_cents].hash
347
+ end
348
+
349
+ # Builds the object from hash
350
+ # @param [Hash] attributes Model attributes in the form of hash
351
+ # @return [Object] Returns the model itself
352
+ def self.build_from_hash(attributes)
353
+ return nil unless attributes.is_a?(Hash)
354
+ attributes = attributes.transform_keys(&:to_sym)
355
+ transformed_hash = {}
356
+ openapi_types.each_pair do |key, type|
357
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
358
+ transformed_hash["#{key}"] = nil
359
+ elsif type =~ /\AArray<(.*)>/i
360
+ # check to ensure the input is an array given that the attribute
361
+ # is documented as an array but the input is not
362
+ if attributes[attribute_map[key]].is_a?(Array)
363
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
364
+ end
365
+ elsif !attributes[attribute_map[key]].nil?
366
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
367
+ end
368
+ end
369
+ new(transformed_hash)
370
+ end
371
+
372
+ # Returns the object in the form of hash
373
+ # @return [Hash] Returns the object in the form of hash
374
+ def to_hash
375
+ hash = {}
376
+ self.class.attribute_map.each_pair do |attr, param|
377
+ value = self.send(attr)
378
+ if value.nil?
379
+ is_nullable = self.class.openapi_nullable.include?(attr)
380
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
381
+ end
382
+
383
+ hash[param] = _to_hash(value)
384
+ end
385
+ hash
386
+ end
387
+
388
+ end
389
+
390
+ end