smplkit 3.0.7 → 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 (57) hide show
  1. checksums.yaml +4 -4
  2. data/lib/smplkit/_generated/app/lib/smplkit_app_client/api/api_keys_api.rb +7 -0
  3. data/lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb +16 -464
  4. data/lib/smplkit/_generated/app/lib/smplkit_app_client/api/context_types_api.rb +7 -0
  5. data/lib/smplkit/_generated/app/lib/smplkit_app_client/api/contexts_api.rb +7 -0
  6. data/lib/smplkit/_generated/app/lib/smplkit_app_client/api/environments_api.rb +7 -0
  7. data/lib/smplkit/_generated/app/lib/smplkit_app_client/api/invitations_api.rb +7 -0
  8. data/lib/smplkit/_generated/app/lib/smplkit_app_client/api/metrics_api.rb +23 -2
  9. data/lib/smplkit/_generated/app/lib/smplkit_app_client/api/plans_api.rb +9 -2
  10. data/lib/smplkit/_generated/app/lib/smplkit_app_client/api/products_api.rb +9 -2
  11. data/lib/smplkit/_generated/app/lib/smplkit_app_client/api/services_api.rb +7 -0
  12. data/lib/smplkit/_generated/app/lib/smplkit_app_client/api/subscription_api.rb +289 -0
  13. data/lib/smplkit/_generated/app/lib/smplkit_app_client/api/users_api.rb +7 -0
  14. data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/{subscription_list_response.rb → admin_subscription_request.rb} +9 -20
  15. data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/admin_subscription_request_attributes.rb +190 -0
  16. data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/{create_subscription_data.rb → admin_subscription_request_resource.rb} +46 -12
  17. data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/{next_tier_meta.rb → next_tier_response.rb} +6 -6
  18. data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/subscription_change_projection.rb +321 -0
  19. data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/{create_subscription_attributes.rb → subscription_item_request.rb} +10 -21
  20. data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/{subscription_attributes.rb → subscription_item_response.rb} +66 -77
  21. data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/subscription_preview_attributes.rb +390 -0
  22. data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/subscription_preview_resource.rb +241 -0
  23. data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/{plan_change_request.rb → subscription_preview_response.rb} +20 -21
  24. data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/{create_subscription_body.rb → subscription_request.rb} +5 -5
  25. data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/subscription_request_attributes.rb +179 -0
  26. data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/subscription_request_resource.rb +227 -0
  27. data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/subscription_resource.rb +4 -2
  28. data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/subscription_response.rb +1 -1
  29. data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/{subscription_list_meta.rb → subscription_response_attributes.rb} +135 -62
  30. data/lib/smplkit/_generated/app/lib/smplkit_app_client.rb +15 -8
  31. data/lib/smplkit/_generated/app/spec/api/api_keys_api_spec.rb +1 -0
  32. data/lib/smplkit/_generated/app/spec/api/billing_api_spec.rb +3 -86
  33. data/lib/smplkit/_generated/app/spec/api/context_types_api_spec.rb +1 -0
  34. data/lib/smplkit/_generated/app/spec/api/contexts_api_spec.rb +1 -0
  35. data/lib/smplkit/_generated/app/spec/api/environments_api_spec.rb +1 -0
  36. data/lib/smplkit/_generated/app/spec/api/invitations_api_spec.rb +1 -0
  37. data/lib/smplkit/_generated/app/spec/api/metrics_api_spec.rb +4 -1
  38. data/lib/smplkit/_generated/app/spec/api/plans_api_spec.rb +2 -1
  39. data/lib/smplkit/_generated/app/spec/api/products_api_spec.rb +2 -1
  40. data/lib/smplkit/_generated/app/spec/api/services_api_spec.rb +1 -0
  41. data/lib/smplkit/_generated/app/spec/api/subscription_api_spec.rb +83 -0
  42. data/lib/smplkit/_generated/app/spec/api/users_api_spec.rb +1 -0
  43. data/lib/smplkit/_generated/app/spec/models/{create_subscription_attributes_spec.rb → admin_subscription_request_attributes_spec.rb} +9 -9
  44. data/lib/smplkit/_generated/app/spec/models/admin_subscription_request_resource_spec.rb +52 -0
  45. data/lib/smplkit/_generated/app/spec/models/{plan_change_request_spec.rb → admin_subscription_request_spec.rb} +7 -7
  46. data/lib/smplkit/_generated/app/spec/models/{next_tier_meta_spec.rb → next_tier_response_spec.rb} +6 -6
  47. data/lib/smplkit/_generated/app/spec/models/{subscription_list_meta_spec.rb → subscription_change_projection_spec.rb} +20 -14
  48. data/lib/smplkit/_generated/app/spec/models/{create_subscription_data_spec.rb → subscription_item_request_spec.rb} +8 -8
  49. data/lib/smplkit/_generated/app/spec/models/{subscription_attributes_spec.rb → subscription_item_response_spec.rb} +12 -18
  50. data/lib/smplkit/_generated/app/spec/models/subscription_preview_attributes_spec.rb +88 -0
  51. data/lib/smplkit/_generated/app/spec/models/subscription_preview_resource_spec.rb +56 -0
  52. data/lib/smplkit/_generated/app/spec/models/subscription_preview_response_spec.rb +36 -0
  53. data/lib/smplkit/_generated/app/spec/models/{subscription_list_response_spec.rb → subscription_request_attributes_spec.rb} +8 -8
  54. data/lib/smplkit/_generated/app/spec/models/subscription_request_resource_spec.rb +52 -0
  55. data/lib/smplkit/_generated/app/spec/models/{create_subscription_body_spec.rb → subscription_request_spec.rb} +6 -6
  56. data/lib/smplkit/_generated/app/spec/models/subscription_response_attributes_spec.rb +100 -0
  57. metadata +31 -17
