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.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cybersource_rest_client.rb +18 -44
  3. data/lib/cybersource_rest_client/api/asymmetric_key_management_api.rb +9 -9
  4. data/lib/cybersource_rest_client/api/symmetric_key_management_api.rb +9 -9
  5. data/lib/cybersource_rest_client/api/tokenization_api.rb +89 -0
  6. data/lib/cybersource_rest_client/models/{tokenize_result.rb → flex_v1_tokens_post200_response.rb} +1 -1
  7. data/lib/cybersource_rest_client/models/{card_info.rb → flexv1tokens_card_info.rb} +1 -1
  8. data/lib/cybersource_rest_client/models/{inline_response_200_3.rb → kms_v2_keys_asym_deletes_post200_response.rb} +2 -2
  9. 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
  10. data/lib/cybersource_rest_client/models/{inline_response_200_2.rb → kms_v2_keys_asym_get200_response.rb} +2 -2
  11. data/lib/cybersource_rest_client/models/{inline_response_200_2_key_information.rb → kms_v2_keys_asym_get200_response_key_information.rb} +2 -2
  12. data/lib/cybersource_rest_client/models/{inline_response_201_1.rb → kms_v2_keys_asym_post201_response.rb} +3 -3
  13. data/lib/cybersource_rest_client/models/{inline_response_201_1_certificate_information.rb → kms_v2_keys_asym_post201_response_certificate_information.rb} +1 -1
  14. data/lib/cybersource_rest_client/models/{inline_response_201_1_key_information.rb → kms_v2_keys_asym_post201_response_key_information.rb} +2 -2
  15. data/lib/cybersource_rest_client/models/{inline_response_200_1.rb → kms_v2_keys_sym_deletes_post200_response.rb} +2 -2
  16. 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
  17. data/lib/cybersource_rest_client/models/{inline_response_200.rb → kms_v2_keys_sym_get200_response.rb} +2 -2
  18. data/lib/cybersource_rest_client/models/{inline_response_200_key_information.rb → kms_v2_keys_sym_get200_response_key_information.rb} +2 -2
  19. data/lib/cybersource_rest_client/models/{inline_response_201.rb → kms_v2_keys_sym_post201_response.rb} +2 -2
  20. data/lib/cybersource_rest_client/models/{inline_response_201_error_information.rb → kms_v2_keys_sym_post201_response_error_information.rb} +1 -1
  21. data/lib/cybersource_rest_client/models/{inline_response_201_key_information.rb → kms_v2_keys_sym_post201_response_key_information.rb} +2 -2
  22. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_processor_information.rb +6 -6
  23. data/lib/cybersource_rest_client/models/pts_v2_payments_reversals_post201_response_processor_information.rb +6 -6
  24. data/lib/cybersource_rest_client/models/ptsv2credits_processing_information.rb +1 -1
  25. data/lib/cybersource_rest_client/models/ptsv2payments_processing_information.rb +1 -1
  26. data/lib/cybersource_rest_client/models/{tokenize_parameters.rb → tokenize_request.rb} +2 -2
  27. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_processing_information.rb +1 -1
  28. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_processing_information.rb +1 -1
  29. metadata +20 -46
  30. data/lib/cybersource_rest_client/models/customer.rb +0 -292
  31. data/lib/cybersource_rest_client/models/der_public_key.rb +0 -205
  32. data/lib/cybersource_rest_client/models/error.rb +0 -192
  33. data/lib/cybersource_rest_client/models/error_bean.rb +0 -247
  34. data/lib/cybersource_rest_client/models/error_field_bean.rb +0 -205
  35. data/lib/cybersource_rest_client/models/error_links.rb +0 -205
  36. data/lib/cybersource_rest_client/models/error_response.rb +0 -192
  37. data/lib/cybersource_rest_client/models/file_bean.rb +0 -202
  38. data/lib/cybersource_rest_client/models/file_detail.rb +0 -244
  39. data/lib/cybersource_rest_client/models/file_details_response.rb +0 -194
  40. data/lib/cybersource_rest_client/models/instrument_identifier.rb +0 -286
  41. data/lib/cybersource_rest_client/models/json_web_key.rb +0 -225
  42. data/lib/cybersource_rest_client/models/key_parameters.rb +0 -199
  43. data/lib/cybersource_rest_client/models/key_result.rb +0 -202
  44. data/lib/cybersource_rest_client/models/link.rb +0 -204
  45. data/lib/cybersource_rest_client/models/links.rb +0 -205
  46. data/lib/cybersource_rest_client/models/payment_instrument.rb +0 -318
  47. data/lib/cybersource_rest_client/models/payment_instrument_paginated.rb +0 -232
  48. data/lib/cybersource_rest_client/models/response_status.rb +0 -225
  49. data/lib/cybersource_rest_client/models/response_status_details.rb +0 -194
  50. data/lib/cybersource_rest_client/models/self_link_bean.rb +0 -192
  51. data/lib/cybersource_rest_client/models/shipping_address.rb +0 -235
  52. data/lib/cybersource_rest_client/models/shipping_address_paginated.rb +0 -233
  53. data/lib/cybersource_rest_client/models/tms_error.rb +0 -205
  54. data/lib/cybersource_rest_client/models/tms_error_details.rb +0 -194
  55. data/lib/cybersource_rest_client/models/tms_error_response.rb +0 -185
  56. data/lib/cybersource_rest_client/models/tokenize_parameters_card_info.rb +0 -224
