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,15 +14,15 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module SmplkitGeneratedClient::App
17
- # Information about the next volume-discount tier.
18
- class NextTierMeta < ApiModelBase
19
- # Number of additional subscribed products needed to reach the next tier.
17
+ # Hint describing how the customer could unlock a better discount.
18
+ class NextTierResponse < ApiModelBase
19
+ # Number of additional paid products required to reach the next discount tier.
20
20
  attr_accessor :products_needed
21
21
 
22
22
  # Discount percentage that would apply at the next tier.
23
23
  attr_accessor :discount_pct
24
24
 
25
- # Additional monthly savings in cents at the next tier.
25
+ # Estimated additional monthly savings (in cents) at the next tier, compared to paying full list price for the added product.
26
26
  attr_accessor :additional_savings_cents
27
27
 
28
28
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -63,14 +63,14 @@ module SmplkitGeneratedClient::App
63
63
  # @param [Hash] attributes Model attributes in the form of hash
64
64
  def initialize(attributes = {})
65
65
  if (!attributes.is_a?(Hash))
66
- fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::App::NextTierMeta` initialize method"
66
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::App::NextTierResponse` initialize method"
67
67
  end
68
68
 
69
69
  # check to see if the attribute exists and convert string to symbol for hash key
70
70
  acceptable_attribute_map = self.class.acceptable_attribute_map