@@ -14,15 +14,14 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module SmplkitGeneratedClient::App
17
- # Body for the subscription upgrade and downgrade actions.
18
- class PlanChangeRequest < ApiModelBase
19
- # Plan key to change the subscription to.
20
- attr_accessor :plan
17
+ # Response envelope for the preview action.
18
+ class SubscriptionPreviewResponse < ApiModelBase
19
+ attr_accessor :data
21
20
 
22
21
  # Attribute mapping from ruby-style variable name to JSON key.
23
22
  def self.attribute_map
24
23
  {
25
- :'plan' => :'plan'
24
+ :'data' => :'data'
26
25
  }
27
26
  end
28
27
 
@@ -39,7 +38,7 @@ module SmplkitGeneratedClient::App
39
38
  # Attribute type mapping.
40
39
  def self.openapi_types
41
40
  {
42
- :'plan' => :'String'
41
+ :'data' => :'SubscriptionPreviewResource'
43
42
  }
44
43
  end
45
44
 
@@ -53,22 +52,22 @@ module SmplkitGeneratedClient::App
53
52
  # @param [Hash] attributes Model attributes in the form of hash
54
53
  def initialize(attributes = {})
55
54
  if (!attributes.is_a?(Hash))
56
- fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::App::PlanChangeRequest` initialize method"
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::App::SubscriptionPreviewResponse` initialize method"
57
56
  end
58
57
 
59
58
  # check to see if the attribute exists and convert string to symbol for hash key
60
59
  acceptable_attribute_map = self.class.acceptable_attribute_map
61
60
  attributes = attributes.each_with_object({}) { |(k, v), h|
62
61
  if (!acceptable_attribute_map.key?(k.to_sym))
63
- fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::App::PlanChangeRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::App::SubscriptionPreviewResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
64
63
  end
65
64
  h[k.to_sym] = v
66
65
  }
67
66
 
68
- if attributes.key?(:'plan')
69
- self.plan = attributes[:'plan']
67
+ if attributes.key?(:'data')
68
+ self.data = attributes[:'data']
70
69
  else
71
- self.plan = nil
70
+ self.data = nil
72
71
  end
73
72
  end
74
73
 
@@ -77,8 +76,8 @@ module SmplkitGeneratedClient::App
77
76
  def list_invalid_properties
