cybersource_rest_client 0.0.67 → 0.0.68

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 (84) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cybersource_rest_client/models/card_processing_config_common_acquirer.rb +257 -257
  3. data/lib/cybersource_rest_client/models/card_processing_config_common_merchant_descriptor_information.rb +279 -279
  4. data/lib/cybersource_rest_client/models/commerce_solutions_products_token_management_configuration_information_configurations.rb +200 -190
  5. data/lib/cybersource_rest_client/models/commerce_solutions_products_token_management_configuration_information_configurations_vault.rb +251 -0
  6. data/lib/cybersource_rest_client/models/e_check_config_common_internal_only_processors.rb +267 -263
  7. data/lib/cybersource_rest_client/models/e_check_config_common_processors.rb +273 -271
  8. data/lib/cybersource_rest_client/models/e_check_config_features_account_validation_service_internal_only_processors.rb +193 -191
  9. data/lib/cybersource_rest_client/models/e_check_config_features_account_validation_service_processors.rb +285 -283
  10. data/lib/cybersource_rest_client/models/flexv2sessions_fields.rb +199 -199
  11. data/lib/cybersource_rest_client/models/flexv2sessions_fields_order_information.rb +209 -209
  12. data/lib/cybersource_rest_client/models/flexv2sessions_fields_order_information_amount_details.rb +199 -199
  13. data/lib/cybersource_rest_client/models/flexv2sessions_fields_order_information_amount_details_total_amount.rb +189 -189
  14. data/lib/cybersource_rest_client/models/flexv2sessions_fields_order_information_bill_to.rb +309 -309
  15. data/lib/cybersource_rest_client/models/flexv2sessions_fields_order_information_ship_to.rb +289 -289
  16. data/lib/cybersource_rest_client/models/flexv2sessions_fields_payment_information.rb +189 -189
  17. data/lib/cybersource_rest_client/models/flexv2sessions_fields_payment_information_card.rb +229 -229
  18. data/lib/cybersource_rest_client/models/generate_capture_context_request.rb +13 -13
  19. data/lib/cybersource_rest_client/models/generate_flex_api_capture_context_request.rb +189 -189
  20. data/lib/cybersource_rest_client/models/generate_unified_checkout_capture_context_request.rb +13 -13
  21. data/lib/cybersource_rest_client/models/inline_response_400_1_details.rb +199 -199
  22. data/lib/cybersource_rest_client/models/inline_response_400_2.rb +235 -235
  23. data/lib/cybersource_rest_client/models/inline_response_400_3.rb +235 -235
  24. data/lib/cybersource_rest_client/models/inline_response_400_4.rb +235 -235
  25. data/lib/cybersource_rest_client/models/inline_response_400_5.rb +258 -258
  26. data/lib/cybersource_rest_client/models/inline_response_400_5_fields.rb +213 -213
  27. data/lib/cybersource_rest_client/models/inline_response_400_6_details.rb +201 -201
  28. data/lib/cybersource_rest_client/models/patch_instrument_identifier_request.rb +313 -313
  29. data/lib/cybersource_rest_client/models/post_instrument_identifier_enrollment_request.rb +313 -313
  30. data/lib/cybersource_rest_client/models/post_instrument_identifier_request.rb +313 -313
  31. data/lib/cybersource_rest_client/models/pts_v2_payments_reversals_post201_response.rb +305 -305
  32. data/lib/cybersource_rest_client/models/ptsv2payments_payment_information_card.rb +445 -428
  33. data/lib/cybersource_rest_client/models/ptsv2payments_processing_information.rb +1 -1
  34. data/lib/cybersource_rest_client/models/ptsv2payments_processing_information_japan_payment_options.rb +339 -411
  35. data/lib/cybersource_rest_client/models/ptsv2payments_processing_information_japan_payment_options_bonuses.rb +213 -0
  36. data/lib/cybersource_rest_client/models/ptsv2payments_recipient_information.rb +383 -383
  37. data/lib/cybersource_rest_client/models/ptsv2payments_recurring_payment_information.rb +363 -363
  38. data/lib/cybersource_rest_client/models/ptsv2payments_sender_information.rb +298 -298
  39. data/lib/cybersource_rest_client/models/ptsv2paymentsid_client_reference_information.rb +256 -256
  40. data/lib/cybersource_rest_client/models/riskv1authenticationresults_payment_information.rb +219 -219
  41. data/lib/cybersource_rest_client/models/riskv1authentications_payment_information.rb +219 -219
  42. data/lib/cybersource_rest_client/models/riskv1authentications_payment_information_customer.rb +222 -222
  43. data/lib/cybersource_rest_client/models/riskv1authenticationsetups_payment_information_customer.rb +205 -205
  44. data/lib/cybersource_rest_client/models/riskv1decisions_consumer_authentication_information.rb +795 -795
  45. data/lib/cybersource_rest_client/models/riskv1exportcomplianceinquiries_order_information_line_items.rb +305 -314
  46. data/lib/cybersource_rest_client/models/tms_embedded_instrument_identifier.rb +313 -313
  47. data/lib/cybersource_rest_client/models/tms_network_token_services.rb +239 -0
  48. data/lib/cybersource_rest_client/models/tms_network_token_services_american_express_token_service.rb +253 -0
  49. data/lib/cybersource_rest_client/models/tms_network_token_services_mastercard_digital_enablement_service.rb +227 -0
  50. data/lib/cybersource_rest_client/models/tms_network_token_services_notifications.rb +190 -0
  51. data/lib/cybersource_rest_client/models/tms_network_token_services_payment_credentials.rb +190 -0
  52. data/lib/cybersource_rest_client/models/tms_network_token_services_synchronous_provisioning.rb +190 -0
  53. data/lib/cybersource_rest_client/models/tms_network_token_services_visa_token_service.rb +244 -0
  54. data/lib/cybersource_rest_client/models/tms_nullify.rb +212 -0
  55. data/lib/cybersource_rest_client/models/tms_sensitive_privileges.rb +190 -0
  56. data/lib/cybersource_rest_client/models/tms_token_formats.rb +223 -0
  57. data/lib/cybersource_rest_client/models/tmsv2_tokenized_card.rb +321 -321
  58. data/lib/cybersource_rest_client/models/tmsv2_tokenized_card_card.rb +225 -225
  59. data/lib/cybersource_rest_client/models/tmsv2_tokenized_card_metadata.rb +189 -189
  60. data/lib/cybersource_rest_client/models/tmsv2_tokenized_card_metadata_card_art.rb +250 -250
  61. data/lib/cybersource_rest_client/models/tmsv2_tokenized_card_metadata_card_art_background_asset.rb +200 -200
  62. data/lib/cybersource_rest_client/models/tmsv2_tokenized_card_metadata_card_art_background_asset__links.rb +189 -189
  63. data/lib/cybersource_rest_client/models/tmsv2_tokenized_card_metadata_card_art_background_asset__links_self.rb +190 -190
  64. data/lib/cybersource_rest_client/models/tmsv2_tokenized_card_metadata_card_art_brand_logo_asset.rb +200 -200
  65. data/lib/cybersource_rest_client/models/tmsv2_tokenized_card_metadata_card_art_brand_logo_asset__links.rb +189 -189
  66. data/lib/cybersource_rest_client/models/tmsv2_tokenized_card_metadata_card_art_brand_logo_asset__links_self.rb +190 -190
  67. data/lib/cybersource_rest_client/models/tmsv2_tokenized_card_metadata_card_art_co_brand_logo_asset.rb +200 -200
  68. data/lib/cybersource_rest_client/models/tmsv2_tokenized_card_metadata_card_art_co_brand_logo_asset__links.rb +189 -189
  69. data/lib/cybersource_rest_client/models/tmsv2_tokenized_card_metadata_card_art_co_brand_logo_asset__links_self.rb +190 -190
  70. data/lib/cybersource_rest_client/models/tmsv2_tokenized_card_metadata_card_art_combined_asset.rb +200 -200
  71. data/lib/cybersource_rest_client/models/tmsv2_tokenized_card_metadata_card_art_combined_asset__links.rb +189 -189
  72. data/lib/cybersource_rest_client/models/tmsv2_tokenized_card_metadata_card_art_combined_asset__links_self.rb +190 -190
  73. data/lib/cybersource_rest_client/models/tmsv2_tokenized_card_metadata_card_art_icon_asset.rb +200 -200
  74. data/lib/cybersource_rest_client/models/tmsv2_tokenized_card_metadata_card_art_icon_asset__links.rb +189 -189
  75. data/lib/cybersource_rest_client/models/tmsv2_tokenized_card_metadata_card_art_icon_asset__links_self.rb +190 -190
  76. data/lib/cybersource_rest_client/models/tmsv2_tokenized_card_metadata_card_art_issuer_logo_asset.rb +200 -200
  77. data/lib/cybersource_rest_client/models/tmsv2_tokenized_card_metadata_card_art_issuer_logo_asset__links.rb +189 -189
  78. data/lib/cybersource_rest_client/models/tmsv2_tokenized_card_metadata_card_art_issuer_logo_asset__links_self.rb +190 -190
  79. data/lib/cybersource_rest_client/models/token_permissions.rb +223 -0
  80. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_processing_information.rb +326 -326
  81. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_processing_information_japan_payment_options.rb +322 -247
  82. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_processing_information.rb +241 -241
  83. data/lib/cybersource_rest_client.rb +13 -0
  84. metadata +16 -3
