square_connect 2.1.1.106 → 2.2.0.110
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -4
- data/docs/Card.md +1 -0
- data/docs/CatalogApi.md +4 -4
- data/docs/CatalogItem.md +1 -1
- data/docs/CatalogItemProductType.md +1 -1
- data/docs/CatalogItemVariation.md +1 -1
- data/docs/CatalogObject.md +3 -3
- data/docs/CatalogQuery.md +2 -2
- data/docs/CatalogTax.md +1 -1
- data/docs/CatalogV1Id.md +2 -2
- data/docs/CreateCheckoutRequest.md +1 -1
- data/docs/{CreateOrderRequestOrder.md → CreateOrderRequest.md} +4 -2
- data/docs/CreateOrderRequestDiscount.md +14 -0
- data/docs/CreateOrderRequestLineItem.md +4 -2
- data/docs/CreateOrderRequestTax.md +14 -0
- data/docs/CustomersApi.md +2 -2
- data/docs/ErrorCode.md +1 -0
- data/docs/ItemVariationLocationOverrides.md +5 -5
- data/docs/Order.md +2 -1
- data/docs/OrderLineItem.md +5 -2
- data/docs/OrderLineItemDiscount.md +17 -0
- data/docs/OrderLineItemDiscountScope.md +13 -0
- data/docs/OrderLineItemDiscountType.md +16 -0
- data/docs/OrderLineItemTax.md +15 -0
- data/docs/OrderLineItemTaxType.md +14 -0
- data/docs/RetrieveCatalogObjectRequest.md +1 -1
- data/docs/SearchCatalogObjectsRequest.md +1 -1
- data/docs/Transaction.md +2 -2
- data/docs/TransactionsApi.md +1 -1
- data/lib/square_connect.rb +8 -1
- data/lib/square_connect/api/catalog_api.rb +6 -6
- data/lib/square_connect/api/customers_api.rb +4 -4
- data/lib/square_connect/api/transactions_api.rb +2 -2
- data/lib/square_connect/api_client.rb +1 -1
- data/lib/square_connect/models/card.rb +14 -4
- data/lib/square_connect/models/catalog_item.rb +1 -1
- data/lib/square_connect/models/catalog_item_variation.rb +1 -1
- data/lib/square_connect/models/catalog_object.rb +3 -3
- data/lib/square_connect/models/catalog_query.rb +2 -2
- data/lib/square_connect/models/catalog_tax.rb +1 -1
- data/lib/square_connect/models/catalog_v1_id.rb +2 -2
- data/lib/square_connect/models/create_checkout_request.rb +1 -1
- data/lib/square_connect/models/{create_order_request_order.rb → create_order_request.rb} +30 -6
- data/lib/square_connect/models/create_order_request_discount.rb +222 -0
- data/lib/square_connect/models/create_order_request_line_item.rb +31 -29
- data/lib/square_connect/models/create_order_request_tax.rb +255 -0
- data/lib/square_connect/models/error.rb +2 -2
- data/lib/square_connect/models/error_code.rb +1 -0
- data/lib/square_connect/models/item_variation_location_overrides.rb +5 -5
- data/lib/square_connect/models/order.rb +24 -14
- data/lib/square_connect/models/order_line_item.rb +46 -12
- data/lib/square_connect/models/order_line_item_discount.rb +281 -0
- data/lib/square_connect/models/order_line_item_discount_scope.rb +19 -0
- data/lib/square_connect/models/order_line_item_discount_type.rb +22 -0
- data/lib/square_connect/models/order_line_item_tax.rb +249 -0
- data/lib/square_connect/models/order_line_item_tax_type.rb +20 -0
- data/lib/square_connect/models/retrieve_catalog_object_request.rb +1 -1
- data/lib/square_connect/models/search_catalog_objects_request.rb +1 -1
- data/lib/square_connect/models/transaction.rb +2 -2
- data/lib/square_connect/version.rb +1 -1
- metadata +17 -3
data/docs/TransactionsApi.md
CHANGED
@@ -128,7 +128,7 @@ Name | Type | Description | Notes
|
|
128
128
|
|
129
129
|
CreateRefund
|
130
130
|
|
131
|
-
Initiates a refund for a previously charged tender.
|
131
|
+
Initiates a refund for a previously charged tender. You must issue a refund within 120 days of the associated payment. See (this article)[https://squareup.com/help/us/en/article/5060] for more information on refund behavior.
|
132
132
|
|
133
133
|
### Example
|
134
134
|
```ruby
|
data/lib/square_connect.rb
CHANGED
@@ -64,8 +64,10 @@ require 'square_connect/models/create_customer_card_request'
|
|
64
64
|
require 'square_connect/models/create_customer_card_response'
|
65
65
|
require 'square_connect/models/create_customer_request'
|
66
66
|
require 'square_connect/models/create_customer_response'
|
67
|
+
require 'square_connect/models/create_order_request'
|
68
|
+
require 'square_connect/models/create_order_request_discount'
|
67
69
|
require 'square_connect/models/create_order_request_line_item'
|
68
|
-
require 'square_connect/models/
|
70
|
+
require 'square_connect/models/create_order_request_tax'
|
69
71
|
require 'square_connect/models/create_refund_request'
|
70
72
|
require 'square_connect/models/create_refund_response'
|
71
73
|
require 'square_connect/models/currency'
|
@@ -99,6 +101,11 @@ require 'square_connect/models/location_capability'
|
|
99
101
|
require 'square_connect/models/money'
|
100
102
|
require 'square_connect/models/order'
|
101
103
|
require 'square_connect/models/order_line_item'
|
104
|
+
require 'square_connect/models/order_line_item_discount'
|
105
|
+
require 'square_connect/models/order_line_item_discount_scope'
|
106
|
+
require 'square_connect/models/order_line_item_discount_type'
|
107
|
+
require 'square_connect/models/order_line_item_tax'
|
108
|
+
require 'square_connect/models/order_line_item_tax_type'
|
102
109
|
require 'square_connect/models/refund'
|
103
110
|
require 'square_connect/models/refund_status'
|
104
111
|
require 'square_connect/models/retrieve_catalog_object_request'
|
@@ -71,7 +71,7 @@ module SquareConnect
|
|
71
71
|
end
|
72
72
|
|
73
73
|
# BatchRetrieveCatalogObjects
|
74
|
-
# Returns a set of objects based on the provided ID. [CatalogItem](#type-catalogitem)
|
74
|
+
# Returns a set of objects based on the provided ID. Each [CatalogItem](#type-catalogitem) returned in the set includes all of its child information including: all of its [CatalogItemVariation](#type-catalogitemvariation) objects, references to its [CatalogModifierList](#type-catalogmodifierlist) objects, and the ids of any [CatalogTax](#type-catalogtax) objects that apply to it.
|
75
75
|
# @param body An object containing the fields to POST for the request. See the corresponding object definition for field details.
|
76
76
|
# @param [Hash] opts the optional parameters
|
77
77
|
# @return [BatchRetrieveCatalogObjectsResponse]
|
@@ -81,7 +81,7 @@ module SquareConnect
|
|
81
81
|
end
|
82
82
|
|
83
83
|
# BatchRetrieveCatalogObjects
|
84
|
-
# Returns a set of objects based on the provided ID. [CatalogItem](#type-catalogitem)
|
84
|
+
# Returns a set of objects based on the provided ID. Each [CatalogItem](#type-catalogitem) returned in the set includes all of its child information including: all of its [CatalogItemVariation](#type-catalogitemvariation) objects, references to its [CatalogModifierList](#type-catalogmodifierlist) objects, and the ids of any [CatalogTax](#type-catalogtax) objects that apply to it.
|
85
85
|
# @param body An object containing the fields to POST for the request. See the corresponding object definition for field details.
|
86
86
|
# @param [Hash] opts the optional parameters
|
87
87
|
# @return [Array<(BatchRetrieveCatalogObjectsResponse, Fixnum, Hash)>] BatchRetrieveCatalogObjectsResponse data, response status code and response headers
|
@@ -337,7 +337,7 @@ module SquareConnect
|
|
337
337
|
# Returns a single [CatalogItem](#type-catalogitem) as a [CatalogObject](#type-catalogobject) based on the provided ID. The returned object includes all of the relevant [CatalogItem](#type-catalogitem) information including: [CatalogItemVariation](#type-catalogitemvariation) children, references to its [CatalogModifierList](#type-catalogmodifierlist) objects, and the ids of any [CatalogTax](#type-catalogtax) objects that apply to it.
|
338
338
|
# @param object_id The object ID of any type of [CatalogObject](#type-catalogobject)s to be retrieved.
|
339
339
|
# @param [Hash] opts the optional parameters
|
340
|
-
# @option opts [BOOLEAN] :include_related_objects If `true`, the response will include additional objects that are related to the requested object, as follows: If the `object` field of the response contains a [CatalogItem](#type-catalogitem), its associated [CatalogCategory](#type-catalogcategory), [CatalogTax](#type-catalogtax)es, and [CatalogModifierList](#type-catalogmodifierlist)s will be returned in the `related_objects` field of the response. If the `object` field of the response contains a [CatalogItemVariation](#type-catalogitemvariation), its parent [CatalogItem](#type-catalogitem) will be returned in the `related_objects` field of the response.
|
340
|
+
# @option opts [BOOLEAN] :include_related_objects If `true`, the response will include additional objects that are related to the requested object, as follows: If the `object` field of the response contains a [CatalogItem](#type-catalogitem), its associated [CatalogCategory](#type-catalogcategory), [CatalogTax](#type-catalogtax)es, and [CatalogModifierList](#type-catalogmodifierlist)s will be returned in the `related_objects` field of the response. If the `object` field of the response contains a [CatalogItemVariation](#type-catalogitemvariation), its parent [CatalogItem](#type-catalogitem) will be returned in the `related_objects` field of the response. Default value: `false`
|
341
341
|
# @return [RetrieveCatalogObjectResponse]
|
342
342
|
def retrieve_catalog_object(object_id, opts = {})
|
343
343
|
data, _status_code, _headers = retrieve_catalog_object_with_http_info(object_id, opts)
|
@@ -348,7 +348,7 @@ module SquareConnect
|
|
348
348
|
# Returns a single [CatalogItem](#type-catalogitem) as a [CatalogObject](#type-catalogobject) based on the provided ID. The returned object includes all of the relevant [CatalogItem](#type-catalogitem) information including: [CatalogItemVariation](#type-catalogitemvariation) children, references to its [CatalogModifierList](#type-catalogmodifierlist) objects, and the ids of any [CatalogTax](#type-catalogtax) objects that apply to it.
|
349
349
|
# @param object_id The object ID of any type of [CatalogObject](#type-catalogobject)s to be retrieved.
|
350
350
|
# @param [Hash] opts the optional parameters
|
351
|
-
# @option opts [BOOLEAN] :include_related_objects If `true`, the response will include additional objects that are related to the requested object, as follows: If the `object` field of the response contains a [CatalogItem](#type-catalogitem), its associated [CatalogCategory](#type-catalogcategory), [CatalogTax](#type-catalogtax)es, and [CatalogModifierList](#type-catalogmodifierlist)s will be returned in the `related_objects` field of the response. If the `object` field of the response contains a [CatalogItemVariation](#type-catalogitemvariation), its parent [CatalogItem](#type-catalogitem) will be returned in the `related_objects` field of the response.
|
351
|
+
# @option opts [BOOLEAN] :include_related_objects If `true`, the response will include additional objects that are related to the requested object, as follows: If the `object` field of the response contains a [CatalogItem](#type-catalogitem), its associated [CatalogCategory](#type-catalogcategory), [CatalogTax](#type-catalogtax)es, and [CatalogModifierList](#type-catalogmodifierlist)s will be returned in the `related_objects` field of the response. If the `object` field of the response contains a [CatalogItemVariation](#type-catalogitemvariation), its parent [CatalogItem](#type-catalogitem) will be returned in the `related_objects` field of the response. Default value: `false`
|
352
352
|
# @return [Array<(RetrieveCatalogObjectResponse, Fixnum, Hash)>] RetrieveCatalogObjectResponse data, response status code and response headers
|
353
353
|
def retrieve_catalog_object_with_http_info(object_id, opts = {})
|
354
354
|
if @api_client.config.debugging
|
@@ -390,7 +390,7 @@ module SquareConnect
|
|
390
390
|
end
|
391
391
|
|
392
392
|
# SearchCatalogObjects
|
393
|
-
# Queries the targeted catalog using a variety of query types ([CatalogQuerySortedAttribute](#type-catalogquerysortedattribute), ([CatalogQueryExact](#type-catalogqueryexact, ([CatalogQueryRange](#type-catalogqueryrange), ([CatalogQueryText](#type-catalogquerytext), ([CatalogQueryItemsForTax](#type-catalogqueryitemsfortax), ([CatalogQueryItemsForModifierList](#type-catalogqueryitemsformodifierlist)).
|
393
|
+
# Queries the targeted catalog using a variety of query types ([CatalogQuerySortedAttribute](#type-catalogquerysortedattribute), ([CatalogQueryExact](#type-catalogqueryexact), ([CatalogQueryRange](#type-catalogqueryrange), ([CatalogQueryText](#type-catalogquerytext), ([CatalogQueryItemsForTax](#type-catalogqueryitemsfortax), ([CatalogQueryItemsForModifierList](#type-catalogqueryitemsformodifierlist)).
|
394
394
|
# @param body An object containing the fields to POST for the request. See the corresponding object definition for field details.
|
395
395
|
# @param [Hash] opts the optional parameters
|
396
396
|
# @return [SearchCatalogObjectsResponse]
|
@@ -400,7 +400,7 @@ module SquareConnect
|
|
400
400
|
end
|
401
401
|
|
402
402
|
# SearchCatalogObjects
|
403
|
-
# Queries the targeted catalog using a variety of query types ([CatalogQuerySortedAttribute](#type-catalogquerysortedattribute), ([CatalogQueryExact](#type-catalogqueryexact, ([CatalogQueryRange](#type-catalogqueryrange), ([CatalogQueryText](#type-catalogquerytext), ([CatalogQueryItemsForTax](#type-catalogqueryitemsfortax), ([CatalogQueryItemsForModifierList](#type-catalogqueryitemsformodifierlist)).
|
403
|
+
# Queries the targeted catalog using a variety of query types ([CatalogQuerySortedAttribute](#type-catalogquerysortedattribute), ([CatalogQueryExact](#type-catalogqueryexact), ([CatalogQueryRange](#type-catalogqueryrange), ([CatalogQueryText](#type-catalogquerytext), ([CatalogQueryItemsForTax](#type-catalogqueryitemsfortax), ([CatalogQueryItemsForModifierList](#type-catalogqueryitemsformodifierlist)).
|
404
404
|
# @param body An object containing the fields to POST for the request. See the corresponding object definition for field details.
|
405
405
|
# @param [Hash] opts the optional parameters
|
406
406
|
# @return [Array<(SearchCatalogObjectsResponse, Fixnum, Hash)>] SearchCatalogObjectsResponse data, response status code and response headers
|
@@ -71,7 +71,7 @@ module SquareConnect
|
|
71
71
|
end
|
72
72
|
|
73
73
|
# CreateCustomerCard
|
74
|
-
# Adds a card on file to an existing customer.
|
74
|
+
# Adds a card on file to an existing customer. In the United States Square takes care of automatically updating any cards on file that might have expired since you first attached them to a customer.
|
75
75
|
# @param customer_id The ID of the customer to link the card on file to.
|
76
76
|
# @param body An object containing the fields to POST for the request. See the corresponding object definition for field details.
|
77
77
|
# @param [Hash] opts the optional parameters
|
@@ -82,7 +82,7 @@ module SquareConnect
|
|
82
82
|
end
|
83
83
|
|
84
84
|
# CreateCustomerCard
|
85
|
-
# Adds a card on file to an existing customer.
|
85
|
+
# Adds a card on file to an existing customer. In the United States Square takes care of automatically updating any cards on file that might have expired since you first attached them to a customer.
|
86
86
|
# @param customer_id The ID of the customer to link the card on file to.
|
87
87
|
# @param body An object containing the fields to POST for the request. See the corresponding object definition for field details.
|
88
88
|
# @param [Hash] opts the optional parameters
|
@@ -343,7 +343,7 @@ module SquareConnect
|
|
343
343
|
end
|
344
344
|
|
345
345
|
# UpdateCustomer
|
346
|
-
# Updates the details of an existing customer. You cannot edit a customer's cards on file with this endpoint. To make changes to a card on file, you must delete the existing card on file with the [DeleteCustomerCard](#endpoint-deletecustomercard) endpoint, then create a new one with the [CreateCustomerCard](#endpoint-createcustomercard) endpoint.
|
346
|
+
# Updates the details of an existing customer. The ID of the customer may change if the customer has been merged into another customer. You cannot edit a customer's cards on file with this endpoint. To make changes to a card on file, you must delete the existing card on file with the [DeleteCustomerCard](#endpoint-deletecustomercard) endpoint, then create a new one with the [CreateCustomerCard](#endpoint-createcustomercard) endpoint.
|
347
347
|
# @param customer_id The ID of the customer to update.
|
348
348
|
# @param body An object containing the fields to POST for the request. See the corresponding object definition for field details.
|
349
349
|
# @param [Hash] opts the optional parameters
|
@@ -354,7 +354,7 @@ module SquareConnect
|
|
354
354
|
end
|
355
355
|
|
356
356
|
# UpdateCustomer
|
357
|
-
# Updates the details of an existing customer. You cannot edit a customer's cards on file with this endpoint. To make changes to a card on file, you must delete the existing card on file with the [DeleteCustomerCard](#endpoint-deletecustomercard) endpoint, then create a new one with the [CreateCustomerCard](#endpoint-createcustomercard) endpoint.
|
357
|
+
# Updates the details of an existing customer. The ID of the customer may change if the customer has been merged into another customer. You cannot edit a customer's cards on file with this endpoint. To make changes to a card on file, you must delete the existing card on file with the [DeleteCustomerCard](#endpoint-deletecustomercard) endpoint, then create a new one with the [CreateCustomerCard](#endpoint-createcustomercard) endpoint.
|
358
358
|
# @param customer_id The ID of the customer to update.
|
359
359
|
# @param body An object containing the fields to POST for the request. See the corresponding object definition for field details.
|
360
360
|
# @param [Hash] opts the optional parameters
|
@@ -132,7 +132,7 @@ module SquareConnect
|
|
132
132
|
end
|
133
133
|
|
134
134
|
# CreateRefund
|
135
|
-
# Initiates a refund for a previously charged tender.
|
135
|
+
# Initiates a refund for a previously charged tender. You must issue a refund within 120 days of the associated payment. See (this article)[https://squareup.com/help/us/en/article/5060] for more information on refund behavior.
|
136
136
|
# @param location_id The ID of the original transaction's associated location.
|
137
137
|
# @param transaction_id The ID of the original transaction that includes the tender to refund.
|
138
138
|
# @param body An object containing the fields to POST for the request. See the corresponding object definition for field details.
|
@@ -144,7 +144,7 @@ module SquareConnect
|
|
144
144
|
end
|
145
145
|
|
146
146
|
# CreateRefund
|
147
|
-
# Initiates a refund for a previously charged tender.
|
147
|
+
# Initiates a refund for a previously charged tender. You must issue a refund within 120 days of the associated payment. See (this article)[https://squareup.com/help/us/en/article/5060] for more information on refund behavior.
|
148
148
|
# @param location_id The ID of the original transaction's associated location.
|
149
149
|
# @param transaction_id The ID of the original transaction that includes the tender to refund.
|
150
150
|
# @param body An object containing the fields to POST for the request. See the corresponding object definition for field details.
|
@@ -30,7 +30,7 @@ module SquareConnect
|
|
30
30
|
@config = config
|
31
31
|
|
32
32
|
# Construct user agent string. Returns slightly different string for JRuby
|
33
|
-
@user_agent = "Square-Connect-Ruby/2.
|
33
|
+
@user_agent = "Square-Connect-Ruby/2.2.0"
|
34
34
|
|
35
35
|
@default_headers = {
|
36
36
|
'Content-Type' => "application/json",
|
@@ -33,6 +33,9 @@ module SquareConnect
|
|
33
33
|
# The card's billing address. This value is present only if this object represents a customer's card on file.
|
34
34
|
attr_accessor :billing_address
|
35
35
|
|
36
|
+
# The unique string fingerprint for the card. The fingerprint is based on the credit card number and is unique to the merchant. If a card is used at multiple locations for the same merchant, it will have the same fingerprint in each case. Note: Fingerprint may not exist on old transactions.
|
37
|
+
attr_accessor :fingerprint
|
38
|
+
|
36
39
|
class EnumAttributeValidator
|
37
40
|
attr_reader :datatype
|
38
41
|
attr_reader :allowable_values
|
@@ -64,7 +67,8 @@ module SquareConnect
|
|
64
67
|
:'exp_month' => :'exp_month',
|
65
68
|
:'exp_year' => :'exp_year',
|
66
69
|
:'cardholder_name' => :'cardholder_name',
|
67
|
-
:'billing_address' => :'billing_address'
|
70
|
+
:'billing_address' => :'billing_address',
|
71
|
+
:'fingerprint' => :'fingerprint'
|
68
72
|
}
|
69
73
|
end
|
70
74
|
|
@@ -77,7 +81,8 @@ module SquareConnect
|
|
77
81
|
:'exp_month' => :'Integer',
|
78
82
|
:'exp_year' => :'Integer',
|
79
83
|
:'cardholder_name' => :'String',
|
80
|
-
:'billing_address' => :'Address'
|
84
|
+
:'billing_address' => :'Address',
|
85
|
+
:'fingerprint' => :'String'
|
81
86
|
}
|
82
87
|
end
|
83
88
|
|
@@ -117,6 +122,10 @@ module SquareConnect
|
|
117
122
|
self.billing_address = attributes[:'billing_address']
|
118
123
|
end
|
119
124
|
|
125
|
+
if attributes.has_key?(:'fingerprint')
|
126
|
+
self.fingerprint = attributes[:'fingerprint']
|
127
|
+
end
|
128
|
+
|
120
129
|
end
|
121
130
|
|
122
131
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -155,7 +164,8 @@ module SquareConnect
|
|
155
164
|
exp_month == o.exp_month &&
|
156
165
|
exp_year == o.exp_year &&
|
157
166
|
cardholder_name == o.cardholder_name &&
|
158
|
-
billing_address == o.billing_address
|
167
|
+
billing_address == o.billing_address &&
|
168
|
+
fingerprint == o.fingerprint
|
159
169
|
end
|
160
170
|
|
161
171
|
# @see the `==` method
|
@@ -167,7 +177,7 @@ module SquareConnect
|
|
167
177
|
# Calculates hash code according to all attributes.
|
168
178
|
# @return [Fixnum] Hash code
|
169
179
|
def hash
|
170
|
-
[id, card_brand, last_4, exp_month, exp_year, cardholder_name, billing_address].hash
|
180
|
+
[id, card_brand, last_4, exp_month, exp_year, cardholder_name, billing_address, fingerprint].hash
|
171
181
|
end
|
172
182
|
|
173
183
|
# Builds the object from hash
|
@@ -21,7 +21,7 @@ module SquareConnect
|
|
21
21
|
# The text of the item's display label in the Square Point of Sale app. Only up to the first five characters of the string are used. Searchable.
|
22
22
|
attr_accessor :abbreviation
|
23
23
|
|
24
|
-
# The color of the item's display label in the Square Point of Sale app.
|
24
|
+
# The color of the item's display label in the Square Point of Sale app.
|
25
25
|
attr_accessor :label_color
|
26
26
|
|
27
27
|
# If `true`, the item can be added to shipping orders from the merchant's online store.
|
@@ -30,7 +30,7 @@ module SquareConnect
|
|
30
30
|
# The item variation's price, if fixed pricing is used.
|
31
31
|
attr_accessor :price_money
|
32
32
|
|
33
|
-
# Per-location price and inventory overrides.
|
33
|
+
# Per-[location][#type-location] price and inventory overrides.
|
34
34
|
attr_accessor :location_overrides
|
35
35
|
|
36
36
|
# If `true`, inventory tracking is active for the variation.
|
@@ -15,7 +15,7 @@ module SquareConnect
|
|
15
15
|
# The type of this object. Each object type has expected properties expressed in a structured format within its corresponding `*_data` field below. See [CatalogObjectType](#type-catalogobjecttype) for all possible values.
|
16
16
|
attr_accessor :type
|
17
17
|
|
18
|
-
#
|
18
|
+
# An identifier to reference this object in the catalog. When a new CatalogObject is inserted, the client should set the id to a temporary identifier starting with a `'#'` character. Other objects being inserted or updated within the same request may use this identifier to refer to the new object. When the server receives the new object, it will supply a unique identifier that replaces the temporary identifier for all future references.
|
19
19
|
attr_accessor :id
|
20
20
|
|
21
21
|
# Last modification [timestamp](#workingwithdates) in RFC 3339 format, e.g., `\"2016-08-15T23:59:33.123Z\"` would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds.
|
@@ -24,10 +24,10 @@ module SquareConnect
|
|
24
24
|
# The version of the object. When updating an object, the version supplied by the must match the version in the database, otherwise the write will be rejected as conflicting.
|
25
25
|
attr_accessor :version
|
26
26
|
|
27
|
-
# If `true`, the object has been deleted from the database. Must be `false` for new objects being inserted. When deleted, the `updated_at` field will equal the deletion time.
|
27
|
+
# If `true`, the object has been deleted from the database. Must be `false` for new objects being inserted. When deleted, the `updated_at` field will equal the deletion time.
|
28
28
|
attr_accessor :is_deleted
|
29
29
|
|
30
|
-
# The Connect V1 IDs for this object at each location where it is present, where they differ from the object's Connect V2 ID. The field will only be present for objects that have been created or modified by legacy APIs.
|
30
|
+
# The Connect V1 IDs for this object at each [location][#type-location] where it is present, where they differ from the object's Connect V2 ID. The field will only be present for objects that have been created or modified by legacy APIs.
|
31
31
|
attr_accessor :catalog_v1_ids
|
32
32
|
|
33
33
|
# If `true`, this object is present at all locations (including future locations), except where specified in the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), except where specified in the `present_at_location_ids` field.
|
@@ -10,7 +10,7 @@ Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
10
10
|
require 'date'
|
11
11
|
|
12
12
|
module SquareConnect
|
13
|
-
# A query to be applied to a [SearchCatalogObjectsRequest](#type-searchcatalogobjectsrequest)
|
13
|
+
# A query to be applied to a [SearchCatalogObjectsRequest](#type-searchcatalogobjectsrequest). Only one query field may be present. Where an attribute name is required, it should be specified as the name of any field marked \"searchable\" from the structured data types for the desired result object type(s) ([CatalogItem](#type-catalogitem), [CatalogItemVariation](#type-catalogitemvariation), [CatalogCategory](#type-catalogcategory), [CatalogTax](#type-catalogtax), [CatalogDiscount](#type-catalogdiscount), [CatalogModifierList](#type-catalogmodifierlist), [CatalogModifier](#type-catalogmodifier)). For example, a query that should return Items may specify attribute names from any of the searchable fields of the [CatalogItem](#type-catalogitem) data type, namely `\"name\"`, `\"description\"`, and `\"abbreviation\"`.
|
14
14
|
class CatalogQuery
|
15
15
|
# A query that returns all objects, sorted by the given attribute.
|
16
16
|
attr_accessor :sorted_attribute_query
|
@@ -24,7 +24,7 @@ module SquareConnect
|
|
24
24
|
# A query that returns only objects for which the given (integer-valued) attribute lies in the given range.
|
25
25
|
attr_accessor :range_query
|
26
26
|
|
27
|
-
# A query that returns only objects whose searchable attributes contain all of the given keywords as prefixes. For example, if a [CatalogItem](#type-catalogitem) contains attributes `{\"name\": \"t-shirt\"}` and `{\"description\": \"Small,
|
27
|
+
# A query that returns only objects whose searchable attributes contain all of the given keywords as prefixes. For example, if a [CatalogItem](#type-catalogitem) contains attributes `{\"name\": \"t-shirt\"}` and `{\"description\": \"Small, Purple\"}`, it will be matched by the query `{\"keywords\": [\"shirt\", \"sma\", \"purp\"]}`.
|
28
28
|
attr_accessor :text_query
|
29
29
|
|
30
30
|
# A query that returns all [CatalogItem](#type-catalogitem)s that have any of the given [CatalogTax](#type-catalogtax)es enabled.
|
@@ -21,7 +21,7 @@ module SquareConnect
|
|
21
21
|
# Whether the tax is `ADDITIVE` or `INCLUSIVE`. See [TaxInclusionType](#type-taxinclusiontype) for all possible values.
|
22
22
|
attr_accessor :inclusion_type
|
23
23
|
|
24
|
-
# The percentage of the tax in decimal form, using a '.' as the decimal separator and without a '%' sign. A value of `7.5` corresponds to 7.5%.
|
24
|
+
# The percentage of the tax in decimal form, using a `'.'` as the decimal separator and without a `'%'` sign. A value of `7.5` corresponds to 7.5%.
|
25
25
|
attr_accessor :percentage
|
26
26
|
|
27
27
|
# If `true`, the fee applies to custom amounts entered into the Square Point of Sale app that are not associated with a particular [CatalogItem](#type-catalogitem).
|
@@ -10,12 +10,12 @@ Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
10
10
|
require 'date'
|
11
11
|
|
12
12
|
module SquareConnect
|
13
|
-
# An Items Connect V1 object ID along with its associated location ID.
|
13
|
+
# An Items Connect V1 object ID along with its associated [location][#type-location] ID.
|
14
14
|
class CatalogV1Id
|
15
15
|
# The ID for an object in Connect V1, if different from its Connect V2 ID.
|
16
16
|
attr_accessor :catalog_v1_id
|
17
17
|
|
18
|
-
# The ID of the location this Connect V1 ID is associated with.
|
18
|
+
# The ID of the [location][#type-location] this Connect V1 ID is associated with.
|
19
19
|
attr_accessor :location_id
|
20
20
|
|
21
21
|
|
@@ -51,7 +51,7 @@ module SquareConnect
|
|
51
51
|
def self.swagger_types
|
52
52
|
{
|
53
53
|
:'idempotency_key' => :'String',
|
54
|
-
:'order' => :'
|
54
|
+
:'order' => :'CreateOrderRequest',
|
55
55
|
:'ask_for_shipping_address' => :'BOOLEAN',
|
56
56
|
:'merchant_support_email' => :'String',
|
57
57
|
:'pre_populate_buyer_email' => :'String',
|
@@ -10,20 +10,28 @@ Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
10
10
|
require 'date'
|
11
11
|
|
12
12
|
module SquareConnect
|
13
|
-
#
|
14
|
-
class
|
13
|
+
# Defines the parameters that can be included in the body of a request to the [CreateCheckout](#endpoint-createcheckout) endpoint.
|
14
|
+
class CreateOrderRequest
|
15
15
|
# 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
16
|
attr_accessor :reference_id
|
17
17
|
|
18
18
|
# The line items to associate with this order. Each line item represents a different product (or a custom monetary amount) to include in a purchase.
|
19
19
|
attr_accessor :line_items
|
20
20
|
|
21
|
+
# The taxes include the custom taxes.
|
22
|
+
attr_accessor :taxes
|
23
|
+
|
24
|
+
# The discounts include the custom discounts .
|
25
|
+
attr_accessor :discounts
|
26
|
+
|
21
27
|
|
22
28
|
# Attribute mapping from ruby-style variable name to JSON key.
|
23
29
|
def self.attribute_map
|
24
30
|
{
|
25
31
|
:'reference_id' => :'reference_id',
|
26
|
-
:'line_items' => :'line_items'
|
32
|
+
:'line_items' => :'line_items',
|
33
|
+
:'taxes' => :'taxes',
|
34
|
+
:'discounts' => :'discounts'
|
27
35
|
}
|
28
36
|
end
|
29
37
|
|
@@ -31,7 +39,9 @@ module SquareConnect
|
|
31
39
|
def self.swagger_types
|
32
40
|
{
|
33
41
|
:'reference_id' => :'String',
|
34
|
-
:'line_items' => :'Array<CreateOrderRequestLineItem>'
|
42
|
+
:'line_items' => :'Array<CreateOrderRequestLineItem>',
|
43
|
+
:'taxes' => :'Array<CreateOrderRequestTax>',
|
44
|
+
:'discounts' => :'Array<CreateOrderRequestDiscount>'
|
35
45
|
}
|
36
46
|
end
|
37
47
|
|
@@ -53,6 +63,18 @@ module SquareConnect
|
|
53
63
|
end
|
54
64
|
end
|
55
65
|
|
66
|
+
if attributes.has_key?(:'taxes')
|
67
|
+
if (value = attributes[:'taxes']).is_a?(Array)
|
68
|
+
self.taxes = value
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
if attributes.has_key?(:'discounts')
|
73
|
+
if (value = attributes[:'discounts']).is_a?(Array)
|
74
|
+
self.discounts = value
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
56
78
|
end
|
57
79
|
|
58
80
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -95,7 +117,9 @@ module SquareConnect
|
|
95
117
|
return true if self.equal?(o)
|
96
118
|
self.class == o.class &&
|
97
119
|
reference_id == o.reference_id &&
|
98
|
-
line_items == o.line_items
|
120
|
+
line_items == o.line_items &&
|
121
|
+
taxes == o.taxes &&
|
122
|
+
discounts == o.discounts
|
99
123
|
end
|
100
124
|
|
101
125
|
# @see the `==` method
|
@@ -107,7 +131,7 @@ module SquareConnect
|
|
107
131
|
# Calculates hash code according to all attributes.
|
108
132
|
# @return [Fixnum] Hash code
|
109
133
|
def hash
|
110
|
-
[reference_id, line_items].hash
|
134
|
+
[reference_id, line_items, taxes, discounts].hash
|
111
135
|
end
|
112
136
|
|
113
137
|
# Builds the object from hash
|
@@ -0,0 +1,222 @@
|
|
1
|
+
=begin
|
2
|
+
#Square Connect API
|
3
|
+
|
4
|
+
OpenAPI spec version: 2.0
|
5
|
+
Contact: developers@squareup.com
|
6
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
7
|
+
|
8
|
+
=end
|
9
|
+
|
10
|
+
require 'date'
|
11
|
+
|
12
|
+
module SquareConnect
|
13
|
+
# Represents a discount that to either a single line item or an entire order.
|
14
|
+
class CreateOrderRequestDiscount
|
15
|
+
# The discount's name.
|
16
|
+
attr_accessor :name
|
17
|
+
|
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
|
19
|
+
attr_accessor :percentage
|
20
|
+
|
21
|
+
# The monetary amount of the discount.
|
22
|
+
attr_accessor :amount_money
|
23
|
+
|
24
|
+
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
26
|
+
def self.attribute_map
|
27
|
+
{
|
28
|
+
:'name' => :'name',
|
29
|
+
:'percentage' => :'percentage',
|
30
|
+
:'amount_money' => :'amount_money'
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
# Attribute type mapping.
|
35
|
+
def self.swagger_types
|
36
|
+
{
|
37
|
+
:'name' => :'String',
|
38
|
+
:'percentage' => :'String',
|
39
|
+
:'amount_money' => :'Money'
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
# Initializes the object
|
44
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
45
|
+
def initialize(attributes = {})
|
46
|
+
return unless attributes.is_a?(Hash)
|
47
|
+
|
48
|
+
# convert string to symbol for hash key
|
49
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
50
|
+
|
51
|
+
if attributes.has_key?(:'name')
|
52
|
+
self.name = attributes[:'name']
|
53
|
+
end
|
54
|
+
|
55
|
+
if attributes.has_key?(:'percentage')
|
56
|
+
self.percentage = attributes[:'percentage']
|
57
|
+
end
|
58
|
+
|
59
|
+
if attributes.has_key?(:'amount_money')
|
60
|
+
self.amount_money = attributes[:'amount_money']
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
66
|
+
# @return Array for valid properies with the reasons
|
67
|
+
def list_invalid_properties
|
68
|
+
invalid_properties = Array.new
|
69
|
+
if !@name.nil? && @name.to_s.length > 255
|
70
|
+
invalid_properties.push("invalid value for 'name', the character length must be smaller than or equal to 255.")
|
71
|
+
end
|
72
|
+
|
73
|
+
return invalid_properties
|
74
|
+
end
|
75
|
+
|
76
|
+
# Check to see if the all the properties in the model are valid
|
77
|
+
# @return true if the model is valid
|
78
|
+
def valid?
|
79
|
+
return false if !@name.nil? && @name.to_s.length > 255
|
80
|
+
return true
|
81
|
+
end
|
82
|
+
|
83
|
+
# Custom attribute writer method with validation
|
84
|
+
# @param [Object] name Value to be assigned
|
85
|
+
def name=(name)
|
86
|
+
|
87
|
+
if !name.nil? && name.to_s.length > 255
|
88
|
+
fail ArgumentError, "invalid value for 'name', the character length must be smaller than or equal to 255."
|
89
|
+
end
|
90
|
+
|
91
|
+
@name = name
|
92
|
+
end
|
93
|
+
|
94
|
+
# Checks equality by comparing each attribute.
|
95
|
+
# @param [Object] Object to be compared
|
96
|
+
def ==(o)
|
97
|
+
return true if self.equal?(o)
|
98
|
+
self.class == o.class &&
|
99
|
+
name == o.name &&
|
100
|
+
percentage == o.percentage &&
|
101
|
+
amount_money == o.amount_money
|
102
|
+
end
|
103
|
+
|
104
|
+
# @see the `==` method
|
105
|
+
# @param [Object] Object to be compared
|
106
|
+
def eql?(o)
|
107
|
+
self == o
|
108
|
+
end
|
109
|
+
|
110
|
+
# Calculates hash code according to all attributes.
|
111
|
+
# @return [Fixnum] Hash code
|
112
|
+
def hash
|
113
|
+
[name, percentage, amount_money].hash
|
114
|
+
end
|
115
|
+
|
116
|
+
# Builds the object from hash
|
117
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
118
|
+
# @return [Object] Returns the model itself
|
119
|
+
def build_from_hash(attributes)
|
120
|
+
return nil unless attributes.is_a?(Hash)
|
121
|
+
self.class.swagger_types.each_pair do |key, type|
|
122
|
+
if type =~ /\AArray<(.*)>/i
|
123
|
+
# check to ensure the input is an array given that the the attribute
|
124
|
+
# is documented as an array but the input is not
|
125
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
126
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
127
|
+
end
|
128
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
129
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
130
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
131
|
+
end
|
132
|
+
|
133
|
+
self
|
134
|
+
end
|
135
|
+
|
136
|
+
# Deserializes the data based on type
|
137
|
+
# @param string type Data type
|
138
|
+
# @param string value Value to be deserialized
|
139
|
+
# @return [Object] Deserialized data
|
140
|
+
def _deserialize(type, value)
|
141
|
+
case type.to_sym
|
142
|
+
when :DateTime
|
143
|
+
DateTime.parse(value)
|
144
|
+
when :Date
|
145
|
+
Date.parse(value)
|
146
|
+
when :String
|
147
|
+
value.to_s
|
148
|
+
when :Integer
|
149
|
+
value.to_i
|
150
|
+
when :Float
|
151
|
+
value.to_f
|
152
|
+
when :BOOLEAN
|
153
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
154
|
+
true
|
155
|
+
else
|
156
|
+
false
|
157
|
+
end
|
158
|
+
when :Object
|
159
|
+
# generic object (usually a Hash), return directly
|
160
|
+
value
|
161
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
162
|
+
inner_type = Regexp.last_match[:inner_type]
|
163
|
+
value.map { |v| _deserialize(inner_type, v) }
|
164
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
165
|
+
k_type = Regexp.last_match[:k_type]
|
166
|
+
v_type = Regexp.last_match[:v_type]
|
167
|
+
{}.tap do |hash|
|
168
|
+
value.each do |k, v|
|
169
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
else # model
|
173
|
+
temp_model = SquareConnect.const_get(type).new
|
174
|
+
temp_model.build_from_hash(value)
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
# Returns the string representation of the object
|
179
|
+
# @return [String] String presentation of the object
|
180
|
+
def to_s
|
181
|
+
to_hash.to_s
|
182
|
+
end
|
183
|
+
|
184
|
+
# to_body is an alias to to_hash (backward compatibility)
|
185
|
+
# @return [Hash] Returns the object in the form of hash
|
186
|
+
def to_body
|
187
|
+
to_hash
|
188
|
+
end
|
189
|
+
|
190
|
+
# Returns the object in the form of hash
|
191
|
+
# @return [Hash] Returns the object in the form of hash
|
192
|
+
def to_hash
|
193
|
+
hash = {}
|
194
|
+
self.class.attribute_map.each_pair do |attr, param|
|
195
|
+
value = self.send(attr)
|
196
|
+
next if value.nil?
|
197
|
+
hash[param] = _to_hash(value)
|
198
|
+
end
|
199
|
+
hash
|
200
|
+
end
|
201
|
+
|
202
|
+
# Outputs non-array value in the form of hash
|
203
|
+
# For object, use to_hash. Otherwise, just return the value
|
204
|
+
# @param [Object] value Any valid value
|
205
|
+
# @return [Hash] Returns the value in the form of hash
|
206
|
+
def _to_hash(value)
|
207
|
+
if value.is_a?(Array)
|
208
|
+
value.compact.map{ |v| _to_hash(v) }
|
209
|
+
elsif value.is_a?(Hash)
|
210
|
+
{}.tap do |hash|
|
211
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
212
|
+
end
|
213
|
+
elsif value.respond_to? :to_hash
|
214
|
+
value.to_hash
|
215
|
+
else
|
216
|
+
value
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
end
|
221
|
+
|
222
|
+
end
|