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,295 +1,295 @@
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 InlineResponse2007EmbeddedBatches
16
- attr_accessor :_links
17
-
18
- # Unique identification number assigned to the submitted request.
19
- attr_accessor :batch_id
20
-
21
- # ISO-8601 format: yyyy-MM-ddTHH:mm:ssZ
22
- attr_accessor :batch_created_date
23
-
24
- # ISO-8601 format: yyyy-MM-ddTHH:mm:ssZ
25
- attr_accessor :batch_modified_date
26
-
27
- # Valid Values: * SCHEDULER * TOKEN_API * CREDIT_CARD_FILE_UPLOAD * AMEX_REGSITRY * AMEX_REGISTRY_API * AMEX_REGISTRY_API_SYNC * AMEX_MAINTENANCE
28
- attr_accessor :batch_source
29
-
30
- # Valid Values: * SECURE_STORAGE * TMS * CYBERSOURCE
31
- attr_accessor :token_source
32
-
33
- # Reference used by merchant to identify batch.
34
- attr_accessor :merchant_reference
35
-
36
- # Valid Values: * VISA * MASTERCARD * AMEX
37
- attr_accessor :batch_ca_endpoints
38
-
39
- # Valid Values: * REJECTED * RECEIVED * VALIDATED * DECLINED * PROCESSING * COMPLETE
40
- attr_accessor :status
41
-
42
- attr_accessor :totals
43
-
44
- # Attribute mapping from ruby-style variable name to JSON key.
45
- def self.attribute_map
46
- {
47
- :'_links' => :'_links',
48
- :'batch_id' => :'batchId',
49
- :'batch_created_date' => :'batchCreatedDate',
50
- :'batch_modified_date' => :'batchModifiedDate',
51
- :'batch_source' => :'batchSource',
52
- :'token_source' => :'tokenSource',
53
- :'merchant_reference' => :'merchantReference',
54
- :'batch_ca_endpoints' => :'batchCaEndpoints',
55
- :'status' => :'status',
56
- :'totals' => :'totals'
57
- }
58
- end
59
-
60
- # Attribute mapping from JSON key to ruby-style variable name.
61
- def self.json_map
62
- {
63
- :'_links' => :'_links',
64
- :'batch_id' => :'batch_id',
65
- :'batch_created_date' => :'batch_created_date',
66
- :'batch_modified_date' => :'batch_modified_date',
67
- :'batch_source' => :'batch_source',
68
- :'token_source' => :'token_source',
69
- :'merchant_reference' => :'merchant_reference',
70
- :'batch_ca_endpoints' => :'batch_ca_endpoints',
71
- :'status' => :'status',
72
- :'totals' => :'totals'
73
- }
74
- end
75
-
76
- # Attribute type mapping.
77
- def self.swagger_types
78
- {
79
- :'_links' => :'InlineResponse2007EmbeddedLinks',
80
- :'batch_id' => :'String',
81
- :'batch_created_date' => :'String',
82
- :'batch_modified_date' => :'String',
83
- :'batch_source' => :'String',
84
- :'token_source' => :'String',
85
- :'merchant_reference' => :'String',
86
- :'batch_ca_endpoints' => :'Array<String>',
87
- :'status' => :'String',
88
- :'totals' => :'InlineResponse2007EmbeddedTotals'
89
- }
90
- end
91
-
92
- # Initializes the object
93
- # @param [Hash] attributes Model attributes in the form of hash
94
- def initialize(attributes = {})
95
- return unless attributes.is_a?(Hash)
96
-
97
- # convert string to symbol for hash key
98
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
99
-
100
- if attributes.has_key?(:'_links')
101
- self._links = attributes[:'_links']
102
- end
103
-
104
- if attributes.has_key?(:'batchId')
105
- self.batch_id = attributes[:'batchId']
106
- end
107
-
108
- if attributes.has_key?(:'batchCreatedDate')
109
- self.batch_created_date = attributes[:'batchCreatedDate']
110
- end
111
-
112
- if attributes.has_key?(:'batchModifiedDate')
113
- self.batch_modified_date = attributes[:'batchModifiedDate']
114
- end
115
-
116
- if attributes.has_key?(:'batchSource')
117
- self.batch_source = attributes[:'batchSource']
118
- end
119
-
120
- if attributes.has_key?(:'tokenSource')
121
- self.token_source = attributes[:'tokenSource']
122
- end
123
-
124
- if attributes.has_key?(:'merchantReference')
125
- self.merchant_reference = attributes[:'merchantReference']
126
- end
127
-
128
- if attributes.has_key?(:'batchCaEndpoints')
129
- if (value = attributes[:'batchCaEndpoints']).is_a?(Array)
130
- self.batch_ca_endpoints = value
131
- end
132
- end
133
-
134
- if attributes.has_key?(:'status')
135
- self.status = attributes[:'status']
136
- end
137
-
138
- if attributes.has_key?(:'totals')
139
- self.totals = attributes[:'totals']
140
- end
141
- end
142
-
143
- # Show invalid properties with the reasons. Usually used together with valid?
144
- # @return Array for valid properties with the reasons
145
- def list_invalid_properties
146
- invalid_properties = Array.new
147
- invalid_properties
148
- end
149
-
150
- # Check to see if the all the properties in the model are valid
151
- # @return true if the model is valid
152
- def valid?
153
- true
154
- end
155
-
156
- # Custom attribute writer method with validation
157
- # @param [Object] merchant_reference Value to be assigned
158
- def merchant_reference=(merchant_reference)
159
- @merchant_reference = merchant_reference
160
- end
161
-
162
- # Checks equality by comparing each attribute.
163
- # @param [Object] Object to be compared
164
- def ==(o)
165
- return true if self.equal?(o)
166
- self.class == o.class &&
167
- _links == o._links &&
168
- batch_id == o.batch_id &&
169
- batch_created_date == o.batch_created_date &&
170
- batch_modified_date == o.batch_modified_date &&
171
- batch_source == o.batch_source &&
172
- token_source == o.token_source &&
173
- merchant_reference == o.merchant_reference &&
174
- batch_ca_endpoints == o.batch_ca_endpoints &&
175
- status == o.status &&
176
- totals == o.totals
177
- end
178
-
179
- # @see the `==` method
180
- # @param [Object] Object to be compared
181
- def eql?(o)
182
- self == o
183
- end
184
-
185
- # Calculates hash code according to all attributes.
186
- # @return [Fixnum] Hash code
187
- def hash
188
- [_links, batch_id, batch_created_date, batch_modified_date, batch_source, token_source, merchant_reference, batch_ca_endpoints, status, totals].hash
189
- end
190
-
191
- # Builds the object from hash
192
- # @param [Hash] attributes Model attributes in the form of hash
193
- # @return [Object] Returns the model itself
194
- def build_from_hash(attributes)
195
- return nil unless attributes.is_a?(Hash)
196
- self.class.swagger_types.each_pair do |key, type|
197
- if type =~ /\AArray<(.*)>/i
198
- # check to ensure the input is an array given that the the attribute
199
- # is documented as an array but the input is not
200
- if attributes[self.class.attribute_map[key]].is_a?(Array)
201
- self.send("#{self.class.json_map[key]}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
202
- end
203
- elsif !attributes[self.class.attribute_map[key]].nil?
204
- self.send("#{self.class.json_map[key]}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
205
- end # or else data not found in attributes(hash), not an issue as the data can be optional
206
- end
207
-
208
- self
209
- end
210
-
211
- # Deserializes the data based on type
212
- # @param string type Data type
213
- # @param string value Value to be deserialized
214
- # @return [Object] Deserialized data
215
- def _deserialize(type, value)
216
- case type.to_sym
217
- when :DateTime
218
- DateTime.parse(value)
219
- when :Date
220
- Date.parse(value)
221
- when :String
222
- value.to_s
223
- when :Integer
224
- value.to_i
225
- when :Float
226
- value.to_f
227
- when :BOOLEAN
228
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
229
- true
230
- else
231
- false
232
- end
233
- when :Object
234
- # generic object (usually a Hash), return directly
235
- value
236
- when /\AArray<(?<inner_type>.+)>\z/
237
- inner_type = Regexp.last_match[:inner_type]
238
- value.map { |v| _deserialize(inner_type, v) }
239
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
240
- k_type = Regexp.last_match[:k_type]
241
- v_type = Regexp.last_match[:v_type]
242
- {}.tap do |hash|
243
- value.each do |k, v|
244
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
245
- end
246
- end
247
- else # model
248
- temp_model = CyberSource.const_get(type).new
249
- temp_model.build_from_hash(value)
250
- end
251
- end
252
-
253
- # Returns the string representation of the object
254
- # @return [String] String presentation of the object
255
- def to_s
256
- to_hash.to_s
257
- end
258
-
259
- # to_body is an alias to to_hash (backward compatibility)
260
- # @return [Hash] Returns the object in the form of hash
261
- def to_body
262
- to_hash
263
- end
264
-
265
- # Returns the object in the form of hash
266
- # @return [Hash] Returns the object in the form of hash
267
- def to_hash
268
- hash = {}
269
- self.class.attribute_map.each_pair do |attr, param|
270
- value = self.send(attr)
271
- next if value.nil?
272
- hash[param] = _to_hash(value)
273
- end
274
- hash
275
- end
276
-
277
- # Outputs non-array value in the form of hash
278
- # For object, use to_hash. Otherwise, just return the value
279
- # @param [Object] value Any valid value
280
- # @return [Hash] Returns the value in the form of hash
281
- def _to_hash(value)
282
- if value.is_a?(Array)
283
- value.compact.map { |v| _to_hash(v) }
284
- elsif value.is_a?(Hash)
285
- {}.tap do |hash|
286
- value.each { |k, v| hash[k] = _to_hash(v) }
287
- end
288
- elsif value.respond_to? :to_hash
289
- value.to_hash
290
- else
291
- value
292
- end
293
- end
294
- end
295
- 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 InlineResponse2008EmbeddedBatches
16
+ attr_accessor :_links
17
+
18
+ # Unique identification number assigned to the submitted request.
19
+ attr_accessor :batch_id
20
+
21
+ # ISO-8601 format: yyyy-MM-ddTHH:mm:ssZ
22
+ attr_accessor :batch_created_date
23
+
24
+ # ISO-8601 format: yyyy-MM-ddTHH:mm:ssZ
25
+ attr_accessor :batch_modified_date
26
+
27
+ # Valid Values: * SCHEDULER * TOKEN_API * CREDIT_CARD_FILE_UPLOAD * AMEX_REGSITRY * AMEX_REGISTRY_API * AMEX_REGISTRY_API_SYNC * AMEX_MAINTENANCE
28
+ attr_accessor :batch_source
29
+
30
+ # Valid Values: * SECURE_STORAGE * TMS * CYBERSOURCE
31
+ attr_accessor :token_source
32
+
33
+ # Reference used by merchant to identify batch.
34
+ attr_accessor :merchant_reference
35
+
36
+ # Valid Values: * VISA * MASTERCARD * AMEX
37
+ attr_accessor :batch_ca_endpoints
38
+
39
+ # Valid Values: * REJECTED * RECEIVED * VALIDATED * DECLINED * PROCESSING * COMPLETE
40
+ attr_accessor :status
41
+
42
+ attr_accessor :totals
43
+
44
+ # Attribute mapping from ruby-style variable name to JSON key.
45
+ def self.attribute_map
46
+ {
47
+ :'_links' => :'_links',
48
+ :'batch_id' => :'batchId',
49
+ :'batch_created_date' => :'batchCreatedDate',
50
+ :'batch_modified_date' => :'batchModifiedDate',
51
+ :'batch_source' => :'batchSource',
52
+ :'token_source' => :'tokenSource',
53
+ :'merchant_reference' => :'merchantReference',
54
+ :'batch_ca_endpoints' => :'batchCaEndpoints',
55
+ :'status' => :'status',
56
+ :'totals' => :'totals'
57
+ }
58
+ end
59
+
60
+ # Attribute mapping from JSON key to ruby-style variable name.
61
+ def self.json_map
62
+ {
63
+ :'_links' => :'_links',
64
+ :'batch_id' => :'batch_id',
65
+ :'batch_created_date' => :'batch_created_date',
66
+ :'batch_modified_date' => :'batch_modified_date',
67
+ :'batch_source' => :'batch_source',
68
+ :'token_source' => :'token_source',
69
+ :'merchant_reference' => :'merchant_reference',
70
+ :'batch_ca_endpoints' => :'batch_ca_endpoints',
71
+ :'status' => :'status',
72
+ :'totals' => :'totals'
73
+ }
74
+ end
75
+
76
+ # Attribute type mapping.
77
+ def self.swagger_types
78
+ {
79
+ :'_links' => :'InlineResponse2008EmbeddedLinks',
80
+ :'batch_id' => :'String',
81
+ :'batch_created_date' => :'String',
82
+ :'batch_modified_date' => :'String',
83
+ :'batch_source' => :'String',
84
+ :'token_source' => :'String',
85
+ :'merchant_reference' => :'String',
86
+ :'batch_ca_endpoints' => :'Array<String>',
87
+ :'status' => :'String',
88
+ :'totals' => :'InlineResponse2008EmbeddedTotals'
89
+ }
90
+ end
91
+
92
+ # Initializes the object
93
+ # @param [Hash] attributes Model attributes in the form of hash
94
+ def initialize(attributes = {})
95
+ return unless attributes.is_a?(Hash)
96
+
97
+ # convert string to symbol for hash key
98
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
99
+
100
+ if attributes.has_key?(:'_links')
101
+ self._links = attributes[:'_links']
102
+ end
103
+
104
+ if attributes.has_key?(:'batchId')
105
+ self.batch_id = attributes[:'batchId']
106
+ end
107
+
108
+ if attributes.has_key?(:'batchCreatedDate')
109
+ self.batch_created_date = attributes[:'batchCreatedDate']
110
+ end
111
+
112
+ if attributes.has_key?(:'batchModifiedDate')
113
+ self.batch_modified_date = attributes[:'batchModifiedDate']
114
+ end
115
+
116
+ if attributes.has_key?(:'batchSource')
117
+ self.batch_source = attributes[:'batchSource']
118
+ end
119
+
120
+ if attributes.has_key?(:'tokenSource')
121
+ self.token_source = attributes[:'tokenSource']
122
+ end
123
+
124
+ if attributes.has_key?(:'merchantReference')
125
+ self.merchant_reference = attributes[:'merchantReference']
126
+ end
127
+
128
+ if attributes.has_key?(:'batchCaEndpoints')
129
+ if (value = attributes[:'batchCaEndpoints']).is_a?(Array)
130
+ self.batch_ca_endpoints = value
131
+ end
132
+ end
133
+
134
+ if attributes.has_key?(:'status')
135
+ self.status = attributes[:'status']
136
+ end
137
+
138
+ if attributes.has_key?(:'totals')
139
+ self.totals = attributes[:'totals']
140
+ end
141
+ end
142
+
143
+ # Show invalid properties with the reasons. Usually used together with valid?
144
+ # @return Array for valid properties with the reasons
145
+ def list_invalid_properties
146
+ invalid_properties = Array.new
147
+ invalid_properties
148
+ end
149
+
150
+ # Check to see if the all the properties in the model are valid
151
+ # @return true if the model is valid
152
+ def valid?
153
+ true
154
+ end
155
+
156
+ # Custom attribute writer method with validation
157
+ # @param [Object] merchant_reference Value to be assigned
158
+ def merchant_reference=(merchant_reference)
159
+ @merchant_reference = merchant_reference
160
+ end
161
+
162
+ # Checks equality by comparing each attribute.
163
+ # @param [Object] Object to be compared
164
+ def ==(o)
165
+ return true if self.equal?(o)
166
+ self.class == o.class &&
167
+ _links == o._links &&
168
+ batch_id == o.batch_id &&
169
+ batch_created_date == o.batch_created_date &&
170
+ batch_modified_date == o.batch_modified_date &&
171
+ batch_source == o.batch_source &&
172
+ token_source == o.token_source &&
173
+ merchant_reference == o.merchant_reference &&
174
+ batch_ca_endpoints == o.batch_ca_endpoints &&
175
+ status == o.status &&
176
+ totals == o.totals
177
+ end
178
+
179
+ # @see the `==` method
180
+ # @param [Object] Object to be compared
181
+ def eql?(o)
182
+ self == o
183
+ end
184
+
185
+ # Calculates hash code according to all attributes.
186
+ # @return [Fixnum] Hash code
187
+ def hash
188
+ [_links, batch_id, batch_created_date, batch_modified_date, batch_source, token_source, merchant_reference, batch_ca_endpoints, status, totals].hash
189
+ end
190
+
191
+ # Builds the object from hash
192
+ # @param [Hash] attributes Model attributes in the form of hash
193
+ # @return [Object] Returns the model itself
194
+ def build_from_hash(attributes)
195
+ return nil unless attributes.is_a?(Hash)
196
+ self.class.swagger_types.each_pair do |key, type|
197
+ if type =~ /\AArray<(.*)>/i
198
+ # check to ensure the input is an array given that the the attribute
199
+ # is documented as an array but the input is not
200
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
201
+ self.send("#{self.class.json_map[key]}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
202
+ end
203
+ elsif !attributes[self.class.attribute_map[key]].nil?
204
+ self.send("#{self.class.json_map[key]}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
205
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
206
+ end
207
+
208
+ self
209
+ end
210
+
211
+ # Deserializes the data based on type
212
+ # @param string type Data type
213
+ # @param string value Value to be deserialized
214
+ # @return [Object] Deserialized data
215
+ def _deserialize(type, value)
216
+ case type.to_sym
217
+ when :DateTime
218
+ DateTime.parse(value)
219
+ when :Date
220
+ Date.parse(value)
221
+ when :String
222
+ value.to_s
223
+ when :Integer
224
+ value.to_i
225
+ when :Float
226
+ value.to_f
227
+ when :BOOLEAN
228
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
229
+ true
230
+ else
231
+ false
232
+ end
233
+ when :Object
234
+ # generic object (usually a Hash), return directly
235
+ value
236
+ when /\AArray<(?<inner_type>.+)>\z/
237
+ inner_type = Regexp.last_match[:inner_type]
238
+ value.map { |v| _deserialize(inner_type, v) }
239
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
240
+ k_type = Regexp.last_match[:k_type]
241
+ v_type = Regexp.last_match[:v_type]
242
+ {}.tap do |hash|
243
+ value.each do |k, v|
244
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
245
+ end
246
+ end
247
+ else # model
248
+ temp_model = CyberSource.const_get(type).new
249
+ temp_model.build_from_hash(value)
250
+ end
251
+ end
252
+
253
+ # Returns the string representation of the object
254
+ # @return [String] String presentation of the object
255
+ def to_s
256
+ to_hash.to_s
257
+ end
258
+
259
+ # to_body is an alias to to_hash (backward compatibility)
260
+ # @return [Hash] Returns the object in the form of hash
261
+ def to_body
262
+ to_hash
263
+ end
264
+
265
+ # Returns the object in the form of hash
266
+ # @return [Hash] Returns the object in the form of hash
267
+ def to_hash
268
+ hash = {}
269
+ self.class.attribute_map.each_pair do |attr, param|
270
+ value = self.send(attr)
271
+ next if value.nil?
272
+ hash[param] = _to_hash(value)
273
+ end
274
+ hash
275
+ end
276
+
277
+ # Outputs non-array value in the form of hash
278
+ # For object, use to_hash. Otherwise, just return the value
279
+ # @param [Object] value Any valid value
280
+ # @return [Hash] Returns the value in the form of hash
281
+ def _to_hash(value)
282
+ if value.is_a?(Array)
283
+ value.compact.map { |v| _to_hash(v) }
284
+ elsif value.is_a?(Hash)
285
+ {}.tap do |hash|
286
+ value.each { |k, v| hash[k] = _to_hash(v) }
287
+ end
288
+ elsif value.respond_to? :to_hash
289
+ value.to_hash
290
+ else
291
+ value
292
+ end
293
+ end
294
+ end
295
+ end