mx-platform-ruby 0.3.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/README.md +29 -222
- data/docs/ChallengeResponse.md +2 -2
- data/docs/{ChallengeImageOptions.md → ImageOptionResponse.md} +2 -2
- data/docs/{ChallengeOptions.md → OptionResponse.md} +2 -2
- data/lib/mx-platform-ruby/models/challenge_response.rb +2 -2
- data/lib/mx-platform-ruby/models/{challenge_image_options.rb → image_option_response.rb} +3 -3
- data/lib/mx-platform-ruby/models/{challenge_options.rb → option_response.rb} +3 -3
- data/lib/mx-platform-ruby/version.rb +1 -1
- data/lib/mx-platform-ruby.rb +2 -2
- data/openapi/config.yml +1 -1
- data/openapi/templates/README.mustache +71 -0
- data/spec/models/{challenge_image_options_spec.rb → image_option_response_spec.rb} +6 -6
- data/spec/models/{challenge_options_spec.rb → option_response_spec.rb} +6 -6
- metadata +88 -190
- data/docs/Account.md +0 -96
- data/docs/AccountNumber.md +0 -32
- data/docs/AccountOwner.md +0 -40
- data/docs/Category.md +0 -32
- data/docs/Challenge.md +0 -30
- data/docs/ChallengeResponseImageOptions.md +0 -22
- data/docs/ChallengeResponseOptions.md +0 -20
- data/docs/ConnectWidget.md +0 -20
- data/docs/Credential.md +0 -26
- data/docs/EnhanceTransaction.md +0 -48
- data/docs/Holding.md +0 -52
- data/docs/InlineResponse200.md +0 -18
- data/docs/Institution.md +0 -36
- data/docs/Member.md +0 -40
- data/docs/MemberStatus.md +0 -34
- data/docs/Merchant.md +0 -28
- data/docs/OAuthWindow.md +0 -20
- data/docs/Pagination.md +0 -24
- data/docs/Statement.md +0 -32
- data/docs/Tag.md +0 -22
- data/docs/Tagging.md +0 -26
- data/docs/Transaction.md +0 -88
- data/docs/TransactionRule.md +0 -30
- data/docs/User.md +0 -26
- data/docs/Widget.md +0 -22
- data/lib/mx-platform-ruby/models/account.rb +0 -569
- data/lib/mx-platform-ruby/models/account_number.rb +0 -281
- data/lib/mx-platform-ruby/models/account_owner.rb +0 -317
- data/lib/mx-platform-ruby/models/category.rb +0 -281
- data/lib/mx-platform-ruby/models/challenge.rb +0 -276
- data/lib/mx-platform-ruby/models/challenge_response_image_options.rb +0 -236
- data/lib/mx-platform-ruby/models/challenge_response_options.rb +0 -227
- data/lib/mx-platform-ruby/models/connect_widget.rb +0 -227
- data/lib/mx-platform-ruby/models/credential.rb +0 -254
- data/lib/mx-platform-ruby/models/enhance_transaction.rb +0 -353
- data/lib/mx-platform-ruby/models/holding.rb +0 -371
- data/lib/mx-platform-ruby/models/inline_response200.rb +0 -218
- data/lib/mx-platform-ruby/models/institution.rb +0 -299
- data/lib/mx-platform-ruby/models/member.rb +0 -317
- data/lib/mx-platform-ruby/models/member_status.rb +0 -292
- data/lib/mx-platform-ruby/models/merchant.rb +0 -263
- data/lib/mx-platform-ruby/models/o_auth_window.rb +0 -227
- data/lib/mx-platform-ruby/models/pagination.rb +0 -245
- data/lib/mx-platform-ruby/models/statement.rb +0 -281
- data/lib/mx-platform-ruby/models/tag.rb +0 -236
- data/lib/mx-platform-ruby/models/tagging.rb +0 -254
- data/lib/mx-platform-ruby/models/transaction.rb +0 -533
- data/lib/mx-platform-ruby/models/transaction_rule.rb +0 -272
- data/lib/mx-platform-ruby/models/user.rb +0 -254
- data/lib/mx-platform-ruby/models/widget.rb +0 -236
- data/openapi/mx_platform_ruby.yml +0 -11
- data/pkg/mx-platform-ruby-0.2.0.gem +0 -0
- data/pkg/mx-platform-ruby-0.2.1.gem +0 -0
- data/spec/models/account_number_spec.rb +0 -76
- data/spec/models/account_owner_spec.rb +0 -100
- data/spec/models/account_spec.rb +0 -268
- data/spec/models/category_spec.rb +0 -76
- data/spec/models/challenge_response_image_options_spec.rb +0 -46
- data/spec/models/challenge_response_options_spec.rb +0 -40
- data/spec/models/challenge_spec.rb +0 -70
- data/spec/models/connect_widget_spec.rb +0 -40
- data/spec/models/credential_spec.rb +0 -58
- data/spec/models/enhance_transaction_spec.rb +0 -124
- data/spec/models/holding_spec.rb +0 -136
- data/spec/models/inline_response200_spec.rb +0 -34
- data/spec/models/institution_spec.rb +0 -88
- data/spec/models/member_spec.rb +0 -100
- data/spec/models/member_status_spec.rb +0 -82
- data/spec/models/merchant_spec.rb +0 -64
- data/spec/models/o_auth_window_spec.rb +0 -40
- data/spec/models/pagination_spec.rb +0 -52
- data/spec/models/statement_spec.rb +0 -76
- data/spec/models/tag_spec.rb +0 -46
- data/spec/models/tagging_spec.rb +0 -58
- data/spec/models/transaction_rule_spec.rb +0 -70
- data/spec/models/transaction_spec.rb +0 -244
- data/spec/models/user_spec.rb +0 -58
- data/spec/models/widget_spec.rb +0 -46
@@ -1,236 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#MX Platform API
|
3
|
-
|
4
|
-
#The MX Platform API is a powerful, fully-featured API designed to make aggregating and enhancing financial data easy and reliable. It can seamlessly connect your app or website to tens of thousands of financial institutions.
|
5
|
-
|
6
|
-
The version of the OpenAPI document: 0.1.0
|
7
|
-
|
8
|
-
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 5.2.0
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'date'
|
14
|
-
require 'time'
|
15
|
-
|
16
|
-
module MxPlatformRuby
|
17
|
-
class Tag
|
18
|
-
attr_accessor :guid
|
19
|
-
|
20
|
-
attr_accessor :name
|
21
|
-
|
22
|
-
attr_accessor :user_guid
|
23
|
-
|
24
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
-
def self.attribute_map
|
26
|
-
{
|
27
|
-
:'guid' => :'guid',
|
28
|
-
:'name' => :'name',
|
29
|
-
:'user_guid' => :'user_guid'
|
30
|
-
}
|
31
|
-
end
|
32
|
-
|
33
|
-
# Returns all the JSON keys this model knows about
|
34
|
-
def self.acceptable_attributes
|
35
|
-
attribute_map.values
|
36
|
-
end
|
37
|
-
|
38
|
-
# Attribute type mapping.
|
39
|
-
def self.openapi_types
|
40
|
-
{
|
41
|
-
:'guid' => :'String',
|
42
|
-
:'name' => :'String',
|
43
|
-
:'user_guid' => :'String'
|
44
|
-
}
|
45
|
-
end
|
46
|
-
|
47
|
-
# List of attributes with nullable: true
|
48
|
-
def self.openapi_nullable
|
49
|
-
Set.new([
|
50
|
-
])
|
51
|
-
end
|
52
|
-
|
53
|
-
# Initializes the object
|
54
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
55
|
-
def initialize(attributes = {})
|
56
|
-
if (!attributes.is_a?(Hash))
|
57
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `MxPlatformRuby::Tag` initialize method"
|
58
|
-
end
|
59
|
-
|
60
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
61
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
62
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
63
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `MxPlatformRuby::Tag`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
64
|
-
end
|
65
|
-
h[k.to_sym] = v
|
66
|
-
}
|
67
|
-
|
68
|
-
if attributes.key?(:'guid')
|
69
|
-
self.guid = attributes[:'guid']
|
70
|
-
end
|
71
|
-
|
72
|
-
if attributes.key?(:'name')
|
73
|
-
self.name = attributes[:'name']
|
74
|
-
end
|
75
|
-
|
76
|
-
if attributes.key?(:'user_guid')
|
77
|
-
self.user_guid = attributes[:'user_guid']
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
82
|
-
# @return Array for valid properties with the reasons
|
83
|
-
def list_invalid_properties
|
84
|
-
invalid_properties = Array.new
|
85
|
-
invalid_properties
|
86
|
-
end
|
87
|
-
|
88
|
-
# Check to see if the all the properties in the model are valid
|
89
|
-
# @return true if the model is valid
|
90
|
-
def valid?
|
91
|
-
true
|
92
|
-
end
|
93
|
-
|
94
|
-
# Checks equality by comparing each attribute.
|
95
|
-
# @param [Object] Object to be compared
|
96
|
-
def ==(o)
|
97
|
-
return true if self.equal?(o)
|
98
|
-
self.class == o.class &&
|
99
|
-
guid == o.guid &&
|
100
|
-
name == o.name &&
|
101
|
-
user_guid == o.user_guid
|
102
|
-
end
|
103
|
-
|
104
|
-
# @see the `==` method
|
105
|
-
# @param [Object] Object to be compared
|
106
|
-
def eql?(o)
|
107
|
-
self == o
|
108
|
-
end
|
109
|
-
|
110
|
-
# Calculates hash code according to all attributes.
|
111
|
-
# @return [Integer] Hash code
|
112
|
-
def hash
|
113
|
-
[guid, name, user_guid].hash
|
114
|
-
end
|
115
|
-
|
116
|
-
# Builds the object from hash
|
117
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
118
|
-
# @return [Object] Returns the model itself
|
119
|
-
def self.build_from_hash(attributes)
|
120
|
-
new.build_from_hash(attributes)
|
121
|
-
end
|
122
|
-
|
123
|
-
# Builds the object from hash
|
124
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
125
|
-
# @return [Object] Returns the model itself
|
126
|
-
def build_from_hash(attributes)
|
127
|
-
return nil unless attributes.is_a?(Hash)
|
128
|
-
self.class.openapi_types.each_pair do |key, type|
|
129
|
-
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
130
|
-
self.send("#{key}=", nil)
|
131
|
-
elsif type =~ /\AArray<(.*)>/i
|
132
|
-
# check to ensure the input is an array given that the attribute
|
133
|
-
# is documented as an array but the input is not
|
134
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
135
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
136
|
-
end
|
137
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
138
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
self
|
143
|
-
end
|
144
|
-
|
145
|
-
# Deserializes the data based on type
|
146
|
-
# @param string type Data type
|
147
|
-
# @param string value Value to be deserialized
|
148
|
-
# @return [Object] Deserialized data
|
149
|
-
def _deserialize(type, value)
|
150
|
-
case type.to_sym
|
151
|
-
when :Time
|
152
|
-
Time.parse(value)
|
153
|
-
when :Date
|
154
|
-
Date.parse(value)
|
155
|
-
when :String
|
156
|
-
value.to_s
|
157
|
-
when :Integer
|
158
|
-
value.to_i
|
159
|
-
when :Float
|
160
|
-
value.to_f
|
161
|
-
when :Boolean
|
162
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
163
|
-
true
|
164
|
-
else
|
165
|
-
false
|
166
|
-
end
|
167
|
-
when :Object
|
168
|
-
# generic object (usually a Hash), return directly
|
169
|
-
value
|
170
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
171
|
-
inner_type = Regexp.last_match[:inner_type]
|
172
|
-
value.map { |v| _deserialize(inner_type, v) }
|
173
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
174
|
-
k_type = Regexp.last_match[:k_type]
|
175
|
-
v_type = Regexp.last_match[:v_type]
|
176
|
-
{}.tap do |hash|
|
177
|
-
value.each do |k, v|
|
178
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
179
|
-
end
|
180
|
-
end
|
181
|
-
else # model
|
182
|
-
# models (e.g. Pet) or oneOf
|
183
|
-
klass = MxPlatformRuby.const_get(type)
|
184
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
|
-
# Returns the string representation of the object
|
189
|
-
# @return [String] String presentation of the object
|
190
|
-
def to_s
|
191
|
-
to_hash.to_s
|
192
|
-
end
|
193
|
-
|
194
|
-
# to_body is an alias to to_hash (backward compatibility)
|
195
|
-
# @return [Hash] Returns the object in the form of hash
|
196
|
-
def to_body
|
197
|
-
to_hash
|
198
|
-
end
|
199
|
-
|
200
|
-
# Returns the object in the form of hash
|
201
|
-
# @return [Hash] Returns the object in the form of hash
|
202
|
-
def to_hash
|
203
|
-
hash = {}
|
204
|
-
self.class.attribute_map.each_pair do |attr, param|
|
205
|
-
value = self.send(attr)
|
206
|
-
if value.nil?
|
207
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
208
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
209
|
-
end
|
210
|
-
|
211
|
-
hash[param] = _to_hash(value)
|
212
|
-
end
|
213
|
-
hash
|
214
|
-
end
|
215
|
-
|
216
|
-
# Outputs non-array value in the form of hash
|
217
|
-
# For object, use to_hash. Otherwise, just return the value
|
218
|
-
# @param [Object] value Any valid value
|
219
|
-
# @return [Hash] Returns the value in the form of hash
|
220
|
-
def _to_hash(value)
|
221
|
-
if value.is_a?(Array)
|
222
|
-
value.compact.map { |v| _to_hash(v) }
|
223
|
-
elsif value.is_a?(Hash)
|
224
|
-
{}.tap do |hash|
|
225
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
226
|
-
end
|
227
|
-
elsif value.respond_to? :to_hash
|
228
|
-
value.to_hash
|
229
|
-
else
|
230
|
-
value
|
231
|
-
end
|
232
|
-
end
|
233
|
-
|
234
|
-
end
|
235
|
-
|
236
|
-
end
|
@@ -1,254 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#MX Platform API
|
3
|
-
|
4
|
-
#The MX Platform API is a powerful, fully-featured API designed to make aggregating and enhancing financial data easy and reliable. It can seamlessly connect your app or website to tens of thousands of financial institutions.
|
5
|
-
|
6
|
-
The version of the OpenAPI document: 0.1.0
|
7
|
-
|
8
|
-
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 5.2.0
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'date'
|
14
|
-
require 'time'
|
15
|
-
|
16
|
-
module MxPlatformRuby
|
17
|
-
class Tagging
|
18
|
-
attr_accessor :guid
|
19
|
-
|
20
|
-
attr_accessor :member_is_managed_by_user
|
21
|
-
|
22
|
-
attr_accessor :tag_guid
|
23
|
-
|
24
|
-
attr_accessor :transaction_guid
|
25
|
-
|
26
|
-
attr_accessor :user_guid
|
27
|
-
|
28
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
-
def self.attribute_map
|
30
|
-
{
|
31
|
-
:'guid' => :'guid',
|
32
|
-
:'member_is_managed_by_user' => :'member_is_managed_by_user',
|
33
|
-
:'tag_guid' => :'tag_guid',
|
34
|
-
:'transaction_guid' => :'transaction_guid',
|
35
|
-
:'user_guid' => :'user_guid'
|
36
|
-
}
|
37
|
-
end
|
38
|
-
|
39
|
-
# Returns all the JSON keys this model knows about
|
40
|
-
def self.acceptable_attributes
|
41
|
-
attribute_map.values
|
42
|
-
end
|
43
|
-
|
44
|
-
# Attribute type mapping.
|
45
|
-
def self.openapi_types
|
46
|
-
{
|
47
|
-
:'guid' => :'String',
|
48
|
-
:'member_is_managed_by_user' => :'Boolean',
|
49
|
-
:'tag_guid' => :'String',
|
50
|
-
:'transaction_guid' => :'String',
|
51
|
-
:'user_guid' => :'String'
|
52
|
-
}
|
53
|
-
end
|
54
|
-
|
55
|
-
# List of attributes with nullable: true
|
56
|
-
def self.openapi_nullable
|
57
|
-
Set.new([
|
58
|
-
])
|
59
|
-
end
|
60
|
-
|
61
|
-
# Initializes the object
|
62
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
63
|
-
def initialize(attributes = {})
|
64
|
-
if (!attributes.is_a?(Hash))
|
65
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `MxPlatformRuby::Tagging` initialize method"
|
66
|
-
end
|
67
|
-
|
68
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
69
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
70
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
71
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `MxPlatformRuby::Tagging`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
72
|
-
end
|
73
|
-
h[k.to_sym] = v
|
74
|
-
}
|
75
|
-
|
76
|
-
if attributes.key?(:'guid')
|
77
|
-
self.guid = attributes[:'guid']
|
78
|
-
end
|
79
|
-
|
80
|
-
if attributes.key?(:'member_is_managed_by_user')
|
81
|
-
self.member_is_managed_by_user = attributes[:'member_is_managed_by_user']
|
82
|
-
end
|
83
|
-
|
84
|
-
if attributes.key?(:'tag_guid')
|
85
|
-
self.tag_guid = attributes[:'tag_guid']
|
86
|
-
end
|
87
|
-
|
88
|
-
if attributes.key?(:'transaction_guid')
|
89
|
-
self.transaction_guid = attributes[:'transaction_guid']
|
90
|
-
end
|
91
|
-
|
92
|
-
if attributes.key?(:'user_guid')
|
93
|
-
self.user_guid = attributes[:'user_guid']
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
98
|
-
# @return Array for valid properties with the reasons
|
99
|
-
def list_invalid_properties
|
100
|
-
invalid_properties = Array.new
|
101
|
-
invalid_properties
|
102
|
-
end
|
103
|
-
|
104
|
-
# Check to see if the all the properties in the model are valid
|
105
|
-
# @return true if the model is valid
|
106
|
-
def valid?
|
107
|
-
true
|
108
|
-
end
|
109
|
-
|
110
|
-
# Checks equality by comparing each attribute.
|
111
|
-
# @param [Object] Object to be compared
|
112
|
-
def ==(o)
|
113
|
-
return true if self.equal?(o)
|
114
|
-
self.class == o.class &&
|
115
|
-
guid == o.guid &&
|
116
|
-
member_is_managed_by_user == o.member_is_managed_by_user &&
|
117
|
-
tag_guid == o.tag_guid &&
|
118
|
-
transaction_guid == o.transaction_guid &&
|
119
|
-
user_guid == o.user_guid
|
120
|
-
end
|
121
|
-
|
122
|
-
# @see the `==` method
|
123
|
-
# @param [Object] Object to be compared
|
124
|
-
def eql?(o)
|
125
|
-
self == o
|
126
|
-
end
|
127
|
-
|
128
|
-
# Calculates hash code according to all attributes.
|
129
|
-
# @return [Integer] Hash code
|
130
|
-
def hash
|
131
|
-
[guid, member_is_managed_by_user, tag_guid, transaction_guid, user_guid].hash
|
132
|
-
end
|
133
|
-
|
134
|
-
# Builds the object from hash
|
135
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
136
|
-
# @return [Object] Returns the model itself
|
137
|
-
def self.build_from_hash(attributes)
|
138
|
-
new.build_from_hash(attributes)
|
139
|
-
end
|
140
|
-
|
141
|
-
# Builds the object from hash
|
142
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
143
|
-
# @return [Object] Returns the model itself
|
144
|
-
def build_from_hash(attributes)
|
145
|
-
return nil unless attributes.is_a?(Hash)
|
146
|
-
self.class.openapi_types.each_pair do |key, type|
|
147
|
-
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
148
|
-
self.send("#{key}=", nil)
|
149
|
-
elsif type =~ /\AArray<(.*)>/i
|
150
|
-
# check to ensure the input is an array given that the attribute
|
151
|
-
# is documented as an array but the input is not
|
152
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
153
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
154
|
-
end
|
155
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
156
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
157
|
-
end
|
158
|
-
end
|
159
|
-
|
160
|
-
self
|
161
|
-
end
|
162
|
-
|
163
|
-
# Deserializes the data based on type
|
164
|
-
# @param string type Data type
|
165
|
-
# @param string value Value to be deserialized
|
166
|
-
# @return [Object] Deserialized data
|
167
|
-
def _deserialize(type, value)
|
168
|
-
case type.to_sym
|
169
|
-
when :Time
|
170
|
-
Time.parse(value)
|
171
|
-
when :Date
|
172
|
-
Date.parse(value)
|
173
|
-
when :String
|
174
|
-
value.to_s
|
175
|
-
when :Integer
|
176
|
-
value.to_i
|
177
|
-
when :Float
|
178
|
-
value.to_f
|
179
|
-
when :Boolean
|
180
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
181
|
-
true
|
182
|
-
else
|
183
|
-
false
|
184
|
-
end
|
185
|
-
when :Object
|
186
|
-
# generic object (usually a Hash), return directly
|
187
|
-
value
|
188
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
189
|
-
inner_type = Regexp.last_match[:inner_type]
|
190
|
-
value.map { |v| _deserialize(inner_type, v) }
|
191
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
192
|
-
k_type = Regexp.last_match[:k_type]
|
193
|
-
v_type = Regexp.last_match[:v_type]
|
194
|
-
{}.tap do |hash|
|
195
|
-
value.each do |k, v|
|
196
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
197
|
-
end
|
198
|
-
end
|
199
|
-
else # model
|
200
|
-
# models (e.g. Pet) or oneOf
|
201
|
-
klass = MxPlatformRuby.const_get(type)
|
202
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
# Returns the string representation of the object
|
207
|
-
# @return [String] String presentation of the object
|
208
|
-
def to_s
|
209
|
-
to_hash.to_s
|
210
|
-
end
|
211
|
-
|
212
|
-
# to_body is an alias to to_hash (backward compatibility)
|
213
|
-
# @return [Hash] Returns the object in the form of hash
|
214
|
-
def to_body
|
215
|
-
to_hash
|
216
|
-
end
|
217
|
-
|
218
|
-
# Returns the object in the form of hash
|
219
|
-
# @return [Hash] Returns the object in the form of hash
|
220
|
-
def to_hash
|
221
|
-
hash = {}
|
222
|
-
self.class.attribute_map.each_pair do |attr, param|
|
223
|
-
value = self.send(attr)
|
224
|
-
if value.nil?
|
225
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
226
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
227
|
-
end
|
228
|
-
|
229
|
-
hash[param] = _to_hash(value)
|
230
|
-
end
|
231
|
-
hash
|
232
|
-
end
|
233
|
-
|
234
|
-
# Outputs non-array value in the form of hash
|
235
|
-
# For object, use to_hash. Otherwise, just return the value
|
236
|
-
# @param [Object] value Any valid value
|
237
|
-
# @return [Hash] Returns the value in the form of hash
|
238
|
-
def _to_hash(value)
|
239
|
-
if value.is_a?(Array)
|
240
|
-
value.compact.map { |v| _to_hash(v) }
|
241
|
-
elsif value.is_a?(Hash)
|
242
|
-
{}.tap do |hash|
|
243
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
244
|
-
end
|
245
|
-
elsif value.respond_to? :to_hash
|
246
|
-
value.to_hash
|
247
|
-
else
|
248
|
-
value
|
249
|
-
end
|
250
|
-
end
|
251
|
-
|
252
|
-
end
|
253
|
-
|
254
|
-
end
|