cybersource_rest_client 0.0.16 → 0.0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cybersource_rest_client.rb +12 -5
- data/lib/cybersource_rest_client/api/credit_api.rb +1 -1
- data/lib/cybersource_rest_client/api/download_dtd_api.rb +4 -4
- data/lib/cybersource_rest_client/api/download_xsd_api.rb +4 -4
- data/lib/cybersource_rest_client/api/payments_api.rb +1 -1
- data/lib/cybersource_rest_client/api/report_subscriptions_api.rb +9 -9
- data/lib/cybersource_rest_client/api/reports_api.rb +9 -9
- data/lib/cybersource_rest_client/api/search_transactions_api.rb +1 -1
- data/lib/cybersource_rest_client/api/transaction_batches_api.rb +2 -8
- data/lib/cybersource_rest_client/models/{request_body.rb → create_adhoc_report_request.rb} +1 -1
- data/lib/cybersource_rest_client/models/{request_body_1.rb → create_report_subscription_request.rb} +1 -1
- data/lib/cybersource_rest_client/models/error.rb +23 -13
- data/lib/cybersource_rest_client/models/error_bean.rb +1 -1
- data/lib/cybersource_rest_client/models/error_links.rb +15 -15
- data/lib/cybersource_rest_client/models/error_response.rb +2 -20
- data/lib/cybersource_rest_client/models/inline_response_400.rb +59 -14
- data/lib/cybersource_rest_client/models/inline_response_400_1.rb +14 -59
- data/lib/cybersource_rest_client/models/{inline_response_400_1_fields.rb → inline_response_400_fields.rb} +1 -1
- data/lib/cybersource_rest_client/models/link.rb +4 -25
- data/lib/cybersource_rest_client/models/links.rb +14 -18
- data/lib/cybersource_rest_client/models/ptsv2credits_processing_information.rb +22 -4
- data/lib/cybersource_rest_client/models/ptsv2credits_processing_information_electronic_benefits_transfer.rb +199 -0
- data/lib/cybersource_rest_client/models/ptsv2credits_processing_information_purchase_options.rb +184 -0
- data/lib/cybersource_rest_client/models/ptsv2payments_order_information_amount_details.rb +29 -4
- data/lib/cybersource_rest_client/models/ptsv2payments_order_information_line_items.rb +6 -6
- data/lib/cybersource_rest_client/models/ptsv2payments_payment_information.rb +13 -4
- data/lib/cybersource_rest_client/models/ptsv2payments_payment_information_payment_type.rb +203 -0
- data/lib/cybersource_rest_client/models/ptsv2payments_payment_information_payment_type_method.rb +184 -0
- data/lib/cybersource_rest_client/models/ptsv2payments_processing_information.rb +22 -4
- data/lib/cybersource_rest_client/models/ptsv2payments_processing_information_electronic_benefits_transfer.rb +224 -0
- data/lib/cybersource_rest_client/models/ptsv2payments_processing_information_purchase_options.rb +209 -0
- data/lib/cybersource_rest_client/models/ptsv2paymentsidcaptures_order_information_amount_details.rb +29 -4
- data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_order_information_line_items.rb +6 -6
- data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_payment_information.rb +13 -4
- data/lib/cybersource_rest_client/models/ptsv2paymentsidreversals_order_information_line_items.rb +6 -6
- data/lib/cybersource_rest_client/models/ptsv2paymentsidvoids_payment_information.rb +183 -0
- data/lib/cybersource_rest_client/models/riskv1decisions_order_information_line_items.rb +6 -6
- data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_payment_information_payment_type.rb +2 -2
- data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_payment_information_payment_type.rb +1 -1
- data/lib/cybersource_rest_client/models/void_capture_request.rb +13 -4
- data/lib/cybersource_rest_client/models/void_credit_request.rb +13 -4
- data/lib/cybersource_rest_client/models/void_payment_request.rb +13 -4
- data/lib/cybersource_rest_client/models/void_refund_request.rb +13 -4
- metadata +12 -5
@@ -129,7 +129,7 @@ module CyberSource
|
|
129
129
|
:'product_code' => :'String',
|
130
130
|
:'product_name' => :'String',
|
131
131
|
:'product_sku' => :'String',
|
132
|
-
:'quantity' => :'
|
132
|
+
:'quantity' => :'Integer',
|
133
133
|
:'unit_price' => :'String',
|
134
134
|
:'unit_of_measure' => :'String',
|
135
135
|
:'total_amount' => :'String',
|
@@ -286,8 +286,8 @@ module CyberSource
|
|
286
286
|
invalid_properties.push('invalid value for "product_sku", the character length must be smaller than or equal to 255.')
|
287
287
|
end
|
288
288
|
|
289
|
-
if !@quantity.nil? && @quantity >
|
290
|
-
invalid_properties.push('invalid value for "quantity", must be smaller than or equal to
|
289
|
+
if !@quantity.nil? && @quantity > 999999999
|
290
|
+
invalid_properties.push('invalid value for "quantity", must be smaller than or equal to 999999999.')
|
291
291
|
end
|
292
292
|
|
293
293
|
if !@quantity.nil? && @quantity < 1
|
@@ -375,7 +375,7 @@ module CyberSource
|
|
375
375
|
return false if !@product_code.nil? && @product_code.to_s.length > 255
|
376
376
|
return false if !@product_name.nil? && @product_name.to_s.length > 255
|
377
377
|
return false if !@product_sku.nil? && @product_sku.to_s.length > 255
|
378
|
-
return false if !@quantity.nil? && @quantity >
|
378
|
+
return false if !@quantity.nil? && @quantity > 999999999
|
379
379
|
return false if !@quantity.nil? && @quantity < 1
|
380
380
|
return false if !@unit_price.nil? && @unit_price.to_s.length > 15
|
381
381
|
return false if !@unit_of_measure.nil? && @unit_of_measure.to_s.length > 12
|
@@ -431,8 +431,8 @@ module CyberSource
|
|
431
431
|
# Custom attribute writer method with validation
|
432
432
|
# @param [Object] quantity Value to be assigned
|
433
433
|
def quantity=(quantity)
|
434
|
-
if !quantity.nil? && quantity >
|
435
|
-
fail ArgumentError, 'invalid value for "quantity", must be smaller than or equal to
|
434
|
+
if !quantity.nil? && quantity > 999999999
|
435
|
+
fail ArgumentError, 'invalid value for "quantity", must be smaller than or equal to 999999999.'
|
436
436
|
end
|
437
437
|
|
438
438
|
if !quantity.nil? && quantity < 1
|
@@ -24,6 +24,8 @@ module CyberSource
|
|
24
24
|
|
25
25
|
attr_accessor :bank
|
26
26
|
|
27
|
+
attr_accessor :payment_type
|
28
|
+
|
27
29
|
# Attribute mapping from ruby-style variable name to JSON key.
|
28
30
|
def self.attribute_map
|
29
31
|
{
|
@@ -31,7 +33,8 @@ module CyberSource
|
|
31
33
|
:'tokenized_card' => :'tokenizedCard',
|
32
34
|
:'fluid_data' => :'fluidData',
|
33
35
|
:'customer' => :'customer',
|
34
|
-
:'bank' => :'bank'
|
36
|
+
:'bank' => :'bank',
|
37
|
+
:'payment_type' => :'paymentType'
|
35
38
|
}
|
36
39
|
end
|
37
40
|
|
@@ -42,7 +45,8 @@ module CyberSource
|
|
42
45
|
:'tokenized_card' => :'Ptsv2paymentsPaymentInformationTokenizedCard',
|
43
46
|
:'fluid_data' => :'Ptsv2paymentsPaymentInformationFluidData',
|
44
47
|
:'customer' => :'Ptsv2paymentsPaymentInformationCustomer',
|
45
|
-
:'bank' => :'Ptsv2paymentsPaymentInformationBank'
|
48
|
+
:'bank' => :'Ptsv2paymentsPaymentInformationBank',
|
49
|
+
:'payment_type' => :'Ptsv2paymentsPaymentInformationPaymentType'
|
46
50
|
}
|
47
51
|
end
|
48
52
|
|
@@ -73,6 +77,10 @@ module CyberSource
|
|
73
77
|
if attributes.has_key?(:'bank')
|
74
78
|
self.bank = attributes[:'bank']
|
75
79
|
end
|
80
|
+
|
81
|
+
if attributes.has_key?(:'paymentType')
|
82
|
+
self.payment_type = attributes[:'paymentType']
|
83
|
+
end
|
76
84
|
end
|
77
85
|
|
78
86
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -97,7 +105,8 @@ module CyberSource
|
|
97
105
|
tokenized_card == o.tokenized_card &&
|
98
106
|
fluid_data == o.fluid_data &&
|
99
107
|
customer == o.customer &&
|
100
|
-
bank == o.bank
|
108
|
+
bank == o.bank &&
|
109
|
+
payment_type == o.payment_type
|
101
110
|
end
|
102
111
|
|
103
112
|
# @see the `==` method
|
@@ -109,7 +118,7 @@ module CyberSource
|
|
109
118
|
# Calculates hash code according to all attributes.
|
110
119
|
# @return [Fixnum] Hash code
|
111
120
|
def hash
|
112
|
-
[card, tokenized_card, fluid_data, customer, bank].hash
|
121
|
+
[card, tokenized_card, fluid_data, customer, bank, payment_type].hash
|
113
122
|
end
|
114
123
|
|
115
124
|
# Builds the object from hash
|
@@ -0,0 +1,203 @@
|
|
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 Ptsv2paymentsPaymentInformationPaymentType
|
17
|
+
# A Payment Type is an agreed means for a payee to receive legal tender from a payer. The way one pays for a commercial financial transaction. Examples: Card, Bank Transfer, Digital, Direct Debit. Possible values: - `CARD` (use this for a PIN debit transaction)
|
18
|
+
attr_accessor :name
|
19
|
+
|
20
|
+
# SubType Name is detail information about Payment Type. Examples: For Card, if Credit or Debit or PrePaid. For Bank Transfer, if Online Bank Transfer or Wire Transfers. - `DEBIT` (use this for a PIN debit transaction)
|
21
|
+
attr_accessor :sub_type_name
|
22
|
+
|
23
|
+
attr_accessor :method
|
24
|
+
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
26
|
+
def self.attribute_map
|
27
|
+
{
|
28
|
+
:'name' => :'name',
|
29
|
+
:'sub_type_name' => :'subTypeName',
|
30
|
+
:'method' => :'method'
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
# Attribute type mapping.
|
35
|
+
def self.swagger_types
|
36
|
+
{
|
37
|
+
:'name' => :'String',
|
38
|
+
:'sub_type_name' => :'String',
|
39
|
+
:'method' => :'Ptsv2paymentsPaymentInformationPaymentTypeMethod'
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
# Initializes the object
|
44
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
45
|
+
def initialize(attributes = {})
|
46
|
+
return unless attributes.is_a?(Hash)
|
47
|
+
|
48
|
+
# convert string to symbol for hash key
|
49
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
50
|
+
|
51
|
+
if attributes.has_key?(:'name')
|
52
|
+
self.name = attributes[:'name']
|
53
|
+
end
|
54
|
+
|
55
|
+
if attributes.has_key?(:'subTypeName')
|
56
|
+
self.sub_type_name = attributes[:'subTypeName']
|
57
|
+
end
|
58
|
+
|
59
|
+
if attributes.has_key?(:'method')
|
60
|
+
self.method = attributes[:'method']
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
65
|
+
# @return Array for valid properties with the reasons
|
66
|
+
def list_invalid_properties
|
67
|
+
invalid_properties = Array.new
|
68
|
+
invalid_properties
|
69
|
+
end
|
70
|
+
|
71
|
+
# Check to see if the all the properties in the model are valid
|
72
|
+
# @return true if the model is valid
|
73
|
+
def valid?
|
74
|
+
true
|
75
|
+
end
|
76
|
+
|
77
|
+
# Checks equality by comparing each attribute.
|
78
|
+
# @param [Object] Object to be compared
|
79
|
+
def ==(o)
|
80
|
+
return true if self.equal?(o)
|
81
|
+
self.class == o.class &&
|
82
|
+
name == o.name &&
|
83
|
+
sub_type_name == o.sub_type_name &&
|
84
|
+
method == o.method
|
85
|
+
end
|
86
|
+
|
87
|
+
# @see the `==` method
|
88
|
+
# @param [Object] Object to be compared
|
89
|
+
def eql?(o)
|
90
|
+
self == o
|
91
|
+
end
|
92
|
+
|
93
|
+
# Calculates hash code according to all attributes.
|
94
|
+
# @return [Fixnum] Hash code
|
95
|
+
def hash
|
96
|
+
[name, sub_type_name, method].hash
|
97
|
+
end
|
98
|
+
|
99
|
+
# Builds the object from hash
|
100
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
101
|
+
# @return [Object] Returns the model itself
|
102
|
+
def build_from_hash(attributes)
|
103
|
+
return nil unless attributes.is_a?(Hash)
|
104
|
+
self.class.swagger_types.each_pair do |key, type|
|
105
|
+
if type =~ /\AArray<(.*)>/i
|
106
|
+
# check to ensure the input is an array given that the the attribute
|
107
|
+
# is documented as an array but the input is not
|
108
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
109
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
110
|
+
end
|
111
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
112
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
113
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
114
|
+
end
|
115
|
+
|
116
|
+
self
|
117
|
+
end
|
118
|
+
|
119
|
+
# Deserializes the data based on type
|
120
|
+
# @param string type Data type
|
121
|
+
# @param string value Value to be deserialized
|
122
|
+
# @return [Object] Deserialized data
|
123
|
+
def _deserialize(type, value)
|
124
|
+
case type.to_sym
|
125
|
+
when :DateTime
|
126
|
+
DateTime.parse(value)
|
127
|
+
when :Date
|
128
|
+
Date.parse(value)
|
129
|
+
when :String
|
130
|
+
value.to_s
|
131
|
+
when :Integer
|
132
|
+
value.to_i
|
133
|
+
when :Float
|
134
|
+
value.to_f
|
135
|
+
when :BOOLEAN
|
136
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
137
|
+
true
|
138
|
+
else
|
139
|
+
false
|
140
|
+
end
|
141
|
+
when :Object
|
142
|
+
# generic object (usually a Hash), return directly
|
143
|
+
value
|
144
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
145
|
+
inner_type = Regexp.last_match[:inner_type]
|
146
|
+
value.map { |v| _deserialize(inner_type, v) }
|
147
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
148
|
+
k_type = Regexp.last_match[:k_type]
|
149
|
+
v_type = Regexp.last_match[:v_type]
|
150
|
+
{}.tap do |hash|
|
151
|
+
value.each do |k, v|
|
152
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
else # model
|
156
|
+
temp_model = CyberSource.const_get(type).new
|
157
|
+
temp_model.build_from_hash(value)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
# Returns the string representation of the object
|
162
|
+
# @return [String] String presentation of the object
|
163
|
+
def to_s
|
164
|
+
to_hash.to_s
|
165
|
+
end
|
166
|
+
|
167
|
+
# to_body is an alias to to_hash (backward compatibility)
|
168
|
+
# @return [Hash] Returns the object in the form of hash
|
169
|
+
def to_body
|
170
|
+
to_hash
|
171
|
+
end
|
172
|
+
|
173
|
+
# Returns the object in the form of hash
|
174
|
+
# @return [Hash] Returns the object in the form of hash
|
175
|
+
def to_hash
|
176
|
+
hash = {}
|
177
|
+
self.class.attribute_map.each_pair do |attr, param|
|
178
|
+
value = self.send(attr)
|
179
|
+
next if value.nil?
|
180
|
+
hash[param] = _to_hash(value)
|
181
|
+
end
|
182
|
+
hash
|
183
|
+
end
|
184
|
+
|
185
|
+
# Outputs non-array value in the form of hash
|
186
|
+
# For object, use to_hash. Otherwise, just return the value
|
187
|
+
# @param [Object] value Any valid value
|
188
|
+
# @return [Hash] Returns the value in the form of hash
|
189
|
+
def _to_hash(value)
|
190
|
+
if value.is_a?(Array)
|
191
|
+
value.compact.map { |v| _to_hash(v) }
|
192
|
+
elsif value.is_a?(Hash)
|
193
|
+
{}.tap do |hash|
|
194
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
195
|
+
end
|
196
|
+
elsif value.respond_to? :to_hash
|
197
|
+
value.to_hash
|
198
|
+
else
|
199
|
+
value
|
200
|
+
end
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
data/lib/cybersource_rest_client/models/ptsv2payments_payment_information_payment_type_method.rb
ADDED
@@ -0,0 +1,184 @@
|
|
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 Ptsv2paymentsPaymentInformationPaymentTypeMethod
|
17
|
+
# A Payment Type is enabled through a Method. Examples: Visa, Master Card, ApplePay, iDeal
|
18
|
+
attr_accessor :name
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'name' => :'name'
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
# Attribute type mapping.
|
28
|
+
def self.swagger_types
|
29
|
+
{
|
30
|
+
:'name' => :'String'
|
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?(:'name')
|
43
|
+
self.name = attributes[:'name']
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
48
|
+
# @return Array for valid properties with the reasons
|
49
|
+
def list_invalid_properties
|
50
|
+
invalid_properties = Array.new
|
51
|
+
invalid_properties
|
52
|
+
end
|
53
|
+
|
54
|
+
# Check to see if the all the properties in the model are valid
|
55
|
+
# @return true if the model is valid
|
56
|
+
def valid?
|
57
|
+
true
|
58
|
+
end
|
59
|
+
|
60
|
+
# Checks equality by comparing each attribute.
|
61
|
+
# @param [Object] Object to be compared
|
62
|
+
def ==(o)
|
63
|
+
return true if self.equal?(o)
|
64
|
+
self.class == o.class &&
|
65
|
+
name == o.name
|
66
|
+
end
|
67
|
+
|
68
|
+
# @see the `==` method
|
69
|
+
# @param [Object] Object to be compared
|
70
|
+
def eql?(o)
|
71
|
+
self == o
|
72
|
+
end
|
73
|
+
|
74
|
+
# Calculates hash code according to all attributes.
|
75
|
+
# @return [Fixnum] Hash code
|
76
|
+
def hash
|
77
|
+
[name].hash
|
78
|
+
end
|
79
|
+
|
80
|
+
# Builds the object from hash
|
81
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
82
|
+
# @return [Object] Returns the model itself
|
83
|
+
def build_from_hash(attributes)
|
84
|
+
return nil unless attributes.is_a?(Hash)
|
85
|
+
self.class.swagger_types.each_pair do |key, type|
|
86
|
+
if type =~ /\AArray<(.*)>/i
|
87
|
+
# check to ensure the input is an array given that the the attribute
|
88
|
+
# is documented as an array but the input is not
|
89
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
90
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
91
|
+
end
|
92
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
93
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
94
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
95
|
+
end
|
96
|
+
|
97
|
+
self
|
98
|
+
end
|
99
|
+
|
100
|
+
# Deserializes the data based on type
|
101
|
+
# @param string type Data type
|
102
|
+
# @param string value Value to be deserialized
|
103
|
+
# @return [Object] Deserialized data
|
104
|
+
def _deserialize(type, value)
|
105
|
+
case type.to_sym
|
106
|
+
when :DateTime
|
107
|
+
DateTime.parse(value)
|
108
|
+
when :Date
|
109
|
+
Date.parse(value)
|
110
|
+
when :String
|
111
|
+
value.to_s
|
112
|
+
when :Integer
|
113
|
+
value.to_i
|
114
|
+
when :Float
|
115
|
+
value.to_f
|
116
|
+
when :BOOLEAN
|
117
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
118
|
+
true
|
119
|
+
else
|
120
|
+
false
|
121
|
+
end
|
122
|
+
when :Object
|
123
|
+
# generic object (usually a Hash), return directly
|
124
|
+
value
|
125
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
126
|
+
inner_type = Regexp.last_match[:inner_type]
|
127
|
+
value.map { |v| _deserialize(inner_type, v) }
|
128
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
129
|
+
k_type = Regexp.last_match[:k_type]
|
130
|
+
v_type = Regexp.last_match[:v_type]
|
131
|
+
{}.tap do |hash|
|
132
|
+
value.each do |k, v|
|
133
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
else # model
|
137
|
+
temp_model = CyberSource.const_get(type).new
|
138
|
+
temp_model.build_from_hash(value)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
# Returns the string representation of the object
|
143
|
+
# @return [String] String presentation of the object
|
144
|
+
def to_s
|
145
|
+
to_hash.to_s
|
146
|
+
end
|
147
|
+
|
148
|
+
# to_body is an alias to to_hash (backward compatibility)
|
149
|
+
# @return [Hash] Returns the object in the form of hash
|
150
|
+
def to_body
|
151
|
+
to_hash
|
152
|
+
end
|
153
|
+
|
154
|
+
# Returns the object in the form of hash
|
155
|
+
# @return [Hash] Returns the object in the form of hash
|
156
|
+
def to_hash
|
157
|
+
hash = {}
|
158
|
+
self.class.attribute_map.each_pair do |attr, param|
|
159
|
+
value = self.send(attr)
|
160
|
+
next if value.nil?
|
161
|
+
hash[param] = _to_hash(value)
|
162
|
+
end
|
163
|
+
hash
|
164
|
+
end
|
165
|
+
|
166
|
+
# Outputs non-array value in the form of hash
|
167
|
+
# For object, use to_hash. Otherwise, just return the value
|
168
|
+
# @param [Object] value Any valid value
|
169
|
+
# @return [Hash] Returns the value in the form of hash
|
170
|
+
def _to_hash(value)
|
171
|
+
if value.is_a?(Array)
|
172
|
+
value.compact.map { |v| _to_hash(v) }
|
173
|
+
elsif value.is_a?(Hash)
|
174
|
+
{}.tap do |hash|
|
175
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
176
|
+
end
|
177
|
+
elsif value.respond_to? :to_hash
|
178
|
+
value.to_hash
|
179
|
+
else
|
180
|
+
value
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|