ultracart_api 3.4.9 → 3.4.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,202 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ OpenAPI spec version: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.15-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module UltracartClient
16
+ class PaymentsConfigurationRestrictionsTheme
17
+ attr_accessor :code
18
+
19
+ attr_accessor :restriction
20
+
21
+ attr_accessor :store_front_host_name
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'code' => :'code',
27
+ :'restriction' => :'restriction',
28
+ :'store_front_host_name' => :'storeFrontHostName'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ :'code' => :'String',
36
+ :'restriction' => :'String',
37
+ :'store_front_host_name' => :'String'
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?(:'code')
50
+ self.code = attributes[:'code']
51
+ end
52
+
53
+ if attributes.has_key?(:'restriction')
54
+ self.restriction = attributes[:'restriction']
55
+ end
56
+
57
+ if attributes.has_key?(:'storeFrontHostName')
58
+ self.store_front_host_name = attributes[:'storeFrontHostName']
59
+ end
60
+ end
61
+
62
+ # Show invalid properties with the reasons. Usually used together with valid?
63
+ # @return Array for valid properties with the reasons
64
+ def list_invalid_properties
65
+ invalid_properties = Array.new
66
+ invalid_properties
67
+ end
68
+
69
+ # Check to see if the all the properties in the model are valid
70
+ # @return true if the model is valid
71
+ def valid?
72
+ true
73
+ end
74
+
75
+ # Checks equality by comparing each attribute.
76
+ # @param [Object] Object to be compared
77
+ def ==(o)
78
+ return true if self.equal?(o)
79
+ self.class == o.class &&
80
+ code == o.code &&
81
+ restriction == o.restriction &&
82
+ store_front_host_name == o.store_front_host_name
83
+ end
84
+
85
+ # @see the `==` method
86
+ # @param [Object] Object to be compared
87
+ def eql?(o)
88
+ self == o
89
+ end
90
+
91
+ # Calculates hash code according to all attributes.
92
+ # @return [Fixnum] Hash code
93
+ def hash
94
+ [code, restriction, store_front_host_name].hash
95
+ end
96
+
97
+ # Builds the object from hash
98
+ # @param [Hash] attributes Model attributes in the form of hash
99
+ # @return [Object] Returns the model itself
100
+ def build_from_hash(attributes)
101
+ return nil unless attributes.is_a?(Hash)
102
+ self.class.swagger_types.each_pair do |key, type|
103
+ if type =~ /\AArray<(.*)>/i
104
+ # check to ensure the input is an array given that the attribute
105
+ # is documented as an array but the input is not
106
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
107
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
108
+ end
109
+ elsif !attributes[self.class.attribute_map[key]].nil?
110
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
111
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
112
+ end
113
+
114
+ self
115
+ end
116
+
117
+ # Deserializes the data based on type
118
+ # @param string type Data type
119
+ # @param string value Value to be deserialized
120
+ # @return [Object] Deserialized data
121
+ def _deserialize(type, value)
122
+ case type.to_sym
123
+ when :DateTime
124
+ DateTime.parse(value)
125
+ when :Date
126
+ Date.parse(value)
127
+ when :String
128
+ value.to_s
129
+ when :Integer
130
+ value.to_i
131
+ when :Float
132
+ value.to_f
133
+ when :BOOLEAN
134
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
135
+ true
136
+ else
137
+ false
138
+ end
139
+ when :Object
140
+ # generic object (usually a Hash), return directly
141
+ value
142
+ when /\AArray<(?<inner_type>.+)>\z/
143
+ inner_type = Regexp.last_match[:inner_type]
144
+ value.map { |v| _deserialize(inner_type, v) }
145
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
146
+ k_type = Regexp.last_match[:k_type]
147
+ v_type = Regexp.last_match[:v_type]
148
+ {}.tap do |hash|
149
+ value.each do |k, v|
150
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
151
+ end
152
+ end
153
+ else # model
154
+ temp_model = UltracartClient.const_get(type).new
155
+ temp_model.build_from_hash(value)
156
+ end
157
+ end
158
+
159
+ # Returns the string representation of the object
160
+ # @return [String] String presentation of the object
161
+ def to_s
162
+ to_hash.to_s
163
+ end
164
+
165
+ # to_body is an alias to to_hash (backward compatibility)
166
+ # @return [Hash] Returns the object in the form of hash
167
+ def to_body
168
+ to_hash
169
+ end
170
+
171
+ # Returns the object in the form of hash
172
+ # @return [Hash] Returns the object in the form of hash
173
+ def to_hash
174
+ hash = {}
175
+ self.class.attribute_map.each_pair do |attr, param|
176
+ value = self.send(attr)
177
+ next if value.nil?
178
+ hash[param] = _to_hash(value)
179
+ end
180
+ hash
181
+ end
182
+
183
+ # Outputs non-array value in the form of hash
184
+ # For object, use to_hash. Otherwise, just return the value
185
+ # @param [Object] value Any valid value
186
+ # @return [Hash] Returns the value in the form of hash
187
+ def _to_hash(value)
188
+ if value.is_a?(Array)
189
+ value.compact.map { |v| _to_hash(v) }
190
+ elsif value.is_a?(Hash)
191
+ {}.tap do |hash|
192
+ value.each { |k, v| hash[k] = _to_hash(v) }
193
+ end
194
+ elsif value.respond_to? :to_hash
195
+ value.to_hash
196
+ else
197
+ value
198
+ end
199
+ end
200
+
201
+ end
202
+ end
@@ -85,7 +85,7 @@ module UltracartClient
85
85
  :'business_id' => :'String',
