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.
- checksums.yaml +4 -4
- data/lib/smplkit/_generated/app/lib/smplkit_app_client/api/billing_api.rb +0 -469
- data/lib/smplkit/_generated/app/lib/smplkit_app_client/api/subscription_api.rb +289 -0
- data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/{subscription_list_response.rb → admin_subscription_request.rb} +9 -20
- data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/admin_subscription_request_attributes.rb +190 -0
- data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/{create_subscription_data.rb → admin_subscription_request_resource.rb} +46 -12
- data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/{next_tier_meta.rb → next_tier_response.rb} +6 -6
- data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/subscription_change_projection.rb +321 -0
- data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/{create_subscription_attributes.rb → subscription_item_request.rb} +10 -21
- data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/{subscription_attributes.rb → subscription_item_response.rb} +66 -77
- data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/subscription_preview_attributes.rb +390 -0
- data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/subscription_preview_resource.rb +241 -0
- data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/{plan_change_request.rb → subscription_preview_response.rb} +20 -21
- data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/{create_subscription_body.rb → subscription_request.rb} +5 -5
- data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/subscription_request_attributes.rb +179 -0
- data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/subscription_request_resource.rb +227 -0
- data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/subscription_resource.rb +4 -2
- data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/subscription_response.rb +1 -1
- data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/{subscription_list_meta.rb → subscription_response_attributes.rb} +135 -62
- data/lib/smplkit/_generated/app/lib/smplkit_app_client.rb +15 -8
- data/lib/smplkit/_generated/app/spec/api/billing_api_spec.rb +0 -86
- data/lib/smplkit/_generated/app/spec/api/subscription_api_spec.rb +83 -0
- data/lib/smplkit/_generated/app/spec/models/{create_subscription_attributes_spec.rb → admin_subscription_request_attributes_spec.rb} +9 -9
- data/lib/smplkit/_generated/app/spec/models/admin_subscription_request_resource_spec.rb +52 -0
- data/lib/smplkit/_generated/app/spec/models/{plan_change_request_spec.rb → admin_subscription_request_spec.rb} +7 -7
- data/lib/smplkit/_generated/app/spec/models/{next_tier_meta_spec.rb → next_tier_response_spec.rb} +6 -6
- data/lib/smplkit/_generated/app/spec/models/{subscription_list_meta_spec.rb → subscription_change_projection_spec.rb} +20 -14
- data/lib/smplkit/_generated/app/spec/models/{create_subscription_data_spec.rb → subscription_item_request_spec.rb} +8 -8
- data/lib/smplkit/_generated/app/spec/models/{subscription_attributes_spec.rb → subscription_item_response_spec.rb} +12 -18
- data/lib/smplkit/_generated/app/spec/models/subscription_preview_attributes_spec.rb +88 -0
- data/lib/smplkit/_generated/app/spec/models/subscription_preview_resource_spec.rb +56 -0
- data/lib/smplkit/_generated/app/spec/models/subscription_preview_response_spec.rb +36 -0
- data/lib/smplkit/_generated/app/spec/models/{subscription_list_response_spec.rb → subscription_request_attributes_spec.rb} +8 -8
- data/lib/smplkit/_generated/app/spec/models/subscription_request_resource_spec.rb +52 -0
- data/lib/smplkit/_generated/app/spec/models/{create_subscription_body_spec.rb → subscription_request_spec.rb} +6 -6
- data/lib/smplkit/_generated/app/spec/models/subscription_response_attributes_spec.rb +100 -0
- metadata +31 -17
data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/subscription_preview_resource.rb
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
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 preview.
|
|
18
|
+
class SubscriptionPreviewResource < ApiModelBase
|
|
19
|
+
# Always `preview`.
|
|
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' => :'SubscriptionPreviewAttributes'
|
|
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::SubscriptionPreviewResource` 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::SubscriptionPreviewResource`. 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
|
+
else
|
|
103
|
+
self.id = 'preview'
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
if attributes.key?(:'type')
|
|
107
|
+
self.type = attributes[:'type']
|
|
108
|
+
else
|
|
109
|
+
self.type = nil
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
if attributes.key?(:'attributes')
|
|
113
|
+
self.attributes = attributes[:'attributes']
|
|
114
|
+
else
|
|
115
|
+
self.attributes = nil
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
120
|
+
# @return Array for valid properties with the reasons
|
|
121
|
+
def list_invalid_properties
|
|
122
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
123
|
+
invalid_properties = Array.new
|
|
124
|
+
if @type.nil?
|
|
125
|
+
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
if @attributes.nil?
|
|
129
|
+
invalid_properties.push('invalid value for "attributes", attributes cannot be nil.')
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
invalid_properties
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# Check to see if the all the properties in the model are valid
|
|
136
|
+
# @return true if the model is valid
|
|
137
|
+
def valid?
|
|
138
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
139
|
+
id_validator = EnumAttributeValidator.new('String', ["preview"])
|
|
140
|
+
return false unless id_validator.valid?(@id)
|
|
141
|
+
return false if @type.nil?
|
|
142
|
+
type_validator = EnumAttributeValidator.new('String', ["subscription_preview"])
|
|
143
|
+
return false unless type_validator.valid?(@type)
|
|
144
|
+
return false if @attributes.nil?
|
|
145
|
+
true
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
149
|
+
# @param [Object] id Object to be assigned
|
|
150
|
+
def id=(id)
|
|
151
|
+
validator = EnumAttributeValidator.new('String', ["preview"])
|
|
152
|
+
unless validator.valid?(id)
|
|
153
|
+
fail ArgumentError, "invalid value for \"id\", must be one of #{validator.allowable_values}."
|
|
154
|
+
end
|
|
155
|
+
@id = id
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
159
|
+
# @param [Object] type Object to be assigned
|
|
160
|
+
def type=(type)
|
|
161
|
+
validator = EnumAttributeValidator.new('String', ["subscription_preview"])
|
|
162
|
+
unless validator.valid?(type)
|
|
163
|
+
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
|
164
|
+
end
|
|
165
|
+
@type = type
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
# Custom attribute writer method with validation
|
|
169
|
+
# @param [Object] attributes Value to be assigned
|
|
170
|
+
def attributes=(attributes)
|
|
171
|
+
if attributes.nil?
|
|
172
|
+
fail ArgumentError, 'attributes cannot be nil'
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
@attributes = attributes
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
# Checks equality by comparing each attribute.
|
|
179
|
+
# @param [Object] Object to be compared
|
|
180
|
+
def ==(o)
|
|
181
|
+
return true if self.equal?(o)
|
|
182
|
+
self.class == o.class &&
|
|
183
|
+
id == o.id &&
|
|
184
|
+
type == o.type &&
|
|
185
|
+
attributes == o.attributes
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
# @see the `==` method
|
|
189
|
+
# @param [Object] Object to be compared
|
|
190
|
+
def eql?(o)
|
|
191
|
+
self == o
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# Calculates hash code according to all attributes.
|
|
195
|
+
# @return [Integer] Hash code
|
|
196
|
+
def hash
|
|
197
|
+
[id, type, attributes].hash
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# Builds the object from hash
|
|
201
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
202
|
+
# @return [Object] Returns the model itself
|
|
203
|
+
def self.build_from_hash(attributes)
|
|
204
|
+
return nil unless attributes.is_a?(Hash)
|
|
205
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
206
|
+
transformed_hash = {}
|
|
207
|
+
openapi_types.each_pair do |key, type|
|
|
208
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
209
|
+
transformed_hash["#{key}"] = nil
|
|
210
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
211
|
+
# check to ensure the input is an array given that the attribute
|
|
212
|
+
# is documented as an array but the input is not
|
|
213
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
214
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
215
|
+
end
|
|
216
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
217
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
new(transformed_hash)
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
# Returns the object in the form of hash
|
|
224
|
+
# @return [Hash] Returns the object in the form of hash
|
|
225
|
+
def to_hash
|
|
226
|
+
hash = {}
|
|
227
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
228
|
+
value = self.send(attr)
|
|
229
|
+
if value.nil?
|
|
230
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
231
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
hash[param] = _to_hash(value)
|
|
235
|
+
end
|
|
236
|
+
hash
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
end
|
|
@@ -14,15 +14,14 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module SmplkitGeneratedClient::App
|
|
17
|
-
#
|
|
18
|
-
class
|
|
19
|
-
|
|
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
|
-
:'
|
|
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
|
-
:'
|
|
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::
|
|
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::
|
|
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?(:'
|
|
69
|
-
self.
|
|
67
|
+
if attributes.key?(:'data')
|
|
68
|
+
self.data = attributes[:'data']
|
|
70
69
|
else
|
|
71
|
-
self.
|
|
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 @
|
|
81
|
-
invalid_properties.push('invalid value for "
|
|
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 @
|
|
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]
|
|
97
|
-
def
|
|
98
|
-
if
|
|
99
|
-
fail ArgumentError, '
|
|
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
|
-
@
|
|
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
|
-
|
|
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
|
-
[
|
|
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
|
-
#
|
|
18
|
-
class
|
|
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' => :'
|
|
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::
|
|
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::
|
|
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
|
}
|
data/lib/smplkit/_generated/app/lib/smplkit_app_client/models/subscription_request_attributes.rb
ADDED
|
@@ -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
|