78
77
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
79
78
  invalid_properties = Array.new
80
- if @plan.nil?
81
- invalid_properties.push('invalid value for "plan", plan cannot be nil.')
79
+ if @data.nil?
80
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
82
81
  end
83
82
 
84
83
  invalid_properties
@@ -88,18 +87,18 @@ module SmplkitGeneratedClient::App
88
87
  # @return true if the model is valid
89
88
  def valid?
90
89
  warn '[DEPRECATED] the `valid?` method is obsolete'
91
- return false if @plan.nil?
90
+ return false if @data.nil?
92
91
  true
93
92
  end
94
93
 
95
94
  # Custom attribute writer method with validation
96
- # @param [Object] plan Value to be assigned
97
- def plan=(plan)
98
- if plan.nil?
99
- fail ArgumentError, 'plan cannot be nil'
95
+ # @param [Object] data Value to be assigned
96
+ def data=(data)
97
+ if data.nil?
98
+ fail ArgumentError, 'data cannot be nil'
100
99
  end
101
100
 
102
- @plan = plan
101
+ @data = data
103
102
  end
104
103
 
105
104
  # Checks equality by comparing each attribute.
@@ -107,7 +106,7 @@ module SmplkitGeneratedClient::App
107
106
  def ==(o)
108
107
  return true if self.equal?(o)
109
108
  self.class == o.class &&
110
- plan == o.plan
109
+ data == o.data
111
110
  end
112
111
 
113
112
  # @see the `==` method
@@ -119,7 +118,7 @@ module SmplkitGeneratedClient::App
119
118
  # Calculates hash code according to all attributes.
120
119
  # @return [Integer] Hash code
121
120
  def hash
122
- [plan].hash
121
+ [data].hash
123
122
  end
124
123
 
125
124
  # Builds the object from hash
@@ -14,8 +14,8 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module SmplkitGeneratedClient::App
17
- # JSON:API request envelope for creating a subscription.
18
- class CreateSubscriptionBody < ApiModelBase
17
+ # Single-resource request envelope for replacing the subscription.
18
+ class SubscriptionRequest < ApiModelBase
19
19
  attr_accessor :data
20
20
 
21
21
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -38,7 +38,7 @@ module SmplkitGeneratedClient::App
38
38
  # Attribute type mapping.
39
39
  def self.openapi_types
40
40
  {
41
- :'data' => :'CreateSubscriptionData'
41
+ :'data' => :'SubscriptionRequestResource'
42
42
  }
43
43
  end
44
44
 
@@ -52,14 +52,14 @@ module SmplkitGeneratedClient::App
52
52
  # @param [Hash] attributes Model attributes in the form of hash
53
53
  def initialize(attributes = {})
54
54
  if (!attributes.is_a?(Hash))
55
- fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::App::CreateSubscriptionBody` initialize method"
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::App::SubscriptionRequest` initialize method"
56
56
  end
57
57
 
58
58
  # check to see if the attribute exists and convert string to symbol for hash key
59
59
  acceptable_attribute_map = self.class.acceptable_attribute_map
