cybersource_rest_client 0.0.46 → 0.0.47

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 (30) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cybersource_rest_client/api/emv_tag_details_api.rb +152 -0
  3. data/lib/cybersource_rest_client/api/transient_token_data_api.rb +92 -0
  4. data/lib/cybersource_rest_client/api/unified_checkout_capture_context_api.rb +88 -0
  5. data/lib/cybersource_rest_client/models/body.rb +216 -0
  6. data/lib/cybersource_rest_client/models/generate_unified_checkout_capture_context_request.rb +276 -0
  7. data/lib/cybersource_rest_client/models/inline_response_400_3.rb +265 -0
  8. data/lib/cybersource_rest_client/models/inline_response_400_3_details.rb +192 -0
  9. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_consumer_authentication_information_issuer_information.rb +52 -4
  10. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_issuer_information.rb +4 -20
  11. data/lib/cybersource_rest_client/models/pts_v2_payouts_post201_response.rb +13 -4
  12. data/lib/cybersource_rest_client/models/pts_v2_payouts_post201_response_issuer_information.rb +190 -0
  13. data/lib/cybersource_rest_client/models/ptsv2payments_point_of_sale_information.rb +1 -1
  14. data/lib/cybersource_rest_client/models/ptsv2payments_processing_information_authorization_options.rb +1 -1
  15. data/lib/cybersource_rest_client/models/ptsv2payments_recurring_payment_information.rb +100 -4
  16. data/lib/cybersource_rest_client/models/tss_v2_get_emv_tags200_response.rb +186 -0
  17. data/lib/cybersource_rest_client/models/tss_v2_get_emv_tags200_response_emv_tag_breakdown_list.rb +215 -0
  18. data/lib/cybersource_rest_client/models/tss_v2_post_emv_tags200_response.rb +186 -0
  19. data/lib/cybersource_rest_client/models/tss_v2_post_emv_tags200_response_emv_tag_breakdown_list.rb +266 -0
  20. data/lib/cybersource_rest_client/models/tss_v2_post_emv_tags200_response_parsed_emv_tags_list.rb +212 -0
  21. data/lib/cybersource_rest_client/models/tssv2transactionsemv_tag_details_emv_details_list.rb +224 -0
  22. data/lib/cybersource_rest_client/models/upv1capturecontexts_capture_mandate.rb +242 -0
  23. data/lib/cybersource_rest_client/models/upv1capturecontexts_checkout_api_initialization.rb +264 -0
  24. data/lib/cybersource_rest_client/models/upv1capturecontexts_order_information.rb +201 -0
  25. data/lib/cybersource_rest_client/models/upv1capturecontexts_order_information_amount_details.rb +192 -0
  26. data/lib/cybersource_rest_client/models/upv1capturecontexts_order_information_bill_to.rb +459 -0
  27. data/lib/cybersource_rest_client/models/upv1capturecontexts_order_information_bill_to_company.rb +350 -0
  28. data/lib/cybersource_rest_client/models/upv1capturecontexts_order_information_ship_to.rb +354 -0
  29. data/lib/cybersource_rest_client.rb +21 -0
  30. metadata +45 -24
