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.
- checksums.yaml +4 -4
- data/lib/cybersource_rest_client/api/emv_tag_details_api.rb +152 -0
- data/lib/cybersource_rest_client/api/transient_token_data_api.rb +92 -0
- data/lib/cybersource_rest_client/api/unified_checkout_capture_context_api.rb +88 -0
- data/lib/cybersource_rest_client/models/body.rb +216 -0
- data/lib/cybersource_rest_client/models/generate_unified_checkout_capture_context_request.rb +276 -0
- data/lib/cybersource_rest_client/models/inline_response_400_3.rb +265 -0
- data/lib/cybersource_rest_client/models/inline_response_400_3_details.rb +192 -0
- data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_consumer_authentication_information_issuer_information.rb +52 -4
- data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_issuer_information.rb +4 -20
- data/lib/cybersource_rest_client/models/pts_v2_payouts_post201_response.rb +13 -4
- data/lib/cybersource_rest_client/models/pts_v2_payouts_post201_response_issuer_information.rb +190 -0
- data/lib/cybersource_rest_client/models/ptsv2payments_point_of_sale_information.rb +1 -1
- data/lib/cybersource_rest_client/models/ptsv2payments_processing_information_authorization_options.rb +1 -1
- data/lib/cybersource_rest_client/models/ptsv2payments_recurring_payment_information.rb +100 -4
- data/lib/cybersource_rest_client/models/tss_v2_get_emv_tags200_response.rb +186 -0
- data/lib/cybersource_rest_client/models/tss_v2_get_emv_tags200_response_emv_tag_breakdown_list.rb +215 -0
- data/lib/cybersource_rest_client/models/tss_v2_post_emv_tags200_response.rb +186 -0
- data/lib/cybersource_rest_client/models/tss_v2_post_emv_tags200_response_emv_tag_breakdown_list.rb +266 -0
- data/lib/cybersource_rest_client/models/tss_v2_post_emv_tags200_response_parsed_emv_tags_list.rb +212 -0
- data/lib/cybersource_rest_client/models/tssv2transactionsemv_tag_details_emv_details_list.rb +224 -0
- data/lib/cybersource_rest_client/models/upv1capturecontexts_capture_mandate.rb +242 -0
- data/lib/cybersource_rest_client/models/upv1capturecontexts_checkout_api_initialization.rb +264 -0
- data/lib/cybersource_rest_client/models/upv1capturecontexts_order_information.rb +201 -0
- data/lib/cybersource_rest_client/models/upv1capturecontexts_order_information_amount_details.rb +192 -0
- data/lib/cybersource_rest_client/models/upv1capturecontexts_order_information_bill_to.rb +459 -0
- data/lib/cybersource_rest_client/models/upv1capturecontexts_order_information_bill_to_company.rb +350 -0
- data/lib/cybersource_rest_client/models/upv1capturecontexts_order_information_ship_to.rb +354 -0
- data/lib/cybersource_rest_client.rb +21 -0
- metadata +45 -24
@@ -30,6 +30,24 @@ module CyberSource
|
|
30
30
|
# This field is mandatory for Cartes Bancaires recurring transactions on Credit Mutuel-CIC. This field records recurring sequence, e.g. 1st for initial, 2 for subsequent, 3 etc
|
31
31
|
attr_accessor :sequence_number
|
32
32
|
|
33
|
+
# This contains the type of recurring payment. Valid Values : 1 - Registration/First transaction 2 - Subsequent transaction 3 - Modification 4 - Cancellation
|
34
|
+
attr_accessor :type
|
35
|
+
|
36
|
+
# This value indicates how often a recurring payment occurs. Valid Values : • 01 (Daily) • 02 (Twice weekly) • 03 (Weekly) • 04 (Ten days) • 05 (Fortnightly) • 06 (Monthly) • 07 (Every two months) • 08 (Trimester) • 09 (Quarterly) • 10 (Twice yearly) • 11 (Annually) • 12 (Unscheduled)
|
37
|
+
attr_accessor :occurrence
|
38
|
+
|
39
|
+
# This tag will contain a value that indicates whether or not the recurring payment transaction has been validated. Valid values : 0- Not validated 1- Validated
|
40
|
+
attr_accessor :validation_indicator
|
41
|
+
|
42
|
+
# Indicates recurring amount type agreed by the cardholder Valid Values : 1- Fixed amount recurring payment 2- Recurring payment with maximum amount
|
43
|
+
attr_accessor :amount_type
|
44
|
+
|
45
|
+
# This API field will contain the maximum amount agreed to by the cardholder. The currency of this amount will be specified in Field 49—Currency Code,Transaction.
|
46
|
+
attr_accessor :maximum_amount
|
47
|
+
|
48
|
+
# This will contain a unique reference number for the recurring payment transaction.
|
49
|
+
attr_accessor :reference_number
|
50
|
+
|
33
51
|
# Attribute mapping from ruby-style variable name to JSON key.
|
34
52
|
def self.attribute_map
|
35
53
|
{
|
@@ -37,7 +55,13 @@ module CyberSource
|
|
37
55
|
:'frequency' => :'frequency',
|
38
56
|
:'number_of_payments' => :'numberOfPayments',
|
39
57
|
:'original_purchase_date' => :'originalPurchaseDate',
|
40
|
-
:'sequence_number' => :'sequenceNumber'
|
58
|
+
:'sequence_number' => :'sequenceNumber',
|
59
|
+
:'type' => :'type',
|
60
|
+
:'occurrence' => :'occurrence',
|
61
|
+
:'validation_indicator' => :'validationIndicator',
|
62
|
+
:'amount_type' => :'amountType',
|
63
|
+
:'maximum_amount' => :'maximumAmount',
|
64
|
+
:'reference_number' => :'referenceNumber'
|
41
65
|
}
|
42
66
|
end
|
43
67
|
|
@@ -48,7 +72,13 @@ module CyberSource
|
|
48
72
|
:'frequency' => :'Integer',
|
49
73
|
:'number_of_payments' => :'Integer',
|
50
74
|
:'original_purchase_date' => :'String',
|
51
|
-
:'sequence_number' => :'Integer'
|
75
|
+
:'sequence_number' => :'Integer',
|
76
|
+
:'type' => :'String',
|
77
|
+
:'occurrence' => :'String',
|
78
|
+
:'validation_indicator' => :'String',
|
79
|
+
:'amount_type' => :'String',
|
80
|
+
:'maximum_amount' => :'String',
|
81
|
+
:'reference_number' => :'String'
|
52
82
|
}
|
53
83
|
end
|
54
84
|
|
@@ -79,6 +109,30 @@ module CyberSource
|
|
79
109
|
if attributes.has_key?(:'sequenceNumber')
|
80
110
|
self.sequence_number = attributes[:'sequenceNumber']
|
81
111
|
end
|
112
|
+
|
113
|
+
if attributes.has_key?(:'type')
|
114
|
+
self.type = attributes[:'type']
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.has_key?(:'occurrence')
|
118
|
+
self.occurrence = attributes[:'occurrence']
|
119
|
+
end
|
120
|
+
|
121
|
+
if attributes.has_key?(:'validationIndicator')
|
122
|
+
self.validation_indicator = attributes[:'validationIndicator']
|
123
|
+
end
|
124
|
+
|
125
|
+
if attributes.has_key?(:'amountType')
|
126
|
+
self.amount_type = attributes[:'amountType']
|
127
|
+
end
|
128
|
+
|
129
|
+
if attributes.has_key?(:'maximumAmount')
|
130
|
+
self.maximum_amount = attributes[:'maximumAmount']
|
131
|
+
end
|
132
|
+
|
133
|
+
if attributes.has_key?(:'referenceNumber')
|
134
|
+
self.reference_number = attributes[:'referenceNumber']
|
135
|
+
end
|
82
136
|
end
|
83
137
|
|
84
138
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -106,6 +160,42 @@ module CyberSource
|
|
106
160
|
@original_purchase_date = original_purchase_date
|
107
161
|
end
|
108
162
|
|
163
|
+
# Custom attribute writer method with validation
|
164
|
+
# @param [Object] type Value to be assigned
|
165
|
+
def type=(type)
|
166
|
+
@type = type
|
167
|
+
end
|
168
|
+
|
169
|
+
# Custom attribute writer method with validation
|
170
|
+
# @param [Object] occurrence Value to be assigned
|
171
|
+
def occurrence=(occurrence)
|
172
|
+
@occurrence = occurrence
|
173
|
+
end
|
174
|
+
|
175
|
+
# Custom attribute writer method with validation
|
176
|
+
# @param [Object] validation_indicator Value to be assigned
|
177
|
+
def validation_indicator=(validation_indicator)
|
178
|
+
@validation_indicator = validation_indicator
|
179
|
+
end
|
180
|
+
|
181
|
+
# Custom attribute writer method with validation
|
182
|
+
# @param [Object] amount_type Value to be assigned
|
183
|
+
def amount_type=(amount_type)
|
184
|
+
@amount_type = amount_type
|
185
|
+
end
|
186
|
+
|
187
|
+
# Custom attribute writer method with validation
|
188
|
+
# @param [Object] maximum_amount Value to be assigned
|
189
|
+
def maximum_amount=(maximum_amount)
|
190
|
+
@maximum_amount = maximum_amount
|
191
|
+
end
|
192
|
+
|
193
|
+
# Custom attribute writer method with validation
|
194
|
+
# @param [Object] reference_number Value to be assigned
|
195
|
+
def reference_number=(reference_number)
|
196
|
+
@reference_number = reference_number
|
197
|
+
end
|
198
|
+
|
109
199
|
# Checks equality by comparing each attribute.
|
110
200
|
# @param [Object] Object to be compared
|
111
201
|
def ==(o)
|
@@ -115,7 +205,13 @@ module CyberSource
|
|
115
205
|
frequency == o.frequency &&
|
116
206
|
number_of_payments == o.number_of_payments &&
|
117
207
|
original_purchase_date == o.original_purchase_date &&
|
118
|
-
sequence_number == o.sequence_number
|
208
|
+
sequence_number == o.sequence_number &&
|
209
|
+
type == o.type &&
|
210
|
+
occurrence == o.occurrence &&
|
211
|
+
validation_indicator == o.validation_indicator &&
|
212
|
+
amount_type == o.amount_type &&
|
213
|
+
maximum_amount == o.maximum_amount &&
|
214
|
+
reference_number == o.reference_number
|
119
215
|
end
|
120
216
|
|
121
217
|
# @see the `==` method
|
@@ -127,7 +223,7 @@ module CyberSource
|
|
127
223
|
# Calculates hash code according to all attributes.
|
128
224
|
# @return [Fixnum] Hash code
|
129
225
|
def hash
|
130
|
-
[end_date, frequency, number_of_payments, original_purchase_date, sequence_number].hash
|
226
|
+
[end_date, frequency, number_of_payments, original_purchase_date, sequence_number, type, occurrence, validation_indicator, amount_type, maximum_amount, reference_number].hash
|
131
227
|
end
|
132
228
|
|
133
229
|
# Builds the object from hash
|
@@ -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 TssV2GetEmvTags200Response
|
17
|
+
# An array of objects with each object containing a single EMV tag from the dictionary.
|
18
|
+
attr_accessor :emv_tag_breakdown_list
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'emv_tag_breakdown_list' => :'emvTagBreakdownList'
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
# Attribute type mapping.
|
28
|
+
def self.swagger_types
|
29
|
+
{
|
30
|
+
:'emv_tag_breakdown_list' => :'Array<TssV2GetEmvTags200ResponseEmvTagBreakdownList>'
|
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?(:'emvTagBreakdownList')
|
43
|
+
if (value = attributes[:'emvTagBreakdownList']).is_a?(Array)
|
44
|
+
self.emv_tag_breakdown_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
|
+
emv_tag_breakdown_list == o.emv_tag_breakdown_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
|
+
[emv_tag_breakdown_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
|
data/lib/cybersource_rest_client/models/tss_v2_get_emv_tags200_response_emv_tag_breakdown_list.rb
ADDED
@@ -0,0 +1,215 @@
|
|
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 TssV2GetEmvTags200ResponseEmvTagBreakdownList
|
17
|
+
# Hexadecimal code of tag.
|
18
|
+
attr_accessor :tag
|
19
|
+
|
20
|
+
# Name of tag.
|
21
|
+
attr_accessor :name
|
22
|
+
|
23
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
24
|
+
def self.attribute_map
|
25
|
+
{
|
26
|
+
:'tag' => :'tag',
|
27
|
+
:'name' => :'name'
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
# Attribute type mapping.
|
32
|
+
def self.swagger_types
|
33
|
+
{
|
34
|
+
:'tag' => :'String',
|
35
|
+
:'name' => :'String'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# Initializes the object
|
40
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
41
|
+
def initialize(attributes = {})
|
42
|
+
return unless attributes.is_a?(Hash)
|
43
|
+
|
44
|
+
# convert string to symbol for hash key
|
45
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
46
|
+
|
47
|
+
if attributes.has_key?(:'tag')
|
48
|
+
self.tag = attributes[:'tag']
|
49
|
+
end
|
50
|
+
|
51
|
+
if attributes.has_key?(:'name')
|
52
|
+
self.name = attributes[:'name']
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
57
|
+
# @return Array for valid properties with the reasons
|
58
|
+
def list_invalid_properties
|
59
|
+
invalid_properties = Array.new
|
60
|
+
#if !@tag.nil? && @tag !~ Regexp.new(/^[0-9A-F]*$/)
|
61
|
+
#invalid_properties.push('invalid value for "tag", must conform to the pattern /^[0-9A-F]*$/.')
|
62
|
+
#end
|
63
|
+
|
64
|
+
invalid_properties
|
65
|
+
end
|
66
|
+
|
67
|
+
# Check to see if the all the properties in the model are valid
|
68
|
+
# @return true if the model is valid
|
69
|
+
def valid?
|
70
|
+
#return false if !@tag.nil? && @tag !~ Regexp.new(/^[0-9A-F]*$/)
|
71
|
+
true
|
72
|
+
end
|
73
|
+
|
74
|
+
# Custom attribute writer method with validation
|
75
|
+
# @param [Object] tag Value to be assigned
|
76
|
+
def tag=(tag)
|
77
|
+
#if !tag.nil? && tag !~ Regexp.new(/^[0-9A-F]*$/)
|
78
|
+
#fail ArgumentError, 'invalid value for "tag", must conform to the pattern /^[0-9A-F]*$/.'
|
79
|
+
#end
|
80
|
+
|
81
|
+
@tag = tag
|
82
|
+
end
|
83
|
+
|
84
|
+
# Custom attribute writer method with validation
|
85
|
+
# @param [Object] name Value to be assigned
|
86
|
+
def name=(name)
|
87
|
+
@name = name
|
88
|
+
end
|
89
|
+
|
90
|
+
# Checks equality by comparing each attribute.
|
91
|
+
# @param [Object] Object to be compared
|
92
|
+
def ==(o)
|
93
|
+
return true if self.equal?(o)
|
94
|
+
self.class == o.class &&
|
95
|
+
tag == o.tag &&
|
96
|
+
name == o.name
|
97
|
+
end
|
98
|
+
|
99
|
+
# @see the `==` method
|
100
|
+
# @param [Object] Object to be compared
|
101
|
+
def eql?(o)
|
102
|
+
self == o
|
103
|
+
end
|
104
|
+
|
105
|
+
# Calculates hash code according to all attributes.
|
106
|
+
# @return [Fixnum] Hash code
|
107
|
+
def hash
|
108
|
+
[tag, name].hash
|
109
|
+
end
|
110
|
+
|
111
|
+
# Builds the object from hash
|
112
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
113
|
+
# @return [Object] Returns the model itself
|
114
|
+
def build_from_hash(attributes)
|
115
|
+
return nil unless attributes.is_a?(Hash)
|
116
|
+
self.class.swagger_types.each_pair do |key, type|
|
117
|
+
if type =~ /\AArray<(.*)>/i
|
118
|
+
# check to ensure the input is an array given that the the attribute
|
119
|
+
# is documented as an array but the input is not
|
120
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
121
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
122
|
+
end
|
123
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
124
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
125
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
126
|
+
end
|
127
|
+
|
128
|
+
self
|
129
|
+
end
|
130
|
+
|
131
|
+
# Deserializes the data based on type
|
132
|
+
# @param string type Data type
|
133
|
+
# @param string value Value to be deserialized
|
134
|
+
# @return [Object] Deserialized data
|
135
|
+
def _deserialize(type, value)
|
136
|
+
case type.to_sym
|
137
|
+
when :DateTime
|
138
|
+
DateTime.parse(value)
|
139
|
+
when :Date
|
140
|
+
Date.parse(value)
|
141
|
+
when :String
|
142
|
+
value.to_s
|
143
|
+
when :Integer
|
144
|
+
value.to_i
|
145
|
+
when :Float
|
146
|
+
value.to_f
|
147
|
+
when :BOOLEAN
|
148
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
149
|
+
true
|
150
|
+
else
|
151
|
+
false
|
152
|
+
end
|
153
|
+
when :Object
|
154
|
+
# generic object (usually a Hash), return directly
|
155
|
+
value
|
156
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
157
|
+
inner_type = Regexp.last_match[:inner_type]
|
158
|
+
value.map { |v| _deserialize(inner_type, v) }
|
159
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
160
|
+
k_type = Regexp.last_match[:k_type]
|
161
|
+
v_type = Regexp.last_match[:v_type]
|
162
|
+
{}.tap do |hash|
|
163
|
+
value.each do |k, v|
|
164
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
else # model
|
168
|
+
temp_model = CyberSource.const_get(type).new
|
169
|
+
temp_model.build_from_hash(value)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
# Returns the string representation of the object
|
174
|
+
# @return [String] String presentation of the object
|
175
|
+
def to_s
|
176
|
+
to_hash.to_s
|
177
|
+
end
|
178
|
+
|
179
|
+
# to_body is an alias to to_hash (backward compatibility)
|
180
|
+
# @return [Hash] Returns the object in the form of hash
|
181
|
+
def to_body
|
182
|
+
to_hash
|
183
|
+
end
|
184
|
+
|
185
|
+
# Returns the object in the form of hash
|
186
|
+
# @return [Hash] Returns the object in the form of hash
|
187
|
+
def to_hash
|
188
|
+
hash = {}
|
189
|
+
self.class.attribute_map.each_pair do |attr, param|
|
190
|
+
value = self.send(attr)
|
191
|
+
next if value.nil?
|
192
|
+
hash[param] = _to_hash(value)
|
193
|
+
end
|
194
|
+
hash
|
195
|
+
end
|
196
|
+
|
197
|
+
# Outputs non-array value in the form of hash
|
198
|
+
# For object, use to_hash. Otherwise, just return the value
|
199
|
+
# @param [Object] value Any valid value
|
200
|
+
# @return [Hash] Returns the value in the form of hash
|
201
|
+
def _to_hash(value)
|
202
|
+
if value.is_a?(Array)
|
203
|
+
value.compact.map { |v| _to_hash(v) }
|
204
|
+
elsif value.is_a?(Hash)
|
205
|
+
{}.tap do |hash|
|
206
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
207
|
+
end
|
208
|
+
elsif value.respond_to? :to_hash
|
209
|
+
value.to_hash
|
210
|
+
else
|
211
|
+
value
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|