jamm 1.2.2 → 1.4.0
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/Gemfile.lock +1 -1
- data/lib/jamm/api/api/customer_api.rb +82 -52
- data/lib/jamm/api/api/healthcheck_api.rb +18 -15
- data/lib/jamm/api/api/payment_api.rb +113 -62
- data/lib/jamm/api/api/webhook_service_api.rb +91 -19
- data/lib/jamm/api/api_client.rb +74 -66
- data/lib/jamm/api/api_error.rb +16 -16
- data/lib/jamm/api/configuration.rb +42 -34
- data/lib/jamm/api/models/apiv1_error.rb +238 -0
- data/lib/jamm/api/models/apiv1_status.rb +57 -47
- data/lib/jamm/api/models/customer_service_update_customer_body.rb +107 -69
- data/lib/jamm/api/models/googlerpc_status.rb +61 -45
- data/lib/jamm/api/models/protobuf_any.rb +42 -35
- data/lib/jamm/api/models/v1_add_charge_request.rb +59 -44
- data/lib/jamm/api/models/v1_add_charge_response.rb +59 -44
- data/lib/jamm/api/models/v1_bank.rb +350 -0
- data/lib/jamm/api/models/v1_bank_assets.rb +244 -0
- data/lib/jamm/api/models/v1_bank_branch.rb +259 -0
- data/lib/jamm/api/models/v1_bank_information.rb +71 -51
- data/lib/jamm/api/models/v1_bank_quota.rb +278 -0
- data/lib/jamm/api/models/v1_bank_scheduled_maintenance_period.rb +250 -0
- data/lib/jamm/api/models/v1_buyer.rb +104 -76
- data/lib/jamm/api/models/v1_charge.rb +67 -52
- data/lib/jamm/api/models/v1_charge_message.rb +151 -93
- data/lib/jamm/api/models/v1_charge_message_status.rb +17 -18
- data/lib/jamm/api/models/v1_charge_result.rb +152 -93
- data/lib/jamm/api/models/v1_contract.rb +64 -52
- data/lib/jamm/api/models/v1_contract_message.rb +67 -48
- data/lib/jamm/api/models/v1_contract_status.rb +20 -21
- data/lib/jamm/api/models/v1_create_contract_with_charge_request.rb +59 -44
- data/lib/jamm/api/models/v1_create_contract_with_charge_response.rb +67 -48
- data/lib/jamm/api/models/v1_create_contract_without_charge_request.rb +51 -40
- data/lib/jamm/api/models/v1_create_contract_without_charge_response.rb +59 -44
- data/lib/jamm/api/models/v1_create_customer_request.rb +42 -35
- data/lib/jamm/api/models/v1_create_customer_response.rb +42 -35
- data/lib/jamm/api/models/v1_customer.rb +91 -60
- data/lib/jamm/api/models/v1_delete_customer_response.rb +42 -35
- data/lib/jamm/api/models/v1_deposit_type.rb +14 -15
- data/lib/jamm/api/models/v1_error_detail.rb +233 -0
- data/lib/jamm/api/models/v1_error_response.rb +238 -0
- data/lib/jamm/api/models/v1_error_type.rb +57 -0
- data/lib/jamm/api/models/v1_event_type.rb +20 -21
- data/lib/jamm/api/models/{v1_error.rb → v1_get_bank_response.rb} +45 -48
- data/lib/jamm/api/models/v1_get_branch_response.rb +214 -0
- data/lib/jamm/api/models/v1_get_branches_response.rb +216 -0
- data/lib/jamm/api/models/v1_get_charge_response.rb +51 -40
- data/lib/jamm/api/models/v1_get_charges_response.rb +60 -45
- data/lib/jamm/api/models/v1_get_contract_response.rb +51 -40
- data/lib/jamm/api/models/v1_get_customer_response.rb +42 -35
- data/lib/jamm/api/models/v1_get_major_banks_response.rb +232 -0
- data/lib/jamm/api/models/v1_initial_charge.rb +61 -48
- data/lib/jamm/api/models/v1_kyc_status.rb +16 -17
- data/lib/jamm/api/models/v1_merchant.rb +51 -40
- data/lib/jamm/api/models/v1_merchant_customer.rb +51 -40
- data/lib/jamm/api/models/v1_merchant_webhook_message.rb +75 -57
- data/lib/jamm/api/models/v1_message_response.rb +67 -48
- data/lib/jamm/api/models/v1_off_session_payment_request.rb +51 -40
- data/lib/jamm/api/models/v1_off_session_payment_response.rb +51 -40
- data/lib/jamm/api/models/v1_on_session_payment_data.rb +67 -48
- data/lib/jamm/api/models/v1_on_session_payment_error.rb +55 -45
- data/lib/jamm/api/models/v1_on_session_payment_error_code.rb +21 -22
- data/lib/jamm/api/models/v1_on_session_payment_request.rb +67 -48
- data/lib/jamm/api/models/v1_on_session_payment_response.rb +59 -44
- data/lib/jamm/api/models/v1_pagination.rb +51 -40
- data/lib/jamm/api/models/v1_payment_authorization_status.rb +14 -15
- data/lib/jamm/api/models/v1_payment_link.rb +57 -44
- data/lib/jamm/api/models/v1_ping_response.rb +42 -35
- data/lib/jamm/api/models/v1_search_banks_response.rb +216 -0
- data/lib/jamm/api/models/v1_search_branches_response.rb +216 -0
- data/lib/jamm/api/models/v1_update_customer_response.rb +42 -35
- data/lib/jamm/api/models/v1_url.rb +48 -39
- data/lib/jamm/api/models/v1_user_account_message.rb +67 -48
- data/lib/jamm/api/models/v1_withdraw_request.rb +51 -40
- data/lib/jamm/api/models/v1_withdraw_response.rb +51 -40
- data/lib/jamm/api/version.rb +11 -11
- data/lib/jamm/api.rb +25 -11
- data/lib/jamm/charge.rb +12 -0
- data/lib/jamm/deprecation.rb +13 -0
- data/lib/jamm/errors.rb +27 -1
- data/lib/jamm/payment.rb +61 -0
- data/lib/jamm/version.rb +1 -1
- data/lib/jamm.rb +2 -0
- metadata +19 -3
@@ -0,0 +1,259 @@
|
|
1
|
+
=begin
|
2
|
+
#Jamm API
|
3
|
+
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.9.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Api
|
17
|
+
class BankBranch
|
18
|
+
attr_accessor :bank_code
|
19
|
+
|
20
|
+
attr_accessor :branch_code
|
21
|
+
|
22
|
+
attr_accessor :name
|
23
|
+
|
24
|
+
attr_accessor :name_katakana
|
25
|
+
|
26
|
+
attr_accessor :name_hiragana
|
27
|
+
|
28
|
+
attr_accessor :name_alphabet
|
29
|
+
|
30
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
31
|
+
def self.attribute_map
|
32
|
+
{
|
33
|
+
:'bank_code' => :'bankCode',
|
34
|
+
:'branch_code' => :'branchCode',
|
35
|
+
:'name' => :'name',
|
36
|
+
:'name_katakana' => :'nameKatakana',
|
37
|
+
:'name_hiragana' => :'nameHiragana',
|
38
|
+
:'name_alphabet' => :'nameAlphabet'
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
# Returns all the JSON keys this model knows about
|
43
|
+
def self.acceptable_attributes
|
44
|
+
attribute_map.values
|
45
|
+
end
|
46
|
+
|
47
|
+
# Attribute type mapping.
|
48
|
+
def self.openapi_types
|
49
|
+
{
|
50
|
+
:'bank_code' => :'String',
|
51
|
+
:'branch_code' => :'String',
|
52
|
+
:'name' => :'String',
|
53
|
+
:'name_katakana' => :'String',
|
54
|
+
:'name_hiragana' => :'String',
|
55
|
+
:'name_alphabet' => :'String'
|
56
|
+
}
|
57
|
+
end
|
58
|
+
|
59
|
+
# List of attributes with nullable: true
|
60
|
+
def self.openapi_nullable
|
61
|
+
Set.new([
|
62
|
+
])
|
63
|
+
end
|
64
|
+
|
65
|
+
# Initializes the object
|
66
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
67
|
+
def initialize(attributes = {})
|
68
|
+
if (!attributes.is_a?(Hash))
|
69
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Api::BankBranch` initialize method"
|
70
|
+
end
|
71
|
+
|
72
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
73
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
74
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
75
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Api::BankBranch`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
76
|
+
end
|
77
|
+
h[k.to_sym] = v
|
78
|
+
}
|
79
|
+
|
80
|
+
if attributes.key?(:'bank_code')
|
81
|
+
self.bank_code = attributes[:'bank_code']
|
82
|
+
end
|
83
|
+
|
84
|
+
if attributes.key?(:'branch_code')
|
85
|
+
self.branch_code = attributes[:'branch_code']
|
86
|
+
end
|
87
|
+
|
88
|
+
if attributes.key?(:'name')
|
89
|
+
self.name = attributes[:'name']
|
90
|
+
end
|
91
|
+
|
92
|
+
if attributes.key?(:'name_katakana')
|
93
|
+
self.name_katakana = attributes[:'name_katakana']
|
94
|
+
end
|
95
|
+
|
96
|
+
if attributes.key?(:'name_hiragana')
|
97
|
+
self.name_hiragana = attributes[:'name_hiragana']
|
98
|
+
end
|
99
|
+
|
100
|
+
if attributes.key?(:'name_alphabet')
|
101
|
+
self.name_alphabet = attributes[:'name_alphabet']
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
106
|
+
# @return Array for valid properties with the reasons
|
107
|
+
def list_invalid_properties
|
108
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
109
|
+
invalid_properties = Array.new
|
110
|
+
invalid_properties
|
111
|
+
end
|
112
|
+
|
113
|
+
# Check to see if the all the properties in the model are valid
|
114
|
+
# @return true if the model is valid
|
115
|
+
def valid?
|
116
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
117
|
+
true
|
118
|
+
end
|
119
|
+
|
120
|
+
# Checks equality by comparing each attribute.
|
121
|
+
# @param [Object] Object to be compared
|
122
|
+
def ==(o)
|
123
|
+
return true if self.equal?(o)
|
124
|
+
self.class == o.class &&
|
125
|
+
bank_code == o.bank_code &&
|
126
|
+
branch_code == o.branch_code &&
|
127
|
+
name == o.name &&
|
128
|
+
name_katakana == o.name_katakana &&
|
129
|
+
name_hiragana == o.name_hiragana &&
|
130
|
+
name_alphabet == o.name_alphabet
|
131
|
+
end
|
132
|
+
|
133
|
+
# @see the `==` method
|
134
|
+
# @param [Object] Object to be compared
|
135
|
+
def eql?(o)
|
136
|
+
self == o
|
137
|
+
end
|
138
|
+
|
139
|
+
# Calculates hash code according to all attributes.
|
140
|
+
# @return [Integer] Hash code
|
141
|
+
def hash
|
142
|
+
[bank_code, branch_code, name, name_katakana, name_hiragana, name_alphabet].hash
|
143
|
+
end
|
144
|
+
|
145
|
+
# Builds the object from hash
|
146
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
147
|
+
# @return [Object] Returns the model itself
|
148
|
+
def self.build_from_hash(attributes)
|
149
|
+
return nil unless attributes.is_a?(Hash)
|
150
|
+
attributes = attributes.transform_keys(&:to_sym)
|
151
|
+
transformed_hash = {}
|
152
|
+
openapi_types.each_pair do |key, type|
|
153
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
154
|
+
transformed_hash["#{key}"] = nil
|
155
|
+
elsif type =~ /\AArray<(.*)>/i
|
156
|
+
# check to ensure the input is an array given that the attribute
|
157
|
+
# is documented as an array but the input is not
|
158
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
159
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
160
|
+
end
|
161
|
+
elsif !attributes[attribute_map[key]].nil?
|
162
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
163
|
+
end
|
164
|
+
end
|
165
|
+
new(transformed_hash)
|
166
|
+
end
|
167
|
+
|
168
|
+
# Deserializes the data based on type
|
169
|
+
# @param string type Data type
|
170
|
+
# @param string value Value to be deserialized
|
171
|
+
# @return [Object] Deserialized data
|
172
|
+
def self._deserialize(type, value)
|
173
|
+
case type.to_sym
|
174
|
+
when :Time
|
175
|
+
Time.parse(value)
|
176
|
+
when :Date
|
177
|
+
Date.parse(value)
|
178
|
+
when :String
|
179
|
+
value.to_s
|
180
|
+
when :Integer
|
181
|
+
value.to_i
|
182
|
+
when :Float
|
183
|
+
value.to_f
|
184
|
+
when :Boolean
|
185
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
186
|
+
true
|
187
|
+
else
|
188
|
+
false
|
189
|
+
end
|
190
|
+
when :Object
|
191
|
+
# generic object (usually a Hash), return directly
|
192
|
+
value
|
193
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
194
|
+
inner_type = Regexp.last_match[:inner_type]
|
195
|
+
value.map { |v| _deserialize(inner_type, v) }
|
196
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
197
|
+
k_type = Regexp.last_match[:k_type]
|
198
|
+
v_type = Regexp.last_match[:v_type]
|
199
|
+
{}.tap do |hash|
|
200
|
+
value.each do |k, v|
|
201
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
else # model
|
205
|
+
# models (e.g. Pet) or oneOf
|
206
|
+
klass = Api.const_get(type)
|
207
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
# Returns the string representation of the object
|
212
|
+
# @return [String] String presentation of the object
|
213
|
+
def to_s
|
214
|
+
to_hash.to_s
|
215
|
+
end
|
216
|
+
|
217
|
+
# to_body is an alias to to_hash (backward compatibility)
|
218
|
+
# @return [Hash] Returns the object in the form of hash
|
219
|
+
def to_body
|
220
|
+
to_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
|
+
# Outputs non-array value in the form of hash
|
240
|
+
# For object, use to_hash. Otherwise, just return the value
|
241
|
+
# @param [Object] value Any valid value
|
242
|
+
# @return [Hash] Returns the value in the form of hash
|
243
|
+
def _to_hash(value)
|
244
|
+
if value.is_a?(Array)
|
245
|
+
value.compact.map { |v| _to_hash(v) }
|
246
|
+
elsif value.is_a?(Hash)
|
247
|
+
{}.tap do |hash|
|
248
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
249
|
+
end
|
250
|
+
elsif value.respond_to? :to_hash
|
251
|
+
value.to_hash
|
252
|
+
else
|
253
|
+
value
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
end
|
258
|
+
|
259
|
+
end
|
@@ -1,24 +1,31 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
#
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
1
|
+
=begin
|
2
|
+
#Jamm API
|
3
|
+
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.9.0
|
10
|
+
|
11
|
+
=end
|
12
12
|
|
13
13
|
require 'date'
|
14
14
|
require 'time'
|
15
15
|
|
16
16
|
module Api
|
17
17
|
class BankInformation
|
18
|
-
attr_accessor :account_number
|
18
|
+
attr_accessor :account_number
|
19
|
+
|
20
|
+
attr_accessor :bank_name
|
21
|
+
|
22
|
+
attr_accessor :branch_name
|
23
|
+
|
24
|
+
attr_accessor :deposit_type
|
19
25
|
|
20
26
|
class EnumAttributeValidator
|
21
|
-
attr_reader :datatype
|
27
|
+
attr_reader :datatype
|
28
|
+
attr_reader :allowable_values
|
22
29
|
|
23
30
|
def initialize(datatype, allowable_values)
|
24
31
|
@allowable_values = allowable_values.map do |value|
|
@@ -41,10 +48,10 @@ module Api
|
|
41
48
|
# Attribute mapping from ruby-style variable name to JSON key.
|
42
49
|
def self.attribute_map
|
43
50
|
{
|
44
|
-
:account_number => :accountNumber,
|
45
|
-
:bank_name => :bankName,
|
46
|
-
:branch_name => :branchName,
|
47
|
-
:deposit_type => :depositType
|
51
|
+
:'account_number' => :'accountNumber',
|
52
|
+
:'bank_name' => :'bankName',
|
53
|
+
:'branch_name' => :'branchName',
|
54
|
+
:'deposit_type' => :'depositType'
|
48
55
|
}
|
49
56
|
end
|
50
57
|
|
@@ -56,48 +63,59 @@ module Api
|
|
56
63
|
# Attribute type mapping.
|
57
64
|
def self.openapi_types
|
58
65
|
{
|
59
|
-
:account_number => :String,
|
60
|
-
:bank_name => :String,
|
61
|
-
:branch_name => :String,
|
62
|
-
:deposit_type => :DepositType
|
66
|
+
:'account_number' => :'String',
|
67
|
+
:'bank_name' => :'String',
|
68
|
+
:'branch_name' => :'String',
|
69
|
+
:'deposit_type' => :'DepositType'
|
63
70
|
}
|
64
71
|
end
|
65
72
|
|
66
73
|
# List of attributes with nullable: true
|
67
74
|
def self.openapi_nullable
|
68
|
-
Set.new([
|
75
|
+
Set.new([
|
76
|
+
])
|
69
77
|
end
|
70
78
|
|
71
79
|
# Initializes the object
|
72
80
|
# @param [Hash] attributes Model attributes in the form of hash
|
73
81
|
def initialize(attributes = {})
|
74
|
-
|
82
|
+
if (!attributes.is_a?(Hash))
|
83
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Api::BankInformation` initialize method"
|
84
|
+
end
|
75
85
|
|
76
86
|
# check to see if the attribute exists and convert string to symbol for hash key
|
77
|
-
attributes = attributes.each_with_object({})
|
78
|
-
|
79
|
-
|
87
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
88
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
89
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Api::BankInformation`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
90
|
+
end
|
80
91
|
h[k.to_sym] = v
|
81
|
-
|
92
|
+
}
|
82
93
|
|
83
|
-
|
94
|
+
if attributes.key?(:'account_number')
|
95
|
+
self.account_number = attributes[:'account_number']
|
96
|
+
end
|
84
97
|
|
85
|
-
|
98
|
+
if attributes.key?(:'bank_name')
|
99
|
+
self.bank_name = attributes[:'bank_name']
|
100
|
+
end
|
86
101
|
|
87
|
-
|
102
|
+
if attributes.key?(:'branch_name')
|
103
|
+
self.branch_name = attributes[:'branch_name']
|
104
|
+
end
|
88
105
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
106
|
+
if attributes.key?(:'deposit_type')
|
107
|
+
self.deposit_type = attributes[:'deposit_type']
|
108
|
+
else
|
109
|
+
self.deposit_type = 'DEPOSIT_TYPE_UNSPECIFIED'
|
110
|
+
end
|
94
111
|
end
|
95
112
|
|
96
113
|
# Show invalid properties with the reasons. Usually used together with valid?
|
97
114
|
# @return Array for valid properties with the reasons
|
98
115
|
def list_invalid_properties
|
99
116
|
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
100
|
-
|
117
|
+
invalid_properties = Array.new
|
118
|
+
invalid_properties
|
101
119
|
end
|
102
120
|
|
103
121
|
# Check to see if the all the properties in the model are valid
|
@@ -109,20 +127,19 @@ module Api
|
|
109
127
|
|
110
128
|
# Checks equality by comparing each attribute.
|
111
129
|
# @param [Object] Object to be compared
|
112
|
-
def ==(
|
113
|
-
return true if equal?(
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
deposit_type == other.deposit_type
|
130
|
+
def ==(o)
|
131
|
+
return true if self.equal?(o)
|
132
|
+
self.class == o.class &&
|
133
|
+
account_number == o.account_number &&
|
134
|
+
bank_name == o.bank_name &&
|
135
|
+
branch_name == o.branch_name &&
|
136
|
+
deposit_type == o.deposit_type
|
120
137
|
end
|
121
138
|
|
122
139
|
# @see the `==` method
|
123
140
|
# @param [Object] Object to be compared
|
124
|
-
def eql?(
|
125
|
-
self ==
|
141
|
+
def eql?(o)
|
142
|
+
self == o
|
126
143
|
end
|
127
144
|
|
128
145
|
# Calculates hash code according to all attributes.
|
@@ -136,18 +153,19 @@ module Api
|
|
136
153
|
# @return [Object] Returns the model itself
|
137
154
|
def self.build_from_hash(attributes)
|
138
155
|
return nil unless attributes.is_a?(Hash)
|
139
|
-
|
140
156
|
attributes = attributes.transform_keys(&:to_sym)
|
141
157
|
transformed_hash = {}
|
142
158
|
openapi_types.each_pair do |key, type|
|
143
159
|
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
144
|
-
transformed_hash[key
|
160
|
+
transformed_hash["#{key}"] = nil
|
145
161
|
elsif type =~ /\AArray<(.*)>/i
|
146
162
|
# check to ensure the input is an array given that the attribute
|
147
163
|
# is documented as an array but the input is not
|
148
|
-
|
164
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
165
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
166
|
+
end
|
149
167
|
elsif !attributes[attribute_map[key]].nil?
|
150
|
-
transformed_hash[key
|
168
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
151
169
|
end
|
152
170
|
end
|
153
171
|
new(transformed_hash)
|
@@ -213,7 +231,7 @@ module Api
|
|
213
231
|
def to_hash
|
214
232
|
hash = {}
|
215
233
|
self.class.attribute_map.each_pair do |attr, param|
|
216
|
-
value = send(attr)
|
234
|
+
value = self.send(attr)
|
217
235
|
if value.nil?
|
218
236
|
is_nullable = self.class.openapi_nullable.include?(attr)
|
219
237
|
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
@@ -241,5 +259,7 @@ module Api
|
|
241
259
|
value
|
242
260
|
end
|
243
261
|
end
|
262
|
+
|
244
263
|
end
|
264
|
+
|
245
265
|
end
|