cybersource_rest_client 0.0.73 → 0.0.74

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 (49) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cybersource_rest_client/api/batches_api.rb +9 -9
  3. data/lib/cybersource_rest_client/api/device_de_association_api.rb +168 -0
  4. data/lib/cybersource_rest_client/api/device_search_api.rb +78 -5
  5. data/lib/cybersource_rest_client/api/subscriptions_api.rb +5 -2
  6. data/lib/cybersource_rest_client/models/{inline_response_200_7__links.rb → de_association_request_body.rb} +190 -200
  7. data/lib/cybersource_rest_client/models/generate_capture_context_request.rb +240 -240
  8. data/lib/cybersource_rest_client/models/generate_unified_checkout_capture_context_request.rb +303 -303
  9. data/lib/cybersource_rest_client/models/get_subscription_response.rb +267 -257
  10. data/lib/cybersource_rest_client/models/get_subscription_response_reactivation_information.rb +213 -0
  11. data/lib/cybersource_rest_client/models/inline_response_200_10.rb +292 -0
  12. data/lib/cybersource_rest_client/models/{inline_response_200_9_records.rb → inline_response_200_10_records.rb} +209 -209
  13. data/lib/cybersource_rest_client/models/{inline_response_200_9_response_record.rb → inline_response_200_10_response_record.rb} +307 -307
  14. data/lib/cybersource_rest_client/models/{inline_response_200_9_response_record_additional_updates.rb → inline_response_200_10_response_record_additional_updates.rb} +242 -242
  15. data/lib/cybersource_rest_client/models/{inline_response_200_9_source_record.rb → inline_response_200_10_source_record.rb} +295 -295
  16. data/lib/cybersource_rest_client/models/inline_response_200_5.rb +247 -202
  17. data/lib/cybersource_rest_client/models/inline_response_200_5_devices.rb +357 -0
  18. data/lib/cybersource_rest_client/models/inline_response_200_6.rb +202 -247
  19. data/lib/cybersource_rest_client/models/inline_response_200_7.rb +247 -251
  20. data/lib/cybersource_rest_client/models/{inline_response_200_6_devices.rb → inline_response_200_7_devices.rb} +371 -371
  21. data/lib/cybersource_rest_client/models/{inline_response_200_6_payment_processor_to_terminal_map.rb → inline_response_200_7_payment_processor_to_terminal_map.rb} +200 -200
  22. data/lib/cybersource_rest_client/models/inline_response_200_8.rb +251 -290
  23. data/lib/cybersource_rest_client/models/{inline_response_200_7__embedded.rb → inline_response_200_8__embedded.rb} +191 -191
  24. data/lib/cybersource_rest_client/models/{inline_response_200_7__embedded__links.rb → inline_response_200_8__embedded__links.rb} +191 -191
  25. data/lib/cybersource_rest_client/models/{inline_response_200_8__links_report.rb → inline_response_200_8__embedded__links_reports.rb} +190 -189
  26. data/lib/cybersource_rest_client/models/{inline_response_200_7__embedded_batches.rb → inline_response_200_8__embedded_batches.rb} +295 -295
  27. data/lib/cybersource_rest_client/models/{inline_response_200_7__embedded_totals.rb → inline_response_200_8__embedded_totals.rb} +229 -229
  28. data/lib/cybersource_rest_client/models/inline_response_200_8__links.rb +200 -201
  29. data/lib/cybersource_rest_client/models/inline_response_200_9.rb +290 -292
  30. data/lib/cybersource_rest_client/models/inline_response_200_9__links.rb +201 -0
  31. data/lib/cybersource_rest_client/models/{inline_response_200_7__embedded__links_reports.rb → inline_response_200_9__links_report.rb} +189 -190
  32. data/lib/cybersource_rest_client/models/{inline_response_200_8_billing.rb → inline_response_200_9_billing.rb} +219 -219
  33. data/lib/cybersource_rest_client/models/payments_products.rb +379 -379
  34. data/lib/cybersource_rest_client/models/payments_products_unified_checkout.rb +199 -0
  35. data/lib/cybersource_rest_client/models/payments_products_unified_checkout_configuration_information.rb +189 -0
  36. data/lib/cybersource_rest_client/models/payments_products_unified_checkout_configuration_information_configurations.rb +189 -0
  37. data/lib/cybersource_rest_client/models/payments_products_unified_checkout_configuration_information_configurations_features.rb +189 -0
  38. data/lib/cybersource_rest_client/models/payments_products_unified_checkout_configuration_information_configurations_features_paze.rb +213 -0
  39. data/lib/cybersource_rest_client/models/payments_products_unified_checkout_subscription_information.rb +225 -0
  40. data/lib/cybersource_rest_client/models/payments_products_unified_checkout_subscription_information_features.rb +189 -0
  41. data/lib/cybersource_rest_client/models/payments_products_unified_checkout_subscription_information_features_paze_for_unified_checkout.rb +190 -0
  42. data/lib/cybersource_rest_client/models/post_device_search_request.rb +223 -0
  43. data/lib/cybersource_rest_client/models/riskv1decisions_travel_information_legs.rb +252 -241
  44. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_processor_information.rb +394 -383
  45. data/lib/cybersource_rest_client/models/upv1capturecontexts_capture_mandate.rb +297 -286
  46. data/lib/cybersource_rest_client/models/upv1capturecontexts_complete_mandate.rb +219 -208
  47. data/lib/cybersource_rest_client.rb +28 -15
  48. metadata +30 -17
  49. data/lib/cybersource_rest_client/api/device_de_association_v3_api.rb +0 -96
