cybersource_rest_client 0.0.70 → 0.0.71

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 (65) 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/create_new_webhooks_api.rb +3 -149
  4. data/lib/cybersource_rest_client/api/manage_webhooks_api.rb +20 -261
  5. data/lib/cybersource_rest_client/api/transaction_batches_api.rb +75 -0
  6. data/lib/cybersource_rest_client/models/generate_unified_checkout_capture_context_request.rb +1 -1
  7. data/lib/cybersource_rest_client/models/inline_response_200_2.rb +64 -26
  8. data/lib/cybersource_rest_client/models/{inline_response_200_5__embedded.rb → inline_response_200_2__embedded.rb} +2 -2
  9. data/lib/cybersource_rest_client/models/{inline_response_200_5__embedded__links.rb → inline_response_200_2__embedded__links.rb} +2 -2
  10. data/lib/cybersource_rest_client/models/{inline_response_200_5__embedded__links_reports.rb → inline_response_200_2__embedded__links_reports.rb} +1 -1
  11. data/lib/cybersource_rest_client/models/{inline_response_200_5__embedded_batches.rb → inline_response_200_2__embedded_batches.rb} +3 -3
  12. data/lib/cybersource_rest_client/models/{inline_response_200_5__embedded_totals.rb → inline_response_200_2__embedded_totals.rb} +1 -1
  13. data/lib/cybersource_rest_client/models/{inline_response_200_5__links.rb → inline_response_200_2__links.rb} +1 -1
  14. data/lib/cybersource_rest_client/models/inline_response_200_3.rb +75 -120
  15. data/lib/cybersource_rest_client/models/{inline_response_200_6__links.rb → inline_response_200_3__links.rb} +2 -2
  16. data/lib/cybersource_rest_client/models/{inline_response_200_6__links_report.rb → inline_response_200_3__links_report.rb} +1 -1
  17. data/lib/cybersource_rest_client/models/{inline_response_200_6_billing.rb → inline_response_200_3_billing.rb} +1 -1
  18. data/lib/cybersource_rest_client/models/inline_response_200_4.rb +83 -126
  19. data/lib/cybersource_rest_client/models/{inline_response_200_7_records.rb → inline_response_200_4_records.rb} +3 -3
  20. data/lib/cybersource_rest_client/models/{inline_response_200_7_response_record.rb → inline_response_200_4_response_record.rb} +2 -2
  21. data/lib/cybersource_rest_client/models/{inline_response_200_7_response_record_additional_updates.rb → inline_response_200_4_response_record_additional_updates.rb} +1 -1
  22. data/lib/cybersource_rest_client/models/{inline_response_200_7_source_record.rb → inline_response_200_4_source_record.rb} +1 -1
  23. data/lib/cybersource_rest_client/models/inline_response_201_4.rb +64 -134
  24. data/lib/cybersource_rest_client/models/inline_response_201_4_payloads.rb +189 -0
  25. data/lib/cybersource_rest_client/models/inline_response_201_4_payloads_test_payload.rb +190 -0
  26. data/lib/cybersource_rest_client/models/inline_response_201_5.rb +5 -25
  27. data/lib/cybersource_rest_client/models/model_400_upload_batch_file_response.rb +199 -0
  28. data/lib/cybersource_rest_client/models/payments_strong_auth_issuer_information.rb +22 -5
  29. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_1.rb +25 -5
  30. data/lib/cybersource_rest_client/models/{inline_response_404_2.rb → pts_v2_payments_post201_response_1_error_information.rb} +4 -2
  31. data/lib/cybersource_rest_client/models/{inline_response_404_2_details.rb → pts_v2_payments_post201_response_1_error_information_details.rb} +3 -12
  32. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_1_issuer_information.rb +213 -0
  33. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_1_order_information.rb +15 -5
  34. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_1_order_information_amount_details.rb +196 -0
  35. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_1_payment_information.rb +11 -1
  36. data/lib/cybersource_rest_client/models/{notificationsubscriptionsv1webhooks_security_policy_1.rb → pts_v2_payments_post201_response_1_payment_information_e_wallet.rb} +30 -29
  37. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_1_processor_information.rb +41 -1
  38. data/lib/cybersource_rest_client/models/pts_v2_payments_refund_post201_response.rb +11 -1
  39. data/lib/cybersource_rest_client/models/ptsv2payments_processing_information.rb +1 -1
  40. data/lib/cybersource_rest_client/models/ptsv2payouts_processing_information.rb +1 -1
  41. data/lib/cybersource_rest_client/models/ptsv2payouts_recipient_information.rb +7 -7
  42. data/lib/cybersource_rest_client/models/ptsv2payouts_sender_information.rb +3 -3
  43. data/lib/cybersource_rest_client/models/ptsv2payouts_sender_information_account.rb +1 -1
  44. data/lib/cybersource_rest_client/models/save_asym_egress_key.rb +0 -10
  45. data/lib/cybersource_rest_client/models/save_sym_egress_key.rb +0 -10
  46. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_payment_information_issuer_information.rb +22 -5
  47. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_processor_information.rb +12 -1
  48. data/lib/cybersource_rest_client.rb +21 -32
  49. metadata +23 -34
  50. data/lib/cybersource_rest_client/api/replay_webhooks_api.rb +0 -98
  51. data/lib/cybersource_rest_client/models/create_webhook_request.rb +0 -289
  52. data/lib/cybersource_rest_client/models/inline_response_200_5.rb +0 -251
  53. data/lib/cybersource_rest_client/models/inline_response_200_6.rb +0 -290
  54. data/lib/cybersource_rest_client/models/inline_response_200_7.rb +0 -292
  55. data/lib/cybersource_rest_client/models/notificationsubscriptionsv1productsorganization_id_event_types.rb +0 -233
  56. data/lib/cybersource_rest_client/models/notificationsubscriptionsv1webhooks_notification_scope.rb +0 -205
  57. data/lib/cybersource_rest_client/models/notificationsubscriptionsv1webhooks_products.rb +0 -202
  58. data/lib/cybersource_rest_client/models/notificationsubscriptionsv1webhooks_retry_policy.rb +0 -270
  59. data/lib/cybersource_rest_client/models/notificationsubscriptionsv1webhooks_security_policy.rb +0 -201
  60. data/lib/cybersource_rest_client/models/notificationsubscriptionsv1webhooks_security_policy_1_config.rb +0 -223
  61. data/lib/cybersource_rest_client/models/notificationsubscriptionsv1webhooks_security_policy_1_config_additional_config.rb +0 -220
  62. data/lib/cybersource_rest_client/models/notificationsubscriptionsv1webhooks_security_policy_config.rb +0 -213
  63. data/lib/cybersource_rest_client/models/nrtfv1webhookswebhook_idreplays_by_delivery_status.rb +0 -243
  64. data/lib/cybersource_rest_client/models/replay_webhooks_request.rb +0 -201
  65. data/lib/cybersource_rest_client/models/update_webhook_request.rb +0 -314