@@ -1,204 +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 Link
17
- # URI of the linked resource.
18
- attr_accessor :href
19
-
20
- # Label of the linked resource.
21
- attr_accessor :title
22
-
23
- # HTTP method of the linked resource.
24
- attr_accessor :method
25
-
26
- # Attribute mapping from ruby-style variable name to JSON key.
27
- def self.attribute_map
28
- {
29
- :'href' => :'href',
30
- :'title' => :'title',
31
- :'method' => :'method'
32
- }
33
- end
34
-
35
- # Attribute type mapping.
36
- def self.swagger_types
37
- {
38
- :'href' => :'String',
39
- :'title' => :'String',
40
- :'method' => :'String'
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?(:'href')
53
- self.href = attributes[:'href']
54
- end
55
-
56
- if attributes.has_key?(:'title')
57
- self.title = attributes[:'title']
58
- end
59
-
60
- if attributes.has_key?(:'method')
61
- self.method = attributes[:'method']
62
- end
63
- end
64
-
65
- # Show invalid properties with the reasons. Usually used together with valid?
66
- # @return Array for valid properties with the reasons
67
- def list_invalid_properties
68
- invalid_properties = Array.new
69
- invalid_properties
70
- end
71
-
72
- # Check to see if the all the properties in the model are valid
73
- # @return true if the model is valid
74
- def valid?
75
- true
76
- end
77
-
78
- # Checks equality by comparing each attribute.
79
- # @param [Object] Object to be compared
80
- def ==(o)
81
- return true if self.equal?(o)
82
- self.class == o.class &&
83
- href == o.href &&
84
- title == o.title &&
85
- method == o.method
86
- end
87
-
88
- # @see the `==` method
89
- # @param [Object] Object to be compared
90
- def eql?(o)
91
- self == o
92
- end
93
-
94
- # Calculates hash code according to all attributes.
95
- # @return [Fixnum] Hash code
96
- def hash
97
- [href, title, method].hash
98
- end
99
-
100
- # Builds the object from hash
101
- # @param [Hash] attributes Model attributes in the form of hash
102
- # @return [Object] Returns the model itself
103
- def build_from_hash(attributes)
104
- return nil unless attributes.is_a?(Hash)
105
- self.class.swagger_types.each_pair do |key, type|
106
- if type =~ /\AArray<(.*)>/i
107
- # check to ensure the input is an array given that the the attribute
108
- # is documented as an array but the input is not
109
- if attributes[self.class.attribute_map[key]].is_a?(Array)
110
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
111
- end
112
- elsif !attributes[self.class.attribute_map[key]].nil?
113
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
114
- end # or else data not found in attributes(hash), not an issue as the data can be optional
115
- end
116
-
117
- self
118
- end
119
-
120
- # Deserializes the data based on type
121
- # @param string type Data type
122
- # @param string value Value to be deserialized
123
- # @return [Object] Deserialized data
124
- def _deserialize(type, value)
125
- case type.to_sym
126
- when :DateTime
127
- DateTime.parse(value)
128
- when :Date
129
- Date.parse(value)
130
- when :String
131
- value.to_s
132
- when :Integer
133
- value.to_i
134
- when :Float
135
- value.to_f
136
- when :BOOLEAN
137
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
138
- true
139
- else
140
- false
141
- end
142
- when :Object
143
- # generic object (usually a Hash), return directly
144
- value
145
- when /\AArray<(?<inner_type>.+)>\z/
146
- inner_type = Regexp.last_match[:inner_type]
147
- value.map { |v| _deserialize(inner_type, v) }
148
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
149
- k_type = Regexp.last_match[:k_type]
150
- v_type = Regexp.last_match[:v_type]
151
- {}.tap do |hash|
152
- value.each do |k, v|
153
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
154
- end
155
- end
156
- else # model
157
- temp_model = CyberSource.const_get(type).new
158
- temp_model.build_from_hash(value)
159
- end
160
- end
161
-
162
- # Returns the string representation of the object
163
- # @return [String] String presentation of the object
164
- def to_s
165
- to_hash.to_s
166
- end
167
-
168
- # to_body is an alias to to_hash (backward compatibility)
169
- # @return [Hash] Returns the object in the form of hash
170
- def to_body
171
- to_hash
172
- end
173
-
174
- # Returns the object in the form of hash
175
- # @return [Hash] Returns the object in the form of hash
176
- def to_hash
177
- hash = {}
178
- self.class.attribute_map.each_pair do |attr, param|
179
- value = self.send(attr)
180
- next if value.nil?
181
- hash[param] = _to_hash(value)
182
- end
183
- hash
184
- end
185
-
186
- # Outputs non-array value in the form of hash
187
- # For object, use to_hash. Otherwise, just return the value
188
- # @param [Object] value Any valid value
189
- # @return [Hash] Returns the value in the form of hash
190
- def _to_hash(value)
191
- if value.is_a?(Array)
192
- value.compact.map { |v| _to_hash(v) }
193
- elsif value.is_a?(Hash)
194
- {}.tap do |hash|
195
- value.each { |k, v| hash[k] = _to_hash(v) }
196
- end
197
- elsif value.respond_to? :to_hash
198
- value.to_hash
199
- else
200
- value
201
- end
202
- end
203
- end
204
- end
@@ -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 Links
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,318 +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 PaymentInstrument
17
- attr_accessor :_links
18
-
19
- # The id of the Payment Instrument Token.
20
- attr_accessor :id
21
-
22
- # The type of token. Valid values: - paymentInstrument
23
- attr_accessor :object
24
-
25
- # Issuers state for the card number. Valid values: - ACTIVE - CLOSED : The account has been closed.
26
- attr_accessor :state
27
-
28
- attr_accessor :bank_account
29
-
30
- attr_accessor :card
31
-
32
- attr_accessor :buyer_information
33
-
34
- attr_accessor :bill_to
35
-
36
- attr_accessor :processing_information
37
-
38
- attr_accessor :merchant_information
39
-
40
- attr_accessor :instrument_identifier
41
-
42
- attr_accessor :metadata
43
-
44
- attr_accessor :_embedded
45
-
46
- # Attribute mapping from ruby-style variable name to JSON key.
47
- def self.attribute_map
48
- {
49
- :'_links' => :'_links',
50
- :'id' => :'id',
51
- :'object' => :'object',
52
- :'state' => :'state',
53
- :'bank_account' => :'bankAccount',
54
- :'card' => :'card',
55
- :'buyer_information' => :'buyerInformation',
56
- :'bill_to' => :'billTo',
57
- :'processing_information' => :'processingInformation',
58
- :'merchant_information' => :'merchantInformation',
59
- :'instrument_identifier' => :'instrumentIdentifier',
60
- :'metadata' => :'metadata',
61
- :'_embedded' => :'_embedded'
62
- }
63
- end
64
-
65
- # Attribute type mapping.
66
- def self.swagger_types
67
- {
68
- :'_links' => :'Tmsv2customersEmbeddedDefaultPaymentInstrumentLinks',
69
- :'id' => :'String',
70
- :'object' => :'String',
71
- :'state' => :'String',
72
- :'bank_account' => :'Tmsv2customersEmbeddedDefaultPaymentInstrumentBankAccount',
73
- :'card' => :'Tmsv2customersEmbeddedDefaultPaymentInstrumentCard',
74
- :'buyer_information' => :'Tmsv2customersEmbeddedDefaultPaymentInstrumentBuyerInformation',
75
- :'bill_to' => :'Tmsv2customersEmbeddedDefaultPaymentInstrumentBillTo',
76
- :'processing_information' => :'Tmsv2customersEmbeddedDefaultPaymentInstrumentProcessingInformation',
77
- :'merchant_information' => :'Tmsv2customersEmbeddedDefaultPaymentInstrumentMerchantInformation',
78
- :'instrument_identifier' => :'Tmsv2customersEmbeddedDefaultPaymentInstrumentInstrumentIdentifier',
79
- :'metadata' => :'Tmsv2customersEmbeddedDefaultPaymentInstrumentMetadata',
80
- :'_embedded' => :'Tmsv2customersEmbeddedDefaultPaymentInstrumentEmbedded'
81
- }
82
- end
83
-
84
- # Initializes the object
85
- # @param [Hash] attributes Model attributes in the form of hash
86
- def initialize(attributes = {})
87
- return unless attributes.is_a?(Hash)
88
-
89
- # convert string to symbol for hash key
90
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
91
-
92
- if attributes.has_key?(:'_links')
93
- self._links = attributes[:'_links']
94
- end
95
-
96
- if attributes.has_key?(:'id')
97
- self.id = attributes[:'id']
98
- end
99
-
100
- if attributes.has_key?(:'object')
101
- self.object = attributes[:'object']
102
- end
103
-
104
- if attributes.has_key?(:'state')
105
- self.state = attributes[:'state']
106
- end
107
-
108
- if attributes.has_key?(:'bankAccount')
109
- self.bank_account = attributes[:'bankAccount']
110
- end
111
-
112
- if attributes.has_key?(:'card')
113
- self.card = attributes[:'card']
114
- end
115
-
116
- if attributes.has_key?(:'buyerInformation')
117
- self.buyer_information = attributes[:'buyerInformation']
118
- end
119
-
120
- if attributes.has_key?(:'billTo')
121
- self.bill_to = attributes[:'billTo']
122
- end
123
-
124
- if attributes.has_key?(:'processingInformation')
125
- self.processing_information = attributes[:'processingInformation']
126
- end
127
-
128
- if attributes.has_key?(:'merchantInformation')
129
- self.merchant_information = attributes[:'merchantInformation']
130
- end
131
-
132
- if attributes.has_key?(:'instrumentIdentifier')
133
- self.instrument_identifier = attributes[:'instrumentIdentifier']
134
- end
135
-
136
- if attributes.has_key?(:'metadata')
137
- self.metadata = attributes[:'metadata']
138
- end
139
-
140
- if attributes.has_key?(:'_embedded')
141
- self._embedded = attributes[:'_embedded']
142
- end
143
- end
144
-
145
- # Show invalid properties with the reasons. Usually used together with valid?
146
- # @return Array for valid properties with the reasons
147
- def list_invalid_properties
148
- invalid_properties = Array.new
149
- if !@id.nil? && @id.to_s.length > 32
150
- invalid_properties.push('invalid value for "id", the character length must be smaller than or equal to 32.')
151
- end
152
-
153
- if !@id.nil? && @id.to_s.length < 1
154
- invalid_properties.push('invalid value for "id", the character length must be great than or equal to 1.')
155
- end
156
-
157
- invalid_properties
158
- end
159
-
160
- # Check to see if the all the properties in the model are valid
161
- # @return true if the model is valid
162
- def valid?
163
- return false if !@id.nil? && @id.to_s.length > 32
164
- return false if !@id.nil? && @id.to_s.length < 1
165
- true
166
- end
167
-
168
- # Custom attribute writer method with validation
169
- # @param [Object] id Value to be assigned
170
- def id=(id)
171
- if !id.nil? && id.to_s.length > 32
172
- fail ArgumentError, 'invalid value for "id", the character length must be smaller than or equal to 32.'
173
- end
174
-
175
- if !id.nil? && id.to_s.length < 1
176
- fail ArgumentError, 'invalid value for "id", the character length must be great than or equal to 1.'
177
- end
178
-
179
- @id = id
180
- end
181
-
182
- # Checks equality by comparing each attribute.
183
- # @param [Object] Object to be compared
184
- def ==(o)
185
- return true if self.equal?(o)
186
- self.class == o.class &&
187
- _links == o._links &&
188
- id == o.id &&
189
- object == o.object &&
190
- state == o.state &&
191
- bank_account == o.bank_account &&
192
- card == o.card &&
193
- buyer_information == o.buyer_information &&
194
- bill_to == o.bill_to &&
195
- processing_information == o.processing_information &&
196
- merchant_information == o.merchant_information &&
197
- instrument_identifier == o.instrument_identifier &&
198
- metadata == o.metadata &&
199
- _embedded == o._embedded
200
- end
201
-
202
- # @see the `==` method
203
- # @param [Object] Object to be compared
204
- def eql?(o)
205
- self == o
206
- end
207
-
208
- # Calculates hash code according to all attributes.
209
- # @return [Fixnum] Hash code
210
- def hash
211
- [_links, id, object, state, bank_account, card, buyer_information, bill_to, processing_information, merchant_information, instrument_identifier, metadata, _embedded].hash
212
- end
213
-
214
- # Builds the object from hash
215
- # @param [Hash] attributes Model attributes in the form of hash
216
- # @return [Object] Returns the model itself
217
- def build_from_hash(attributes)
218
- return nil unless attributes.is_a?(Hash)
219
- self.class.swagger_types.each_pair do |key, type|
220
- if type =~ /\AArray<(.*)>/i
221
- # check to ensure the input is an array given that the the attribute
222
- # is documented as an array but the input is not
223
- if attributes[self.class.attribute_map[key]].is_a?(Array)
224
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
225
- end
226
- elsif !attributes[self.class.attribute_map[key]].nil?
227
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
228
- end # or else data not found in attributes(hash), not an issue as the data can be optional
229
- end
230
-
231
- self
232
- end
233
-
234
- # Deserializes the data based on type
235
- # @param string type Data type
236
- # @param string value Value to be deserialized
237
- # @return [Object] Deserialized data
238
- def _deserialize(type, value)
239
- case type.to_sym
240
- when :DateTime
241
- DateTime.parse(value)
242
- when :Date
243
- Date.parse(value)
244
- when :String
245
- value.to_s
246
- when :Integer
247
- value.to_i
248
- when :Float
249
- value.to_f
250
- when :BOOLEAN
251
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
252
- true
253
- else
254
- false
255
- end
256
- when :Object
257
- # generic object (usually a Hash), return directly
258
- value
259
- when /\AArray<(?<inner_type>.+)>\z/
260
- inner_type = Regexp.last_match[:inner_type]
261
- value.map { |v| _deserialize(inner_type, v) }
262
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
263
- k_type = Regexp.last_match[:k_type]
264
- v_type = Regexp.last_match[:v_type]
265
- {}.tap do |hash|
266
- value.each do |k, v|
267
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
268
- end
269
- end
270
- else # model
271
- temp_model = CyberSource.const_get(type).new
272
- temp_model.build_from_hash(value)
273
- end
274
- end
275
-
276
- # Returns the string representation of the object
277
- # @return [String] String presentation of the object
278
- def to_s
279
- to_hash.to_s
280
- end
281
-
282
- # to_body is an alias to to_hash (backward compatibility)
283
- # @return [Hash] Returns the object in the form of hash
284
- def to_body
285
- to_hash
286
- end
287
-
288
- # Returns the object in the form of hash
289
- # @return [Hash] Returns the object in the form of hash
290
- def to_hash
291
- hash = {}
292
- self.class.attribute_map.each_pair do |attr, param|
293
- value = self.send(attr)
294
- next if value.nil?
295
- hash[param] = _to_hash(value)
296
- end
297
- hash
298
- end
299
-
300
- # Outputs non-array value in the form of hash
301
- # For object, use to_hash. Otherwise, just return the value
302
- # @param [Object] value Any valid value
303
- # @return [Hash] Returns the value in the form of hash
304
- def _to_hash(value)
305
- if value.is_a?(Array)
306
- value.compact.map { |v| _to_hash(v) }
307
- elsif value.is_a?(Hash)
308
- {}.tap do |hash|
309
- value.each { |k, v| hash[k] = _to_hash(v) }
310
- end
311
- elsif value.respond_to? :to_hash
312
- value.to_hash
313
- else
314
- value
315
- end
316
- end
317
- end
318
- end