ultracart_api 4.0.103.rc → 4.0.105.rc

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,300 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module UltracartClient
17
+ class PointOfSaleLocation
18
+ # Address line 2
19
+ attr_accessor :adddress2
20
+
21
+ # Address line 1
22
+ attr_accessor :address1
23
+
24
+ # City
25
+ attr_accessor :city
26
+
27
+ # Country
28
+ attr_accessor :country
29
+
30
+ # The distribution center code where inventory is reduced from for this sale.
31
+ attr_accessor :distribution_center_code
32
+
33
+ # Merchant ID that owns this location
34
+ attr_accessor :merchant_id
35
+
36
+ # Object identifier of the point of sale location.
37
+ attr_accessor :pos_location_oid
38
+
39
+ # Postal code
40
+ attr_accessor :postal_code
41
+
42
+ # State/province
43
+ attr_accessor :state_province
44
+
45
+ # Attribute mapping from ruby-style variable name to JSON key.
46
+ def self.attribute_map
47
+ {
48
+ :'adddress2' => :'adddress2',
49
+ :'address1' => :'address1',
50
+ :'city' => :'city',
51
+ :'country' => :'country',
52
+ :'distribution_center_code' => :'distribution_center_code',
53
+ :'merchant_id' => :'merchant_id',
54
+ :'pos_location_oid' => :'pos_location_oid',
55
+ :'postal_code' => :'postal_code',
56
+ :'state_province' => :'state_province'
57
+ }
58
+ end
59
+
60
+ # Returns all the JSON keys this model knows about
61
+ def self.acceptable_attributes
62
+ attribute_map.values
63
+ end
64
+
65
+ # Attribute type mapping.
66
+ def self.openapi_types
67
+ {
68
+ :'adddress2' => :'String',
69
+ :'address1' => :'String',
70
+ :'city' => :'String',
71
+ :'country' => :'String',
72
+ :'distribution_center_code' => :'String',
73
+ :'merchant_id' => :'String',
74
+ :'pos_location_oid' => :'Integer',
75
+ :'postal_code' => :'String',
76
+ :'state_province' => :'String'
77
+ }
78
+ end
79
+
80
+ # List of attributes with nullable: true
81
+ def self.openapi_nullable
82
+ Set.new([
83
+ ])
84
+ end
85
+
86
+ # Initializes the object
87
+ # @param [Hash] attributes Model attributes in the form of hash
88
+ def initialize(attributes = {})
89
+ if (!attributes.is_a?(Hash))
90
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::PointOfSaleLocation` initialize method"
91
+ end
92
+
93
+ # check to see if the attribute exists and convert string to symbol for hash key
94
+ attributes = attributes.each_with_object({}) { |(k, v), h|
95
+ if (!self.class.attribute_map.key?(k.to_sym))
96
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::PointOfSaleLocation`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
97
+ end
98
+ h[k.to_sym] = v
99
+ }
100
+
101
+ if attributes.key?(:'adddress2')
102
+ self.adddress2 = attributes[:'adddress2']
103
+ end
104
+
105
+ if attributes.key?(:'address1')
106
+ self.address1 = attributes[:'address1']
107
+ end
108
+
109
+ if attributes.key?(:'city')
110
+ self.city = attributes[:'city']
111
+ end
112
+
113
+ if attributes.key?(:'country')
114
+ self.country = attributes[:'country']
115
+ end
116
+
117
+ if attributes.key?(:'distribution_center_code')
118
+ self.distribution_center_code = attributes[:'distribution_center_code']
119
+ end
120
+
121
+ if attributes.key?(:'merchant_id')
122
+ self.merchant_id = attributes[:'merchant_id']
123
+ end
124
+
125
+ if attributes.key?(:'pos_location_oid')
126
+ self.pos_location_oid = attributes[:'pos_location_oid']
127
+ end
128
+
129
+ if attributes.key?(:'postal_code')
130
+ self.postal_code = attributes[:'postal_code']
131
+ end
132
+
133
+ if attributes.key?(:'state_province')
134
+ self.state_province = attributes[:'state_province']
135
+ end
136
+ end
137
+
138
+ # Show invalid properties with the reasons. Usually used together with valid?
139
+ # @return Array for valid properties with the reasons
140
+ def list_invalid_properties
141
+ invalid_properties = Array.new
142
+ invalid_properties
143
+ end
144
+
145
+ # Check to see if the all the properties in the model are valid
146
+ # @return true if the model is valid
147
+ def valid?
148
+ true
149
+ end
150
+
151
+ # Checks equality by comparing each attribute.
152
+ # @param [Object] Object to be compared
153
+ def ==(o)
154
+ return true if self.equal?(o)
155
+ self.class == o.class &&
156
+ adddress2 == o.adddress2 &&
157
+ address1 == o.address1 &&
158
+ city == o.city &&
159
+ country == o.country &&
160
+ distribution_center_code == o.distribution_center_code &&
161
+ merchant_id == o.merchant_id &&
162
+ pos_location_oid == o.pos_location_oid &&
163
+ postal_code == o.postal_code &&
164
+ state_province == o.state_province
165
+ end
166
+
167
+ # @see the `==` method
168
+ # @param [Object] Object to be compared
169
+ def eql?(o)
170
+ self == o
171
+ end
172
+
173
+ # Calculates hash code according to all attributes.
174
+ # @return [Integer] Hash code
175
+ def hash
176
+ [adddress2, address1, city, country, distribution_center_code, merchant_id, pos_location_oid, postal_code, state_province].hash
177
+ end
178
+
179
+ # Builds the object from hash
180
+ # @param [Hash] attributes Model attributes in the form of hash
181
+ # @return [Object] Returns the model itself
182
+ def self.build_from_hash(attributes)
183
+ new.build_from_hash(attributes)
184
+ end
185
+
186
+ # Builds the object from hash
187
+ # @param [Hash] attributes Model attributes in the form of hash
188
+ # @return [Object] Returns the model itself
189
+ def build_from_hash(attributes)
190
+ return nil unless attributes.is_a?(Hash)
191
+ attributes = attributes.transform_keys(&:to_sym)
192
+ self.class.openapi_types.each_pair do |key, type|
193
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
194
+ self.send("#{key}=", nil)
195
+ elsif type =~ /\AArray<(.*)>/i
196
+ # check to ensure the input is an array given that the attribute
197
+ # is documented as an array but the input is not
198
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
199
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
200
+ end
201
+ elsif !attributes[self.class.attribute_map[key]].nil?
202
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
203
+ end
204
+ end
205
+
206
+ self
207
+ end
208
+
209
+ # Deserializes the data based on type
210
+ # @param string type Data type
211
+ # @param string value Value to be deserialized
212
+ # @return [Object] Deserialized data
213
+ def _deserialize(type, value)
214
+ case type.to_sym
215
+ when :Time
216
+ Time.parse(value)
217
+ when :Date
218
+ Date.parse(value)
219
+ when :String
220
+ value.to_s
221
+ when :Integer
222
+ value.to_i
223
+ when :Float
224
+ value.to_f
225
+ when :Boolean
226
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
227
+ true
228
+ else
229
+ false
230
+ end
231
+ when :Object
232
+ # generic object (usually a Hash), return directly
233
+ value
234
+ when /\AArray<(?<inner_type>.+)>\z/
235
+ inner_type = Regexp.last_match[:inner_type]
236
+ value.map { |v| _deserialize(inner_type, v) }
237
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
238
+ k_type = Regexp.last_match[:k_type]
239
+ v_type = Regexp.last_match[:v_type]
240
+ {}.tap do |hash|
241
+ value.each do |k, v|
242
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
243
+ end
244
+ end
245
+ else # model
246
+ # models (e.g. Pet) or oneOf
247
+ klass = UltracartClient.const_get(type)
248
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
249
+ end
250
+ end
251
+
252
+ # Returns the string representation of the object
253
+ # @return [String] String presentation of the object
254
+ def to_s
255
+ to_hash.to_s
256
+ end
257
+
258
+ # to_body is an alias to to_hash (backward compatibility)
259
+ # @return [Hash] Returns the object in the form of hash
260
+ def to_body
261
+ to_hash
262
+ end
263
+
264
+ # Returns the object in the form of hash
265
+ # @return [Hash] Returns the object in the form of hash
266
+ def to_hash
267
+ hash = {}
268
+ self.class.attribute_map.each_pair do |attr, param|
269
+ value = self.send(attr)
270
+ if value.nil?
271
+ is_nullable = self.class.openapi_nullable.include?(attr)
272
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
273
+ end
274
+
275
+ hash[param] = _to_hash(value)
276
+ end
277
+ hash
278
+ end
279
+
280
+ # Outputs non-array value in the form of hash
281
+ # For object, use to_hash. Otherwise, just return the value
282
+ # @param [Object] value Any valid value
283
+ # @return [Hash] Returns the value in the form of hash
284
+ def _to_hash(value)
285
+ if value.is_a?(Array)
286
+ value.compact.map { |v| _to_hash(v) }
287
+ elsif value.is_a?(Hash)
288
+ {}.tap do |hash|
289
+ value.each { |k, v| hash[k] = _to_hash(v) }
290
+ end
291
+ elsif value.respond_to? :to_hash
292
+ value.to_hash
293
+ else
294
+ value
295
+ end
296
+ end
297
+
298
+ end
299
+
300
+ end
@@ -0,0 +1,334 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module UltracartClient
17
+ class PointOfSaleReader
18
+ # The device type of the reader.
19
+ attr_accessor :device_type
20
+
21
+ # The label of the reader.
22
+ attr_accessor :label
23
+
24
+ # The merchant id that owns this point of sale reader.
25
+ attr_accessor :merchant_id
26
+
27
+ # The payment provider for the card reader.
28
+ attr_accessor :payment_provider
29
+
30
+ # Object identifier of the point of sale reader.
31
+ attr_accessor :pos_reader_id
32
+
33
+ # Object identifier of the point of sale register this reader is assigned to.
34
+ attr_accessor :pos_register_oid
35
+
36
+ # The serial number of the reader.
37
+ attr_accessor :serial_number
38
+
39
+ # If the payment provider is Stripe, this is the Stripe account id
40
+ attr_accessor :stripe_account_id
41
+
42
+ # If the payment provide is Stripe, this is the Stripe terminal reader id
43
+ attr_accessor :stripe_reader_id
44
+
45
+ class EnumAttributeValidator
46
+ attr_reader :datatype
47
+ attr_reader :allowable_values
48
+
49
+ def initialize(datatype, allowable_values)
50
+ @allowable_values = allowable_values.map do |value|
51
+ case datatype.to_s
52
+ when /Integer/i
53
+ value.to_i
54
+ when /Float/i
55
+ value.to_f
56
+ else
57
+ value
58
+ end
59
+ end
60
+ end
61
+
62
+ def valid?(value)
63
+ !value || allowable_values.include?(value)
64
+ end
65
+ end
66
+
67
+ # Attribute mapping from ruby-style variable name to JSON key.
68
+ def self.attribute_map
69
+ {
70
+ :'device_type' => :'device_type',
71
+ :'label' => :'label',
72
+ :'merchant_id' => :'merchant_id',
73
+ :'payment_provider' => :'payment_provider',
74
+ :'pos_reader_id' => :'pos_reader_id',
75
+ :'pos_register_oid' => :'pos_register_oid',
76
+ :'serial_number' => :'serial_number',
77
+ :'stripe_account_id' => :'stripe_account_id',
78
+ :'stripe_reader_id' => :'stripe_reader_id'
79
+ }
80
+ end
81
+
82
+ # Returns all the JSON keys this model knows about
83
+ def self.acceptable_attributes
84
+ attribute_map.values
85
+ end
86
+
87
+ # Attribute type mapping.
88
+ def self.openapi_types
89
+ {
90
+ :'device_type' => :'String',
91
+ :'label' => :'String',
92
+ :'merchant_id' => :'String',
93
+ :'payment_provider' => :'String',
94
+ :'pos_reader_id' => :'Integer',
95
+ :'pos_register_oid' => :'Integer',
96
+ :'serial_number' => :'String',
97
+ :'stripe_account_id' => :'String',
98
+ :'stripe_reader_id' => :'String'
99
+ }
100
+ end
101
+
102
+ # List of attributes with nullable: true
103
+ def self.openapi_nullable
104
+ Set.new([
105
+ ])
106
+ end
107
+
108
+ # Initializes the object
109
+ # @param [Hash] attributes Model attributes in the form of hash
110
+ def initialize(attributes = {})
111
+ if (!attributes.is_a?(Hash))
112
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::PointOfSaleReader` initialize method"
113
+ end
114
+
115
+ # check to see if the attribute exists and convert string to symbol for hash key
116
+ attributes = attributes.each_with_object({}) { |(k, v), h|
117
+ if (!self.class.attribute_map.key?(k.to_sym))
118
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::PointOfSaleReader`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
119
+ end
120
+ h[k.to_sym] = v
121
+ }
122
+
123
+ if attributes.key?(:'device_type')
124
+ self.device_type = attributes[:'device_type']
125
+ end
126
+
127
+ if attributes.key?(:'label')
128
+ self.label = attributes[:'label']
129
+ end
130
+
131
+ if attributes.key?(:'merchant_id')
132
+ self.merchant_id = attributes[:'merchant_id']
133
+ end
134
+
135
+ if attributes.key?(:'payment_provider')
136
+ self.payment_provider = attributes[:'payment_provider']
137
+ end
138
+
139
+ if attributes.key?(:'pos_reader_id')
140
+ self.pos_reader_id = attributes[:'pos_reader_id']
141
+ end
142
+
143
+ if attributes.key?(:'pos_register_oid')
144
+ self.pos_register_oid = attributes[:'pos_register_oid']
145
+ end
146
+
147
+ if attributes.key?(:'serial_number')
148
+ self.serial_number = attributes[:'serial_number']
149
+ end
150
+
151
+ if attributes.key?(:'stripe_account_id')
152
+ self.stripe_account_id = attributes[:'stripe_account_id']
153
+ end
154
+
155
+ if attributes.key?(:'stripe_reader_id')
156
+ self.stripe_reader_id = attributes[:'stripe_reader_id']
157
+ end
158
+ end
159
+
160
+ # Show invalid properties with the reasons. Usually used together with valid?
161
+ # @return Array for valid properties with the reasons
162
+ def list_invalid_properties
163
+ invalid_properties = Array.new
164
+ invalid_properties
165
+ end
166
+
167
+ # Check to see if the all the properties in the model are valid
168
+ # @return true if the model is valid
169
+ def valid?
170
+ payment_provider_validator = EnumAttributeValidator.new('String', ["stripe"])
171
+ return false unless payment_provider_validator.valid?(@payment_provider)
172
+ true
173
+ end
174
+
175
+ # Custom attribute writer method checking allowed values (enum).
176
+ # @param [Object] payment_provider Object to be assigned
177
+ def payment_provider=(payment_provider)
178
+ validator = EnumAttributeValidator.new('String', ["stripe"])
179
+ unless validator.valid?(payment_provider)
180
+ fail ArgumentError, "invalid value for \"payment_provider\", must be one of #{validator.allowable_values}."
181
+ end
182
+ @payment_provider = payment_provider
183
+ end
184
+
185
+ # Checks equality by comparing each attribute.
186
+ # @param [Object] Object to be compared
187
+ def ==(o)
188
+ return true if self.equal?(o)
189
+ self.class == o.class &&
190
+ device_type == o.device_type &&
191
+ label == o.label &&
192
+ merchant_id == o.merchant_id &&
193
+ payment_provider == o.payment_provider &&
194
+ pos_reader_id == o.pos_reader_id &&
195
+ pos_register_oid == o.pos_register_oid &&
196
+ serial_number == o.serial_number &&
197
+ stripe_account_id == o.stripe_account_id &&
198
+ stripe_reader_id == o.stripe_reader_id
199
+ end
200
+
201
+ # @see the `==` method
202
+ # @param [Object] Object to be compared
203
+ def eql?(o)
204
+ self == o
205
+ end
206
+
207
+ # Calculates hash code according to all attributes.
208
+ # @return [Integer] Hash code
209
+ def hash
210
+ [device_type, label, merchant_id, payment_provider, pos_reader_id, pos_register_oid, serial_number, stripe_account_id, stripe_reader_id].hash
211
+ end
212
+
213
+ # Builds the object from hash
214
+ # @param [Hash] attributes Model attributes in the form of hash
215
+ # @return [Object] Returns the model itself
216
+ def self.build_from_hash(attributes)
217
+ new.build_from_hash(attributes)
218
+ end
219
+
220
+ # Builds the object from hash
221
+ # @param [Hash] attributes Model attributes in the form of hash
222
+ # @return [Object] Returns the model itself
223
+ def build_from_hash(attributes)
224
+ return nil unless attributes.is_a?(Hash)
225
+ attributes = attributes.transform_keys(&:to_sym)
226
+ self.class.openapi_types.each_pair do |key, type|
227
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
228
+ self.send("#{key}=", nil)
229
+ elsif type =~ /\AArray<(.*)>/i
230
+ # check to ensure the input is an array given that the attribute
231
+ # is documented as an array but the input is not
232
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
233
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
234
+ end
235
+ elsif !attributes[self.class.attribute_map[key]].nil?
236
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
237
+ end
238
+ end
239
+
240
+ self
241
+ end
242
+
243
+ # Deserializes the data based on type
244
+ # @param string type Data type
245
+ # @param string value Value to be deserialized
246
+ # @return [Object] Deserialized data
247
+ def _deserialize(type, value)
248
+ case type.to_sym
249
+ when :Time
250
+ Time.parse(value)
251
+ when :Date
252
+ Date.parse(value)
253
+ when :String
254
+ value.to_s
255
+ when :Integer
256
+ value.to_i
257
+ when :Float
258
+ value.to_f
259
+ when :Boolean
260
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
261
+ true
262
+ else
263
+ false
264
+ end
265
+ when :Object
266
+ # generic object (usually a Hash), return directly
267
+ value
268
+ when /\AArray<(?<inner_type>.+)>\z/
269
+ inner_type = Regexp.last_match[:inner_type]
270
+ value.map { |v| _deserialize(inner_type, v) }
271
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
272
+ k_type = Regexp.last_match[:k_type]
273
+ v_type = Regexp.last_match[:v_type]
274
+ {}.tap do |hash|
275
+ value.each do |k, v|
276
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
277
+ end
278
+ end
279
+ else # model
280
+ # models (e.g. Pet) or oneOf
281
+ klass = UltracartClient.const_get(type)
282
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
283
+ end
284
+ end
285
+
286
+ # Returns the string representation of the object
287
+ # @return [String] String presentation of the object
288
+ def to_s
289
+ to_hash.to_s
290
+ end
291
+
292
+ # to_body is an alias to to_hash (backward compatibility)
293
+ # @return [Hash] Returns the object in the form of hash
294
+ def to_body
295
+ to_hash
296
+ end
297
+
298
+ # Returns the object in the form of hash
299
+ # @return [Hash] Returns the object in the form of hash
300
+ def to_hash
301
+ hash = {}
302
+ self.class.attribute_map.each_pair do |attr, param|
303
+ value = self.send(attr)
304
+ if value.nil?
305
+ is_nullable = self.class.openapi_nullable.include?(attr)
306
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
307
+ end
308
+
309
+ hash[param] = _to_hash(value)
310
+ end
311
+ hash
312
+ end
313
+
314
+ # Outputs non-array value in the form of hash
315
+ # For object, use to_hash. Otherwise, just return the value
316
+ # @param [Object] value Any valid value
317
+ # @return [Hash] Returns the value in the form of hash
318
+ def _to_hash(value)
319
+ if value.is_a?(Array)
320
+ value.compact.map { |v| _to_hash(v) }
321
+ elsif value.is_a?(Hash)
322
+ {}.tap do |hash|
323
+ value.each { |k, v| hash[k] = _to_hash(v) }
324
+ end
325
+ elsif value.respond_to? :to_hash
326
+ value.to_hash
327
+ else
328
+ value
329
+ end
330
+ end
331
+
332
+ end
333
+
334
+ end