square_connect 2.2.1.145 → 2.3.0.153
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.
- checksums.yaml +4 -4
- data/README.md +9 -1
- data/docs/BatchRetrieveOrdersRequest.md +12 -0
- data/docs/BatchRetrieveOrdersResponse.md +13 -0
- data/docs/CatalogItemVariation.md +1 -1
- data/docs/CatalogObject.md +1 -1
- data/docs/CatalogV1Id.md +2 -2
- data/docs/CreateOrderRequest.md +5 -4
- data/docs/CreateOrderRequestDiscount.md +5 -4
- data/docs/CreateOrderRequestLineItem.md +10 -6
- data/docs/CreateOrderRequestModifier.md +12 -0
- data/docs/CreateOrderRequestTax.md +5 -4
- data/docs/CreateOrderResponse.md +13 -0
- data/docs/Currency.md +1 -0
- data/docs/CustomersApi.md +1 -1
- data/docs/ErrorCode.md +2 -0
- data/docs/ItemVariationLocationOverrides.md +5 -5
- data/docs/Location.md +9 -1
- data/docs/LocationStatus.md +13 -0
- data/docs/Order.md +1 -0
- data/docs/OrderLineItem.md +6 -1
- data/docs/OrderLineItemDiscount.md +1 -0
- data/docs/OrderLineItemDiscountScope.md +1 -0
- data/docs/OrderLineItemDiscountType.md +1 -1
- data/docs/OrderLineItemModifier.md +15 -0
- data/docs/OrderLineItemTax.md +1 -0
- data/docs/OrderLineItemTaxType.md +1 -1
- data/docs/OrdersApi.md +120 -0
- data/docs/SearchCatalogObjectsRequest.md +1 -1
- data/docs/Transaction.md +1 -1
- data/docs/TransactionsApi.md +1 -1
- data/docs/V1Payment.md +3 -3
- data/docs/V1Refund.md +0 -5
- data/lib/square_connect/api/customers_api.rb +2 -2
- data/lib/square_connect/api/orders_api.rb +134 -0
- data/lib/square_connect/api/transactions_api.rb +2 -2
- data/lib/square_connect/api_client.rb +1 -1
- data/lib/square_connect/models/batch_retrieve_orders_request.rb +193 -0
- data/lib/square_connect/models/batch_retrieve_orders_response.rb +200 -0
- data/lib/square_connect/models/catalog_item_variation.rb +1 -1
- data/lib/square_connect/models/catalog_object.rb +1 -1
- data/lib/square_connect/models/catalog_v1_id.rb +2 -2
- data/lib/square_connect/models/charge_request.rb +108 -0
- data/lib/square_connect/models/create_checkout_request.rb +16 -0
- data/lib/square_connect/models/create_order_request.rb +31 -5
- data/lib/square_connect/models/create_order_request_discount.rb +47 -5
- data/lib/square_connect/models/create_order_request_line_item.rb +106 -7
- data/lib/square_connect/models/create_order_request_modifier.rb +219 -0
- data/lib/square_connect/models/create_order_request_tax.rb +49 -7
- data/lib/square_connect/models/create_order_response.rb +198 -0
- data/lib/square_connect/models/create_refund_request.rb +72 -0
- data/lib/square_connect/models/currency.rb +1 -0
- data/lib/square_connect/models/error.rb +2 -2
- data/lib/square_connect/models/error_code.rb +2 -0
- data/lib/square_connect/models/item_variation_location_overrides.rb +5 -5
- data/lib/square_connect/models/location.rb +121 -5
- data/lib/square_connect/models/location_status.rb +19 -0
- data/lib/square_connect/models/money.rb +27 -2
- data/lib/square_connect/models/order.rb +11 -1
- data/lib/square_connect/models/order_line_item.rb +54 -2
- data/lib/square_connect/models/order_line_item_discount.rb +15 -5
- data/lib/square_connect/models/order_line_item_discount_scope.rb +1 -0
- data/lib/square_connect/models/order_line_item_discount_type.rb +1 -1
- data/lib/square_connect/models/order_line_item_modifier.rb +216 -0
- data/lib/square_connect/models/order_line_item_tax.rb +13 -3
- data/lib/square_connect/models/order_line_item_tax_type.rb +1 -1
- data/lib/square_connect/models/search_catalog_objects_request.rb +1 -1
- data/lib/square_connect/models/transaction.rb +14 -14
- data/lib/square_connect/models/v1_payment.rb +3 -0
- data/lib/square_connect/models/v1_refund.rb +1 -51
- data/lib/square_connect/version.rb +1 -1
- data/lib/square_connect.rb +7 -0
- metadata +17 -3
|
@@ -142,10 +142,38 @@ module SquareConnect
|
|
|
142
142
|
invalid_properties.push("invalid value for 'idempotency_key', idempotency_key cannot be nil.")
|
|
143
143
|
end
|
|
144
144
|
|
|
145
|
+
if @idempotency_key.to_s.length > 192
|
|
146
|
+
invalid_properties.push("invalid value for 'idempotency_key', the character length must be smaller than or equal to 192.")
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
if @idempotency_key.to_s.length < 1
|
|
150
|
+
invalid_properties.push("invalid value for 'idempotency_key', the character length must be great than or equal to 1.")
|
|
151
|
+
end
|
|
152
|
+
|
|
145
153
|
if @amount_money.nil?
|
|
146
154
|
invalid_properties.push("invalid value for 'amount_money', amount_money cannot be nil.")
|
|
147
155
|
end
|
|
148
156
|
|
|
157
|
+
if !@card_nonce.nil? && @card_nonce.to_s.length > 192
|
|
158
|
+
invalid_properties.push("invalid value for 'card_nonce', the character length must be smaller than or equal to 192.")
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
if !@customer_card_id.nil? && @customer_card_id.to_s.length > 192
|
|
162
|
+
invalid_properties.push("invalid value for 'customer_card_id', the character length must be smaller than or equal to 192.")
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
if !@reference_id.nil? && @reference_id.to_s.length > 40
|
|
166
|
+
invalid_properties.push("invalid value for 'reference_id', the character length must be smaller than or equal to 40.")
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
if !@note.nil? && @note.to_s.length > 60
|
|
170
|
+
invalid_properties.push("invalid value for 'note', the character length must be smaller than or equal to 60.")
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
if !@customer_id.nil? && @customer_id.to_s.length > 50
|
|
174
|
+
invalid_properties.push("invalid value for 'customer_id', the character length must be smaller than or equal to 50.")
|
|
175
|
+
end
|
|
176
|
+
|
|
149
177
|
return invalid_properties
|
|
150
178
|
end
|
|
151
179
|
|
|
@@ -153,10 +181,90 @@ module SquareConnect
|
|
|
153
181
|
# @return true if the model is valid
|
|
154
182
|
def valid?
|
|
155
183
|
return false if @idempotency_key.nil?
|
|
184
|
+
return false if @idempotency_key.to_s.length > 192
|
|
185
|
+
return false if @idempotency_key.to_s.length < 1
|
|
156
186
|
return false if @amount_money.nil?
|
|
187
|
+
return false if !@card_nonce.nil? && @card_nonce.to_s.length > 192
|
|
188
|
+
return false if !@customer_card_id.nil? && @customer_card_id.to_s.length > 192
|
|
189
|
+
return false if !@reference_id.nil? && @reference_id.to_s.length > 40
|
|
190
|
+
return false if !@note.nil? && @note.to_s.length > 60
|
|
191
|
+
return false if !@customer_id.nil? && @customer_id.to_s.length > 50
|
|
157
192
|
return true
|
|
158
193
|
end
|
|
159
194
|
|
|
195
|
+
# Custom attribute writer method with validation
|
|
196
|
+
# @param [Object] idempotency_key Value to be assigned
|
|
197
|
+
def idempotency_key=(idempotency_key)
|
|
198
|
+
if idempotency_key.nil?
|
|
199
|
+
fail ArgumentError, "idempotency_key cannot be nil"
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
if idempotency_key.to_s.length > 192
|
|
203
|
+
fail ArgumentError, "invalid value for 'idempotency_key', the character length must be smaller than or equal to 192."
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
if idempotency_key.to_s.length < 1
|
|
207
|
+
fail ArgumentError, "invalid value for 'idempotency_key', the character length must be great than or equal to 1."
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
@idempotency_key = idempotency_key
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
# Custom attribute writer method with validation
|
|
214
|
+
# @param [Object] card_nonce Value to be assigned
|
|
215
|
+
def card_nonce=(card_nonce)
|
|
216
|
+
|
|
217
|
+
if !card_nonce.nil? && card_nonce.to_s.length > 192
|
|
218
|
+
fail ArgumentError, "invalid value for 'card_nonce', the character length must be smaller than or equal to 192."
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
@card_nonce = card_nonce
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
# Custom attribute writer method with validation
|
|
225
|
+
# @param [Object] customer_card_id Value to be assigned
|
|
226
|
+
def customer_card_id=(customer_card_id)
|
|
227
|
+
|
|
228
|
+
if !customer_card_id.nil? && customer_card_id.to_s.length > 192
|
|
229
|
+
fail ArgumentError, "invalid value for 'customer_card_id', the character length must be smaller than or equal to 192."
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
@customer_card_id = customer_card_id
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
# Custom attribute writer method with validation
|
|
236
|
+
# @param [Object] reference_id Value to be assigned
|
|
237
|
+
def reference_id=(reference_id)
|
|
238
|
+
|
|
239
|
+
if !reference_id.nil? && reference_id.to_s.length > 40
|
|
240
|
+
fail ArgumentError, "invalid value for 'reference_id', the character length must be smaller than or equal to 40."
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
@reference_id = reference_id
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
# Custom attribute writer method with validation
|
|
247
|
+
# @param [Object] note Value to be assigned
|
|
248
|
+
def note=(note)
|
|
249
|
+
|
|
250
|
+
if !note.nil? && note.to_s.length > 60
|
|
251
|
+
fail ArgumentError, "invalid value for 'note', the character length must be smaller than or equal to 60."
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
@note = note
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
# Custom attribute writer method with validation
|
|
258
|
+
# @param [Object] customer_id Value to be assigned
|
|
259
|
+
def customer_id=(customer_id)
|
|
260
|
+
|
|
261
|
+
if !customer_id.nil? && customer_id.to_s.length > 50
|
|
262
|
+
fail ArgumentError, "invalid value for 'customer_id', the character length must be smaller than or equal to 50."
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
@customer_id = customer_id
|
|
266
|
+
end
|
|
267
|
+
|
|
160
268
|
# Checks equality by comparing each attribute.
|
|
161
269
|
# @param [Object] Object to be compared
|
|
162
270
|
def ==(o)
|
|
@@ -126,6 +126,10 @@ module SquareConnect
|
|
|
126
126
|
invalid_properties.push("invalid value for 'pre_populate_buyer_email', the character length must be smaller than or equal to 254.")
|
|
127
127
|
end
|
|
128
128
|
|
|
129
|
+
if !@redirect_url.nil? && @redirect_url.to_s.length > 800
|
|
130
|
+
invalid_properties.push("invalid value for 'redirect_url', the character length must be smaller than or equal to 800.")
|
|
131
|
+
end
|
|
132
|
+
|
|
129
133
|
return invalid_properties
|
|
130
134
|
end
|
|
131
135
|
|
|
@@ -138,6 +142,7 @@ module SquareConnect
|
|
|
138
142
|
return false if @order.nil?
|
|
139
143
|
return false if !@merchant_support_email.nil? && @merchant_support_email.to_s.length > 254
|
|
140
144
|
return false if !@pre_populate_buyer_email.nil? && @pre_populate_buyer_email.to_s.length > 254
|
|
145
|
+
return false if !@redirect_url.nil? && @redirect_url.to_s.length > 800
|
|
141
146
|
return true
|
|
142
147
|
end
|
|
143
148
|
|
|
@@ -181,6 +186,17 @@ module SquareConnect
|
|
|
181
186
|
@pre_populate_buyer_email = pre_populate_buyer_email
|
|
182
187
|
end
|
|
183
188
|
|
|
189
|
+
# Custom attribute writer method with validation
|
|
190
|
+
# @param [Object] redirect_url Value to be assigned
|
|
191
|
+
def redirect_url=(redirect_url)
|
|
192
|
+
|
|
193
|
+
if !redirect_url.nil? && redirect_url.to_s.length > 800
|
|
194
|
+
fail ArgumentError, "invalid value for 'redirect_url', the character length must be smaller than or equal to 800."
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
@redirect_url = redirect_url
|
|
198
|
+
end
|
|
199
|
+
|
|
184
200
|
# Checks equality by comparing each attribute.
|
|
185
201
|
# @param [Object] Object to be compared
|
|
186
202
|
def ==(o)
|
|
@@ -10,24 +10,28 @@ Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
|
10
10
|
require 'date'
|
|
11
11
|
|
|
12
12
|
module SquareConnect
|
|
13
|
-
#
|
|
13
|
+
#
|
|
14
14
|
class CreateOrderRequest
|
|
15
|
+
# A value you specify that uniquely identifies this order among orders you've created. If you're unsure whether a particular order was created successfully, you can reattempt it with the same idempotency key without worrying about creating duplicate orders. See [Idempotency keys](#idempotencykeys) for more information.
|
|
16
|
+
attr_accessor :idempotency_key
|
|
17
|
+
|
|
15
18
|
# An optional ID you can associate with the order for your own purposes (such as to associate the order with an entity ID in your own database). This value cannot exceed 40 characters.
|
|
16
19
|
attr_accessor :reference_id
|
|
17
20
|
|
|
18
|
-
# The line items to associate with this order. Each line item represents a different product
|
|
21
|
+
# The line items to associate with this order. Each line item represents a different product to include in a purchase.
|
|
19
22
|
attr_accessor :line_items
|
|
20
23
|
|
|
21
|
-
# The taxes include the
|
|
24
|
+
# The taxes to include on the order.
|
|
22
25
|
attr_accessor :taxes
|
|
23
26
|
|
|
24
|
-
# The discounts include the
|
|
27
|
+
# The discounts to include on the order.
|
|
25
28
|
attr_accessor :discounts
|
|
26
29
|
|
|
27
30
|
|
|
28
31
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
29
32
|
def self.attribute_map
|
|
30
33
|
{
|
|
34
|
+
:'idempotency_key' => :'idempotency_key',
|
|
31
35
|
:'reference_id' => :'reference_id',
|
|
32
36
|
:'line_items' => :'line_items',
|
|
33
37
|
:'taxes' => :'taxes',
|
|
@@ -38,6 +42,7 @@ module SquareConnect
|
|
|
38
42
|
# Attribute type mapping.
|
|
39
43
|
def self.swagger_types
|
|
40
44
|
{
|
|
45
|
+
:'idempotency_key' => :'String',
|
|
41
46
|
:'reference_id' => :'String',
|
|
42
47
|
:'line_items' => :'Array<CreateOrderRequestLineItem>',
|
|
43
48
|
:'taxes' => :'Array<CreateOrderRequestTax>',
|
|
@@ -53,6 +58,10 @@ module SquareConnect
|
|
|
53
58
|
# convert string to symbol for hash key
|
|
54
59
|
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
|
55
60
|
|
|
61
|
+
if attributes.has_key?(:'idempotency_key')
|
|
62
|
+
self.idempotency_key = attributes[:'idempotency_key']
|
|
63
|
+
end
|
|
64
|
+
|
|
56
65
|
if attributes.has_key?(:'reference_id')
|
|
57
66
|
self.reference_id = attributes[:'reference_id']
|
|
58
67
|
end
|
|
@@ -81,6 +90,10 @@ module SquareConnect
|
|
|
81
90
|
# @return Array for valid properies with the reasons
|
|
82
91
|
def list_invalid_properties
|
|
83
92
|
invalid_properties = Array.new
|
|
93
|
+
if !@idempotency_key.nil? && @idempotency_key.to_s.length > 192
|
|
94
|
+
invalid_properties.push("invalid value for 'idempotency_key', the character length must be smaller than or equal to 192.")
|
|
95
|
+
end
|
|
96
|
+
|
|
84
97
|
if !@reference_id.nil? && @reference_id.to_s.length > 40
|
|
85
98
|
invalid_properties.push("invalid value for 'reference_id', the character length must be smaller than or equal to 40.")
|
|
86
99
|
end
|
|
@@ -95,11 +108,23 @@ module SquareConnect
|
|
|
95
108
|
# Check to see if the all the properties in the model are valid
|
|
96
109
|
# @return true if the model is valid
|
|
97
110
|
def valid?
|
|
111
|
+
return false if !@idempotency_key.nil? && @idempotency_key.to_s.length > 192
|
|
98
112
|
return false if !@reference_id.nil? && @reference_id.to_s.length > 40
|
|
99
113
|
return false if @line_items.nil?
|
|
100
114
|
return true
|
|
101
115
|
end
|
|
102
116
|
|
|
117
|
+
# Custom attribute writer method with validation
|
|
118
|
+
# @param [Object] idempotency_key Value to be assigned
|
|
119
|
+
def idempotency_key=(idempotency_key)
|
|
120
|
+
|
|
121
|
+
if !idempotency_key.nil? && idempotency_key.to_s.length > 192
|
|
122
|
+
fail ArgumentError, "invalid value for 'idempotency_key', the character length must be smaller than or equal to 192."
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
@idempotency_key = idempotency_key
|
|
126
|
+
end
|
|
127
|
+
|
|
103
128
|
# Custom attribute writer method with validation
|
|
104
129
|
# @param [Object] reference_id Value to be assigned
|
|
105
130
|
def reference_id=(reference_id)
|
|
@@ -116,6 +141,7 @@ module SquareConnect
|
|
|
116
141
|
def ==(o)
|
|
117
142
|
return true if self.equal?(o)
|
|
118
143
|
self.class == o.class &&
|
|
144
|
+
idempotency_key == o.idempotency_key &&
|
|
119
145
|
reference_id == o.reference_id &&
|
|
120
146
|
line_items == o.line_items &&
|
|
121
147
|
taxes == o.taxes &&
|
|
@@ -131,7 +157,7 @@ module SquareConnect
|
|
|
131
157
|
# Calculates hash code according to all attributes.
|
|
132
158
|
# @return [Fixnum] Hash code
|
|
133
159
|
def hash
|
|
134
|
-
[reference_id, line_items, taxes, discounts].hash
|
|
160
|
+
[idempotency_key, reference_id, line_items, taxes, discounts].hash
|
|
135
161
|
end
|
|
136
162
|
|
|
137
163
|
# Builds the object from hash
|
|
@@ -10,21 +10,25 @@ Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
|
10
10
|
require 'date'
|
|
11
11
|
|
|
12
12
|
module SquareConnect
|
|
13
|
-
# Represents a discount that to either a single line item or an entire order.
|
|
13
|
+
# Represents a discount that can apply to either a single line item or an entire order.
|
|
14
14
|
class CreateOrderRequestDiscount
|
|
15
|
-
# The
|
|
15
|
+
# Only used for catalog taxes. The catalog object ID from exsiting [CatalogDiscount](#type-catalogdiscount). Do not provide a value for this field if you provide values in other fields for an ad hoc discount.
|
|
16
|
+
attr_accessor :catalog_object_id
|
|
17
|
+
|
|
18
|
+
# Only used for ad hoc discounts. The discount's name.
|
|
16
19
|
attr_accessor :name
|
|
17
20
|
|
|
18
|
-
# The percentage of the discount, as a string representation of a decimal number. A value of `7.25` corresponds to a percentage of 7.25%. This value range between 0.0 up to 100.0
|
|
21
|
+
# Only used for ad hoc discounts. The percentage of the discount, as a string representation of a decimal number. A value of `7.25` corresponds to a percentage of 7.25%. This value range between 0.0 up to 100.0
|
|
19
22
|
attr_accessor :percentage
|
|
20
23
|
|
|
21
|
-
# The monetary amount of the discount.
|
|
24
|
+
# Only used for ad hoc discounts. The monetary amount of the discount.
|
|
22
25
|
attr_accessor :amount_money
|
|
23
26
|
|
|
24
27
|
|
|
25
28
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
26
29
|
def self.attribute_map
|
|
27
30
|
{
|
|
31
|
+
:'catalog_object_id' => :'catalog_object_id',
|
|
28
32
|
:'name' => :'name',
|
|
29
33
|
:'percentage' => :'percentage',
|
|
30
34
|
:'amount_money' => :'amount_money'
|
|
@@ -34,6 +38,7 @@ module SquareConnect
|
|
|
34
38
|
# Attribute type mapping.
|
|
35
39
|
def self.swagger_types
|
|
36
40
|
{
|
|
41
|
+
:'catalog_object_id' => :'String',
|
|
37
42
|
:'name' => :'String',
|
|
38
43
|
:'percentage' => :'String',
|
|
39
44
|
:'amount_money' => :'Money'
|
|
@@ -48,6 +53,10 @@ module SquareConnect
|
|
|
48
53
|
# convert string to symbol for hash key
|
|
49
54
|
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
|
50
55
|
|
|
56
|
+
if attributes.has_key?(:'catalog_object_id')
|
|
57
|
+
self.catalog_object_id = attributes[:'catalog_object_id']
|
|
58
|
+
end
|
|
59
|
+
|
|
51
60
|
if attributes.has_key?(:'name')
|
|
52
61
|
self.name = attributes[:'name']
|
|
53
62
|
end
|
|
@@ -66,20 +75,41 @@ module SquareConnect
|
|
|
66
75
|
# @return Array for valid properies with the reasons
|
|
67
76
|
def list_invalid_properties
|
|
68
77
|
invalid_properties = Array.new
|
|
78
|
+
if !@catalog_object_id.nil? && @catalog_object_id.to_s.length > 192
|
|
79
|
+
invalid_properties.push("invalid value for 'catalog_object_id', the character length must be smaller than or equal to 192.")
|
|
80
|
+
end
|
|
81
|
+
|
|
69
82
|
if !@name.nil? && @name.to_s.length > 255
|
|
70
83
|
invalid_properties.push("invalid value for 'name', the character length must be smaller than or equal to 255.")
|
|
71
84
|
end
|
|
72
85
|
|
|
86
|
+
if !@percentage.nil? && @percentage.to_s.length > 10
|
|
87
|
+
invalid_properties.push("invalid value for 'percentage', the character length must be smaller than or equal to 10.")
|
|
88
|
+
end
|
|
89
|
+
|
|
73
90
|
return invalid_properties
|
|
74
91
|
end
|
|
75
92
|
|
|
76
93
|
# Check to see if the all the properties in the model are valid
|
|
77
94
|
# @return true if the model is valid
|
|
78
95
|
def valid?
|
|
96
|
+
return false if !@catalog_object_id.nil? && @catalog_object_id.to_s.length > 192
|
|
79
97
|
return false if !@name.nil? && @name.to_s.length > 255
|
|
98
|
+
return false if !@percentage.nil? && @percentage.to_s.length > 10
|
|
80
99
|
return true
|
|
81
100
|
end
|
|
82
101
|
|
|
102
|
+
# Custom attribute writer method with validation
|
|
103
|
+
# @param [Object] catalog_object_id Value to be assigned
|
|
104
|
+
def catalog_object_id=(catalog_object_id)
|
|
105
|
+
|
|
106
|
+
if !catalog_object_id.nil? && catalog_object_id.to_s.length > 192
|
|
107
|
+
fail ArgumentError, "invalid value for 'catalog_object_id', the character length must be smaller than or equal to 192."
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
@catalog_object_id = catalog_object_id
|
|
111
|
+
end
|
|
112
|
+
|
|
83
113
|
# Custom attribute writer method with validation
|
|
84
114
|
# @param [Object] name Value to be assigned
|
|
85
115
|
def name=(name)
|
|
@@ -91,11 +121,23 @@ module SquareConnect
|
|
|
91
121
|
@name = name
|
|
92
122
|
end
|
|
93
123
|
|
|
124
|
+
# Custom attribute writer method with validation
|
|
125
|
+
# @param [Object] percentage Value to be assigned
|
|
126
|
+
def percentage=(percentage)
|
|
127
|
+
|
|
128
|
+
if !percentage.nil? && percentage.to_s.length > 10
|
|
129
|
+
fail ArgumentError, "invalid value for 'percentage', the character length must be smaller than or equal to 10."
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
@percentage = percentage
|
|
133
|
+
end
|
|
134
|
+
|
|
94
135
|
# Checks equality by comparing each attribute.
|
|
95
136
|
# @param [Object] Object to be compared
|
|
96
137
|
def ==(o)
|
|
97
138
|
return true if self.equal?(o)
|
|
98
139
|
self.class == o.class &&
|
|
140
|
+
catalog_object_id == o.catalog_object_id &&
|
|
99
141
|
name == o.name &&
|
|
100
142
|
percentage == o.percentage &&
|
|
101
143
|
amount_money == o.amount_money
|
|
@@ -110,7 +152,7 @@ module SquareConnect
|
|
|
110
152
|
# Calculates hash code according to all attributes.
|
|
111
153
|
# @return [Fixnum] Hash code
|
|
112
154
|
def hash
|
|
113
|
-
[name, percentage, amount_money].hash
|
|
155
|
+
[catalog_object_id, name, percentage, amount_money].hash
|
|
114
156
|
end
|
|
115
157
|
|
|
116
158
|
# Builds the object from hash
|
|
@@ -10,21 +10,33 @@ Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
|
10
10
|
require 'date'
|
|
11
11
|
|
|
12
12
|
module SquareConnect
|
|
13
|
-
# Represents a line item to include in an order. Each line item describes a different product to purchase, with its own quantity and price details.
|
|
13
|
+
# Represents a line item to include in an order. Each line item describes a different product to purchase, with its own quantity and price details. Line items can either reference objects from the merchant's catalog, or can alternatively specify a name and price instead.
|
|
14
14
|
class CreateOrderRequestLineItem
|
|
15
|
-
# The name of the line item. This value cannot exceed 500 characters.
|
|
15
|
+
# Only used for ad hoc line items. The name of the line item. This value cannot exceed 500 characters. Do not provide a value for this field if you provide values in catalog_object_id.
|
|
16
16
|
attr_accessor :name
|
|
17
17
|
|
|
18
|
-
# The quantity to purchase, as a string representation of a number.
|
|
18
|
+
# The quantity to purchase, as a string representation of a number. This string must have a positive integer value.
|
|
19
19
|
attr_accessor :quantity
|
|
20
20
|
|
|
21
|
-
# The base price for a single unit of the line item's associated variation.
|
|
21
|
+
# Only used for ad hoc line items. The base price for a single unit of the line item's associated variation. Do not provide a value for this field if you provide a value for the `catalog_object_id`.
|
|
22
22
|
attr_accessor :base_price_money
|
|
23
23
|
|
|
24
|
-
# The
|
|
24
|
+
# Only used for ad hoc line items. The variation name of the line item. This value cannot exceed 255 characters. If this value is not set for an ad hoc line item, the default value of `Regular` is used. Do not provide a value for this field if you provide a value for the `catalog_object_id`.
|
|
25
|
+
attr_accessor :variation_name
|
|
26
|
+
|
|
27
|
+
# The note of the line item. This value cannot exceed 50 characters.
|
|
28
|
+
attr_accessor :note
|
|
29
|
+
|
|
30
|
+
# Only used for Catalog line items. The catalog object ID from existing [CatalogItemVariation](#type-catalogitemvariation). Do not provide a value for this field if you provide a value for `name` and `base_price_money`.
|
|
31
|
+
attr_accessor :catalog_object_id
|
|
32
|
+
|
|
33
|
+
# Only used for Catalog line items. The modifiers to include on the line item.
|
|
34
|
+
attr_accessor :modifiers
|
|
35
|
+
|
|
36
|
+
# The taxes to include on the line item.
|
|
25
37
|
attr_accessor :taxes
|
|
26
38
|
|
|
27
|
-
# The discounts include the
|
|
39
|
+
# The discounts to include on the line item.
|
|
28
40
|
attr_accessor :discounts
|
|
29
41
|
|
|
30
42
|
|
|
@@ -34,6 +46,10 @@ module SquareConnect
|
|
|
34
46
|
:'name' => :'name',
|
|
35
47
|
:'quantity' => :'quantity',
|
|
36
48
|
:'base_price_money' => :'base_price_money',
|
|
49
|
+
:'variation_name' => :'variation_name',
|
|
50
|
+
:'note' => :'note',
|
|
51
|
+
:'catalog_object_id' => :'catalog_object_id',
|
|
52
|
+
:'modifiers' => :'modifiers',
|
|
37
53
|
:'taxes' => :'taxes',
|
|
38
54
|
:'discounts' => :'discounts'
|
|
39
55
|
}
|
|
@@ -45,6 +61,10 @@ module SquareConnect
|
|
|
45
61
|
:'name' => :'String',
|
|
46
62
|
:'quantity' => :'String',
|
|
47
63
|
:'base_price_money' => :'Money',
|
|
64
|
+
:'variation_name' => :'String',
|
|
65
|
+
:'note' => :'String',
|
|
66
|
+
:'catalog_object_id' => :'String',
|
|
67
|
+
:'modifiers' => :'Array<CreateOrderRequestModifier>',
|
|
48
68
|
:'taxes' => :'Array<CreateOrderRequestTax>',
|
|
49
69
|
:'discounts' => :'Array<CreateOrderRequestDiscount>'
|
|
50
70
|
}
|
|
@@ -70,6 +90,24 @@ module SquareConnect
|
|
|
70
90
|
self.base_price_money = attributes[:'base_price_money']
|
|
71
91
|
end
|
|
72
92
|
|
|
93
|
+
if attributes.has_key?(:'variation_name')
|
|
94
|
+
self.variation_name = attributes[:'variation_name']
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
if attributes.has_key?(:'note')
|
|
98
|
+
self.note = attributes[:'note']
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
if attributes.has_key?(:'catalog_object_id')
|
|
102
|
+
self.catalog_object_id = attributes[:'catalog_object_id']
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
if attributes.has_key?(:'modifiers')
|
|
106
|
+
if (value = attributes[:'modifiers']).is_a?(Array)
|
|
107
|
+
self.modifiers = value
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
73
111
|
if attributes.has_key?(:'taxes')
|
|
74
112
|
if (value = attributes[:'taxes']).is_a?(Array)
|
|
75
113
|
self.taxes = value
|
|
@@ -96,10 +134,26 @@ module SquareConnect
|
|
|
96
134
|
invalid_properties.push("invalid value for 'quantity', quantity cannot be nil.")
|
|
97
135
|
end
|
|
98
136
|
|
|
137
|
+
if @quantity.to_s.length > 5
|
|
138
|
+
invalid_properties.push("invalid value for 'quantity', the character length must be smaller than or equal to 5.")
|
|
139
|
+
end
|
|
140
|
+
|
|
99
141
|
if @quantity.to_s.length < 1
|
|
100
142
|
invalid_properties.push("invalid value for 'quantity', the character length must be great than or equal to 1.")
|
|
101
143
|
end
|
|
102
144
|
|
|
145
|
+
if !@variation_name.nil? && @variation_name.to_s.length > 255
|
|
146
|
+
invalid_properties.push("invalid value for 'variation_name', the character length must be smaller than or equal to 255.")
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
if !@note.nil? && @note.to_s.length > 50
|
|
150
|
+
invalid_properties.push("invalid value for 'note', the character length must be smaller than or equal to 50.")
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
if !@catalog_object_id.nil? && @catalog_object_id.to_s.length > 192
|
|
154
|
+
invalid_properties.push("invalid value for 'catalog_object_id', the character length must be smaller than or equal to 192.")
|
|
155
|
+
end
|
|
156
|
+
|
|
103
157
|
return invalid_properties
|
|
104
158
|
end
|
|
105
159
|
|
|
@@ -108,7 +162,11 @@ module SquareConnect
|
|
|
108
162
|
def valid?
|
|
109
163
|
return false if !@name.nil? && @name.to_s.length > 500
|
|
110
164
|
return false if @quantity.nil?
|
|
165
|
+
return false if @quantity.to_s.length > 5
|
|
111
166
|
return false if @quantity.to_s.length < 1
|
|
167
|
+
return false if !@variation_name.nil? && @variation_name.to_s.length > 255
|
|
168
|
+
return false if !@note.nil? && @note.to_s.length > 50
|
|
169
|
+
return false if !@catalog_object_id.nil? && @catalog_object_id.to_s.length > 192
|
|
112
170
|
return true
|
|
113
171
|
end
|
|
114
172
|
|
|
@@ -130,6 +188,10 @@ module SquareConnect
|
|
|
130
188
|
fail ArgumentError, "quantity cannot be nil"
|
|
131
189
|
end
|
|
132
190
|
|
|
191
|
+
if quantity.to_s.length > 5
|
|
192
|
+
fail ArgumentError, "invalid value for 'quantity', the character length must be smaller than or equal to 5."
|
|
193
|
+
end
|
|
194
|
+
|
|
133
195
|
if quantity.to_s.length < 1
|
|
134
196
|
fail ArgumentError, "invalid value for 'quantity', the character length must be great than or equal to 1."
|
|
135
197
|
end
|
|
@@ -137,6 +199,39 @@ module SquareConnect
|
|
|
137
199
|
@quantity = quantity
|
|
138
200
|
end
|
|
139
201
|
|
|
202
|
+
# Custom attribute writer method with validation
|
|
203
|
+
# @param [Object] variation_name Value to be assigned
|
|
204
|
+
def variation_name=(variation_name)
|
|
205
|
+
|
|
206
|
+
if !variation_name.nil? && variation_name.to_s.length > 255
|
|
207
|
+
fail ArgumentError, "invalid value for 'variation_name', the character length must be smaller than or equal to 255."
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
@variation_name = variation_name
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
# Custom attribute writer method with validation
|
|
214
|
+
# @param [Object] note Value to be assigned
|
|
215
|
+
def note=(note)
|
|
216
|
+
|
|
217
|
+
if !note.nil? && note.to_s.length > 50
|
|
218
|
+
fail ArgumentError, "invalid value for 'note', the character length must be smaller than or equal to 50."
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
@note = note
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
# Custom attribute writer method with validation
|
|
225
|
+
# @param [Object] catalog_object_id Value to be assigned
|
|
226
|
+
def catalog_object_id=(catalog_object_id)
|
|
227
|
+
|
|
228
|
+
if !catalog_object_id.nil? && catalog_object_id.to_s.length > 192
|
|
229
|
+
fail ArgumentError, "invalid value for 'catalog_object_id', the character length must be smaller than or equal to 192."
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
@catalog_object_id = catalog_object_id
|
|
233
|
+
end
|
|
234
|
+
|
|
140
235
|
# Checks equality by comparing each attribute.
|
|
141
236
|
# @param [Object] Object to be compared
|
|
142
237
|
def ==(o)
|
|
@@ -145,6 +240,10 @@ module SquareConnect
|
|
|
145
240
|
name == o.name &&
|
|
146
241
|
quantity == o.quantity &&
|
|
147
242
|
base_price_money == o.base_price_money &&
|
|
243
|
+
variation_name == o.variation_name &&
|
|
244
|
+
note == o.note &&
|
|
245
|
+
catalog_object_id == o.catalog_object_id &&
|
|
246
|
+
modifiers == o.modifiers &&
|
|
148
247
|
taxes == o.taxes &&
|
|
149
248
|
discounts == o.discounts
|
|
150
249
|
end
|
|
@@ -158,7 +257,7 @@ module SquareConnect
|
|
|
158
257
|
# Calculates hash code according to all attributes.
|
|
159
258
|
# @return [Fixnum] Hash code
|
|
160
259
|
def hash
|
|
161
|
-
[name, quantity, base_price_money, taxes, discounts].hash
|
|
260
|
+
[name, quantity, base_price_money, variation_name, note, catalog_object_id, modifiers, taxes, discounts].hash
|
|
162
261
|
end
|
|
163
262
|
|
|
164
263
|
# Builds the object from hash
|