60
60
  attributes = attributes.each_with_object({}) { |(k, v), h|
61
61
  if (!acceptable_attribute_map.key?(k.to_sym))
62
- fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::App::CreateSubscriptionBody`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::App::SubscriptionRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
63
63
  end
64
64
  h[k.to_sym] = v
65
65
  }
@@ -0,0 +1,179 @@
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
+ # Customer's desired subscription state.
18
+ class SubscriptionRequestAttributes < ApiModelBase
19
+ # Desired enrollments. Products listed are scheduled to be on the specified plan immediately (for upgrades and new enrollments) or at the end of the current billing period (for downgrades). Products not listed are scheduled to be dropped at the end of the current billing period.
20
+ attr_accessor :items
21
+
22
+ # Optional identifier of the payment method to bill against. If omitted, the account's default payment method is used.
23
+ attr_accessor :payment_method
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'items' => :'items',
29
+ :'payment_method' => :'payment_method'
30
+ }
31
+ end
32
+
33
+ # Returns attribute mapping this model knows about
34
+ def self.acceptable_attribute_map
35
+ attribute_map
36
+ end
37
+
38
+ # Returns all the JSON keys this model knows about
39
+ def self.acceptable_attributes
40
+ acceptable_attribute_map.values
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'items' => :'Array<SubscriptionItemRequest>',
47
+ :'payment_method' => :'String'
48
+ }
49
+ end
50
+
51
+ # List of attributes with nullable: true
52
+ def self.openapi_nullable
53
+ Set.new([
54
+ :'payment_method'
55
+ ])
56
+ end
57
+
58
+ # Initializes the object
59
+ # @param [Hash] attributes Model attributes in the form of hash
60
+ def initialize(attributes = {})
61
+ if (!attributes.is_a?(Hash))
62
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::App::SubscriptionRequestAttributes` initialize method"
63
+ end
64
+
65
+ # check to see if the attribute exists and convert string to symbol for hash key
66
+ acceptable_attribute_map = self.class.acceptable_attribute_map
67
+ attributes = attributes.each_with_object({}) { |(k, v), h|
68
+ if (!acceptable_attribute_map.key?(k.to_sym))
69
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::App::SubscriptionRequestAttributes`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
70
+ end
71
+ h[k.to_sym] = v
72
+ }
73
+
74
+ if attributes.key?(:'items')
75
+ if (value = attributes[:'items']).is_a?(Array)
76
+ self.items = value
77
+ end
78
+ else
79
+ self.items = nil
80
+ end
81
+
82
+ if attributes.key?(:'payment_method')
83
+ self.payment_method = attributes[:'payment_method']
84
+ end
85
+ end
86
+
87
+ # Show invalid properties with the reasons. Usually used together with valid?
88
+ # @return Array for valid properties with the reasons
89
+ def list_invalid_properties
90
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
91
+ invalid_properties = Array.new
92
+ if @items.nil?
93
+ invalid_properties.push('invalid value for "items", items cannot be nil.')
94
+ end
95
+
96
+ invalid_properties
97
+ end
98
+
99
+ # Check to see if the all the properties in the model are valid
100
+ # @return true if the model is valid
101
+ def valid?
102
+ warn '[DEPRECATED] the `valid?` method is obsolete'
103
+ return false if @items.nil?
104
+ true
105
+ end
106
+
107
+ # Custom attribute writer method with validation
108
+ # @param [Object] items Value to be assigned
109
+ def items=(items)
110
+ if items.nil?
111
+ fail ArgumentError, 'items cannot be nil'
112
+ end
113
+
114
+ @items = items
115
+ end
116
+
117
+ # Checks equality by comparing each attribute.
118
+ # @param [Object] Object to be compared
119
+ def ==(o)
120
+ return true if self.equal?(o)
121
+ self.class == o.class &&
122
+ items == o.items &&
123
+ payment_method == o.payment_method
124
+ end
125
+
126
+ # @see the `==` method
127
+ # @param [Object] Object to be compared
128
+ def eql?(o)
129
+ self == o
130
+ end
131
+
132
+ # Calculates hash code according to all attributes.
133
+ # @return [Integer] Hash code
134
+ def hash
135
+ [items, payment_method].hash
136
+ end
137
+
138
+ # Builds the object from hash
139
+ # @param [Hash] attributes Model attributes in the form of hash
140
+ # @return [Object] Returns the model itself
141
+ def self.build_from_hash(attributes)
142
+ return nil unless attributes.is_a?(Hash)
143
+ attributes = attributes.transform_keys(&:to_sym)
144
+ transformed_hash = {}
145
+ openapi_types.each_pair do |key, type|
146
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
147
+ transformed_hash["#{key}"] = nil
148
+ elsif type =~ /\AArray<(.*)>/i
149
+ # check to ensure the input is an array given that the attribute
150
+ # is documented as an array but the input is not
151
+ if attributes[attribute_map[key]].is_a?(Array)
152
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
153
+ end
154
+ elsif !attributes[attribute_map[key]].nil?
155
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
156
+ end
157
+ end
158
+ new(transformed_hash)
159
+ end
160
+
161
+ # Returns the object in the form of hash
162
+ # @return [Hash] Returns the object in the form of hash
163
+ def to_hash
164
+ hash = {}
165
+ self.class.attribute_map.each_pair do |attr, param|
166
+ value = self.send(attr)
167
+ if value.nil?
168
+ is_nullable = self.class.openapi_nullable.include?(attr)
169
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
170
+ end
171
+
172
+ hash[param] = _to_hash(value)
173
+ end
174
+ hash
175
+ end
176
+
177
+ end
178
+
179
+ end
@@ -0,0 +1,227 @@
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
+ # JSON:API resource object for a subscription update request.
18
+ class SubscriptionRequestResource < ApiModelBase
19
+ # Subscription identifier; the server ignores this and uses the auth context.
20
+ attr_accessor :id
21
+
22
+ # JSON:API resource type.
23
+ attr_accessor :type
24
+
25
+ attr_accessor :attributes
26
+
27
+ class EnumAttributeValidator
28
+ attr_reader :datatype
29
+ attr_reader :allowable_values
30
+
31
+ def initialize(datatype, allowable_values)
32
+ @allowable_values = allowable_values.map do |value|
33
+ case datatype.to_s
34
+ when /Integer/i
35
+ value.to_i
36
+ when /Float/i
37
+ value.to_f
38
+ else
39
+ value
40
+ end
41
+ end
42
+ end
43
+
44
+ def valid?(value)
45
+ !value || allowable_values.include?(value)
46
+ end
47
+ end
48
+
49
+ # Attribute mapping from ruby-style variable name to JSON key.
50
+ def self.attribute_map
51
+ {
52
+ :'id' => :'id',
53
+ :'type' => :'type',
54
+ :'attributes' => :'attributes'
55
+ }
56
+ end
57
+
58
+ # Returns attribute mapping this model knows about
59
+ def self.acceptable_attribute_map
60
+ attribute_map
61
+ end
62
+
63
+ # Returns all the JSON keys this model knows about
64
+ def self.acceptable_attributes
65
+ acceptable_attribute_map.values
66
+ end
67
+
68
+ # Attribute type mapping.
69
+ def self.openapi_types
70
+ {
71
+ :'id' => :'String',
72
+ :'type' => :'String',
73
+ :'attributes' => :'SubscriptionRequestAttributes'
74
+ }
75
+ end
76
+
77
+ # List of attributes with nullable: true
78
+ def self.openapi_nullable
79
+ Set.new([
80
+ :'id',
81
+ ])
82
+ end
83
+
84
+ # Initializes the object
85
+ # @param [Hash] attributes Model attributes in the form of hash
86
+ def initialize(attributes = {})
87
+ if (!attributes.is_a?(Hash))
88
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::App::SubscriptionRequestResource` initialize method"
89
+ end
90
+
91
+ # check to see if the attribute exists and convert string to symbol for hash key
92
+ acceptable_attribute_map = self.class.acceptable_attribute_map
93
+ attributes = attributes.each_with_object({}) { |(k, v), h|
94
+ if (!acceptable_attribute_map.key?(k.to_sym))
95
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::App::SubscriptionRequestResource`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
96
+ end
97
+ h[k.to_sym] = v
98
+ }
99
+
100
+ if attributes.key?(:'id')
101
+ self.id = attributes[:'id']
102
+ end
103
+
104
+ if attributes.key?(:'type')
105
+ self.type = attributes[:'type']
106
+ else
107
+ self.type = nil
108
+ end
109
+
110
+ if attributes.key?(:'attributes')
111
+ self.attributes = attributes[:'attributes']
112
+ else
113
+ self.attributes = nil
114
+ end
115
+ end
116
+
117
+ # Show invalid properties with the reasons. Usually used together with valid?
118
+ # @return Array for valid properties with the reasons
119
+ def list_invalid_properties
120
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
121
+ invalid_properties = Array.new
122
+ if @type.nil?
123
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
124
+ end
125
+
126
+ if @attributes.nil?
127
+ invalid_properties.push('invalid value for "attributes", attributes cannot be nil.')
128
+ end
129
+
130
+ invalid_properties
131
+ end
132
+
133
+ # Check to see if the all the properties in the model are valid
134
+ # @return true if the model is valid
135
+ def valid?
136
+ warn '[DEPRECATED] the `valid?` method is obsolete'
137
+ return false if @type.nil?
138
+ type_validator = EnumAttributeValidator.new('String', ["subscription"])
139
+ return false unless type_validator.valid?(@type)
140
+ return false if @attributes.nil?
141
+ true
142
+ end
143
+
144
+ # Custom attribute writer method checking allowed values (enum).
145
+ # @param [Object] type Object to be assigned
146
+ def type=(type)
147
+ validator = EnumAttributeValidator.new('String', ["subscription"])
148
+ unless validator.valid?(type)
149
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
150
+ end
151
+ @type = type
152
+ end
153
+
154
+ # Custom attribute writer method with validation
155
+ # @param [Object] attributes Value to be assigned
156
+ def attributes=(attributes)
157
+ if attributes.nil?
158
+ fail ArgumentError, 'attributes cannot be nil'
159
+ end
160
+
161
+ @attributes = attributes
162
+ end
163
+
164
+ # Checks equality by comparing each attribute.
165
+ # @param [Object] Object to be compared
166
+ def ==(o)
167
+ return true if self.equal?(o)
168
+ self.class == o.class &&
169
+ id == o.id &&
170
+ type == o.type &&
171
+ attributes == o.attributes
172
+ end
173
+
174
+ # @see the `==` method
175
+ # @param [Object] Object to be compared
176
+ def eql?(o)
177
+ self == o
178
+ end
179
+
180
+ # Calculates hash code according to all attributes.
181
+ # @return [Integer] Hash code
182
+ def hash
183
+ [id, type, attributes].hash
184
+ end
185
+
186
+ # Builds the object from hash
187
+ # @param [Hash] attributes Model attributes in the form of hash
188
+ # @return [Object] Returns the model itself
189
+ def self.build_from_hash(attributes)
190
+ return nil unless attributes.is_a?(Hash)
191
+ attributes = attributes.transform_keys(&:to_sym)
192
+ transformed_hash = {}
193
+ openapi_types.each_pair do |key, type|
194
+ if attributes.key?(attribute_map[key]) && attributes[attribute_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[attribute_map[key]].is_a?(Array)
200
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
201
+ end
202
+ elsif !attributes[attribute_map[key]].nil?
203
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_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
+ self.class.attribute_map.each_pair do |attr, param|
214
+ value = self.send(attr)
215
+ if value.nil?
216
+ is_nullable = self.class.openapi_nullable.include?(attr)
217
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
218
+ end
219
+
220
+ hash[param] = _to_hash(value)
221
+ end
222
+ hash
223
+ end
224
+
225
+ end
226
+
227
+ end
@@ -14,10 +14,12 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module SmplkitGeneratedClient::App
17
- # JSON:API resource envelope for a subscription. `id` must not be specified for create requests (the server assigns it).
17
+ # JSON:API resource object for a subscription.
18
18
  class SubscriptionResource < ApiModelBase
19
+ # Subscription identifier. Always `current` on response; absent on create-style requests.
19
20
  attr_accessor :id
20
21
 
22
+ # JSON:API resource type.
21
23
  attr_accessor :type
22
24
 
23
25
  attr_accessor :attributes
@@ -68,7 +70,7 @@ module SmplkitGeneratedClient::App
68
70
  {
69
71
  :'id' => :'String',
70
72
  :'type' => :'String',
71
- :'attributes' => :'SubscriptionAttributes'
73
+ :'attributes' => :'SubscriptionResponseAttributes'
72
74
  }
73
75
  end
74
76
 
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module SmplkitGeneratedClient::App
17
- # JSON:API single-resource response envelope for a subscription.
17
+ # Single-resource response envelope for a subscription.
18
18
  class SubscriptionResponse < ApiModelBase
19
19
  attr_accessor :data
20
20