86
86
  :'deposit_to_account' => :'String',
87
87
  :'environment' => :'String',
88
- :'environments' => :'Object',
88
+ :'environments' => :'Array<String>',
89
89
  :'private_api_key' => :'String',
90
90
  :'public_api_key' => :'String',
91
91
  :'restrictions' => :'PaymentsConfigurationRestrictions'
@@ -121,7 +121,9 @@ module UltracartClient
121
121
  end
122
122
 
123
123
  if attributes.has_key?(:'environments')
124
- self.environments = attributes[:'environments']
124
+ if (value = attributes[:'environments']).is_a?(Array)
125
+ self.environments = value
126
+ end
125
127
  end
126
128
 
127
129
  if attributes.has_key?(:'private_api_key')
@@ -0,0 +1,319 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ OpenAPI spec version: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.15-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module UltracartClient
16
+ class PaymentsConfigurationTestMethod
17
+ # Bank account number
18
+ attr_accessor :bank_account_number
19
+
20
+ # Bank routing number
21
+ attr_accessor :bank_routing_number
22
+
23
+ # Credit card number
24
+ attr_accessor :credit_card_number
25
+
26
+ # The existing credit card number
27
+ attr_accessor :credit_card_number_existing
28
+
29
+ # Description
30
+ attr_accessor :description
31
+
32
+ # Payment action
33
+ attr_accessor :payment_action
34
+
35
+ # Payment method
36
+ attr_accessor :payment_method
37
+
38
+ # Payment method test oid
39
+ attr_accessor :payment_method_test_oid
40
+
41
+ # Skip affiliate transaction
42
+ attr_accessor :skip_affiliate_transaction
43
+
44
+ # If true, skips recording any conversion pixels to avoid sending test orders to your analysis sites
45
+ attr_accessor :skip_conversion_pixels
46
+
47
+ # Skip fraud filter
48
+ attr_accessor :skip_fraud_filter
49
+
50
+ class EnumAttributeValidator
51
+ attr_reader :datatype
52
+ attr_reader :allowable_values
53
+
54
+ def initialize(datatype, allowable_values)
55
+ @allowable_values = allowable_values.map do |value|
56
+ case datatype.to_s
57
+ when /Integer/i
58
+ value.to_i
59
+ when /Float/i
60
+ value.to_f
61
+ else
62
+ value
63
+ end
64
+ end
65
+ end
66
+
67
+ def valid?(value)
68
+ !value || allowable_values.include?(value)
69
+ end
70
+ end
71
+
72
+ # Attribute mapping from ruby-style variable name to JSON key.
73
+ def self.attribute_map
74
+ {
75
+ :'bank_account_number' => :'bank_account_number',
76
+ :'bank_routing_number' => :'bank_routing_number',
77
+ :'credit_card_number' => :'credit_card_number',
78
+ :'credit_card_number_existing' => :'credit_card_number_existing',
79
+ :'description' => :'description',
80
+ :'payment_action' => :'payment_action',
81
+ :'payment_method' => :'payment_method',
82
+ :'payment_method_test_oid' => :'payment_method_test_oid',
83
+ :'skip_affiliate_transaction' => :'skip_affiliate_transaction',
84
+ :'skip_conversion_pixels' => :'skip_conversion_pixels',
85
+ :'skip_fraud_filter' => :'skip_fraud_filter'
86
+ }
87
+ end
88
+
89
+ # Attribute type mapping.
90
+ def self.swagger_types
91
+ {
92
+ :'bank_account_number' => :'String',
93
+ :'bank_routing_number' => :'String',
94
+ :'credit_card_number' => :'String',
95
+ :'credit_card_number_existing' => :'String',
96
+ :'description' => :'String',
97
+ :'payment_action' => :'String',
98
+ :'payment_method' => :'String',
99
+ :'payment_method_test_oid' => :'Integer',
100
+ :'skip_affiliate_transaction' => :'BOOLEAN',
101
+ :'skip_conversion_pixels' => :'BOOLEAN',
102
+ :'skip_fraud_filter' => :'BOOLEAN'
103
+ }
104
+ end
105
+
106
+ # Initializes the object
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ def initialize(attributes = {})
109
+ return unless attributes.is_a?(Hash)
110
+
111
+ # convert string to symbol for hash key
112
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
113
+
114
+ if attributes.has_key?(:'bank_account_number')
115
+ self.bank_account_number = attributes[:'bank_account_number']
116
+ end
117
+
118
+ if attributes.has_key?(:'bank_routing_number')
119
+ self.bank_routing_number = attributes[:'bank_routing_number']
120
+ end
121
+
122
+ if attributes.has_key?(:'credit_card_number')
123
+ self.credit_card_number = attributes[:'credit_card_number']
124
+ end
125
+
126
+ if attributes.has_key?(:'credit_card_number_existing')
127
+ self.credit_card_number_existing = attributes[:'credit_card_number_existing']
128
+ end
129
+
130
+ if attributes.has_key?(:'description')
131
+ self.description = attributes[:'description']
132
+ end
133
+
134
+ if attributes.has_key?(:'payment_action')
135
+ self.payment_action = attributes[:'payment_action']
136
+ end
137
+
138
+ if attributes.has_key?(:'payment_method')
139
+ self.payment_method = attributes[:'payment_method']
140
+ end
141
+
142
+ if attributes.has_key?(:'payment_method_test_oid')
143
+ self.payment_method_test_oid = attributes[:'payment_method_test_oid']
144
+ end
145
+
146
+ if attributes.has_key?(:'skip_affiliate_transaction')
147
+ self.skip_affiliate_transaction = attributes[:'skip_affiliate_transaction']
148
+ end
149
+
150
+ if attributes.has_key?(:'skip_conversion_pixels')
151
+ self.skip_conversion_pixels = attributes[:'skip_conversion_pixels']
152
+ end
153
+
154
+ if attributes.has_key?(:'skip_fraud_filter')
155
+ self.skip_fraud_filter = attributes[:'skip_fraud_filter']
156
+ end
157
+ end
158
+
159
+ # Show invalid properties with the reasons. Usually used together with valid?
160
+ # @return Array for valid properties with the reasons
161
+ def list_invalid_properties
162
+ invalid_properties = Array.new
163
+ invalid_properties
164
+ end
165
+
166
+ # Check to see if the all the properties in the model are valid
167
+ # @return true if the model is valid
168
+ def valid?
169
+ payment_action_validator = EnumAttributeValidator.new('String', ['skip payment', 'skip pmt rej', 'skip pmt co', 'hold in ar'])
170
+ return false unless payment_action_validator.valid?(@payment_action)
171
+ true
172
+ end
173
+
174
+ # Custom attribute writer method checking allowed values (enum).
175
+ # @param [Object] payment_action Object to be assigned
176
+ def payment_action=(payment_action)
177
+ validator = EnumAttributeValidator.new('String', ['skip payment', 'skip pmt rej', 'skip pmt co', 'hold in ar'])
178
+ unless validator.valid?(payment_action)
179
+ fail ArgumentError, 'invalid value for "payment_action", must be one of #{validator.allowable_values}.'
180
+ end
181
+ @payment_action = payment_action
182
+ end
183
+
184
+ # Checks equality by comparing each attribute.
185
+ # @param [Object] Object to be compared
186
+ def ==(o)
187
+ return true if self.equal?(o)
188
+ self.class == o.class &&
189
+ bank_account_number == o.bank_account_number &&
190
+ bank_routing_number == o.bank_routing_number &&
191
+ credit_card_number == o.credit_card_number &&
192
+ credit_card_number_existing == o.credit_card_number_existing &&
193
+ description == o.description &&
194
+ payment_action == o.payment_action &&
195
+ payment_method == o.payment_method &&
196
+ payment_method_test_oid == o.payment_method_test_oid &&
197
+ skip_affiliate_transaction == o.skip_affiliate_transaction &&
198
+ skip_conversion_pixels == o.skip_conversion_pixels &&
199
+ skip_fraud_filter == o.skip_fraud_filter
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
+ [bank_account_number, bank_routing_number, credit_card_number, credit_card_number_existing, description, payment_action, payment_method, payment_method_test_oid, skip_affiliate_transaction, skip_conversion_pixels, skip_fraud_filter].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 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 = UltracartClient.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
+
318
+ end
319
+ end