@@ -1,307 +1,307 @@
1
- =begin
2
- #CyberSource Merged Spec
3
-
4
- #All CyberSource API specs merged together. These are available at https://developer.cybersource.com/api/reference/api-reference.html
5
-
6
- OpenAPI spec version: 0.0.1
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.38
10
- =end
11
-
12
- require 'date'
13
-
14
- module CyberSource
15
- class InlineResponse2009ResponseRecord
16
- # Valid Values: * NAN * NED * ACL * CCH * CUR * NUP * UNA * ERR * DEC
17
- attr_accessor :response
18
-
19
- attr_accessor :reason
20
-
21
- attr_accessor :token
22
-
23
- attr_accessor :instrument_identifier_id
24
-
25
- # Valid Values: * true * false
26
- attr_accessor :instrument_identifier_created
27
-
28
- attr_accessor :card_number
29
-
30
- attr_accessor :card_expiry_month
31
-
32
- attr_accessor :card_expiry_year
33
-
34
- attr_accessor :card_type
35
-
36
- attr_accessor :additional_updates
37
-
38
- # Attribute mapping from ruby-style variable name to JSON key.
39
- def self.attribute_map
40
- {
41
- :'response' => :'response',
42
- :'reason' => :'reason',
43
- :'token' => :'token',
44
- :'instrument_identifier_id' => :'instrumentIdentifierId',
45
- :'instrument_identifier_created' => :'instrumentIdentifierCreated',
46
- :'card_number' => :'cardNumber',
47
- :'card_expiry_month' => :'cardExpiryMonth',
48
- :'card_expiry_year' => :'cardExpiryYear',
49
- :'card_type' => :'cardType',
50
- :'additional_updates' => :'additionalUpdates'
51
- }
52
- end
53
-
54
- # Attribute mapping from JSON key to ruby-style variable name.
55
- def self.json_map
56
- {
57
- :'response' => :'response',
58
- :'reason' => :'reason',
59
- :'token' => :'token',
60
- :'instrument_identifier_id' => :'instrument_identifier_id',
61
- :'instrument_identifier_created' => :'instrument_identifier_created',
62
- :'card_number' => :'card_number',
63
- :'card_expiry_month' => :'card_expiry_month',
64
- :'card_expiry_year' => :'card_expiry_year',
65
- :'card_type' => :'card_type',
66
- :'additional_updates' => :'additional_updates'
67
- }
68
- end
69
-
70
- # Attribute type mapping.
71
- def self.swagger_types
72
- {
73
- :'response' => :'String',
74
- :'reason' => :'String',
75
- :'token' => :'String',
76
- :'instrument_identifier_id' => :'String',
77
- :'instrument_identifier_created' => :'String',
78
- :'card_number' => :'String',
79
- :'card_expiry_month' => :'String',
80
- :'card_expiry_year' => :'String',
81
- :'card_type' => :'String',
82
- :'additional_updates' => :'Array<InlineResponse2009ResponseRecordAdditionalUpdates>'
83
- }
84
- end
85
-
86
- # Initializes the object
87
- # @param [Hash] attributes Model attributes in the form of hash
88
- def initialize(attributes = {})
89
- return unless attributes.is_a?(Hash)
90
-
91
- # convert string to symbol for hash key
92
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
93
-
94
- if attributes.has_key?(:'response')
95
- self.response = attributes[:'response']
96
- end
97
-
98
- if attributes.has_key?(:'reason')
99
- self.reason = attributes[:'reason']
100
- end
101
-
102
- if attributes.has_key?(:'token')
103
- self.token = attributes[:'token']
104
- end
105
-
106
- if attributes.has_key?(:'instrumentIdentifierId')
107
- self.instrument_identifier_id = attributes[:'instrumentIdentifierId']
108
- end
109
-
110
- if attributes.has_key?(:'instrumentIdentifierCreated')
111
- self.instrument_identifier_created = attributes[:'instrumentIdentifierCreated']
112
- end
113
-
114
- if attributes.has_key?(:'cardNumber')
115
- self.card_number = attributes[:'cardNumber']
116
- end
117
-
118
- if attributes.has_key?(:'cardExpiryMonth')
119
- self.card_expiry_month = attributes[:'cardExpiryMonth']
120
- end
121
-
122
- if attributes.has_key?(:'cardExpiryYear')
123
- self.card_expiry_year = attributes[:'cardExpiryYear']
124
- end
125
-
126
- if attributes.has_key?(:'cardType')
127
- self.card_type = attributes[:'cardType']
128
- end
129
-
130
- if attributes.has_key?(:'additionalUpdates')
131
- if (value = attributes[:'additionalUpdates']).is_a?(Array)
132
- self.additional_updates = value
133
- end
134
- end
135
- end
136
-
137
- # Show invalid properties with the reasons. Usually used together with valid?
138
- # @return Array for valid properties with the reasons
139
- def list_invalid_properties
140
- invalid_properties = Array.new
141
- invalid_properties
142
- end
143
-
144
- # Check to see if the all the properties in the model are valid
145
- # @return true if the model is valid
146
- def valid?
147
- true
148
- end
149
-
150
- # Custom attribute writer method with validation
151
- # @param [Object] token Value to be assigned
152
- def token=(token)
153
- @token = token
154
- end
155
-
156
- # Custom attribute writer method with validation
157
- # @param [Object] instrument_identifier_id Value to be assigned
158
- def instrument_identifier_id=(instrument_identifier_id)
159
- @instrument_identifier_id = instrument_identifier_id
160
- end
161
-
162
- # Custom attribute writer method with validation
163
- # @param [Object] card_expiry_month Value to be assigned
164
- def card_expiry_month=(card_expiry_month)
165
- @card_expiry_month = card_expiry_month
166
- end
167
-
168
- # Custom attribute writer method with validation
169
- # @param [Object] card_expiry_year Value to be assigned
170
- def card_expiry_year=(card_expiry_year)
171
- @card_expiry_year = card_expiry_year
172
- end
173
-
174
- # Checks equality by comparing each attribute.
175
- # @param [Object] Object to be compared
176
- def ==(o)
177
- return true if self.equal?(o)
178
- self.class == o.class &&
179
- response == o.response &&
180
- reason == o.reason &&
181
- token == o.token &&
182
- instrument_identifier_id == o.instrument_identifier_id &&
183
- instrument_identifier_created == o.instrument_identifier_created &&
184
- card_number == o.card_number &&
185
- card_expiry_month == o.card_expiry_month &&
186
- card_expiry_year == o.card_expiry_year &&
187
- card_type == o.card_type &&
188
- additional_updates == o.additional_updates
189
- end
190
-
191
- # @see the `==` method
192
- # @param [Object] Object to be compared
193
- def eql?(o)
194
- self == o
195
- end
196
-
197
- # Calculates hash code according to all attributes.
198
- # @return [Fixnum] Hash code
199
- def hash
200
- [response, reason, token, instrument_identifier_id, instrument_identifier_created, card_number, card_expiry_month, card_expiry_year, card_type, additional_updates].hash
201
- end
202
-
203
- # Builds the object from hash
204
- # @param [Hash] attributes Model attributes in the form of hash
205
- # @return [Object] Returns the model itself
206
- def build_from_hash(attributes)
207
- return nil unless attributes.is_a?(Hash)
208
- self.class.swagger_types.each_pair do |key, type|
209
- if type =~ /\AArray<(.*)>/i
210
- # check to ensure the input is an array given that the the attribute
211
- # is documented as an array but the input is not
212
- if attributes[self.class.attribute_map[key]].is_a?(Array)
213
- self.send("#{self.class.json_map[key]}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
214
- end
215
- elsif !attributes[self.class.attribute_map[key]].nil?
216
- self.send("#{self.class.json_map[key]}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
217
- end # or else data not found in attributes(hash), not an issue as the data can be optional
218
- end
219
-
220
- self
221
- end
222
-
223
- # Deserializes the data based on type
224
- # @param string type Data type
225
- # @param string value Value to be deserialized
226
- # @return [Object] Deserialized data
227
- def _deserialize(type, value)
228
- case type.to_sym
229
- when :DateTime
230
- DateTime.parse(value)
231
- when :Date
232
- Date.parse(value)
233
- when :String
234
- value.to_s
235
- when :Integer
236
- value.to_i
237
- when :Float
238
- value.to_f
239
- when :BOOLEAN
240
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
241
- true
242
- else
243
- false
244
- end
245
- when :Object
246
- # generic object (usually a Hash), return directly
247
- value
248
- when /\AArray<(?<inner_type>.+)>\z/
249
- inner_type = Regexp.last_match[:inner_type]
250
- value.map { |v| _deserialize(inner_type, v) }
251
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
252
- k_type = Regexp.last_match[:k_type]
253
- v_type = Regexp.last_match[:v_type]
254
- {}.tap do |hash|
255
- value.each do |k, v|
256
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
257
- end
258
- end
259
- else # model
260
- temp_model = CyberSource.const_get(type).new
261
- temp_model.build_from_hash(value)
262
- end
263
- end
264
-
265
- # Returns the string representation of the object
266
- # @return [String] String presentation of the object
267
- def to_s
268
- to_hash.to_s
269
- end
270
-
271
- # to_body is an alias to to_hash (backward compatibility)
272
- # @return [Hash] Returns the object in the form of hash
273
- def to_body
274
- to_hash
275
- end
276
-
277
- # Returns the object in the form of hash
278
- # @return [Hash] Returns the object in the form of hash
279
- def to_hash
280
- hash = {}
281
- self.class.attribute_map.each_pair do |attr, param|
282
- value = self.send(attr)
283
- next if value.nil?
284
- hash[param] = _to_hash(value)
285
- end
286
- hash
287
- end
288
-
289
- # Outputs non-array value in the form of hash
290
- # For object, use to_hash. Otherwise, just return the value
291
- # @param [Object] value Any valid value
292
- # @return [Hash] Returns the value in the form of hash
293
- def _to_hash(value)
294
- if value.is_a?(Array)
295
- value.compact.map { |v| _to_hash(v) }
296
- elsif value.is_a?(Hash)
297
- {}.tap do |hash|
298
- value.each { |k, v| hash[k] = _to_hash(v) }
299
- end
300
- elsif value.respond_to? :to_hash
301
- value.to_hash
302
- else
303
- value
304
- end
305
- end
306
- end
307
- end
1
+ =begin
2
+ #CyberSource Merged Spec
3
+
4
+ #All CyberSource API specs merged together. These are available at https://developer.cybersource.com/api/reference/api-reference.html
5
+
6
+ OpenAPI spec version: 0.0.1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.38
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module CyberSource
15
+ class InlineResponse20010ResponseRecord
16
+ # Valid Values: * NAN * NED * ACL * CCH * CUR * NUP * UNA * ERR * DEC
17
+ attr_accessor :response
18
+
19
+ attr_accessor :reason
20
+
21
+ attr_accessor :token
22
+
23
+ attr_accessor :instrument_identifier_id
24
+
25
+ # Valid Values: * true * false
26
+ attr_accessor :instrument_identifier_created
27
+
28
+ attr_accessor :card_number
29
+
30
+ attr_accessor :card_expiry_month
31
+
32
+ attr_accessor :card_expiry_year
33
+
34
+ attr_accessor :card_type
35
+
36
+ attr_accessor :additional_updates
37
+
38
+ # Attribute mapping from ruby-style variable name to JSON key.
39
+ def self.attribute_map
40
+ {
41
+ :'response' => :'response',
42
+ :'reason' => :'reason',
43
+ :'token' => :'token',
44
+ :'instrument_identifier_id' => :'instrumentIdentifierId',
45
+ :'instrument_identifier_created' => :'instrumentIdentifierCreated',
46
+ :'card_number' => :'cardNumber',
47
+ :'card_expiry_month' => :'cardExpiryMonth',
48
+ :'card_expiry_year' => :'cardExpiryYear',
49
+ :'card_type' => :'cardType',
50
+ :'additional_updates' => :'additionalUpdates'
51
+ }
52
+ end
53
+
54
+ # Attribute mapping from JSON key to ruby-style variable name.
55
+ def self.json_map
56
+ {
57
+ :'response' => :'response',
58
+ :'reason' => :'reason',
59
+ :'token' => :'token',
60
+ :'instrument_identifier_id' => :'instrument_identifier_id',
61
+ :'instrument_identifier_created' => :'instrument_identifier_created',
62
+ :'card_number' => :'card_number',
63
+ :'card_expiry_month' => :'card_expiry_month',
64
+ :'card_expiry_year' => :'card_expiry_year',
65
+ :'card_type' => :'card_type',
66
+ :'additional_updates' => :'additional_updates'
67
+ }
68
+ end
69
+
70
+ # Attribute type mapping.
71
+ def self.swagger_types
72
+ {
73
+ :'response' => :'String',
74
+ :'reason' => :'String',
75
+ :'token' => :'String',
76
+ :'instrument_identifier_id' => :'String',
77
+ :'instrument_identifier_created' => :'String',
78
+ :'card_number' => :'String',
79
+ :'card_expiry_month' => :'String',
80
+ :'card_expiry_year' => :'String',
81
+ :'card_type' => :'String',
82
+ :'additional_updates' => :'Array<InlineResponse20010ResponseRecordAdditionalUpdates>'
83
+ }
84
+ end
85
+
86
+ # Initializes the object
87
+ # @param [Hash] attributes Model attributes in the form of hash
88
+ def initialize(attributes = {})
89
+ return unless attributes.is_a?(Hash)
90
+
91
+ # convert string to symbol for hash key
92
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
93
+
94
+ if attributes.has_key?(:'response')
95
+ self.response = attributes[:'response']
96
+ end
97
+
98
+ if attributes.has_key?(:'reason')
99
+ self.reason = attributes[:'reason']
100
+ end
101
+
102
+ if attributes.has_key?(:'token')
103
+ self.token = attributes[:'token']
104
+ end
105
+
106
+ if attributes.has_key?(:'instrumentIdentifierId')
107
+ self.instrument_identifier_id = attributes[:'instrumentIdentifierId']
108
+ end
109
+
110
+ if attributes.has_key?(:'instrumentIdentifierCreated')
111
+ self.instrument_identifier_created = attributes[:'instrumentIdentifierCreated']
112
+ end
113
+
114
+ if attributes.has_key?(:'cardNumber')
115
+ self.card_number = attributes[:'cardNumber']
116
+ end
117
+
118
+ if attributes.has_key?(:'cardExpiryMonth')
119
+ self.card_expiry_month = attributes[:'cardExpiryMonth']
120
+ end
121
+
122
+ if attributes.has_key?(:'cardExpiryYear')
123
+ self.card_expiry_year = attributes[:'cardExpiryYear']
124
+ end
125
+
126
+ if attributes.has_key?(:'cardType')
127
+ self.card_type = attributes[:'cardType']
128
+ end
129
+
130
+ if attributes.has_key?(:'additionalUpdates')
131
+ if (value = attributes[:'additionalUpdates']).is_a?(Array)
132
+ self.additional_updates = value
133
+ end
134
+ end
135
+ end
136
+
137
+ # Show invalid properties with the reasons. Usually used together with valid?
138
+ # @return Array for valid properties with the reasons
139
+ def list_invalid_properties
140
+ invalid_properties = Array.new
141
+ invalid_properties
142
+ end
143
+
144
+ # Check to see if the all the properties in the model are valid
145
+ # @return true if the model is valid
146
+ def valid?
147
+ true
148
+ end
149
+
150
+ # Custom attribute writer method with validation
151
+ # @param [Object] token Value to be assigned
152
+ def token=(token)
153
+ @token = token
154
+ end
155
+
156
+ # Custom attribute writer method with validation
157
+ # @param [Object] instrument_identifier_id Value to be assigned
158
+ def instrument_identifier_id=(instrument_identifier_id)
159
+ @instrument_identifier_id = instrument_identifier_id
160
+ end
161
+
162
+ # Custom attribute writer method with validation
163
+ # @param [Object] card_expiry_month Value to be assigned
164
+ def card_expiry_month=(card_expiry_month)
165
+ @card_expiry_month = card_expiry_month
166
+ end
167
+
168
+ # Custom attribute writer method with validation
169
+ # @param [Object] card_expiry_year Value to be assigned
170
+ def card_expiry_year=(card_expiry_year)
171
+ @card_expiry_year = card_expiry_year
172
+ end
173
+
174
+ # Checks equality by comparing each attribute.
175
+ # @param [Object] Object to be compared
176
+ def ==(o)
177
+ return true if self.equal?(o)
178
+ self.class == o.class &&
179
+ response == o.response &&
180
+ reason == o.reason &&
181
+ token == o.token &&
182
+ instrument_identifier_id == o.instrument_identifier_id &&
183
+ instrument_identifier_created == o.instrument_identifier_created &&
184
+ card_number == o.card_number &&
185
+ card_expiry_month == o.card_expiry_month &&
186
+ card_expiry_year == o.card_expiry_year &&
187
+ card_type == o.card_type &&
188
+ additional_updates == o.additional_updates
189
+ end
190
+
191
+ # @see the `==` method
192
+ # @param [Object] Object to be compared
193
+ def eql?(o)
194
+ self == o
195
+ end
196
+
197
+ # Calculates hash code according to all attributes.
198
+ # @return [Fixnum] Hash code
199
+ def hash
200
+ [response, reason, token, instrument_identifier_id, instrument_identifier_created, card_number, card_expiry_month, card_expiry_year, card_type, additional_updates].hash
201
+ end
202
+
203
+ # Builds the object from hash
204
+ # @param [Hash] attributes Model attributes in the form of hash
205
+ # @return [Object] Returns the model itself
206
+ def build_from_hash(attributes)
207
+ return nil unless attributes.is_a?(Hash)
208
+ self.class.swagger_types.each_pair do |key, type|
209
+ if type =~ /\AArray<(.*)>/i
210
+ # check to ensure the input is an array given that the the attribute
211
+ # is documented as an array but the input is not
212
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
213
+ self.send("#{self.class.json_map[key]}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
214
+ end
215
+ elsif !attributes[self.class.attribute_map[key]].nil?
216
+ self.send("#{self.class.json_map[key]}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
217
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
218
+ end
219
+
220
+ self
221
+ end
222
+
223
+ # Deserializes the data based on type
224
+ # @param string type Data type
225
+ # @param string value Value to be deserialized
226
+ # @return [Object] Deserialized data
227
+ def _deserialize(type, value)
228
+ case type.to_sym
229
+ when :DateTime
230
+ DateTime.parse(value)
231
+ when :Date
232
+ Date.parse(value)
233
+ when :String
234
+ value.to_s
235
+ when :Integer
236
+ value.to_i
237
+ when :Float
238
+ value.to_f
239
+ when :BOOLEAN
240
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
241
+ true
242
+ else
243
+ false
244
+ end
245
+ when :Object
246
+ # generic object (usually a Hash), return directly
247
+ value
248
+ when /\AArray<(?<inner_type>.+)>\z/
249
+ inner_type = Regexp.last_match[:inner_type]
250
+ value.map { |v| _deserialize(inner_type, v) }
251
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
252
+ k_type = Regexp.last_match[:k_type]
253
+ v_type = Regexp.last_match[:v_type]
254
+ {}.tap do |hash|
255
+ value.each do |k, v|
256
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
257
+ end
258
+ end
259
+ else # model
260
+ temp_model = CyberSource.const_get(type).new
261
+ temp_model.build_from_hash(value)
262
+ end
263
+ end
264
+
265
+ # Returns the string representation of the object
266
+ # @return [String] String presentation of the object
267
+ def to_s
268
+ to_hash.to_s
269
+ end
270
+
271
+ # to_body is an alias to to_hash (backward compatibility)
272
+ # @return [Hash] Returns the object in the form of hash
273
+ def to_body
274
+ to_hash
275
+ end
276
+
277
+ # Returns the object in the form of hash
278
+ # @return [Hash] Returns the object in the form of hash
279
+ def to_hash
280
+ hash = {}
281
+ self.class.attribute_map.each_pair do |attr, param|
282
+ value = self.send(attr)
283
+ next if value.nil?
284
+ hash[param] = _to_hash(value)
285
+ end
286
+ hash
287
+ end
288
+
289
+ # Outputs non-array value in the form of hash
290
+ # For object, use to_hash. Otherwise, just return the value
291
+ # @param [Object] value Any valid value
292
+ # @return [Hash] Returns the value in the form of hash
293
+ def _to_hash(value)
294
+ if value.is_a?(Array)
295
+ value.compact.map { |v| _to_hash(v) }
296
+ elsif value.is_a?(Hash)
297
+ {}.tap do |hash|
298
+ value.each { |k, v| hash[k] = _to_hash(v) }
299
+ end
300
+ elsif value.respond_to? :to_hash
301
+ value.to_hash
302
+ else
303
+ value
304
+ end
305
+ end
306
+ end
307
+ end