cybersource_rest_client 0.0.46 → 0.0.47

Sign up to get free protection for your applications and to get access to all the features.
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,186 @@
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 TssV2PostEmvTags200Response
17
+ # An array of objects (one per object in the passed emvDetailsList), each of which contains a fully parsed EMV string
18
+ attr_accessor :parsed_emv_tags_list
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'parsed_emv_tags_list' => :'parsedEMVTagsList'
24
+ }
25
+ end
26
+
27
+ # Attribute type mapping.
28
+ def self.swagger_types
29
+ {
30
+ :'parsed_emv_tags_list' => :'Array<TssV2PostEmvTags200ResponseParsedEMVTagsList>'
31
+ }
32
+ end
33
+
34
+ # Initializes the object
35
+ # @param [Hash] attributes Model attributes in the form of hash
36
+ def initialize(attributes = {})
37
+ return unless attributes.is_a?(Hash)
38
+
39
+ # convert string to symbol for hash key
40
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
41
+
42
+ if attributes.has_key?(:'parsedEMVTagsList')
43
+ if (value = attributes[:'parsedEMVTagsList']).is_a?(Array)
44
+ self.parsed_emv_tags_list = value
45
+ end
46
+ end
47
+ end
48
+
49
+ # Show invalid properties with the reasons. Usually used together with valid?
50
+ # @return Array for valid properties with the reasons
51
+ def list_invalid_properties
52
+ invalid_properties = Array.new
53
+ invalid_properties
54
+ end
55
+
56
+ # Check to see if the all the properties in the model are valid
57
+ # @return true if the model is valid
58
+ def valid?
59
+ true
60
+ end
61
+
62
+ # Checks equality by comparing each attribute.
63
+ # @param [Object] Object to be compared
64
+ def ==(o)
65
+ return true if self.equal?(o)
66
+ self.class == o.class &&
67
+ parsed_emv_tags_list == o.parsed_emv_tags_list
68
+ end
69
+
70
+ # @see the `==` method
71
+ # @param [Object] Object to be compared
72
+ def eql?(o)
73
+ self == o
74
+ end
75
+
76
+ # Calculates hash code according to all attributes.
77
+ # @return [Fixnum] Hash code
78
+ def hash
79
+ [parsed_emv_tags_list].hash
80
+ end
81
+
82
+ # Builds the object from hash
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ # @return [Object] Returns the model itself
85
+ def build_from_hash(attributes)
86
+ return nil unless attributes.is_a?(Hash)
87
+ self.class.swagger_types.each_pair do |key, type|
88
+ if type =~ /\AArray<(.*)>/i
89
+ # check to ensure the input is an array given that the the attribute
90
+ # is documented as an array but the input is not
91
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
92
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
93
+ end
94
+ elsif !attributes[self.class.attribute_map[key]].nil?
95
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
96
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
97
+ end
98
+
99
+ self
100
+ end
101
+
102
+ # Deserializes the data based on type
103
+ # @param string type Data type
104
+ # @param string value Value to be deserialized
105
+ # @return [Object] Deserialized data
106
+ def _deserialize(type, value)
107
+ case type.to_sym
108
+ when :DateTime
109
+ DateTime.parse(value)
110
+ when :Date
111
+ Date.parse(value)
112
+ when :String
113
+ value.to_s
114
+ when :Integer
115
+ value.to_i
116
+ when :Float
117
+ value.to_f
118
+ when :BOOLEAN
119
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
120
+ true
121
+ else
122
+ false
123
+ end
124
+ when :Object
125
+ # generic object (usually a Hash), return directly
126
+ value
127
+ when /\AArray<(?<inner_type>.+)>\z/
128
+ inner_type = Regexp.last_match[:inner_type]
129
+ value.map { |v| _deserialize(inner_type, v) }
130
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
131
+ k_type = Regexp.last_match[:k_type]
132
+ v_type = Regexp.last_match[:v_type]
133
+ {}.tap do |hash|
134
+ value.each do |k, v|
135
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
136
+ end
137
+ end
138
+ else # model
139
+ temp_model = CyberSource.const_get(type).new
140
+ temp_model.build_from_hash(value)
141
+ end
142
+ end
143
+
144
+ # Returns the string representation of the object
145
+ # @return [String] String presentation of the object
146
+ def to_s
147
+ to_hash.to_s
148
+ end
149
+
150
+ # to_body is an alias to to_hash (backward compatibility)
151
+ # @return [Hash] Returns the object in the form of hash
152
+ def to_body
153
+ to_hash
154
+ end
155
+
156
+ # Returns the object in the form of hash
157
+ # @return [Hash] Returns the object in the form of hash
158
+ def to_hash
159
+ hash = {}
160
+ self.class.attribute_map.each_pair do |attr, param|
161
+ value = self.send(attr)
162
+ next if value.nil?
163
+ hash[param] = _to_hash(value)
164
+ end
165
+ hash
166
+ end
167
+
168
+ # Outputs non-array value in the form of hash
169
+ # For object, use to_hash. Otherwise, just return the value
170
+ # @param [Object] value Any valid value
171
+ # @return [Hash] Returns the value in the form of hash
172
+ def _to_hash(value)
173
+ if value.is_a?(Array)
174
+ value.compact.map { |v| _to_hash(v) }
175
+ elsif value.is_a?(Hash)
176
+ {}.tap do |hash|
177
+ value.each { |k, v| hash[k] = _to_hash(v) }
178
+ end
179
+ elsif value.respond_to? :to_hash
180
+ value.to_hash
181
+ else
182
+ value
183
+ end
184
+ end
185
+ end
186
+ end
@@ -0,0 +1,266 @@
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 TssV2PostEmvTags200ResponseEmvTagBreakdownList
17
+ # Hexadecimal code of tag.
18
+ attr_accessor :tag
19
+
20
+ # Name of tag.
21
+ attr_accessor :name
22
+
23
+ # Tag length in bytes.
24
+ attr_accessor :length
25
+
26
+ # Hexadecimal value contained in the tag, masked data is represented by an 'X'.
27
+ attr_accessor :value
28
+
29
+ # Description of tag.
30
+ attr_accessor :description
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'tag' => :'tag',
36
+ :'name' => :'name',
37
+ :'length' => :'length',
38
+ :'value' => :'value',
39
+ :'description' => :'description'
40
+ }
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.swagger_types
45
+ {
46
+ :'tag' => :'String',
47
+ :'name' => :'String',
48
+ :'length' => :'Integer',
49
+ :'value' => :'String',
50
+ :'description' => :'String'
51
+ }
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ return unless attributes.is_a?(Hash)
58
+
59
+ # convert string to symbol for hash key
60
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
61
+
62
+ if attributes.has_key?(:'tag')
63
+ self.tag = attributes[:'tag']
64
+ end
65
+
66
+ if attributes.has_key?(:'name')
67
+ self.name = attributes[:'name']
68
+ end
69
+
70
+ if attributes.has_key?(:'length')
71
+ self.length = attributes[:'length']
72
+ end
73
+
74
+ if attributes.has_key?(:'value')
75
+ self.value = attributes[:'value']
76
+ end
77
+
78
+ if attributes.has_key?(:'description')
79
+ self.description = attributes[:'description']
80
+ end
81
+ end
82
+
83
+ # Show invalid properties with the reasons. Usually used together with valid?
84
+ # @return Array for valid properties with the reasons
85
+ def list_invalid_properties
86
+ invalid_properties = Array.new
87
+ #if !@tag.nil? && @tag !~ Regexp.new(/^[0-9A-F]*$/)
88
+ #invalid_properties.push('invalid value for "tag", must conform to the pattern /^[0-9A-F]*$/.')
89
+ #end
90
+
91
+ #if !@value.nil? && @value !~ Regexp.new(/^[0-9A-F|X]*$/)
92
+ #invalid_properties.push('invalid value for "value", must conform to the pattern /^[0-9A-F|X]*$/.')
93
+ #end
94
+
95
+ invalid_properties
96
+ end
97
+
98
+ # Check to see if the all the properties in the model are valid
99
+ # @return true if the model is valid
100
+ def valid?
101
+ #return false if !@tag.nil? && @tag !~ Regexp.new(/^[0-9A-F]*$/)
102
+ #return false if !@value.nil? && @value !~ Regexp.new(/^[0-9A-F|X]*$/)
103
+ true
104
+ end
105
+
106
+ # Custom attribute writer method with validation
107
+ # @param [Object] tag Value to be assigned
108
+ def tag=(tag)
109
+ #if !tag.nil? && tag !~ Regexp.new(/^[0-9A-F]*$/)
110
+ #fail ArgumentError, 'invalid value for "tag", must conform to the pattern /^[0-9A-F]*$/.'
111
+ #end
112
+
113
+ @tag = tag
114
+ end
115
+
116
+ # Custom attribute writer method with validation
117
+ # @param [Object] name Value to be assigned
118
+ def name=(name)
119
+ @name = name
120
+ end
121
+
122
+ # Custom attribute writer method with validation
123
+ # @param [Object] value Value to be assigned
124
+ def value=(value)
125
+ #if !value.nil? && value !~ Regexp.new(/^[0-9A-F|X]*$/)
126
+ #fail ArgumentError, 'invalid value for "value", must conform to the pattern /^[0-9A-F|X]*$/.'
127
+ #end
128
+
129
+ @value = value
130
+ end
131
+
132
+ # Custom attribute writer method with validation
133
+ # @param [Object] description Value to be assigned
134
+ def description=(description)
135
+ @description = description
136
+ end
137
+
138
+ # Checks equality by comparing each attribute.
139
+ # @param [Object] Object to be compared
140
+ def ==(o)
141
+ return true if self.equal?(o)
142
+ self.class == o.class &&
143
+ tag == o.tag &&
144
+ name == o.name &&
145
+ length == o.length &&
146
+ value == o.value &&
147
+ description == o.description
148
+ end
149
+
150
+ # @see the `==` method
151
+ # @param [Object] Object to be compared
152
+ def eql?(o)
153
+ self == o
154
+ end
155
+
156
+ # Calculates hash code according to all attributes.
157
+ # @return [Fixnum] Hash code
158
+ def hash
159
+ [tag, name, length, value, description].hash
160
+ end
161
+
162
+ # Builds the object from hash
163
+ # @param [Hash] attributes Model attributes in the form of hash
164
+ # @return [Object] Returns the model itself
165
+ def build_from_hash(attributes)
166
+ return nil unless attributes.is_a?(Hash)
167
+ self.class.swagger_types.each_pair do |key, type|
168
+ if type =~ /\AArray<(.*)>/i
169
+ # check to ensure the input is an array given that the the attribute
170
+ # is documented as an array but the input is not
171
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
172
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
173
+ end
174
+ elsif !attributes[self.class.attribute_map[key]].nil?
175
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
176
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
177
+ end
178
+
179
+ self
180
+ end
181
+
182
+ # Deserializes the data based on type
183
+ # @param string type Data type
184
+ # @param string value Value to be deserialized
185
+ # @return [Object] Deserialized data
186
+ def _deserialize(type, value)
187
+ case type.to_sym
188
+ when :DateTime
189
+ DateTime.parse(value)
190
+ when :Date
191
+ Date.parse(value)
192
+ when :String
193
+ value.to_s
194
+ when :Integer
195
+ value.to_i
196
+ when :Float
197
+ value.to_f
198
+ when :BOOLEAN
199
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
200
+ true
201
+ else
202
+ false
203
+ end
204
+ when :Object
205
+ # generic object (usually a Hash), return directly
206
+ value
207
+ when /\AArray<(?<inner_type>.+)>\z/
208
+ inner_type = Regexp.last_match[:inner_type]
209
+ value.map { |v| _deserialize(inner_type, v) }
210
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
211
+ k_type = Regexp.last_match[:k_type]
212
+ v_type = Regexp.last_match[:v_type]
213
+ {}.tap do |hash|
214
+ value.each do |k, v|
215
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
216
+ end
217
+ end
218
+ else # model
219
+ temp_model = CyberSource.const_get(type).new
220
+ temp_model.build_from_hash(value)
221
+ end
222
+ end
223
+
224
+ # Returns the string representation of the object
225
+ # @return [String] String presentation of the object
226
+ def to_s
227
+ to_hash.to_s
228
+ end
229
+
230
+ # to_body is an alias to to_hash (backward compatibility)
231
+ # @return [Hash] Returns the object in the form of hash
232
+ def to_body
233
+ to_hash
234
+ end
235
+
236
+ # Returns the object in the form of hash
237
+ # @return [Hash] Returns the object in the form of hash
238
+ def to_hash
239
+ hash = {}
240
+ self.class.attribute_map.each_pair do |attr, param|
241
+ value = self.send(attr)
242
+ next if value.nil?
243
+ hash[param] = _to_hash(value)
244
+ end
245
+ hash
246
+ end
247
+
248
+ # Outputs non-array value in the form of hash
249
+ # For object, use to_hash. Otherwise, just return the value
250
+ # @param [Object] value Any valid value
251
+ # @return [Hash] Returns the value in the form of hash
252
+ def _to_hash(value)
253
+ if value.is_a?(Array)
254
+ value.compact.map { |v| _to_hash(v) }
255
+ elsif value.is_a?(Hash)
256
+ {}.tap do |hash|
257
+ value.each { |k, v| hash[k] = _to_hash(v) }
258
+ end
259
+ elsif value.respond_to? :to_hash
260
+ value.to_hash
261
+ else
262
+ value
263
+ end
264
+ end
265
+ end
266
+ end
@@ -0,0 +1,212 @@
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 TssV2PostEmvTags200ResponseParsedEMVTagsList
17
+ # An unique identification number generated by Cybersource to identify the submitted request. Returned by all services. It is also appended to the endpoint of the resource. On incremental authorizations, this value with be the same as the identification number returned in the original authorization response.
18
+ attr_accessor :request_id
19
+
20
+ # Number of tags parsed
21
+ attr_accessor :total_tags
22
+
23
+ # An array of objects, where each object contains one parsed tag from the relevant EMV string.
24
+ attr_accessor :emv_tag_breakdown_list
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'request_id' => :'requestId',
30
+ :'total_tags' => :'totalTags',
31
+ :'emv_tag_breakdown_list' => :'emvTagBreakdownList'
32
+ }
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.swagger_types
37
+ {
38
+ :'request_id' => :'String',
39
+ :'total_tags' => :'Integer',
40
+ :'emv_tag_breakdown_list' => :'Array<TssV2PostEmvTags200ResponseEmvTagBreakdownList>'
41
+ }
42
+ end
43
+
44
+ # Initializes the object
45
+ # @param [Hash] attributes Model attributes in the form of hash
46
+ def initialize(attributes = {})
47
+ return unless attributes.is_a?(Hash)
48
+
49
+ # convert string to symbol for hash key
50
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
51
+
52
+ if attributes.has_key?(:'requestId')
53
+ self.request_id = attributes[:'requestId']
54
+ end
55
+
56
+ if attributes.has_key?(:'totalTags')
57
+ self.total_tags = attributes[:'totalTags']
58
+ end
59
+
60
+ if attributes.has_key?(:'emvTagBreakdownList')
61
+ if (value = attributes[:'emvTagBreakdownList']).is_a?(Array)
62
+ self.emv_tag_breakdown_list = value
63
+ end
64
+ end
65
+ end
66
+
67
+ # Show invalid properties with the reasons. Usually used together with valid?
68
+ # @return Array for valid properties with the reasons
69
+ def list_invalid_properties
70
+ invalid_properties = Array.new
71
+ invalid_properties
72
+ end
73
+
74
+ # Check to see if the all the properties in the model are valid
75
+ # @return true if the model is valid
76
+ def valid?
77
+ true
78
+ end
79
+
80
+ # Custom attribute writer method with validation
81
+ # @param [Object] request_id Value to be assigned
82
+ def request_id=(request_id)
83
+ @request_id = request_id
84
+ end
85
+
86
+ # Checks equality by comparing each attribute.
87
+ # @param [Object] Object to be compared
88
+ def ==(o)
89
+ return true if self.equal?(o)
90
+ self.class == o.class &&
91
+ request_id == o.request_id &&
92
+ total_tags == o.total_tags &&
93
+ emv_tag_breakdown_list == o.emv_tag_breakdown_list
94
+ end
95
+
96
+ # @see the `==` method
97
+ # @param [Object] Object to be compared
98
+ def eql?(o)
99
+ self == o
100
+ end
101
+
102
+ # Calculates hash code according to all attributes.
103
+ # @return [Fixnum] Hash code
104
+ def hash
105
+ [request_id, total_tags, emv_tag_breakdown_list].hash
106
+ end
107
+
108
+ # Builds the object from hash
109
+ # @param [Hash] attributes Model attributes in the form of hash
110
+ # @return [Object] Returns the model itself
111
+ def build_from_hash(attributes)
112
+ return nil unless attributes.is_a?(Hash)
113
+ self.class.swagger_types.each_pair do |key, type|
114
+ if type =~ /\AArray<(.*)>/i
115
+ # check to ensure the input is an array given that the the attribute
116
+ # is documented as an array but the input is not
117
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
118
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
119
+ end
120
+ elsif !attributes[self.class.attribute_map[key]].nil?
121
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
122
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
123
+ end
124
+
125
+ self
126
+ end
127
+
128
+ # Deserializes the data based on type
129
+ # @param string type Data type
130
+ # @param string value Value to be deserialized
131
+ # @return [Object] Deserialized data
132
+ def _deserialize(type, value)
133
+ case type.to_sym
134
+ when :DateTime
135
+ DateTime.parse(value)
136
+ when :Date
137
+ Date.parse(value)
138
+ when :String
139
+ value.to_s
140
+ when :Integer
141
+ value.to_i
142
+ when :Float
143
+ value.to_f
144
+ when :BOOLEAN
145
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
146
+ true
147
+ else
148
+ false
149
+ end
150
+ when :Object
151
+ # generic object (usually a Hash), return directly
152
+ value
153
+ when /\AArray<(?<inner_type>.+)>\z/
154
+ inner_type = Regexp.last_match[:inner_type]
155
+ value.map { |v| _deserialize(inner_type, v) }
156
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
157
+ k_type = Regexp.last_match[:k_type]
158
+ v_type = Regexp.last_match[:v_type]
159
+ {}.tap do |hash|
160
+ value.each do |k, v|
161
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
162
+ end
163
+ end
164
+ else # model
165
+ temp_model = CyberSource.const_get(type).new
166
+ temp_model.build_from_hash(value)
167
+ end
168
+ end
169
+
170
+ # Returns the string representation of the object
171
+ # @return [String] String presentation of the object
172
+ def to_s
173
+ to_hash.to_s
174
+ end
175
+
176
+ # to_body is an alias to to_hash (backward compatibility)
177
+ # @return [Hash] Returns the object in the form of hash
178
+ def to_body
179
+ to_hash
180
+ end
181
+
182
+ # Returns the object in the form of hash
183
+ # @return [Hash] Returns the object in the form of hash
184
+ def to_hash
185
+ hash = {}
186
+ self.class.attribute_map.each_pair do |attr, param|
187
+ value = self.send(attr)
188
+ next if value.nil?
189
+ hash[param] = _to_hash(value)
190
+ end
191
+ hash
192
+ end
193
+
194
+ # Outputs non-array value in the form of hash
195
+ # For object, use to_hash. Otherwise, just return the value
196
+ # @param [Object] value Any valid value
197
+ # @return [Hash] Returns the value in the form of hash
198
+ def _to_hash(value)
199
+ if value.is_a?(Array)
200
+ value.compact.map { |v| _to_hash(v) }
201
+ elsif value.is_a?(Hash)
202
+ {}.tap do |hash|
203
+ value.each { |k, v| hash[k] = _to_hash(v) }
204
+ end
205
+ elsif value.respond_to? :to_hash
206
+ value.to_hash
207
+ else
208
+ value
209
+ end
210
+ end
211
+ end
212
+ end