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
@@ -0,0 +1,249 @@
|
|
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 tax that applies to one or more line items in an order.
|
14
|
+
class OrderLineItemTax
|
15
|
+
# The tax's name.
|
16
|
+
attr_accessor :name
|
17
|
+
|
18
|
+
# Indicates the calculation method used to apply the tax. See [OrderLineItemTaxType](#type-orderlineitemtaxtype) for possible values.
|
19
|
+
attr_accessor :type
|
20
|
+
|
21
|
+
# The percentage of the tax, as a string representation of a decimal number. A value of `7.25` corresponds to a percentage of 7.25%.
|
22
|
+
attr_accessor :percentage
|
23
|
+
|
24
|
+
# The amount of the money applied by the tax in an order.
|
25
|
+
attr_accessor :applied_money
|
26
|
+
|
27
|
+
class EnumAttributeValidator
|
28
|
+
attr_reader :datatype
|
29
|
+
attr_reader :allowable_values
|
30
|
+
|
31
|
+
def initialize(datatype, allowable_values)
|
32
|
+
@allowable_values = allowable_values.map do |value|
|
33
|
+
case datatype.to_s
|
34
|
+
when /Integer/i
|
35
|
+
value.to_i
|
36
|
+
when /Float/i
|
37
|
+
value.to_f
|
38
|
+
else
|
39
|
+
value
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def valid?(value)
|
45
|
+
!value || allowable_values.include?(value)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
50
|
+
def self.attribute_map
|
51
|
+
{
|
52
|
+
:'name' => :'name',
|
53
|
+
:'type' => :'type',
|
54
|
+
:'percentage' => :'percentage',
|
55
|
+
:'applied_money' => :'applied_money'
|
56
|
+
}
|
57
|
+
end
|
58
|
+
|
59
|
+
# Attribute type mapping.
|
60
|
+
def self.swagger_types
|
61
|
+
{
|
62
|
+
:'name' => :'String',
|
63
|
+
:'type' => :'String',
|
64
|
+
:'percentage' => :'String',
|
65
|
+
:'applied_money' => :'Money'
|
66
|
+
}
|
67
|
+
end
|
68
|
+
|
69
|
+
# Initializes the object
|
70
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
71
|
+
def initialize(attributes = {})
|
72
|
+
return unless attributes.is_a?(Hash)
|
73
|
+
|
74
|
+
# convert string to symbol for hash key
|
75
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
76
|
+
|
77
|
+
if attributes.has_key?(:'name')
|
78
|
+
self.name = attributes[:'name']
|
79
|
+
end
|
80
|
+
|
81
|
+
if attributes.has_key?(:'type')
|
82
|
+
self.type = attributes[:'type']
|
83
|
+
end
|
84
|
+
|
85
|
+
if attributes.has_key?(:'percentage')
|
86
|
+
self.percentage = attributes[:'percentage']
|
87
|
+
end
|
88
|
+
|
89
|
+
if attributes.has_key?(:'applied_money')
|
90
|
+
self.applied_money = attributes[:'applied_money']
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
96
|
+
# @return Array for valid properies with the reasons
|
97
|
+
def list_invalid_properties
|
98
|
+
invalid_properties = Array.new
|
99
|
+
return invalid_properties
|
100
|
+
end
|
101
|
+
|
102
|
+
# Check to see if the all the properties in the model are valid
|
103
|
+
# @return true if the model is valid
|
104
|
+
def valid?
|
105
|
+
type_validator = EnumAttributeValidator.new('String', ["UNKNOWN", "ADDITIVE", "INCLUSIVE"])
|
106
|
+
return false unless type_validator.valid?(@type)
|
107
|
+
return true
|
108
|
+
end
|
109
|
+
|
110
|
+
# Custom attribute writer method checking allowed values (enum).
|
111
|
+
# @param [Object] type Object to be assigned
|
112
|
+
def type=(type)
|
113
|
+
validator = EnumAttributeValidator.new('String', ["UNKNOWN", "ADDITIVE", "INCLUSIVE"])
|
114
|
+
unless validator.valid?(type)
|
115
|
+
fail ArgumentError, "invalid value for 'type', must be one of #{validator.allowable_values}."
|
116
|
+
end
|
117
|
+
@type = type
|
118
|
+
end
|
119
|
+
|
120
|
+
# Checks equality by comparing each attribute.
|
121
|
+
# @param [Object] Object to be compared
|
122
|
+
def ==(o)
|
123
|
+
return true if self.equal?(o)
|
124
|
+
self.class == o.class &&
|
125
|
+
name == o.name &&
|
126
|
+
type == o.type &&
|
127
|
+
percentage == o.percentage &&
|
128
|
+
applied_money == o.applied_money
|
129
|
+
end
|
130
|
+
|
131
|
+
# @see the `==` method
|
132
|
+
# @param [Object] Object to be compared
|
133
|
+
def eql?(o)
|
134
|
+
self == o
|
135
|
+
end
|
136
|
+
|
137
|
+
# Calculates hash code according to all attributes.
|
138
|
+
# @return [Fixnum] Hash code
|
139
|
+
def hash
|
140
|
+
[name, type, percentage, applied_money].hash
|
141
|
+
end
|
142
|
+
|
143
|
+
# Builds the object from hash
|
144
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
145
|
+
# @return [Object] Returns the model itself
|
146
|
+
def build_from_hash(attributes)
|
147
|
+
return nil unless attributes.is_a?(Hash)
|
148
|
+
self.class.swagger_types.each_pair do |key, type|
|
149
|
+
if type =~ /\AArray<(.*)>/i
|
150
|
+
# check to ensure the input is an array given that the the attribute
|
151
|
+
# is documented as an array but the input is not
|
152
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
153
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
154
|
+
end
|
155
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
156
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
157
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
158
|
+
end
|
159
|
+
|
160
|
+
self
|
161
|
+
end
|
162
|
+
|
163
|
+
# Deserializes the data based on type
|
164
|
+
# @param string type Data type
|
165
|
+
# @param string value Value to be deserialized
|
166
|
+
# @return [Object] Deserialized data
|
167
|
+
def _deserialize(type, value)
|
168
|
+
case type.to_sym
|
169
|
+
when :DateTime
|
170
|
+
DateTime.parse(value)
|
171
|
+
when :Date
|
172
|
+
Date.parse(value)
|
173
|
+
when :String
|
174
|
+
value.to_s
|
175
|
+
when :Integer
|
176
|
+
value.to_i
|
177
|
+
when :Float
|
178
|
+
value.to_f
|
179
|
+
when :BOOLEAN
|
180
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
181
|
+
true
|
182
|
+
else
|
183
|
+
false
|
184
|
+
end
|
185
|
+
when :Object
|
186
|
+
# generic object (usually a Hash), return directly
|
187
|
+
value
|
188
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
189
|
+
inner_type = Regexp.last_match[:inner_type]
|
190
|
+
value.map { |v| _deserialize(inner_type, v) }
|
191
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
192
|
+
k_type = Regexp.last_match[:k_type]
|
193
|
+
v_type = Regexp.last_match[:v_type]
|
194
|
+
{}.tap do |hash|
|
195
|
+
value.each do |k, v|
|
196
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
197
|
+
end
|
198
|
+
end
|
199
|
+
else # model
|
200
|
+
temp_model = SquareConnect.const_get(type).new
|
201
|
+
temp_model.build_from_hash(value)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
# Returns the string representation of the object
|
206
|
+
# @return [String] String presentation of the object
|
207
|
+
def to_s
|
208
|
+
to_hash.to_s
|
209
|
+
end
|
210
|
+
|
211
|
+
# to_body is an alias to to_hash (backward compatibility)
|
212
|
+
# @return [Hash] Returns the object in the form of hash
|
213
|
+
def to_body
|
214
|
+
to_hash
|
215
|
+
end
|
216
|
+
|
217
|
+
# Returns the object in the form of hash
|
218
|
+
# @return [Hash] Returns the object in the form of hash
|
219
|
+
def to_hash
|
220
|
+
hash = {}
|
221
|
+
self.class.attribute_map.each_pair do |attr, param|
|
222
|
+
value = self.send(attr)
|
223
|
+
next if value.nil?
|
224
|
+
hash[param] = _to_hash(value)
|
225
|
+
end
|
226
|
+
hash
|
227
|
+
end
|
228
|
+
|
229
|
+
# Outputs non-array value in the form of hash
|
230
|
+
# For object, use to_hash. Otherwise, just return the value
|
231
|
+
# @param [Object] value Any valid value
|
232
|
+
# @return [Hash] Returns the value in the form of hash
|
233
|
+
def _to_hash(value)
|
234
|
+
if value.is_a?(Array)
|
235
|
+
value.compact.map{ |v| _to_hash(v) }
|
236
|
+
elsif value.is_a?(Hash)
|
237
|
+
{}.tap do |hash|
|
238
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
239
|
+
end
|
240
|
+
elsif value.respond_to? :to_hash
|
241
|
+
value.to_hash
|
242
|
+
else
|
243
|
+
value
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
end
|
248
|
+
|
249
|
+
end
|
@@ -0,0 +1,20 @@
|
|
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
|
+
class OrderLineItemTaxType
|
14
|
+
|
15
|
+
UNKNOWN = "UNKNOWN".freeze
|
16
|
+
ADDITIVE = "ADDITIVE".freeze
|
17
|
+
INCLUSIVE = "INCLUSIVE".freeze
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -12,7 +12,7 @@ require 'date'
|
|
12
12
|
module SquareConnect
|
13
13
|
#
|
14
14
|
class RetrieveCatalogObjectRequest
|
15
|
-
# 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.
|
15
|
+
# 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`
|
16
16
|
attr_accessor :include_related_objects
|
17
17
|
|
18
18
|
|
@@ -24,7 +24,7 @@ module SquareConnect
|
|
24
24
|
# If `true`, the response will include additional objects that are related to the requested object, as follows: If a [CatalogItem](#type-catalogitem) is returned in the object field of the response, its associated [CatalogCategory](#type-catalogcategory), [CatalogTax](#type-catalogtax)es, and [CatalogModifierList](#type-catalogmodifierlist)s will be included in the `related_objects` field of the response. If a [CatalogItemVariation](#type-catalogitemvariation) is returned in the object field of the response, its parent [CatalogItem](#type-catalogitem) will be included in the `related_objects` field of the response.
|
25
25
|
attr_accessor :include_related_objects
|
26
26
|
|
27
|
-
# Return only objects that have been modified after this [timestamp](#workingwithdates) (in RFC 3339 format, e.g., \"2016-09-04T23:59:33.123Z\").
|
27
|
+
# Return only objects that have been modified after this [timestamp](#workingwithdates) (in RFC 3339 format, e.g., \"2016-09-04T23:59:33.123Z\"). The timestamp is exclusive - objects whose timestamp is equal to `begin_time` will not be included in the response.
|
28
28
|
attr_accessor :begin_time
|
29
29
|
|
30
30
|
# A query to be used to filter or sort the results. If no query is specified, the entire catalog will be returned.
|
@@ -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
|
-
# Represents a transaction processed with Square, either with the Connect API or with Square
|
13
|
+
# Represents a transaction processed with Square, either with the Connect API or with Square Point of Sale. The `tenders` field of this object lists all methods of payment used to pay in the transaction.
|
14
14
|
class Transaction
|
15
15
|
# The transaction's unique ID, issued by Square payments servers.
|
16
16
|
attr_accessor :id
|
@@ -33,7 +33,7 @@ module SquareConnect
|
|
33
33
|
# The Square product that processed the transaction.
|
34
34
|
attr_accessor :product
|
35
35
|
|
36
|
-
# If the transaction was created in the Square
|
36
|
+
# If the transaction was created in the Square Point of Sale app, this value is the ID generated for the transaction by Square Point of Sale. This ID has no relationship to the transaction's canonical `id`, which is generated by Square's backend servers. This value is generated for bookkeeping purposes, in case the transaction cannot immediately be completed (for example, if the transaction is processed in offline mode). It is not currently possible with the Connect API to perform a transaction lookup by this value.
|
37
37
|
attr_accessor :client_id
|
38
38
|
|
39
39
|
# The order associated with this transaction, if any.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: square_connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0.110
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Square, Inc.
|
@@ -255,8 +255,10 @@ files:
|
|
255
255
|
- docs/CreateCustomerCardResponse.md
|
256
256
|
- docs/CreateCustomerRequest.md
|
257
257
|
- docs/CreateCustomerResponse.md
|
258
|
+
- docs/CreateOrderRequest.md
|
259
|
+
- docs/CreateOrderRequestDiscount.md
|
258
260
|
- docs/CreateOrderRequestLineItem.md
|
259
|
-
- docs/
|
261
|
+
- docs/CreateOrderRequestTax.md
|
260
262
|
- docs/CreateRefundRequest.md
|
261
263
|
- docs/CreateRefundResponse.md
|
262
264
|
- docs/Currency.md
|
@@ -292,6 +294,11 @@ files:
|
|
292
294
|
- docs/Money.md
|
293
295
|
- docs/Order.md
|
294
296
|
- docs/OrderLineItem.md
|
297
|
+
- docs/OrderLineItemDiscount.md
|
298
|
+
- docs/OrderLineItemDiscountScope.md
|
299
|
+
- docs/OrderLineItemDiscountType.md
|
300
|
+
- docs/OrderLineItemTax.md
|
301
|
+
- docs/OrderLineItemTaxType.md
|
295
302
|
- docs/Refund.md
|
296
303
|
- docs/RefundStatus.md
|
297
304
|
- docs/RetrieveCatalogObjectRequest.md
|
@@ -429,8 +436,10 @@ files:
|
|
429
436
|
- lib/square_connect/models/create_customer_card_response.rb
|
430
437
|
- lib/square_connect/models/create_customer_request.rb
|
431
438
|
- lib/square_connect/models/create_customer_response.rb
|
439
|
+
- lib/square_connect/models/create_order_request.rb
|
440
|
+
- lib/square_connect/models/create_order_request_discount.rb
|
432
441
|
- lib/square_connect/models/create_order_request_line_item.rb
|
433
|
-
- lib/square_connect/models/
|
442
|
+
- lib/square_connect/models/create_order_request_tax.rb
|
434
443
|
- lib/square_connect/models/create_refund_request.rb
|
435
444
|
- lib/square_connect/models/create_refund_response.rb
|
436
445
|
- lib/square_connect/models/currency.rb
|
@@ -464,6 +473,11 @@ files:
|
|
464
473
|
- lib/square_connect/models/money.rb
|
465
474
|
- lib/square_connect/models/order.rb
|
466
475
|
- lib/square_connect/models/order_line_item.rb
|
476
|
+
- lib/square_connect/models/order_line_item_discount.rb
|
477
|
+
- lib/square_connect/models/order_line_item_discount_scope.rb
|
478
|
+
- lib/square_connect/models/order_line_item_discount_type.rb
|
479
|
+
- lib/square_connect/models/order_line_item_tax.rb
|
480
|
+
- lib/square_connect/models/order_line_item_tax_type.rb
|
467
481
|
- lib/square_connect/models/refund.rb
|
468
482
|
- lib/square_connect/models/refund_status.rb
|
469
483
|
- lib/square_connect/models/retrieve_catalog_object_request.rb
|