71
71
  attributes = attributes.each_with_object({}) { |(k, v), h|
72
72
  if (!acceptable_attribute_map.key?(k.to_sym))
73
- fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::App::NextTierMeta`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
73
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::App::NextTierResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
74
74
  end
75
75
  h[k.to_sym] = v
76
76
  }
@@ -0,0 +1,321 @@
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
+ # Per-item projected effect of a subscription change.
18
+ class SubscriptionChangeProjection < ApiModelBase
19
+ # Product key affected by this change.
20
+ attr_accessor :product
21
+
22
+ # Current plan for this product, or `FREE` if it is being added.
23
+ attr_accessor :from_plan
24
+
25
+ # Plan the product will be on after the change. `FREE` indicates the enrollment will be dropped.
26
+ attr_accessor :to_plan
27
+
28
+ # Monthly cost in cents of this enrollment after the change. `0` when the enrollment will be dropped.
29
+ attr_accessor :monthly_cents
30
+
31
+ # `IMMEDIATE` when the change takes effect at confirmation time (and a prorated charge may apply today). `NEXT_PERIOD` when the change takes effect at the end of the current billing period.
32
+ attr_accessor :effect
33
+
34
+ # When `effect` is `IMMEDIATE`, the estimated prorated charge for the remainder of the current billing period in cents. Always `0` when `effect` is `NEXT_PERIOD`.
35
+ attr_accessor :prorated_charge_today_cents
36
+
37
+ # When `effect` is `NEXT_PERIOD`, the ISO-8601 timestamp at which the change takes effect. `null` when `effect` is `IMMEDIATE` (the change applies on confirmation).
38
+ attr_accessor :starts_at
39
+
40
+ class EnumAttributeValidator
41
+ attr_reader :datatype
42
+ attr_reader :allowable_values
43
+
44
+ def initialize(datatype, allowable_values)
45
+ @allowable_values = allowable_values.map do |value|
46
+ case datatype.to_s
47
+ when /Integer/i
48
+ value.to_i
49
+ when /Float/i
50
+ value.to_f
51
+ else
52
+ value
53
+ end
54
+ end
55
+ end
56
+
57
+ def valid?(value)
58
+ !value || allowable_values.include?(value)
59
+ end
60
+ end
61
+
62
+ # Attribute mapping from ruby-style variable name to JSON key.
63
+ def self.attribute_map
64
+ {
65
+ :'product' => :'product',
66
+ :'from_plan' => :'from_plan',
67
+ :'to_plan' => :'to_plan',
68
+ :'monthly_cents' => :'monthly_cents',
69
+ :'effect' => :'effect',
70
+ :'prorated_charge_today_cents' => :'prorated_charge_today_cents',
71
+ :'starts_at' => :'starts_at'
72
+ }
73
+ end
74
+
75
+ # Returns attribute mapping this model knows about
76
+ def self.acceptable_attribute_map
77
+ attribute_map
78
+ end
79
+
80
+ # Returns all the JSON keys this model knows about
81
+ def self.acceptable_attributes
82
+ acceptable_attribute_map.values
83
+ end
84
+
85
+ # Attribute type mapping.
86
+ def self.openapi_types
87
+ {
88
+ :'product' => :'String',
89
+ :'from_plan' => :'String',
90
+ :'to_plan' => :'String',
91
+ :'monthly_cents' => :'Integer',
92
+ :'effect' => :'String',
93
+ :'prorated_charge_today_cents' => :'Integer',
94
+ :'starts_at' => :'String'
95
+ }
96
+ end
97
+
98
+ # List of attributes with nullable: true
99
+ def self.openapi_nullable
100
+ Set.new([
101
+ :'starts_at'
102
+ ])
103
+ end
104
+
105
+ # Initializes the object
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ def initialize(attributes = {})
108
+ if (!attributes.is_a?(Hash))
109
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::App::SubscriptionChangeProjection` initialize method"
110
+ end
111
+
112
+ # check to see if the attribute exists and convert string to symbol for hash key
113
+ acceptable_attribute_map = self.class.acceptable_attribute_map
114
+ attributes = attributes.each_with_object({}) { |(k, v), h|
115
+ if (!acceptable_attribute_map.key?(k.to_sym))
116
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::App::SubscriptionChangeProjection`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
117
+ end
118
+ h[k.to_sym] = v
119
+ }
120
+
121
+ if attributes.key?(:'product')
122
+ self.product = attributes[:'product']
123
+ else
124
+ self.product = nil
125
+ end
126
+
127
+ if attributes.key?(:'from_plan')
128
+ self.from_plan = attributes[:'from_plan']
129
+ else
130
+ self.from_plan = nil
131
+ end
132
+
133
+ if attributes.key?(:'to_plan')
134
+ self.to_plan = attributes[:'to_plan']
135
+ else
136
+ self.to_plan = nil
137
+ end
138
+
139
+ if attributes.key?(:'monthly_cents')
140
+ self.monthly_cents = attributes[:'monthly_cents']
141
+ else
142
+ self.monthly_cents = nil
143
+ end
144
+
145
+ if attributes.key?(:'effect')
146
+ self.effect = attributes[:'effect']
147
+ else
148
+ self.effect = nil
149
+ end
150
+
151
+ if attributes.key?(:'prorated_charge_today_cents')
152
+ self.prorated_charge_today_cents = attributes[:'prorated_charge_today_cents']
153
+ else
154
+ self.prorated_charge_today_cents = 0
155
+ end
156
+
157
+ if attributes.key?(:'starts_at')
158
+ self.starts_at = attributes[:'starts_at']
159
+ end
160
+ end
161
+
162
+ # Show invalid properties with the reasons. Usually used together with valid?
163
+ # @return Array for valid properties with the reasons
164
+ def list_invalid_properties
165
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
166
+ invalid_properties = Array.new
167
+ if @product.nil?
168
+ invalid_properties.push('invalid value for "product", product cannot be nil.')
169
+ end
170
+
171
+ if @from_plan.nil?
172
+ invalid_properties.push('invalid value for "from_plan", from_plan cannot be nil.')
173
+ end
174
+
175
+ if @to_plan.nil?
176
+ invalid_properties.push('invalid value for "to_plan", to_plan cannot be nil.')
177
+ end
178
+
179
+ if @monthly_cents.nil?
180
+ invalid_properties.push('invalid value for "monthly_cents", monthly_cents cannot be nil.')
181
+ end
182
+
183
+ if @effect.nil?
184
+ invalid_properties.push('invalid value for "effect", effect cannot be nil.')
185
+ end
186
+
187
+ invalid_properties
188
+ end
189
+
190
+ # Check to see if the all the properties in the model are valid
191
+ # @return true if the model is valid
192
+ def valid?
193
+ warn '[DEPRECATED] the `valid?` method is obsolete'
194
+ return false if @product.nil?
195
+ return false if @from_plan.nil?
196
+ return false if @to_plan.nil?
197
+ return false if @monthly_cents.nil?
198
+ return false if @effect.nil?
199
+ effect_validator = EnumAttributeValidator.new('String', ["IMMEDIATE", "NEXT_PERIOD"])
200
+ return false unless effect_validator.valid?(@effect)
201
+ true
202
+ end
203
+
204
+ # Custom attribute writer method with validation
205
+ # @param [Object] product Value to be assigned
206
+ def product=(product)
207
+ if product.nil?
208
+ fail ArgumentError, 'product cannot be nil'
209
+ end
210
+
211
+ @product = product
212
+ end
213
+
214
+ # Custom attribute writer method with validation
215
+ # @param [Object] from_plan Value to be assigned
216
+ def from_plan=(from_plan)
217
+ if from_plan.nil?
218
+ fail ArgumentError, 'from_plan cannot be nil'
219
+ end
220
+
221
+ @from_plan = from_plan
222
+ end
223
+
224
+ # Custom attribute writer method with validation
225
+ # @param [Object] to_plan Value to be assigned
226
+ def to_plan=(to_plan)
227
+ if to_plan.nil?
228
+ fail ArgumentError, 'to_plan cannot be nil'
229
+ end
230
+
231
+ @to_plan = to_plan
232
+ end
233
+
234
+ # Custom attribute writer method with validation
235
+ # @param [Object] monthly_cents Value to be assigned
236
+ def monthly_cents=(monthly_cents)
237
+ if monthly_cents.nil?
238
+ fail ArgumentError, 'monthly_cents cannot be nil'
239
+ end
240
+
241
+ @monthly_cents = monthly_cents
242
+ end
243
+
244
+ # Custom attribute writer method checking allowed values (enum).
245
+ # @param [Object] effect Object to be assigned
246
+ def effect=(effect)
247
+ validator = EnumAttributeValidator.new('String', ["IMMEDIATE", "NEXT_PERIOD"])
248
+ unless validator.valid?(effect)
249
+ fail ArgumentError, "invalid value for \"effect\", must be one of #{validator.allowable_values}."
250
+ end
251
+ @effect = effect
252
+ end
253
+
254
+ # Checks equality by comparing each attribute.
255
+ # @param [Object] Object to be compared
256
+ def ==(o)
257
+ return true if self.equal?(o)
258
+ self.class == o.class &&
259
+ product == o.product &&
260
+ from_plan == o.from_plan &&
261
+ to_plan == o.to_plan &&
262
+ monthly_cents == o.monthly_cents &&
263
+ effect == o.effect &&
264
+ prorated_charge_today_cents == o.prorated_charge_today_cents &&
265
+ starts_at == o.starts_at
266
+ end
267
+
268
+ # @see the `==` method
269
+ # @param [Object] Object to be compared
270
+ def eql?(o)
271
+ self == o
272
+ end
273
+
274
+ # Calculates hash code according to all attributes.
275
+ # @return [Integer] Hash code
276
+ def hash
277
+ [product, from_plan, to_plan, monthly_cents, effect, prorated_charge_today_cents, starts_at].hash
278
+ end
279
+
280
+ # Builds the object from hash
281
+ # @param [Hash] attributes Model attributes in the form of hash
282
+ # @return [Object] Returns the model itself
283
+ def self.build_from_hash(attributes)
284
+ return nil unless attributes.is_a?(Hash)
285
+ attributes = attributes.transform_keys(&:to_sym)
286
+ transformed_hash = {}
287
+ openapi_types.each_pair do |key, type|
288
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
289
+ transformed_hash["#{key}"] = nil
290
+ elsif type =~ /\AArray<(.*)>/i
291
+ # check to ensure the input is an array given that the attribute
292
+ # is documented as an array but the input is not
293
+ if attributes[attribute_map[key]].is_a?(Array)
294
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
295
+ end
296
+ elsif !attributes[attribute_map[key]].nil?
297
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
298
+ end
299
+ end
300
+ new(transformed_hash)
301
+ end
302
+
303
+ # Returns the object in the form of hash
304
+ # @return [Hash] Returns the object in the form of hash
305
+ def to_hash
306
+ hash = {}
307
+ self.class.attribute_map.each_pair do |attr, param|
308
+ value = self.send(attr)
309
+ if value.nil?
310
+ is_nullable = self.class.openapi_nullable.include?(attr)
311
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
312
+ end
313
+
314
+ hash[param] = _to_hash(value)
315
+ end
316
+ hash
317
+ end
318
+
319
+ end
320
+
321
+ end
@@ -14,23 +14,19 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module SmplkitGeneratedClient::App
17
- # Attributes accepted when creating a new subscription.
18
- class CreateSubscriptionAttributes < ApiModelBase
19
- # Product key to subscribe to, e.g. `flags`.
17
+ # One product enrollment as supplied by the caller. The caller supplies the *desired* (product, plan) pair for each product they want enrolled. Products absent from the request are interpreted as scheduled-for-drop at the end of the current billing period.
18
+ class SubscriptionItemRequest < ApiModelBase
19
+ # Product key (e.g. `audit`, `config`, `flags`, `logging`).
20
20
  attr_accessor :product
21
21
 
22
- # Plan key to subscribe on, e.g. `pro`.
22
+ # Target plan for this product. Must be a paid plan such as `STANDARD` or `PRO`; the free plan is implicit when a product is not listed.
23
23
  attr_accessor :plan
24
24
 
25
- # UUID of a payment method on file to bill against. If omitted, the account's default payment method is used.
26
- attr_accessor :payment_method
27
-
28
25
  # Attribute mapping from ruby-style variable name to JSON key.
29
26
  def self.attribute_map
30
27
  {
31
28
  :'product' => :'product',
32
- :'plan' => :'plan',
33
- :'payment_method' => :'payment_method'
29
+ :'plan' => :'plan'
34
30
  }
35
31
  end
36
32
 
@@ -48,15 +44,13 @@ module SmplkitGeneratedClient::App
48
44
  def self.openapi_types
49
45
  {
50
46
  :'product' => :'String',
51
- :'plan' => :'String',
52
- :'payment_method' => :'String'
47
+ :'plan' => :'String'
53
48
  }
54
49
  end
55
50
 
56
51
  # List of attributes with nullable: true
57
52
  def self.openapi_nullable
58
53
  Set.new([
59
- :'payment_method'
60
54
  ])
61
55
  end
62
56
 
@@ -64,14 +58,14 @@ module SmplkitGeneratedClient::App
64
58
  # @param [Hash] attributes Model attributes in the form of hash
65
59
  def initialize(attributes = {})
66
60
  if (!attributes.is_a?(Hash))
67
- fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::App::CreateSubscriptionAttributes` initialize method"
61
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::App::SubscriptionItemRequest` initialize method"
68
62
  end
69
63
 
70
64
  # check to see if the attribute exists and convert string to symbol for hash key
71
65
  acceptable_attribute_map = self.class.acceptable_attribute_map
72
66
  attributes = attributes.each_with_object({}) { |(k, v), h|
73
67
  if (!acceptable_attribute_map.key?(k.to_sym))
74
- fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::App::CreateSubscriptionAttributes`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
68
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::App::SubscriptionItemRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
75
69
  end
76
70
  h[k.to_sym] = v
77
71
  }
@@ -87,10 +81,6 @@ module SmplkitGeneratedClient::App
87
81
  else
88
82
  self.plan = nil
89
83
  end
90
-
91
- if attributes.key?(:'payment_method')
92
- self.payment_method = attributes[:'payment_method']
93
- end
94
84
  end
95
85
 
96
86
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -144,8 +134,7 @@ module SmplkitGeneratedClient::App
144
134
  return true if self.equal?(o)
145
135
  self.class == o.class &&
146
136
  product == o.product &&
147
- plan == o.plan &&
148
- payment_method == o.payment_method
137
+ plan == o.plan
149
138
  end
150
139
 
151
140
  # @see the `==` method
@@ -157,7 +146,7 @@ module SmplkitGeneratedClient::App
157
146
  # Calculates hash code according to all attributes.
158
147
  # @return [Integer] Hash code
159
148
  def hash
160
- [product, plan, payment_method].hash
149
+ [product, plan].hash
161
150
  end
162
151
 
163
152
  # Builds the object from hash