@@ -1,290 +0,0 @@
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 InlineResponse2006
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
- # Valid Values: * SCHEDULER * TOKEN_API * CREDIT_CARD_FILE_UPLOAD * AMEX_REGSITRY * AMEX_REGISTRY_API * AMEX_MAINTENANCE
25
- attr_accessor :batch_source
26
-
27
- # Reference used by merchant to identify batch.
28
- attr_accessor :merchant_reference
29
-
30
- attr_accessor :batch_ca_endpoints
31
-
32
- # Valid Values: * REJECTED * RECEIVED * VALIDATED * DECLINED * PROCESSING * COMPLETED
33
- attr_accessor :status
34
-
35
- attr_accessor :totals
36
-
37
- attr_accessor :billing
38
-
39
- attr_accessor :description
40
-
41
- # Attribute mapping from ruby-style variable name to JSON key.
42
- def self.attribute_map
43
- {
44
- :'_links' => :'_links',
45
- :'batch_id' => :'batchId',
46
- :'batch_created_date' => :'batchCreatedDate',
47
- :'batch_source' => :'batchSource',
48
- :'merchant_reference' => :'merchantReference',
49
- :'batch_ca_endpoints' => :'batchCaEndpoints',
50
- :'status' => :'status',
51
- :'totals' => :'totals',
52
- :'billing' => :'billing',
53
- :'description' => :'description'
54
- }
55
- end
56
-
57
- # Attribute mapping from JSON key to ruby-style variable name.
58
- def self.json_map
59
- {
60
- :'_links' => :'_links',
61
- :'batch_id' => :'batch_id',
62
- :'batch_created_date' => :'batch_created_date',
63
- :'batch_source' => :'batch_source',
64
- :'merchant_reference' => :'merchant_reference',
65
- :'batch_ca_endpoints' => :'batch_ca_endpoints',
66
- :'status' => :'status',
67
- :'totals' => :'totals',
68
- :'billing' => :'billing',
69
- :'description' => :'description'
70
- }
71
- end
72
-
73
- # Attribute type mapping.
74
- def self.swagger_types
75
- {
76
- :'_links' => :'InlineResponse2006Links',
77
- :'batch_id' => :'String',
78
- :'batch_created_date' => :'String',
79
- :'batch_source' => :'String',
80
- :'merchant_reference' => :'String',
81
- :'batch_ca_endpoints' => :'String',
82
- :'status' => :'String',
83
- :'totals' => :'InlineResponse2005EmbeddedTotals',
84
- :'billing' => :'InlineResponse2006Billing',
85
- :'description' => :'String'
86
- }
87
- end
88
-
89
- # Initializes the object
90
- # @param [Hash] attributes Model attributes in the form of hash
91
- def initialize(attributes = {})
92
- return unless attributes.is_a?(Hash)
93
-
94
- # convert string to symbol for hash key
95
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
96
-
97
- if attributes.has_key?(:'_links')
98
- self._links = attributes[:'_links']
99
- end
100
-
101
- if attributes.has_key?(:'batchId')
102
- self.batch_id = attributes[:'batchId']
103
- end
104
-
105
- if attributes.has_key?(:'batchCreatedDate')
106
- self.batch_created_date = attributes[:'batchCreatedDate']
107
- end
108
-
109
- if attributes.has_key?(:'batchSource')
110
- self.batch_source = attributes[:'batchSource']
111
- end
112
-
113
- if attributes.has_key?(:'merchantReference')
114
- self.merchant_reference = attributes[:'merchantReference']
115
- end
116
-
117
- if attributes.has_key?(:'batchCaEndpoints')
118
- self.batch_ca_endpoints = attributes[:'batchCaEndpoints']
119
- end
120
-
121
- if attributes.has_key?(:'status')
122
- self.status = attributes[:'status']
123
- end
124
-
125
- if attributes.has_key?(:'totals')
126
- self.totals = attributes[:'totals']
127
- end
128
-
129
- if attributes.has_key?(:'billing')
130
- self.billing = attributes[:'billing']
131
- end
132
-
133
- if attributes.has_key?(:'description')
134
- self.description = attributes[:'description']
135
- end
136
- end
137
-
138
- # Show invalid properties with the reasons. Usually used together with valid?
139
- # @return Array for valid properties with the reasons
140
- def list_invalid_properties
141
- invalid_properties = Array.new
142
- invalid_properties
143
- end
144
-
145
- # Check to see if the all the properties in the model are valid
146
- # @return true if the model is valid
147
- def valid?
148
- true
149
- end
150
-
151
- # Custom attribute writer method with validation
152
- # @param [Object] merchant_reference Value to be assigned
153
- def merchant_reference=(merchant_reference)
154
- @merchant_reference = merchant_reference
155
- end
156
-
157
- # Checks equality by comparing each attribute.
158
- # @param [Object] Object to be compared
159
- def ==(o)
160
- return true if self.equal?(o)
161
- self.class == o.class &&
162
- _links == o._links &&
163
- batch_id == o.batch_id &&
164
- batch_created_date == o.batch_created_date &&
165
- batch_source == o.batch_source &&
166
- merchant_reference == o.merchant_reference &&
167
- batch_ca_endpoints == o.batch_ca_endpoints &&
168
- status == o.status &&
169
- totals == o.totals &&
170
- billing == o.billing &&
171
- description == o.description
172
- end
173
-
174
- # @see the `==` method
175
- # @param [Object] Object to be compared
176
- def eql?(o)
177
- self == o
178
- end
179
-
180
- # Calculates hash code according to all attributes.
181
- # @return [Fixnum] Hash code
182
- def hash
183
- [_links, batch_id, batch_created_date, batch_source, merchant_reference, batch_ca_endpoints, status, totals, billing, description].hash
184
- end
185
-
186
- # Builds the object from hash
187
- # @param [Hash] attributes Model attributes in the form of hash
188
- # @return [Object] Returns the model itself
189
- def build_from_hash(attributes)
190
- return nil unless attributes.is_a?(Hash)
191
- self.class.swagger_types.each_pair do |key, type|
192
- if type =~ /\AArray<(.*)>/i
193
- # check to ensure the input is an array given that the the attribute
194
- # is documented as an array but the input is not
195
- if attributes[self.class.attribute_map[key]].is_a?(Array)
196
- self.send("#{self.class.json_map[key]}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
197
- end
198
- elsif !attributes[self.class.attribute_map[key]].nil?
199
- self.send("#{self.class.json_map[key]}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
200
- end # or else data not found in attributes(hash), not an issue as the data can be optional
201
- end
202
-
203
- self
204
- end
205
-
206
- # Deserializes the data based on type
207
- # @param string type Data type
208
- # @param string value Value to be deserialized
209
- # @return [Object] Deserialized data
210
- def _deserialize(type, value)
211
- case type.to_sym
212
- when :DateTime
213
- DateTime.parse(value)
214
- when :Date
215
- Date.parse(value)
216
- when :String
217
- value.to_s
218
- when :Integer
219
- value.to_i
220
- when :Float
221
- value.to_f
222
- when :BOOLEAN
223
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
224
- true
225
- else
226
- false
227
- end
228
- when :Object
229
- # generic object (usually a Hash), return directly
230
- value
231
- when /\AArray<(?<inner_type>.+)>\z/
232
- inner_type = Regexp.last_match[:inner_type]
233
- value.map { |v| _deserialize(inner_type, v) }
234
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
235
- k_type = Regexp.last_match[:k_type]
236
- v_type = Regexp.last_match[:v_type]
237
- {}.tap do |hash|
238
- value.each do |k, v|
239
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
240
- end
241
- end
242
- else # model
243
- temp_model = CyberSource.const_get(type).new
244
- temp_model.build_from_hash(value)
245
- end
246
- end
247
-
248
- # Returns the string representation of the object
249
- # @return [String] String presentation of the object
250
- def to_s
251
- to_hash.to_s
252
- end
253
-
254
- # to_body is an alias to to_hash (backward compatibility)
255
- # @return [Hash] Returns the object in the form of hash
256
- def to_body
257
- to_hash
258
- end
259
-
260
- # Returns the object in the form of hash
261
- # @return [Hash] Returns the object in the form of hash
262
- def to_hash
263
- hash = {}
264
- self.class.attribute_map.each_pair do |attr, param|
265
- value = self.send(attr)
266
- next if value.nil?
267
- hash[param] = _to_hash(value)
268
- end
269
- hash
270
- end
271
-
272
- # Outputs non-array value in the form of hash
273
- # For object, use to_hash. Otherwise, just return the value
274
- # @param [Object] value Any valid value
275
- # @return [Hash] Returns the value in the form of hash
276
- def _to_hash(value)
277
- if value.is_a?(Array)
278
- value.compact.map { |v| _to_hash(v) }
279
- elsif value.is_a?(Hash)
280
- {}.tap do |hash|
281
- value.each { |k, v| hash[k] = _to_hash(v) }
282
- end
283
- elsif value.respond_to? :to_hash
284
- value.to_hash
285
- else
286
- value
287
- end
288
- end
289
- end
290
- end
@@ -1,292 +0,0 @@
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 InlineResponse2007
16
- attr_accessor :version
17
-
18
- # ISO-8601 format: yyyy-MM-ddTHH:mm:ssZ
19
- attr_accessor :report_created_date
20
-
21
- # Unique identification number assigned to the submitted request.
22
- attr_accessor :batch_id
23
-
24
- # Valid Values: * SCHEDULER * TOKEN_API * CREDIT_CARD_FILE_UPLOAD * AMEX_REGSITRY * AMEX_REGISTRY_API * AMEX_MAINTENANCE
25
- attr_accessor :batch_source
26
-
27
- attr_accessor :batch_ca_endpoints
28
-
29
- # ISO-8601 format: yyyy-MM-ddTHH:mm:ssZ
30
- attr_accessor :batch_created_date
31
-
32
- # Reference used by merchant to identify batch.
33
- attr_accessor :merchant_reference
34
-
35
- attr_accessor :totals
36
-
37
- attr_accessor :billing
38
-
39
- attr_accessor :records
40
-
41
- # Attribute mapping from ruby-style variable name to JSON key.
42
- def self.attribute_map
43
- {
44
- :'version' => :'version',
45
- :'report_created_date' => :'reportCreatedDate',
46
- :'batch_id' => :'batchId',
47
- :'batch_source' => :'batchSource',
48
- :'batch_ca_endpoints' => :'batchCaEndpoints',
49
- :'batch_created_date' => :'batchCreatedDate',
50
- :'merchant_reference' => :'merchantReference',
51
- :'totals' => :'totals',
52
- :'billing' => :'billing',
53
- :'records' => :'records'
54
- }
55
- end
56
-
57
- # Attribute mapping from JSON key to ruby-style variable name.
58
- def self.json_map
59
- {
60
- :'version' => :'version',
61
- :'report_created_date' => :'report_created_date',
62
- :'batch_id' => :'batch_id',
63
- :'batch_source' => :'batch_source',
64
- :'batch_ca_endpoints' => :'batch_ca_endpoints',
65
- :'batch_created_date' => :'batch_created_date',
66
- :'merchant_reference' => :'merchant_reference',
67
- :'totals' => :'totals',
68
- :'billing' => :'billing',
69
- :'records' => :'records'
70
- }
71
- end
72
-
73
- # Attribute type mapping.
74
- def self.swagger_types
75
- {
76
- :'version' => :'String',
77
- :'report_created_date' => :'String',
78
- :'batch_id' => :'String',
79
- :'batch_source' => :'String',
80
- :'batch_ca_endpoints' => :'String',
81
- :'batch_created_date' => :'String',
82
- :'merchant_reference' => :'String',
83
- :'totals' => :'InlineResponse2005EmbeddedTotals',
84
- :'billing' => :'InlineResponse2006Billing',
85
- :'records' => :'Array<InlineResponse2007Records>'
86
- }
87
- end
88
-
89
- # Initializes the object
90
- # @param [Hash] attributes Model attributes in the form of hash
91
- def initialize(attributes = {})
92
- return unless attributes.is_a?(Hash)
93
-
94
- # convert string to symbol for hash key
95
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
96
-
97
- if attributes.has_key?(:'version')
98
- self.version = attributes[:'version']
99
- end
100
-
101
- if attributes.has_key?(:'reportCreatedDate')
102
- self.report_created_date = attributes[:'reportCreatedDate']
103
- end
104
-
105
- if attributes.has_key?(:'batchId')
106
- self.batch_id = attributes[:'batchId']
107
- end
108
-
109
- if attributes.has_key?(:'batchSource')
110
- self.batch_source = attributes[:'batchSource']
111
- end
112
-
113
- if attributes.has_key?(:'batchCaEndpoints')
114
- self.batch_ca_endpoints = attributes[:'batchCaEndpoints']
115
- end
116
-
117
- if attributes.has_key?(:'batchCreatedDate')
118
- self.batch_created_date = attributes[:'batchCreatedDate']
119
- end
120
-
121
- if attributes.has_key?(:'merchantReference')
122
- self.merchant_reference = attributes[:'merchantReference']
123
- end
124
-
125
- if attributes.has_key?(:'totals')
126
- self.totals = attributes[:'totals']
127
- end
128
-
129
- if attributes.has_key?(:'billing')
130
- self.billing = attributes[:'billing']
131
- end
132
-
133
- if attributes.has_key?(:'records')
134
- if (value = attributes[:'records']).is_a?(Array)
135
- self.records = value
136
- end
137
- end
138
- end
139
-
140
- # Show invalid properties with the reasons. Usually used together with valid?
141
- # @return Array for valid properties with the reasons
142
- def list_invalid_properties
143
- invalid_properties = Array.new
144
- invalid_properties
145
- end
146
-
147
- # Check to see if the all the properties in the model are valid
148
- # @return true if the model is valid
149
- def valid?
150
- true
151
- end
152
-
153
- # Custom attribute writer method with validation
154
- # @param [Object] merchant_reference Value to be assigned
155
- def merchant_reference=(merchant_reference)
156
- @merchant_reference = merchant_reference
157
- end
158
-
159
- # Checks equality by comparing each attribute.
160
- # @param [Object] Object to be compared
161
- def ==(o)
162
- return true if self.equal?(o)
163
- self.class == o.class &&
164
- version == o.version &&
165
- report_created_date == o.report_created_date &&
166
- batch_id == o.batch_id &&
167
- batch_source == o.batch_source &&
168
- batch_ca_endpoints == o.batch_ca_endpoints &&
169
- batch_created_date == o.batch_created_date &&
170
- merchant_reference == o.merchant_reference &&
171
- totals == o.totals &&
172
- billing == o.billing &&
173
- records == o.records
174
- end
175
-
176
- # @see the `==` method
177
- # @param [Object] Object to be compared
178
- def eql?(o)
179
- self == o
180
- end
181
-
182
- # Calculates hash code according to all attributes.
183
- # @return [Fixnum] Hash code
184
- def hash
185
- [version, report_created_date, batch_id, batch_source, batch_ca_endpoints, batch_created_date, merchant_reference, totals, billing, records].hash
186
- end
187
-
188
- # Builds the object from hash
189
- # @param [Hash] attributes Model attributes in the form of hash
190
- # @return [Object] Returns the model itself
191
- def build_from_hash(attributes)
192
- return nil unless attributes.is_a?(Hash)
193
- self.class.swagger_types.each_pair do |key, type|
194
- if type =~ /\AArray<(.*)>/i
195
- # check to ensure the input is an array given that the the attribute
196
- # is documented as an array but the input is not
197
- if attributes[self.class.attribute_map[key]].is_a?(Array)
198
- self.send("#{self.class.json_map[key]}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
199
- end
200
- elsif !attributes[self.class.attribute_map[key]].nil?
201
- self.send("#{self.class.json_map[key]}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
202
- end # or else data not found in attributes(hash), not an issue as the data can be optional
203
- end
204
-
205
- self
206
- end
207
-
208
- # Deserializes the data based on type
209
- # @param string type Data type
210
- # @param string value Value to be deserialized
211
- # @return [Object] Deserialized data
212
- def _deserialize(type, value)
213
- case type.to_sym
214
- when :DateTime
215
- DateTime.parse(value)
216
- when :Date
217
- Date.parse(value)
218
- when :String
219
- value.to_s
220
- when :Integer
221
- value.to_i
222
- when :Float
223
- value.to_f
224
- when :BOOLEAN
225
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
226
- true
227
- else
228
- false
229
- end
230
- when :Object
231
- # generic object (usually a Hash), return directly
232
- value
233
- when /\AArray<(?<inner_type>.+)>\z/
234
- inner_type = Regexp.last_match[:inner_type]
235
- value.map { |v| _deserialize(inner_type, v) }
236
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
237
- k_type = Regexp.last_match[:k_type]
238
- v_type = Regexp.last_match[:v_type]
239
- {}.tap do |hash|
240
- value.each do |k, v|
241
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
242
- end
243
- end
244
- else # model
245
- temp_model = CyberSource.const_get(type).new
246
- temp_model.build_from_hash(value)
247
- end
248
- end
249
-
250
- # Returns the string representation of the object
251
- # @return [String] String presentation of the object
252
- def to_s
253
- to_hash.to_s
254
- end
255
-
256
- # to_body is an alias to to_hash (backward compatibility)
257
- # @return [Hash] Returns the object in the form of hash
258
- def to_body
259
- to_hash
260
- end
261
-
262
- # Returns the object in the form of hash
263
- # @return [Hash] Returns the object in the form of hash
264
- def to_hash
265
- hash = {}
266
- self.class.attribute_map.each_pair do |attr, param|
267
- value = self.send(attr)
268
- next if value.nil?
269
- hash[param] = _to_hash(value)
270
- end
271
- hash
272
- end
273
-
274
- # Outputs non-array value in the form of hash
275
- # For object, use to_hash. Otherwise, just return the value
276
- # @param [Object] value Any valid value
277
- # @return [Hash] Returns the value in the form of hash
278
- def _to_hash(value)
279
- if value.is_a?(Array)
280
- value.compact.map { |v| _to_hash(v) }
281
- elsif value.is_a?(Hash)
282
- {}.tap do |hash|
283
- value.each { |k, v| hash[k] = _to_hash(v) }
284
- end
285
- elsif value.respond_to? :to_hash
286
- value.to_hash
287
- else
288
- value
289
- end
290
- end
291
- end
292
- end