cybersource_rest_client 0.0.24 → 0.0.25
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 +18 -44
- data/lib/cybersource_rest_client/api/asymmetric_key_management_api.rb +9 -9
- data/lib/cybersource_rest_client/api/symmetric_key_management_api.rb +9 -9
- data/lib/cybersource_rest_client/api/tokenization_api.rb +89 -0
- data/lib/cybersource_rest_client/models/{tokenize_result.rb → flex_v1_tokens_post200_response.rb} +1 -1
- data/lib/cybersource_rest_client/models/{card_info.rb → flexv1tokens_card_info.rb} +1 -1
- data/lib/cybersource_rest_client/models/{inline_response_200_3.rb → kms_v2_keys_asym_deletes_post200_response.rb} +2 -2
- data/lib/cybersource_rest_client/models/{inline_response_200_3_key_information.rb → kms_v2_keys_asym_deletes_post200_response_key_information.rb} +2 -2
- data/lib/cybersource_rest_client/models/{inline_response_200_2.rb → kms_v2_keys_asym_get200_response.rb} +2 -2
- data/lib/cybersource_rest_client/models/{inline_response_200_2_key_information.rb → kms_v2_keys_asym_get200_response_key_information.rb} +2 -2
- data/lib/cybersource_rest_client/models/{inline_response_201_1.rb → kms_v2_keys_asym_post201_response.rb} +3 -3
- data/lib/cybersource_rest_client/models/{inline_response_201_1_certificate_information.rb → kms_v2_keys_asym_post201_response_certificate_information.rb} +1 -1
- data/lib/cybersource_rest_client/models/{inline_response_201_1_key_information.rb → kms_v2_keys_asym_post201_response_key_information.rb} +2 -2
- data/lib/cybersource_rest_client/models/{inline_response_200_1.rb → kms_v2_keys_sym_deletes_post200_response.rb} +2 -2
- data/lib/cybersource_rest_client/models/{inline_response_200_1_key_information.rb → kms_v2_keys_sym_deletes_post200_response_key_information.rb} +2 -2
- data/lib/cybersource_rest_client/models/{inline_response_200.rb → kms_v2_keys_sym_get200_response.rb} +2 -2
- data/lib/cybersource_rest_client/models/{inline_response_200_key_information.rb → kms_v2_keys_sym_get200_response_key_information.rb} +2 -2
- data/lib/cybersource_rest_client/models/{inline_response_201.rb → kms_v2_keys_sym_post201_response.rb} +2 -2
- data/lib/cybersource_rest_client/models/{inline_response_201_error_information.rb → kms_v2_keys_sym_post201_response_error_information.rb} +1 -1
- data/lib/cybersource_rest_client/models/{inline_response_201_key_information.rb → kms_v2_keys_sym_post201_response_key_information.rb} +2 -2
- data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_processor_information.rb +6 -6
- data/lib/cybersource_rest_client/models/pts_v2_payments_reversals_post201_response_processor_information.rb +6 -6
- data/lib/cybersource_rest_client/models/ptsv2credits_processing_information.rb +1 -1
- data/lib/cybersource_rest_client/models/ptsv2payments_processing_information.rb +1 -1
- data/lib/cybersource_rest_client/models/{tokenize_parameters.rb → tokenize_request.rb} +2 -2
- data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_processing_information.rb +1 -1
- data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_processing_information.rb +1 -1
- metadata +20 -46
- data/lib/cybersource_rest_client/models/customer.rb +0 -292
- data/lib/cybersource_rest_client/models/der_public_key.rb +0 -205
- data/lib/cybersource_rest_client/models/error.rb +0 -192
- data/lib/cybersource_rest_client/models/error_bean.rb +0 -247
- data/lib/cybersource_rest_client/models/error_field_bean.rb +0 -205
- data/lib/cybersource_rest_client/models/error_links.rb +0 -205
- data/lib/cybersource_rest_client/models/error_response.rb +0 -192
- data/lib/cybersource_rest_client/models/file_bean.rb +0 -202
- data/lib/cybersource_rest_client/models/file_detail.rb +0 -244
- data/lib/cybersource_rest_client/models/file_details_response.rb +0 -194
- data/lib/cybersource_rest_client/models/instrument_identifier.rb +0 -286
- data/lib/cybersource_rest_client/models/json_web_key.rb +0 -225
- data/lib/cybersource_rest_client/models/key_parameters.rb +0 -199
- data/lib/cybersource_rest_client/models/key_result.rb +0 -202
- data/lib/cybersource_rest_client/models/link.rb +0 -204
- data/lib/cybersource_rest_client/models/links.rb +0 -205
- data/lib/cybersource_rest_client/models/payment_instrument.rb +0 -318
- data/lib/cybersource_rest_client/models/payment_instrument_paginated.rb +0 -232
- data/lib/cybersource_rest_client/models/response_status.rb +0 -225
- data/lib/cybersource_rest_client/models/response_status_details.rb +0 -194
- data/lib/cybersource_rest_client/models/self_link_bean.rb +0 -192
- data/lib/cybersource_rest_client/models/shipping_address.rb +0 -235
- data/lib/cybersource_rest_client/models/shipping_address_paginated.rb +0 -233
- data/lib/cybersource_rest_client/models/tms_error.rb +0 -205
- data/lib/cybersource_rest_client/models/tms_error_details.rb +0 -194
- data/lib/cybersource_rest_client/models/tms_error_response.rb +0 -185
- data/lib/cybersource_rest_client/models/tokenize_parameters_card_info.rb +0 -224
@@ -1,205 +0,0 @@
|
|
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 ErrorLinks
|
17
|
-
attr_accessor :_self
|
18
|
-
|
19
|
-
attr_accessor :documentation
|
20
|
-
|
21
|
-
attr_accessor :_next
|
22
|
-
|
23
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
24
|
-
def self.attribute_map
|
25
|
-
{
|
26
|
-
:'_self' => :'self',
|
27
|
-
:'documentation' => :'documentation',
|
28
|
-
:'_next' => :'next'
|
29
|
-
}
|
30
|
-
end
|
31
|
-
|
32
|
-
# Attribute type mapping.
|
33
|
-
def self.swagger_types
|
34
|
-
{
|
35
|
-
:'_self' => :'InlineResponseDefaultLinksNext',
|
36
|
-
:'documentation' => :'Array<InlineResponseDefaultLinksNext>',
|
37
|
-
:'_next' => :'Array<InlineResponseDefaultLinksNext>'
|
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?(:'self')
|
50
|
-
self._self = attributes[:'self']
|
51
|
-
end
|
52
|
-
|
53
|
-
if attributes.has_key?(:'documentation')
|
54
|
-
if (value = attributes[:'documentation']).is_a?(Array)
|
55
|
-
self.documentation = value
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
if attributes.has_key?(:'next')
|
60
|
-
if (value = attributes[:'next']).is_a?(Array)
|
61
|
-
self._next = value
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
67
|
-
# @return Array for valid properties with the reasons
|
68
|
-
def list_invalid_properties
|
69
|
-
invalid_properties = Array.new
|
70
|
-
invalid_properties
|
71
|
-
end
|
72
|
-
|
73
|
-
# Check to see if the all the properties in the model are valid
|
74
|
-
# @return true if the model is valid
|
75
|
-
def valid?
|
76
|
-
true
|
77
|
-
end
|
78
|
-
|
79
|
-
# Checks equality by comparing each attribute.
|
80
|
-
# @param [Object] Object to be compared
|
81
|
-
def ==(o)
|
82
|
-
return true if self.equal?(o)
|
83
|
-
self.class == o.class &&
|
84
|
-
_self == o._self &&
|
85
|
-
documentation == o.documentation &&
|
86
|
-
_next == o._next
|
87
|
-
end
|
88
|
-
|
89
|
-
# @see the `==` method
|
90
|
-
# @param [Object] Object to be compared
|
91
|
-
def eql?(o)
|
92
|
-
self == o
|
93
|
-
end
|
94
|
-
|
95
|
-
# Calculates hash code according to all attributes.
|
96
|
-
# @return [Fixnum] Hash code
|
97
|
-
def hash
|
98
|
-
[_self, documentation, _next].hash
|
99
|
-
end
|
100
|
-
|
101
|
-
# Builds the object from hash
|
102
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
103
|
-
# @return [Object] Returns the model itself
|
104
|
-
def build_from_hash(attributes)
|
105
|
-
return nil unless attributes.is_a?(Hash)
|
106
|
-
self.class.swagger_types.each_pair do |key, type|
|
107
|
-
if type =~ /\AArray<(.*)>/i
|
108
|
-
# check to ensure the input is an array given that the the attribute
|
109
|
-
# is documented as an array but the input is not
|
110
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
111
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
112
|
-
end
|
113
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
114
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
115
|
-
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
116
|
-
end
|
117
|
-
|
118
|
-
self
|
119
|
-
end
|
120
|
-
|
121
|
-
# Deserializes the data based on type
|
122
|
-
# @param string type Data type
|
123
|
-
# @param string value Value to be deserialized
|
124
|
-
# @return [Object] Deserialized data
|
125
|
-
def _deserialize(type, value)
|
126
|
-
case type.to_sym
|
127
|
-
when :DateTime
|
128
|
-
DateTime.parse(value)
|
129
|
-
when :Date
|
130
|
-
Date.parse(value)
|
131
|
-
when :String
|
132
|
-
value.to_s
|
133
|
-
when :Integer
|
134
|
-
value.to_i
|
135
|
-
when :Float
|
136
|
-
value.to_f
|
137
|
-
when :BOOLEAN
|
138
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
139
|
-
true
|
140
|
-
else
|
141
|
-
false
|
142
|
-
end
|
143
|
-
when :Object
|
144
|
-
# generic object (usually a Hash), return directly
|
145
|
-
value
|
146
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
147
|
-
inner_type = Regexp.last_match[:inner_type]
|
148
|
-
value.map { |v| _deserialize(inner_type, v) }
|
149
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
150
|
-
k_type = Regexp.last_match[:k_type]
|
151
|
-
v_type = Regexp.last_match[:v_type]
|
152
|
-
{}.tap do |hash|
|
153
|
-
value.each do |k, v|
|
154
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
155
|
-
end
|
156
|
-
end
|
157
|
-
else # model
|
158
|
-
temp_model = CyberSource.const_get(type).new
|
159
|
-
temp_model.build_from_hash(value)
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
|
-
# Returns the string representation of the object
|
164
|
-
# @return [String] String presentation of the object
|
165
|
-
def to_s
|
166
|
-
to_hash.to_s
|
167
|
-
end
|
168
|
-
|
169
|
-
# to_body is an alias to to_hash (backward compatibility)
|
170
|
-
# @return [Hash] Returns the object in the form of hash
|
171
|
-
def to_body
|
172
|
-
to_hash
|
173
|
-
end
|
174
|
-
|
175
|
-
# Returns the object in the form of hash
|
176
|
-
# @return [Hash] Returns the object in the form of hash
|
177
|
-
def to_hash
|
178
|
-
hash = {}
|
179
|
-
self.class.attribute_map.each_pair do |attr, param|
|
180
|
-
value = self.send(attr)
|
181
|
-
next if value.nil?
|
182
|
-
hash[param] = _to_hash(value)
|
183
|
-
end
|
184
|
-
hash
|
185
|
-
end
|
186
|
-
|
187
|
-
# Outputs non-array value in the form of hash
|
188
|
-
# For object, use to_hash. Otherwise, just return the value
|
189
|
-
# @param [Object] value Any valid value
|
190
|
-
# @return [Hash] Returns the value in the form of hash
|
191
|
-
def _to_hash(value)
|
192
|
-
if value.is_a?(Array)
|
193
|
-
value.compact.map { |v| _to_hash(v) }
|
194
|
-
elsif value.is_a?(Hash)
|
195
|
-
{}.tap do |hash|
|
196
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
197
|
-
end
|
198
|
-
elsif value.respond_to? :to_hash
|
199
|
-
value.to_hash
|
200
|
-
else
|
201
|
-
value
|
202
|
-
end
|
203
|
-
end
|
204
|
-
end
|
205
|
-
end
|
@@ -1,192 +0,0 @@
|
|
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 ErrorResponse
|
17
|
-
attr_accessor :response_status
|
18
|
-
|
19
|
-
attr_accessor :_links
|
20
|
-
|
21
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
-
def self.attribute_map
|
23
|
-
{
|
24
|
-
:'response_status' => :'responseStatus',
|
25
|
-
:'_links' => :'_links'
|
26
|
-
}
|
27
|
-
end
|
28
|
-
|
29
|
-
# Attribute type mapping.
|
30
|
-
def self.swagger_types
|
31
|
-
{
|
32
|
-
:'response_status' => :'InlineResponseDefaultResponseStatus',
|
33
|
-
:'_links' => :'InlineResponseDefaultLinks'
|
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?(:'responseStatus')
|
46
|
-
self.response_status = attributes[:'responseStatus']
|
47
|
-
end
|
48
|
-
|
49
|
-
if attributes.has_key?(:'_links')
|
50
|
-
self._links = attributes[:'_links']
|
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
|
-
response_status == o.response_status &&
|
73
|
-
_links == o._links
|
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
|
-
[response_status, _links].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
|
@@ -1,202 +0,0 @@
|
|
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 FileBean
|
17
|
-
# Unique identifier for each file
|
18
|
-
attr_accessor :file_id
|
19
|
-
|
20
|
-
attr_accessor :href
|
21
|
-
|
22
|
-
attr_accessor :method
|
23
|
-
|
24
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
-
def self.attribute_map
|
26
|
-
{
|
27
|
-
:'file_id' => :'fileId',
|
28
|
-
:'href' => :'href',
|
29
|
-
:'method' => :'method'
|
30
|
-
}
|
31
|
-
end
|
32
|
-
|
33
|
-
# Attribute type mapping.
|
34
|
-
def self.swagger_types
|
35
|
-
{
|
36
|
-
:'file_id' => :'String',
|
37
|
-
:'href' => :'String',
|
38
|
-
:'method' => :'String'
|
39
|
-
}
|
40
|
-
end
|
41
|
-
|
42
|
-
# Initializes the object
|
43
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
44
|
-
def initialize(attributes = {})
|
45
|
-
return unless attributes.is_a?(Hash)
|
46
|
-
|
47
|
-
# convert string to symbol for hash key
|
48
|
-
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
49
|
-
|
50
|
-
if attributes.has_key?(:'fileId')
|
51
|
-
self.file_id = attributes[:'fileId']
|
52
|
-
end
|
53
|
-
|
54
|
-
if attributes.has_key?(:'href')
|
55
|
-
self.href = attributes[:'href']
|
56
|
-
end
|
57
|
-
|
58
|
-
if attributes.has_key?(:'method')
|
59
|
-
self.method = attributes[:'method']
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
64
|
-
# @return Array for valid properties with the reasons
|
65
|
-
def list_invalid_properties
|
66
|
-
invalid_properties = Array.new
|
67
|
-
invalid_properties
|
68
|
-
end
|
69
|
-
|
70
|
-
# Check to see if the all the properties in the model are valid
|
71
|
-
# @return true if the model is valid
|
72
|
-
def valid?
|
73
|
-
true
|
74
|
-
end
|
75
|
-
|
76
|
-
# Checks equality by comparing each attribute.
|
77
|
-
# @param [Object] Object to be compared
|
78
|
-
def ==(o)
|
79
|
-
return true if self.equal?(o)
|
80
|
-
self.class == o.class &&
|
81
|
-
file_id == o.file_id &&
|
82
|
-
href == o.href &&
|
83
|
-
method == o.method
|
84
|
-
end
|
85
|
-
|
86
|
-
# @see the `==` method
|
87
|
-
# @param [Object] Object to be compared
|
88
|
-
def eql?(o)
|
89
|
-
self == o
|
90
|
-
end
|
91
|
-
|
92
|
-
# Calculates hash code according to all attributes.
|
93
|
-
# @return [Fixnum] Hash code
|
94
|
-
def hash
|
95
|
-
[file_id, href, method].hash
|
96
|
-
end
|
97
|
-
|
98
|
-
# Builds the object from hash
|
99
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
100
|
-
# @return [Object] Returns the model itself
|
101
|
-
def build_from_hash(attributes)
|
102
|
-
return nil unless attributes.is_a?(Hash)
|
103
|
-
self.class.swagger_types.each_pair do |key, type|
|
104
|
-
if type =~ /\AArray<(.*)>/i
|
105
|
-
# check to ensure the input is an array given that the the attribute
|
106
|
-
# is documented as an array but the input is not
|
107
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
108
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
109
|
-
end
|
110
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
111
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
112
|
-
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
113
|
-
end
|
114
|
-
|
115
|
-
self
|
116
|
-
end
|
117
|
-
|
118
|
-
# Deserializes the data based on type
|
119
|
-
# @param string type Data type
|
120
|
-
# @param string value Value to be deserialized
|
121
|
-
# @return [Object] Deserialized data
|
122
|
-
def _deserialize(type, value)
|
123
|
-
case type.to_sym
|
124
|
-
when :DateTime
|
125
|
-
DateTime.parse(value)
|
126
|
-
when :Date
|
127
|
-
Date.parse(value)
|
128
|
-
when :String
|
129
|
-
value.to_s
|
130
|
-
when :Integer
|
131
|
-
value.to_i
|
132
|
-
when :Float
|
133
|
-
value.to_f
|
134
|
-
when :BOOLEAN
|
135
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
136
|
-
true
|
137
|
-
else
|
138
|
-
false
|
139
|
-
end
|
140
|
-
when :Object
|
141
|
-
# generic object (usually a Hash), return directly
|
142
|
-
value
|
143
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
144
|
-
inner_type = Regexp.last_match[:inner_type]
|
145
|
-
value.map { |v| _deserialize(inner_type, v) }
|
146
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
147
|
-
k_type = Regexp.last_match[:k_type]
|
148
|
-
v_type = Regexp.last_match[:v_type]
|
149
|
-
{}.tap do |hash|
|
150
|
-
value.each do |k, v|
|
151
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
152
|
-
end
|
153
|
-
end
|
154
|
-
else # model
|
155
|
-
temp_model = CyberSource.const_get(type).new
|
156
|
-
temp_model.build_from_hash(value)
|
157
|
-
end
|
158
|
-
end
|
159
|
-
|
160
|
-
# Returns the string representation of the object
|
161
|
-
# @return [String] String presentation of the object
|
162
|
-
def to_s
|
163
|
-
to_hash.to_s
|
164
|
-
end
|
165
|
-
|
166
|
-
# to_body is an alias to to_hash (backward compatibility)
|
167
|
-
# @return [Hash] Returns the object in the form of hash
|
168
|
-
def to_body
|
169
|
-
to_hash
|
170
|
-
end
|
171
|
-
|
172
|
-
# Returns the object in the form of hash
|
173
|
-
# @return [Hash] Returns the object in the form of hash
|
174
|
-
def to_hash
|
175
|
-
hash = {}
|
176
|
-
self.class.attribute_map.each_pair do |attr, param|
|
177
|
-
value = self.send(attr)
|
178
|
-
next if value.nil?
|
179
|
-
hash[param] = _to_hash(value)
|
180
|
-
end
|
181
|
-
hash
|
182
|
-
end
|
183
|
-
|
184
|
-
# Outputs non-array value in the form of hash
|
185
|
-
# For object, use to_hash. Otherwise, just return the value
|
186
|
-
# @param [Object] value Any valid value
|
187
|
-
# @return [Hash] Returns the value in the form of hash
|
188
|
-
def _to_hash(value)
|
189
|
-
if value.is_a?(Array)
|
190
|
-
value.compact.map { |v| _to_hash(v) }
|
191
|
-
elsif value.is_a?(Hash)
|
192
|
-
{}.tap do |hash|
|
193
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
194
|
-
end
|
195
|
-
elsif value.respond_to? :to_hash
|
196
|
-
value.to_hash
|
197
|
-
else
|
198
|
-
value
|
199
|
-
end
|
200
|
-
end
|
201
|
-
end
|
202
|
-
end
|