@@ -0,0 +1,264 @@
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.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CyberSource
16
+ class Upv1capturecontextsCheckoutApiInitialization
17
+ attr_accessor :profile_id
18
+
19
+ attr_accessor :access_key
20
+
21
+ attr_accessor :reference_number
22
+
23
+ attr_accessor :transaction_uuid
24
+
25
+ attr_accessor :transaction_type
26
+
27
+ attr_accessor :currency
28
+
29
+ attr_accessor :amount
30
+
31
+ attr_accessor :locale
32
+
33
+ attr_accessor :override_custom_receipt_page
34
+
35
+ attr_accessor :unsigned_field_names
36
+
37
+ # Attribute mapping from ruby-style variable name to JSON key.
38
+ def self.attribute_map
39
+ {
40
+ :'profile_id' => :'profile_id',
41
+ :'access_key' => :'access_key',
42
+ :'reference_number' => :'reference_number',
43
+ :'transaction_uuid' => :'transaction_uuid',
44
+ :'transaction_type' => :'transaction_type',
45
+ :'currency' => :'currency',
46
+ :'amount' => :'amount',
47
+ :'locale' => :'locale',
48
+ :'override_custom_receipt_page' => :'override_custom_receipt_page',
49
+ :'unsigned_field_names' => :'unsigned_field_names'
50
+ }
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.swagger_types
55
+ {
56
+ :'profile_id' => :'String',
57
+ :'access_key' => :'String',
58
+ :'reference_number' => :'String',
59
+ :'transaction_uuid' => :'String',
60
+ :'transaction_type' => :'String',
61
+ :'currency' => :'String',
62
+ :'amount' => :'String',
63
+ :'locale' => :'String',
64
+ :'override_custom_receipt_page' => :'String',
65
+ :'unsigned_field_names' => :'String'
66
+ }
67
+ end
68
+
69
+ # Initializes the object
70
+ # @param [Hash] attributes Model attributes in the form of hash
71
+ def initialize(attributes = {})
72
+ return unless attributes.is_a?(Hash)
73
+
74
+ # convert string to symbol for hash key
75
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
76
+
77
+ if attributes.has_key?(:'profile_id')
78
+ self.profile_id = attributes[:'profile_id']
79
+ end
80
+
81
+ if attributes.has_key?(:'access_key')
82
+ self.access_key = attributes[:'access_key']
83
+ end
84
+
85
+ if attributes.has_key?(:'reference_number')
86
+ self.reference_number = attributes[:'reference_number']
87
+ end
88
+
89
+ if attributes.has_key?(:'transaction_uuid')
90
+ self.transaction_uuid = attributes[:'transaction_uuid']
91
+ end
92
+
93
+ if attributes.has_key?(:'transaction_type')
94
+ self.transaction_type = attributes[:'transaction_type']
95
+ end
96
+
97
+ if attributes.has_key?(:'currency')
98
+ self.currency = attributes[:'currency']
99
+ end
100
+
101
+ if attributes.has_key?(:'amount')
102
+ self.amount = attributes[:'amount']
103
+ end
104
+
105
+ if attributes.has_key?(:'locale')
106
+ self.locale = attributes[:'locale']
107
+ end
108
+
109
+ if attributes.has_key?(:'override_custom_receipt_page')
110
+ self.override_custom_receipt_page = attributes[:'override_custom_receipt_page']
111
+ end
112
+
113
+ if attributes.has_key?(:'unsigned_field_names')
114
+ self.unsigned_field_names = attributes[:'unsigned_field_names']
115
+ end
116
+ end
117
+
118
+ # Show invalid properties with the reasons. Usually used together with valid?
119
+ # @return Array for valid properties with the reasons
120
+ def list_invalid_properties
121
+ invalid_properties = Array.new
122
+ invalid_properties
123
+ end
124
+
125
+ # Check to see if the all the properties in the model are valid
126
+ # @return true if the model is valid
127
+ def valid?
128
+ true
129
+ end
130
+
131
+ # Checks equality by comparing each attribute.
132
+ # @param [Object] Object to be compared
133
+ def ==(o)
134
+ return true if self.equal?(o)
135
+ self.class == o.class &&
136
+ profile_id == o.profile_id &&
137
+ access_key == o.access_key &&
138
+ reference_number == o.reference_number &&
139
+ transaction_uuid == o.transaction_uuid &&
140
+ transaction_type == o.transaction_type &&
141
+ currency == o.currency &&
142
+ amount == o.amount &&
143
+ locale == o.locale &&
144
+ override_custom_receipt_page == o.override_custom_receipt_page &&
145
+ unsigned_field_names == o.unsigned_field_names
146
+ end
147
+
148
+ # @see the `==` method
149
+ # @param [Object] Object to be compared
150
+ def eql?(o)
151
+ self == o
152
+ end
153
+
154
+ # Calculates hash code according to all attributes.
155
+ # @return [Fixnum] Hash code
156
+ def hash
157
+ [profile_id, access_key, reference_number, transaction_uuid, transaction_type, currency, amount, locale, override_custom_receipt_page, unsigned_field_names].hash
158
+ end
159
+
160
+ # Builds the object from hash
161
+ # @param [Hash] attributes Model attributes in the form of hash
162
+ # @return [Object] Returns the model itself
163
+ def build_from_hash(attributes)
164
+ return nil unless attributes.is_a?(Hash)
165
+ self.class.swagger_types.each_pair do |key, type|
166
+ if type =~ /\AArray<(.*)>/i
167
+ # check to ensure the input is an array given that the the attribute
168
+ # is documented as an array but the input is not
169
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
170
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
171
+ end
172
+ elsif !attributes[self.class.attribute_map[key]].nil?
173
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
174
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
175
+ end
176
+
177
+ self
178
+ end
179
+
180
+ # Deserializes the data based on type
181
+ # @param string type Data type
182
+ # @param string value Value to be deserialized
183
+ # @return [Object] Deserialized data
184
+ def _deserialize(type, value)
185
+ case type.to_sym
186
+ when :DateTime
187
+ DateTime.parse(value)
188
+ when :Date
189
+ Date.parse(value)
190
+ when :String
191
+ value.to_s
192
+ when :Integer
193
+ value.to_i
194
+ when :Float
195
+ value.to_f
196
+ when :BOOLEAN
197
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
198
+ true
199
+ else
200
+ false
201
+ end
202
+ when :Object
203
+ # generic object (usually a Hash), return directly
204
+ value
205
+ when /\AArray<(?<inner_type>.+)>\z/
206
+ inner_type = Regexp.last_match[:inner_type]
207
+ value.map { |v| _deserialize(inner_type, v) }
208
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
209
+ k_type = Regexp.last_match[:k_type]
210
+ v_type = Regexp.last_match[:v_type]
211
+ {}.tap do |hash|
212
+ value.each do |k, v|
213
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
214
+ end
215
+ end
216
+ else # model
217
+ temp_model = CyberSource.const_get(type).new
218
+ temp_model.build_from_hash(value)
219
+ end
220
+ end
221
+
222
+ # Returns the string representation of the object
223
+ # @return [String] String presentation of the object
224
+ def to_s
225
+ to_hash.to_s
226
+ end
227
+
228
+ # to_body is an alias to to_hash (backward compatibility)
229
+ # @return [Hash] Returns the object in the form of hash
230
+ def to_body
231
+ to_hash
232
+ end
233
+
234
+ # Returns the object in the form of hash
235
+ # @return [Hash] Returns the object in the form of hash
236
+ def to_hash
237
+ hash = {}
238
+ self.class.attribute_map.each_pair do |attr, param|
239
+ value = self.send(attr)
240
+ next if value.nil?
241
+ hash[param] = _to_hash(value)
242
+ end
243
+ hash
244
+ end
245
+
246
+ # Outputs non-array value in the form of hash
247
+ # For object, use to_hash. Otherwise, just return the value
248
+ # @param [Object] value Any valid value
249
+ # @return [Hash] Returns the value in the form of hash
250
+ def _to_hash(value)
251
+ if value.is_a?(Array)
252
+ value.compact.map { |v| _to_hash(v) }
253
+ elsif value.is_a?(Hash)
254
+ {}.tap do |hash|
255
+ value.each { |k, v| hash[k] = _to_hash(v) }
256
+ end
257
+ elsif value.respond_to? :to_hash
258
+ value.to_hash
259
+ else
260
+ value
261
+ end
262
+ end
263
+ end
264
+ end
@@ -0,0 +1,201 @@
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.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CyberSource
16
+ class Upv1capturecontextsOrderInformation
17
+ attr_accessor :amount_details
18
+
19
+ attr_accessor :bill_to
20
+
21
+ attr_accessor :ship_to
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'amount_details' => :'amountDetails',
27
+ :'bill_to' => :'billTo',
28
+ :'ship_to' => :'shipTo'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ :'amount_details' => :'Upv1capturecontextsOrderInformationAmountDetails',
36
+ :'bill_to' => :'Upv1capturecontextsOrderInformationBillTo',
37
+ :'ship_to' => :'Upv1capturecontextsOrderInformationShipTo'
38
+ }
39
+ end
40
+
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ def initialize(attributes = {})
44
+ return unless attributes.is_a?(Hash)
45
+
46
+ # convert string to symbol for hash key
47
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
48
+
49
+ if attributes.has_key?(:'amountDetails')
50
+ self.amount_details = attributes[:'amountDetails']
51
+ end
52
+
53
+ if attributes.has_key?(:'billTo')
54
+ self.bill_to = attributes[:'billTo']
55
+ end
56
+
57
+ if attributes.has_key?(:'shipTo')
58
+ self.ship_to = attributes[:'shipTo']
59
+ end
60
+ end
61
+
62
+ # Show invalid properties with the reasons. Usually used together with valid?
63
+ # @return Array for valid properties with the reasons
64
+ def list_invalid_properties
65
+ invalid_properties = Array.new
66
+ invalid_properties
67
+ end
68
+
69
+ # Check to see if the all the properties in the model are valid
70
+ # @return true if the model is valid
71
+ def valid?
72
+ true
73
+ end
74
+
75
+ # Checks equality by comparing each attribute.
76
+ # @param [Object] Object to be compared
77
+ def ==(o)
78
+ return true if self.equal?(o)
79
+ self.class == o.class &&
80
+ amount_details == o.amount_details &&
81
+ bill_to == o.bill_to &&
82
+ ship_to == o.ship_to
83
+ end
84
+
85
+ # @see the `==` method
86
+ # @param [Object] Object to be compared
87
+ def eql?(o)
88
+ self == o
89
+ end
90
+
91
+ # Calculates hash code according to all attributes.
92
+ # @return [Fixnum] Hash code
93
+ def hash
94
+ [amount_details, bill_to, ship_to].hash
95
+ end
96
+
97
+ # Builds the object from hash
98
+ # @param [Hash] attributes Model attributes in the form of hash
99
+ # @return [Object] Returns the model itself
100
+ def build_from_hash(attributes)
101
+ return nil unless attributes.is_a?(Hash)
102
+ self.class.swagger_types.each_pair do |key, type|
103
+ if type =~ /\AArray<(.*)>/i
104
+ # check to ensure the input is an array given that the the attribute
105
+ # is documented as an array but the input is not
106
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
107
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
108
+ end
109
+ elsif !attributes[self.class.attribute_map[key]].nil?
110
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
111
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
112
+ end
113
+
114
+ self
115
+ end
116
+
117
+ # Deserializes the data based on type
118
+ # @param string type Data type
119
+ # @param string value Value to be deserialized
120
+ # @return [Object] Deserialized data
121
+ def _deserialize(type, value)
122
+ case type.to_sym
123
+ when :DateTime
124
+ DateTime.parse(value)
125
+ when :Date
126
+ Date.parse(value)
127
+ when :String
128
+ value.to_s
129
+ when :Integer
130
+ value.to_i
131
+ when :Float
132
+ value.to_f
133
+ when :BOOLEAN
134
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
135
+ true
136
+ else
137
+ false
138
+ end
139
+ when :Object
140
+ # generic object (usually a Hash), return directly
141
+ value
142
+ when /\AArray<(?<inner_type>.+)>\z/
143
+ inner_type = Regexp.last_match[:inner_type]
144
+ value.map { |v| _deserialize(inner_type, v) }
145
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
146
+ k_type = Regexp.last_match[:k_type]
147
+ v_type = Regexp.last_match[:v_type]
148
+ {}.tap do |hash|
149
+ value.each do |k, v|
150
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
151
+ end
152
+ end
153
+ else # model
154
+ temp_model = CyberSource.const_get(type).new
155
+ temp_model.build_from_hash(value)
156
+ end
157
+ end
158
+
159
+ # Returns the string representation of the object
160
+ # @return [String] String presentation of the object
161
+ def to_s
162
+ to_hash.to_s
163
+ end
164
+
165
+ # to_body is an alias to to_hash (backward compatibility)
166
+ # @return [Hash] Returns the object in the form of hash
167
+ def to_body
168
+ to_hash
169
+ end
170
+
171
+ # Returns the object in the form of hash
172
+ # @return [Hash] Returns the object in the form of hash
173
+ def to_hash
174
+ hash = {}
175
+ self.class.attribute_map.each_pair do |attr, param|
176
+ value = self.send(attr)
177
+ next if value.nil?
178
+ hash[param] = _to_hash(value)
179
+ end
180
+ hash
181
+ end
182
+
183
+ # Outputs non-array value in the form of hash
184
+ # For object, use to_hash. Otherwise, just return the value
185
+ # @param [Object] value Any valid value
186
+ # @return [Hash] Returns the value in the form of hash
187
+ def _to_hash(value)
188
+ if value.is_a?(Array)
189
+ value.compact.map { |v| _to_hash(v) }
190
+ elsif value.is_a?(Hash)
191
+ {}.tap do |hash|
192
+ value.each { |k, v| hash[k] = _to_hash(v) }
193
+ end
194
+ elsif value.respond_to? :to_hash
195
+ value.to_hash
196
+ else
197
+ value
198
+ end
199
+ end
200
+ end
201
+ end
@@ -0,0 +1,192 @@
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.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CyberSource
16
+ class Upv1capturecontextsOrderInformationAmountDetails
17
+ attr_accessor :total_amount
18
+
19
+ attr_accessor :currency
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'total_amount' => :'totalAmount',
25
+ :'currency' => :'currency'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.swagger_types
31
+ {
32
+ :'total_amount' => :'String',
33
+ :'currency' => :'String'
34
+ }
35
+ end
36
+
37
+ # Initializes the object
38
+ # @param [Hash] attributes Model attributes in the form of hash
39
+ def initialize(attributes = {})
40
+ return unless attributes.is_a?(Hash)
41
+
42
+ # convert string to symbol for hash key
43
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
44
+
45
+ if attributes.has_key?(:'totalAmount')
46
+ self.total_amount = attributes[:'totalAmount']
47
+ end
48
+
49
+ if attributes.has_key?(:'currency')
50
+ self.currency = attributes[:'currency']
51
+ end
52
+ end
53
+
54
+ # Show invalid properties with the reasons. Usually used together with valid?
55
+ # @return Array for valid properties with the reasons
56
+ def list_invalid_properties
57
+ invalid_properties = Array.new
58
+ invalid_properties
59
+ end
60
+
61
+ # Check to see if the all the properties in the model are valid
62
+ # @return true if the model is valid
63
+ def valid?
64
+ true
65
+ end
66
+
67
+ # Checks equality by comparing each attribute.
68
+ # @param [Object] Object to be compared
69
+ def ==(o)
70
+ return true if self.equal?(o)
71
+ self.class == o.class &&
72
+ total_amount == o.total_amount &&
73
+ currency == o.currency
74
+ end
75
+
76
+ # @see the `==` method
77
+ # @param [Object] Object to be compared
78
+ def eql?(o)
79
+ self == o
80
+ end
81
+
82
+ # Calculates hash code according to all attributes.
83
+ # @return [Fixnum] Hash code
84
+ def hash
85
+ [total_amount, currency].hash
86
+ end
87
+
88
+ # Builds the object from hash
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ # @return [Object] Returns the model itself
91
+ def build_from_hash(attributes)
92
+ return nil unless attributes.is_a?(Hash)
93
+ self.class.swagger_types.each_pair do |key, type|
94
+ if type =~ /\AArray<(.*)>/i
95
+ # check to ensure the input is an array given that the the attribute
96
+ # is documented as an array but the input is not
97
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
98
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
99
+ end
100
+ elsif !attributes[self.class.attribute_map[key]].nil?
101
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
102
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
103
+ end
104
+
105
+ self
106
+ end
107
+
108
+ # Deserializes the data based on type
109
+ # @param string type Data type
110
+ # @param string value Value to be deserialized
111
+ # @return [Object] Deserialized data
112
+ def _deserialize(type, value)
113
+ case type.to_sym
114
+ when :DateTime
115
+ DateTime.parse(value)
116
+ when :Date
117
+ Date.parse(value)
118
+ when :String
119
+ value.to_s
120
+ when :Integer
121
+ value.to_i
122
+ when :Float
123
+ value.to_f
124
+ when :BOOLEAN
125
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
126
+ true
127
+ else
128
+ false
129
+ end
130
+ when :Object
131
+ # generic object (usually a Hash), return directly
132
+ value
133
+ when /\AArray<(?<inner_type>.+)>\z/
134
+ inner_type = Regexp.last_match[:inner_type]
135
+ value.map { |v| _deserialize(inner_type, v) }
136
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
137
+ k_type = Regexp.last_match[:k_type]
138
+ v_type = Regexp.last_match[:v_type]
139
+ {}.tap do |hash|
140
+ value.each do |k, v|
141
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
142
+ end
143
+ end
144
+ else # model
145
+ temp_model = CyberSource.const_get(type).new
146
+ temp_model.build_from_hash(value)
147
+ end
148
+ end
149
+
150
+ # Returns the string representation of the object
151
+ # @return [String] String presentation of the object
152
+ def to_s
153
+ to_hash.to_s
154
+ end
155
+
156
+ # to_body is an alias to to_hash (backward compatibility)
157
+ # @return [Hash] Returns the object in the form of hash
158
+ def to_body
159
+ to_hash
160
+ end
161
+
162
+ # Returns the object in the form of hash
163
+ # @return [Hash] Returns the object in the form of hash
164
+ def to_hash
165
+ hash = {}
166
+ self.class.attribute_map.each_pair do |attr, param|
167
+ value = self.send(attr)
168
+ next if value.nil?
169
+ hash[param] = _to_hash(value)
170
+ end
171
+ hash
172
+ end
173
+
174
+ # Outputs non-array value in the form of hash
175
+ # For object, use to_hash. Otherwise, just return the value
176
+ # @param [Object] value Any valid value
177
+ # @return [Hash] Returns the value in the form of hash
178
+ def _to_hash(value)
179
+ if value.is_a?(Array)
180
+ value.compact.map { |v| _to_hash(v) }
181
+ elsif value.is_a?(Hash)
182
+ {}.tap do |hash|
183
+ value.each { |k, v| hash[k] = _to_hash(v) }
184
+ end
185
+ elsif value.respond_to? :to_hash
186
+ value.to_hash
187
+ else
188
+ value
189
+ end
190
+ end
191
+ end
192
+ end