@@ -1,250 +1,250 @@
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 Tmsv2TokenizedCardMetadataCardArt
16
- attr_accessor :combined_asset
17
-
18
- attr_accessor :brand_logo_asset
19
-
20
- attr_accessor :co_brand_logo_asset
21
-
22
- attr_accessor :issuer_logo_asset
23
-
24
- attr_accessor :icon_asset
25
-
26
- # The foreground color of the brand logo asset.
27
- attr_accessor :foreground_color
28
-
29
- attr_accessor :background_asset
30
-
31
- # Attribute mapping from ruby-style variable name to JSON key.
32
- def self.attribute_map
33
- {
34
- :'combined_asset' => :'combinedAsset',
35
- :'brand_logo_asset' => :'brandLogoAsset',
36
- :'co_brand_logo_asset' => :'coBrandLogoAsset',
37
- :'issuer_logo_asset' => :'issuerLogoAsset',
38
- :'icon_asset' => :'iconAsset',
39
- :'foreground_color' => :'foregroundColor',
40
- :'background_asset' => :'backgroundAsset'
41
- }
42
- end
43
-
44
- # Attribute mapping from JSON key to ruby-style variable name.
45
- def self.json_map
46
- {
47
- :'combined_asset' => :'combined_asset',
48
- :'brand_logo_asset' => :'brand_logo_asset',
49
- :'co_brand_logo_asset' => :'co_brand_logo_asset',
50
- :'issuer_logo_asset' => :'issuer_logo_asset',
51
- :'icon_asset' => :'icon_asset',
52
- :'foreground_color' => :'foreground_color',
53
- :'background_asset' => :'background_asset'
54
- }
55
- end
56
-
57
- # Attribute type mapping.
58
- def self.swagger_types
59
- {
60
- :'combined_asset' => :'Tmsv2TokenizedCardMetadataCardArtCombinedAsset',
61
- :'brand_logo_asset' => :'Tmsv2TokenizedCardMetadataCardArtBrandLogoAsset',
62
- :'co_brand_logo_asset' => :'Tmsv2TokenizedCardMetadataCardArtCoBrandLogoAsset',
63
- :'issuer_logo_asset' => :'Tmsv2TokenizedCardMetadataCardArtIssuerLogoAsset',
64
- :'icon_asset' => :'Tmsv2TokenizedCardMetadataCardArtIconAsset',
65
- :'foreground_color' => :'String',
66
- :'background_asset' => :'Tmsv2TokenizedCardMetadataCardArtBackgroundAsset'
67
- }
68
- end
69
-
70
- # Initializes the object
71
- # @param [Hash] attributes Model attributes in the form of hash
72
- def initialize(attributes = {})
73
- return unless attributes.is_a?(Hash)
74
-
75
- # convert string to symbol for hash key
76
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
77
-
78
- if attributes.has_key?(:'combinedAsset')
79
- self.combined_asset = attributes[:'combinedAsset']
80
- end
81
-
82
- if attributes.has_key?(:'brandLogoAsset')
83
- self.brand_logo_asset = attributes[:'brandLogoAsset']
84
- end
85
-
86
- if attributes.has_key?(:'coBrandLogoAsset')
87
- self.co_brand_logo_asset = attributes[:'coBrandLogoAsset']
88
- end
89
-
90
- if attributes.has_key?(:'issuerLogoAsset')
91
- self.issuer_logo_asset = attributes[:'issuerLogoAsset']
92
- end
93
-
94
- if attributes.has_key?(:'iconAsset')
95
- self.icon_asset = attributes[:'iconAsset']
96
- end
97
-
98
- if attributes.has_key?(:'foregroundColor')
99
- self.foreground_color = attributes[:'foregroundColor']
100
- end
101
-
102
- if attributes.has_key?(:'backgroundAsset')
103
- self.background_asset = attributes[:'backgroundAsset']
104
- end
105
- end
106
-
107
- # Show invalid properties with the reasons. Usually used together with valid?
108
- # @return Array for valid properties with the reasons
109
- def list_invalid_properties
110
- invalid_properties = Array.new
111
- invalid_properties
112
- end
113
-
114
- # Check to see if the all the properties in the model are valid
115
- # @return true if the model is valid
116
- def valid?
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
- combined_asset == o.combined_asset &&
126
- brand_logo_asset == o.brand_logo_asset &&
127
- co_brand_logo_asset == o.co_brand_logo_asset &&
128
- issuer_logo_asset == o.issuer_logo_asset &&
129
- icon_asset == o.icon_asset &&
130
- foreground_color == o.foreground_color &&
131
- background_asset == o.background_asset
132
- end
133
-
134
- # @see the `==` method
135
- # @param [Object] Object to be compared
136
- def eql?(o)
137
- self == o
138
- end
139
-
140
- # Calculates hash code according to all attributes.
141
- # @return [Fixnum] Hash code
142
- def hash
143
- [combined_asset, brand_logo_asset, co_brand_logo_asset, issuer_logo_asset, icon_asset, foreground_color, background_asset].hash
144
- end
145
-
146
- # Builds the object from hash
147
- # @param [Hash] attributes Model attributes in the form of hash
148
- # @return [Object] Returns the model itself
149
- def build_from_hash(attributes)
150
- return nil unless attributes.is_a?(Hash)
151
- self.class.swagger_types.each_pair do |key, type|
152
- if type =~ /\AArray<(.*)>/i
153
- # check to ensure the input is an array given that the the attribute
154
- # is documented as an array but the input is not
155
- if attributes[self.class.attribute_map[key]].is_a?(Array)
156
- self.send("#{self.class.json_map[key]}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
157
- end
158
- elsif !attributes[self.class.attribute_map[key]].nil?
159
- self.send("#{self.class.json_map[key]}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
160
- end # or else data not found in attributes(hash), not an issue as the data can be optional
161
- end
162
-
163
- self
164
- end
165
-
166
- # Deserializes the data based on type
167
- # @param string type Data type
168
- # @param string value Value to be deserialized
169
- # @return [Object] Deserialized data
170
- def _deserialize(type, value)
171
- case type.to_sym
172
- when :DateTime
173
- DateTime.parse(value)
174
- when :Date
175
- Date.parse(value)
176
- when :String
177
- value.to_s
178
- when :Integer
179
- value.to_i
180
- when :Float
181
- value.to_f
182
- when :BOOLEAN
183
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
184
- true
185
- else
186
- false
187
- end
188
- when :Object
189
- # generic object (usually a Hash), return directly
190
- value
191
- when /\AArray<(?<inner_type>.+)>\z/
192
- inner_type = Regexp.last_match[:inner_type]
193
- value.map { |v| _deserialize(inner_type, v) }
194
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
195
- k_type = Regexp.last_match[:k_type]
196
- v_type = Regexp.last_match[:v_type]
197
- {}.tap do |hash|
198
- value.each do |k, v|
199
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
200
- end
201
- end
202
- else # model
203
- temp_model = CyberSource.const_get(type).new
204
- temp_model.build_from_hash(value)
205
- end
206
- end
207
-
208
- # Returns the string representation of the object
209
- # @return [String] String presentation of the object
210
- def to_s
211
- to_hash.to_s
212
- end
213
-
214
- # to_body is an alias to to_hash (backward compatibility)
215
- # @return [Hash] Returns the object in the form of hash
216
- def to_body
217
- to_hash
218
- end
219
-
220
- # Returns the object in the form of hash
221
- # @return [Hash] Returns the object in the form of hash
222
- def to_hash
223
- hash = {}
224
- self.class.attribute_map.each_pair do |attr, param|
225
- value = self.send(attr)
226
- next if value.nil?
227
- hash[param] = _to_hash(value)
228
- end
229
- hash
230
- end
231
-
232
- # Outputs non-array value in the form of hash
233
- # For object, use to_hash. Otherwise, just return the value
234
- # @param [Object] value Any valid value
235
- # @return [Hash] Returns the value in the form of hash
236
- def _to_hash(value)
237
- if value.is_a?(Array)
238
- value.compact.map { |v| _to_hash(v) }
239
- elsif value.is_a?(Hash)
240
- {}.tap do |hash|
241
- value.each { |k, v| hash[k] = _to_hash(v) }
242
- end
243
- elsif value.respond_to? :to_hash
244
- value.to_hash
245
- else
246
- value
247
- end
248
- end
249
- end
250
- 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 Tmsv2TokenizedCardMetadataCardArt
16
+ attr_accessor :combined_asset
17
+
18
+ attr_accessor :brand_logo_asset
19
+
20
+ attr_accessor :co_brand_logo_asset
21
+
22
+ attr_accessor :issuer_logo_asset
23
+
24
+ attr_accessor :icon_asset
25
+
26
+ # The foreground color of the brand logo asset.
27
+ attr_accessor :foreground_color
28
+
29
+ attr_accessor :background_asset
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'combined_asset' => :'combinedAsset',
35
+ :'brand_logo_asset' => :'brandLogoAsset',
36
+ :'co_brand_logo_asset' => :'coBrandLogoAsset',
37
+ :'issuer_logo_asset' => :'issuerLogoAsset',
38
+ :'icon_asset' => :'iconAsset',
39
+ :'foreground_color' => :'foregroundColor',
40
+ :'background_asset' => :'backgroundAsset'
41
+ }
42
+ end
43
+
44
+ # Attribute mapping from JSON key to ruby-style variable name.
45
+ def self.json_map
46
+ {
47
+ :'combined_asset' => :'combined_asset',
48
+ :'brand_logo_asset' => :'brand_logo_asset',
49
+ :'co_brand_logo_asset' => :'co_brand_logo_asset',
50
+ :'issuer_logo_asset' => :'issuer_logo_asset',
51
+ :'icon_asset' => :'icon_asset',
52
+ :'foreground_color' => :'foreground_color',
53
+ :'background_asset' => :'background_asset'
54
+ }
55
+ end
56
+
57
+ # Attribute type mapping.
58
+ def self.swagger_types
59
+ {
60
+ :'combined_asset' => :'Tmsv2TokenizedCardMetadataCardArtCombinedAsset',
61
+ :'brand_logo_asset' => :'Tmsv2TokenizedCardMetadataCardArtBrandLogoAsset',
62
+ :'co_brand_logo_asset' => :'Tmsv2TokenizedCardMetadataCardArtCoBrandLogoAsset',
63
+ :'issuer_logo_asset' => :'Tmsv2TokenizedCardMetadataCardArtIssuerLogoAsset',
64
+ :'icon_asset' => :'Tmsv2TokenizedCardMetadataCardArtIconAsset',
65
+ :'foreground_color' => :'String',
66
+ :'background_asset' => :'Tmsv2TokenizedCardMetadataCardArtBackgroundAsset'
67
+ }
68
+ end
69
+
70
+ # Initializes the object
71
+ # @param [Hash] attributes Model attributes in the form of hash
72
+ def initialize(attributes = {})
73
+ return unless attributes.is_a?(Hash)
74
+
75
+ # convert string to symbol for hash key
76
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
77
+
78
+ if attributes.has_key?(:'combinedAsset')
79
+ self.combined_asset = attributes[:'combinedAsset']
80
+ end
81
+
82
+ if attributes.has_key?(:'brandLogoAsset')
83
+ self.brand_logo_asset = attributes[:'brandLogoAsset']
84
+ end
85
+
86
+ if attributes.has_key?(:'coBrandLogoAsset')
87
+ self.co_brand_logo_asset = attributes[:'coBrandLogoAsset']
88
+ end
89
+
90
+ if attributes.has_key?(:'issuerLogoAsset')
91
+ self.issuer_logo_asset = attributes[:'issuerLogoAsset']
92
+ end
93
+
94
+ if attributes.has_key?(:'iconAsset')
95
+ self.icon_asset = attributes[:'iconAsset']
96
+ end
97
+
98
+ if attributes.has_key?(:'foregroundColor')
99
+ self.foreground_color = attributes[:'foregroundColor']
100
+ end
101
+
102
+ if attributes.has_key?(:'backgroundAsset')
103
+ self.background_asset = attributes[:'backgroundAsset']
104
+ end
105
+ end
106
+
107
+ # Show invalid properties with the reasons. Usually used together with valid?
108
+ # @return Array for valid properties with the reasons
109
+ def list_invalid_properties
110
+ invalid_properties = Array.new
111
+ invalid_properties
112
+ end
113
+
114
+ # Check to see if the all the properties in the model are valid
115
+ # @return true if the model is valid
116
+ def valid?
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
+ combined_asset == o.combined_asset &&
126
+ brand_logo_asset == o.brand_logo_asset &&
127
+ co_brand_logo_asset == o.co_brand_logo_asset &&
128
+ issuer_logo_asset == o.issuer_logo_asset &&
129
+ icon_asset == o.icon_asset &&
130
+ foreground_color == o.foreground_color &&
131
+ background_asset == o.background_asset
132
+ end
133
+
134
+ # @see the `==` method
135
+ # @param [Object] Object to be compared
136
+ def eql?(o)
137
+ self == o
138
+ end
139
+
140
+ # Calculates hash code according to all attributes.
141
+ # @return [Fixnum] Hash code
142
+ def hash
143
+ [combined_asset, brand_logo_asset, co_brand_logo_asset, issuer_logo_asset, icon_asset, foreground_color, background_asset].hash
144
+ end
145
+
146
+ # Builds the object from hash
147
+ # @param [Hash] attributes Model attributes in the form of hash
148
+ # @return [Object] Returns the model itself
149
+ def build_from_hash(attributes)
150
+ return nil unless attributes.is_a?(Hash)
151
+ self.class.swagger_types.each_pair do |key, type|
152
+ if type =~ /\AArray<(.*)>/i
153
+ # check to ensure the input is an array given that the the attribute
154
+ # is documented as an array but the input is not
155
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
156
+ self.send("#{self.class.json_map[key]}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
157
+ end
158
+ elsif !attributes[self.class.attribute_map[key]].nil?
159
+ self.send("#{self.class.json_map[key]}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
160
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
161
+ end
162
+
163
+ self
164
+ end
165
+
166
+ # Deserializes the data based on type
167
+ # @param string type Data type
168
+ # @param string value Value to be deserialized
169
+ # @return [Object] Deserialized data
170
+ def _deserialize(type, value)
171
+ case type.to_sym
172
+ when :DateTime
173
+ DateTime.parse(value)
174
+ when :Date
175
+ Date.parse(value)
176
+ when :String
177
+ value.to_s
178
+ when :Integer
179
+ value.to_i
180
+ when :Float
181
+ value.to_f
182
+ when :BOOLEAN
183
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
184
+ true
185
+ else
186
+ false
187
+ end
188
+ when :Object
189
+ # generic object (usually a Hash), return directly
190
+ value
191
+ when /\AArray<(?<inner_type>.+)>\z/
192
+ inner_type = Regexp.last_match[:inner_type]
193
+ value.map { |v| _deserialize(inner_type, v) }
194
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
195
+ k_type = Regexp.last_match[:k_type]
196
+ v_type = Regexp.last_match[:v_type]
197
+ {}.tap do |hash|
198
+ value.each do |k, v|
199
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
200
+ end
201
+ end
202
+ else # model
203
+ temp_model = CyberSource.const_get(type).new
204
+ temp_model.build_from_hash(value)
205
+ end
206
+ end
207
+
208
+ # Returns the string representation of the object
209
+ # @return [String] String presentation of the object
210
+ def to_s
211
+ to_hash.to_s
212
+ end
213
+
214
+ # to_body is an alias to to_hash (backward compatibility)
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_body
217
+ to_hash
218
+ end
219
+
220
+ # Returns the object in the form of hash
221
+ # @return [Hash] Returns the object in the form of hash
222
+ def to_hash
223
+ hash = {}
224
+ self.class.attribute_map.each_pair do |attr, param|
225
+ value = self.send(attr)
226
+ next if value.nil?
227
+ hash[param] = _to_hash(value)
228
+ end
229
+ hash
230
+ end
231
+
232
+ # Outputs non-array value in the form of hash
233
+ # For object, use to_hash. Otherwise, just return the value
234
+ # @param [Object] value Any valid value
235
+ # @return [Hash] Returns the value in the form of hash
236
+ def _to_hash(value)
237
+ if value.is_a?(Array)
238
+ value.compact.map { |v| _to_hash(v) }
239
+ elsif value.is_a?(Hash)
240
+ {}.tap do |hash|
241
+ value.each { |k, v| hash[k] = _to_hash(v) }
242
+ end
243
+ elsif value.respond_to? :to_hash
244
+ value.to_hash
245
+ else
246
+ value
247
+ end
248
+ end
249
+ end
250
+ end