square_connect 2.20190410.1.300 → 2.20190508.0.304
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +10 -0
- data/README.md +32 -1
- data/docs/BatchRetrieveOrdersResponse.md +1 -0
- data/docs/BusinessHours.md +12 -0
- data/docs/BusinessHoursPeriod.md +14 -0
- data/docs/ChargeRequest.md +3 -3
- data/docs/CreateOrderRequest.md +1 -1
- data/docs/CreateOrderRequestTax.md +1 -1
- data/docs/DayOfWeek.md +18 -0
- data/docs/ErrorCode.md +2 -0
- data/docs/InventoryAdjustment.md +1 -1
- data/docs/InventoryCount.md +2 -2
- data/docs/InventoryPhysicalCount.md +2 -2
- data/docs/InventoryTransfer.md +1 -1
- data/docs/Location.md +1 -0
- data/docs/MeasurementUnit.md +16 -0
- data/docs/MeasurementUnitArea.md +19 -0
- data/docs/MeasurementUnitCustom.md +13 -0
- data/docs/MeasurementUnitLength.md +19 -0
- data/docs/MeasurementUnitVolume.md +22 -0
- data/docs/MeasurementUnitWeight.md +17 -0
- data/docs/Order.md +12 -1
- data/docs/OrderEntry.md +13 -0
- data/docs/OrderLineItem.md +5 -2
- data/docs/OrderLineItemDiscount.md +2 -1
- data/docs/OrderLineItemModifier.md +2 -1
- data/docs/OrderLineItemTax.md +1 -0
- data/docs/OrderMoneyAmounts.md +16 -0
- data/docs/OrderQuantityUnit.md +13 -0
- data/docs/OrderReturn.md +18 -0
- data/docs/OrderReturnDiscount.md +20 -0
- data/docs/OrderReturnLineItem.md +28 -0
- data/docs/OrderReturnLineItemModifier.md +17 -0
- data/docs/OrderReturnTax.md +19 -0
- data/docs/OrderRoundingAdjustment.md +14 -0
- data/docs/OrderSource.md +1 -1
- data/docs/OrderState.md +14 -0
- data/docs/OrdersApi.md +54 -1
- data/docs/SearchOrdersCustomerFilter.md +12 -0
- data/docs/SearchOrdersDateTimeFilter.md +14 -0
- data/docs/SearchOrdersFilter.md +16 -0
- data/docs/SearchOrdersFulfillmentFilter.md +13 -0
- data/docs/SearchOrdersQuery.md +13 -0
- data/docs/SearchOrdersRequest.md +16 -0
- data/docs/SearchOrdersResponse.md +16 -0
- data/docs/SearchOrdersSort.md +13 -0
- data/docs/SearchOrdersSortField.md +14 -0
- data/docs/SearchOrdersSourceFilter.md +12 -0
- data/docs/SearchOrdersStateFilter.md +12 -0
- data/docs/TransactionsApi.md +1 -1
- data/lib/square_connect.rb +30 -0
- data/lib/square_connect/api/apple_pay_api.rb +1 -1
- data/lib/square_connect/api/catalog_api.rb +11 -11
- data/lib/square_connect/api/checkout_api.rb +1 -1
- data/lib/square_connect/api/customers_api.rb +8 -8
- data/lib/square_connect/api/employees_api.rb +2 -2
- data/lib/square_connect/api/inventory_api.rb +7 -7
- data/lib/square_connect/api/labor_api.rb +14 -14
- data/lib/square_connect/api/locations_api.rb +1 -1
- data/lib/square_connect/api/mobile_authorization_api.rb +1 -1
- data/lib/square_connect/api/o_auth_api.rb +3 -3
- data/lib/square_connect/api/orders_api.rb +59 -4
- data/lib/square_connect/api/reporting_api.rb +2 -2
- data/lib/square_connect/api/transactions_api.rb +9 -9
- data/lib/square_connect/api/v1_employees_api.rb +16 -16
- data/lib/square_connect/api/v1_items_api.rb +40 -40
- data/lib/square_connect/api/v1_locations_api.rb +2 -2
- data/lib/square_connect/api/v1_transactions_api.rb +11 -11
- data/lib/square_connect/api_client.rb +1 -1
- data/lib/square_connect/models/batch_retrieve_orders_response.rb +16 -4
- data/lib/square_connect/models/business_hours.rb +188 -0
- data/lib/square_connect/models/business_hours_period.rb +239 -0
- data/lib/square_connect/models/charge_request.rb +3 -3
- data/lib/square_connect/models/create_order_request.rb +1 -1
- data/lib/square_connect/models/create_order_request_tax.rb +1 -1
- data/lib/square_connect/models/day_of_week.rb +24 -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/inventory_adjustment.rb +1 -1
- data/lib/square_connect/models/inventory_count.rb +2 -2
- data/lib/square_connect/models/inventory_physical_count.rb +2 -2
- data/lib/square_connect/models/inventory_transfer.rb +1 -1
- data/lib/square_connect/models/location.rb +14 -4
- data/lib/square_connect/models/measurement_unit.rb +295 -0
- data/lib/square_connect/models/measurement_unit_area.rb +25 -0
- data/lib/square_connect/models/measurement_unit_custom.rb +206 -0
- data/lib/square_connect/models/measurement_unit_length.rb +25 -0
- data/lib/square_connect/models/measurement_unit_volume.rb +28 -0
- data/lib/square_connect/models/measurement_unit_weight.rb +23 -0
- data/lib/square_connect/models/order.rb +151 -2
- data/lib/square_connect/models/order_entry.rb +196 -0
- data/lib/square_connect/models/order_line_item.rb +54 -8
- data/lib/square_connect/models/order_line_item_discount.rb +28 -2
- data/lib/square_connect/models/order_line_item_modifier.rb +28 -2
- data/lib/square_connect/models/order_line_item_tax.rb +27 -1
- data/lib/square_connect/models/order_money_amounts.rb +226 -0
- data/lib/square_connect/models/order_quantity_unit.rb +196 -0
- data/lib/square_connect/models/order_return.rb +268 -0
- data/lib/square_connect/models/order_return_discount.rb +391 -0
- data/lib/square_connect/models/order_return_line_item.rb +481 -0
- data/lib/square_connect/models/order_return_line_item_modifier.rb +300 -0
- data/lib/square_connect/models/order_return_tax.rb +381 -0
- data/lib/square_connect/models/order_rounding_adjustment.rb +222 -0
- data/lib/square_connect/models/order_source.rb +1 -1
- data/lib/square_connect/models/order_state.rb +20 -0
- data/lib/square_connect/models/search_orders_customer_filter.rb +188 -0
- data/lib/square_connect/models/search_orders_date_time_filter.rb +206 -0
- data/lib/square_connect/models/search_orders_filter.rb +226 -0
- data/lib/square_connect/models/search_orders_fulfillment_filter.rb +226 -0
- data/lib/square_connect/models/search_orders_query.rb +196 -0
- data/lib/square_connect/models/search_orders_request.rb +244 -0
- data/lib/square_connect/models/search_orders_response.rb +234 -0
- data/lib/square_connect/models/search_orders_sort.rb +246 -0
- data/lib/square_connect/models/search_orders_sort_field.rb +20 -0
- data/lib/square_connect/models/search_orders_source_filter.rb +188 -0
- data/lib/square_connect/models/search_orders_state_filter.rb +214 -0
- data/lib/square_connect/version.rb +1 -1
- data/spec/models/business_hours_period_spec.rb +55 -0
- data/spec/models/business_hours_spec.rb +39 -0
- data/spec/models/day_of_week_spec.rb +33 -0
- data/spec/models/measurement_unit_area_spec.rb +33 -0
- data/spec/models/measurement_unit_custom_spec.rb +45 -0
- data/spec/models/measurement_unit_length_spec.rb +33 -0
- data/spec/models/measurement_unit_spec.rb +79 -0
- data/spec/models/measurement_unit_volume_spec.rb +33 -0
- data/spec/models/measurement_unit_weight_spec.rb +33 -0
- data/spec/models/order_entry_spec.rb +45 -0
- data/spec/models/order_money_amounts_spec.rb +63 -0
- data/spec/models/order_quantity_unit_spec.rb +45 -0
- data/spec/models/order_return_discount_spec.rb +95 -0
- data/spec/models/order_return_line_item_modifier_spec.rb +69 -0
- data/spec/models/order_return_line_item_spec.rb +135 -0
- data/spec/models/order_return_spec.rb +75 -0
- data/spec/models/order_return_tax_spec.rb +89 -0
- data/spec/models/order_rounding_adjustment_spec.rb +51 -0
- data/spec/models/order_state_spec.rb +33 -0
- data/spec/models/search_orders_customer_filter_spec.rb +39 -0
- data/spec/models/search_orders_date_time_filter_spec.rb +51 -0
- data/spec/models/search_orders_filter_spec.rb +63 -0
- data/spec/models/search_orders_fulfillment_filter_spec.rb +53 -0
- data/spec/models/search_orders_query_spec.rb +45 -0
- data/spec/models/search_orders_request_spec.rb +63 -0
- data/spec/models/search_orders_response_spec.rb +63 -0
- data/spec/models/search_orders_sort_field_spec.rb +33 -0
- data/spec/models/search_orders_sort_spec.rb +53 -0
- data/spec/models/search_orders_source_filter_spec.rb +39 -0
- data/spec/models/search_orders_state_filter_spec.rb +43 -0
- metadata +122 -2
@@ -0,0 +1,25 @@
|
|
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 MeasurementUnitArea
|
14
|
+
|
15
|
+
IMPERIAL_ACRE = "IMPERIAL_ACRE".freeze
|
16
|
+
IMPERIAL_SQUARE_INCH = "IMPERIAL_SQUARE_INCH".freeze
|
17
|
+
IMPERIAL_SQUARE_FOOT = "IMPERIAL_SQUARE_FOOT".freeze
|
18
|
+
IMPERIAL_SQUARE_YARD = "IMPERIAL_SQUARE_YARD".freeze
|
19
|
+
IMPERIAL_SQUARE_MILE = "IMPERIAL_SQUARE_MILE".freeze
|
20
|
+
METRIC_SQUARE_CENTIMETER = "METRIC_SQUARE_CENTIMETER".freeze
|
21
|
+
METRIC_SQUARE_METER = "METRIC_SQUARE_METER".freeze
|
22
|
+
METRIC_SQUARE_KILOMETER = "METRIC_SQUARE_KILOMETER".freeze
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,206 @@
|
|
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
|
+
# The information needed to define a custom unit, provided by the seller.
|
14
|
+
class MeasurementUnitCustom
|
15
|
+
# The name of the custom unit, for example \"bushel\".
|
16
|
+
attr_accessor :name
|
17
|
+
|
18
|
+
# The abbreviation of the custom unit, such as \"bsh\" (bushel). This appears in the cart for the Point of Sale app, and in reports.
|
19
|
+
attr_accessor :abbreviation
|
20
|
+
|
21
|
+
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
+
def self.attribute_map
|
24
|
+
{
|
25
|
+
:'name' => :'name',
|
26
|
+
:'abbreviation' => :'abbreviation'
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
# Attribute type mapping.
|
31
|
+
def self.swagger_types
|
32
|
+
{
|
33
|
+
:'name' => :'String',
|
34
|
+
:'abbreviation' => :'String'
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
# Initializes the object
|
39
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
40
|
+
def initialize(attributes = {})
|
41
|
+
return unless attributes.is_a?(Hash)
|
42
|
+
|
43
|
+
# convert string to symbol for hash key
|
44
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
45
|
+
|
46
|
+
if attributes.has_key?(:'name')
|
47
|
+
self.name = attributes[:'name']
|
48
|
+
end
|
49
|
+
|
50
|
+
if attributes.has_key?(:'abbreviation')
|
51
|
+
self.abbreviation = attributes[:'abbreviation']
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
57
|
+
# @return Array for valid properies with the reasons
|
58
|
+
def list_invalid_properties
|
59
|
+
invalid_properties = Array.new
|
60
|
+
if @name.nil?
|
61
|
+
invalid_properties.push("invalid value for 'name', name cannot be nil.")
|
62
|
+
end
|
63
|
+
|
64
|
+
if @abbreviation.nil?
|
65
|
+
invalid_properties.push("invalid value for 'abbreviation', abbreviation cannot be nil.")
|
66
|
+
end
|
67
|
+
|
68
|
+
return invalid_properties
|
69
|
+
end
|
70
|
+
|
71
|
+
# Check to see if the all the properties in the model are valid
|
72
|
+
# @return true if the model is valid
|
73
|
+
def valid?
|
74
|
+
return false if @name.nil?
|
75
|
+
return false if @abbreviation.nil?
|
76
|
+
return true
|
77
|
+
end
|
78
|
+
|
79
|
+
# Checks equality by comparing each attribute.
|
80
|
+
# @param [Object] Object to be compared
|
81
|
+
def ==(o)
|
82
|
+
return true if self.equal?(o)
|
83
|
+
self.class == o.class &&
|
84
|
+
name == o.name &&
|
85
|
+
abbreviation == o.abbreviation
|
86
|
+
end
|
87
|
+
|
88
|
+
# @see the `==` method
|
89
|
+
# @param [Object] Object to be compared
|
90
|
+
def eql?(o)
|
91
|
+
self == o
|
92
|
+
end
|
93
|
+
|
94
|
+
# Calculates hash code according to all attributes.
|
95
|
+
# @return [Fixnum] Hash code
|
96
|
+
def hash
|
97
|
+
[name, abbreviation].hash
|
98
|
+
end
|
99
|
+
|
100
|
+
# Builds the object from hash
|
101
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
102
|
+
# @return [Object] Returns the model itself
|
103
|
+
def build_from_hash(attributes)
|
104
|
+
return nil unless attributes.is_a?(Hash)
|
105
|
+
self.class.swagger_types.each_pair do |key, type|
|
106
|
+
if type =~ /\AArray<(.*)>/i
|
107
|
+
# check to ensure the input is an array given that the the attribute
|
108
|
+
# is documented as an array but the input is not
|
109
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
110
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
111
|
+
end
|
112
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
113
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
114
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
115
|
+
end
|
116
|
+
|
117
|
+
self
|
118
|
+
end
|
119
|
+
|
120
|
+
# Deserializes the data based on type
|
121
|
+
# @param string type Data type
|
122
|
+
# @param string value Value to be deserialized
|
123
|
+
# @return [Object] Deserialized data
|
124
|
+
def _deserialize(type, value)
|
125
|
+
case type.to_sym
|
126
|
+
when :DateTime
|
127
|
+
DateTime.parse(value)
|
128
|
+
when :Date
|
129
|
+
Date.parse(value)
|
130
|
+
when :String
|
131
|
+
value.to_s
|
132
|
+
when :Integer
|
133
|
+
value.to_i
|
134
|
+
when :Float
|
135
|
+
value.to_f
|
136
|
+
when :BOOLEAN
|
137
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
138
|
+
true
|
139
|
+
else
|
140
|
+
false
|
141
|
+
end
|
142
|
+
when :Object
|
143
|
+
# generic object (usually a Hash), return directly
|
144
|
+
value
|
145
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
146
|
+
inner_type = Regexp.last_match[:inner_type]
|
147
|
+
value.map { |v| _deserialize(inner_type, v) }
|
148
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
149
|
+
k_type = Regexp.last_match[:k_type]
|
150
|
+
v_type = Regexp.last_match[:v_type]
|
151
|
+
{}.tap do |hash|
|
152
|
+
value.each do |k, v|
|
153
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
else # model
|
157
|
+
temp_model = SquareConnect.const_get(type).new
|
158
|
+
temp_model.build_from_hash(value)
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
# Returns the string representation of the object
|
163
|
+
# @return [String] String presentation of the object
|
164
|
+
def to_s
|
165
|
+
to_hash.to_s
|
166
|
+
end
|
167
|
+
|
168
|
+
# to_body is an alias to to_hash (backward compatibility)
|
169
|
+
# @return [Hash] Returns the object in the form of hash
|
170
|
+
def to_body
|
171
|
+
to_hash
|
172
|
+
end
|
173
|
+
|
174
|
+
# Returns the object in the form of hash
|
175
|
+
# @return [Hash] Returns the object in the form of hash
|
176
|
+
def to_hash
|
177
|
+
hash = {}
|
178
|
+
self.class.attribute_map.each_pair do |attr, param|
|
179
|
+
value = self.send(attr)
|
180
|
+
next if value.nil?
|
181
|
+
hash[param] = _to_hash(value)
|
182
|
+
end
|
183
|
+
hash
|
184
|
+
end
|
185
|
+
|
186
|
+
# Outputs non-array value in the form of hash
|
187
|
+
# For object, use to_hash. Otherwise, just return the value
|
188
|
+
# @param [Object] value Any valid value
|
189
|
+
# @return [Hash] Returns the value in the form of hash
|
190
|
+
def _to_hash(value)
|
191
|
+
if value.is_a?(Array)
|
192
|
+
value.compact.map{ |v| _to_hash(v) }
|
193
|
+
elsif value.is_a?(Hash)
|
194
|
+
{}.tap do |hash|
|
195
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
196
|
+
end
|
197
|
+
elsif value.respond_to? :to_hash
|
198
|
+
value.to_hash
|
199
|
+
else
|
200
|
+
value
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
end
|
205
|
+
|
206
|
+
end
|
@@ -0,0 +1,25 @@
|
|
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 MeasurementUnitLength
|
14
|
+
|
15
|
+
IMPERIAL_INCH = "IMPERIAL_INCH".freeze
|
16
|
+
IMPERIAL_FOOT = "IMPERIAL_FOOT".freeze
|
17
|
+
IMPERIAL_YARD = "IMPERIAL_YARD".freeze
|
18
|
+
IMPERIAL_MILE = "IMPERIAL_MILE".freeze
|
19
|
+
METRIC_MILLIMETER = "METRIC_MILLIMETER".freeze
|
20
|
+
METRIC_CENTIMETER = "METRIC_CENTIMETER".freeze
|
21
|
+
METRIC_METER = "METRIC_METER".freeze
|
22
|
+
METRIC_KILOMETER = "METRIC_KILOMETER".freeze
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,28 @@
|
|
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 MeasurementUnitVolume
|
14
|
+
|
15
|
+
GENERIC_FLUID_OUNCE = "GENERIC_FLUID_OUNCE".freeze
|
16
|
+
GENERIC_SHOT = "GENERIC_SHOT".freeze
|
17
|
+
GENERIC_CUP = "GENERIC_CUP".freeze
|
18
|
+
GENERIC_PINT = "GENERIC_PINT".freeze
|
19
|
+
GENERIC_QUART = "GENERIC_QUART".freeze
|
20
|
+
GENERIC_GALLON = "GENERIC_GALLON".freeze
|
21
|
+
IMPERIAL_CUBIC_INCH = "IMPERIAL_CUBIC_INCH".freeze
|
22
|
+
IMPERIAL_CUBIC_FOOT = "IMPERIAL_CUBIC_FOOT".freeze
|
23
|
+
IMPERIAL_CUBIC_YARD = "IMPERIAL_CUBIC_YARD".freeze
|
24
|
+
METRIC_MILLILITER = "METRIC_MILLILITER".freeze
|
25
|
+
METRIC_LITER = "METRIC_LITER".freeze
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,23 @@
|
|
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 MeasurementUnitWeight
|
14
|
+
|
15
|
+
IMPERIAL_WEIGHT_OUNCE = "IMPERIAL_WEIGHT_OUNCE".freeze
|
16
|
+
IMPERIAL_POUND = "IMPERIAL_POUND".freeze
|
17
|
+
IMPERIAL_STONE = "IMPERIAL_STONE".freeze
|
18
|
+
METRIC_MILLIGRAM = "METRIC_MILLIGRAM".freeze
|
19
|
+
METRIC_GRAM = "METRIC_GRAM".freeze
|
20
|
+
METRIC_KILOGRAM = "METRIC_KILOGRAM".freeze
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -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
|
-
# Contains all information related to a single order to process with Square, including line items that specify the products to purchase
|
13
|
+
# Contains all information related to a single order to process with Square, including line items that specify the products to purchase. Order objects also include information on any associated tenders, refunds, and returns. All Connect V2 Transactions have all been converted to Orders including all associated itemization data.
|
14
14
|
class Order
|
15
15
|
# The order's unique ID. This value is only present for Order objects created by the Orders API through the [CreateOrder](#endpoint-orders-createorder) endpoint.
|
16
16
|
attr_accessor :id
|
@@ -24,6 +24,9 @@ module SquareConnect
|
|
24
24
|
# The origination details of the order.
|
25
25
|
attr_accessor :source
|
26
26
|
|
27
|
+
# The [Customer](#type-customer) ID of the customer associated with the order.
|
28
|
+
attr_accessor :customer_id
|
29
|
+
|
27
30
|
# The line items included in the order.
|
28
31
|
attr_accessor :line_items
|
29
32
|
|
@@ -36,6 +39,36 @@ module SquareConnect
|
|
36
39
|
# Details on order fulfillment. Orders can only be created with at most one fulfillment. However, orders returned by the API may contain multiple fulfillments.
|
37
40
|
attr_accessor :fulfillments
|
38
41
|
|
42
|
+
# Collection of items from sale Orders being returned in this one. Normally part of an Itemized Return or Exchange. There will be exactly one `Return` object per sale Order being referenced.
|
43
|
+
attr_accessor :returns
|
44
|
+
|
45
|
+
# Rollup of returned money amounts.
|
46
|
+
attr_accessor :return_amounts
|
47
|
+
|
48
|
+
# Net money amounts (sale money - return money).
|
49
|
+
attr_accessor :net_amounts
|
50
|
+
|
51
|
+
# A positive or negative rounding adjustment to the total of the order, commonly used to apply Cash Rounding when the minimum unit of account is smaller than the lowest physical denomination of currency.
|
52
|
+
attr_accessor :rounding_adjustment
|
53
|
+
|
54
|
+
# The Tenders which were used to pay for the Order. This field is read-only.
|
55
|
+
attr_accessor :tenders
|
56
|
+
|
57
|
+
# The Refunds that are part of this Order. This field is read-only.
|
58
|
+
attr_accessor :refunds
|
59
|
+
|
60
|
+
# Timestamp for when the order was created. In RFC 3339 format, e.g., \"2016-09-04T23:59:33.123Z\".
|
61
|
+
attr_accessor :created_at
|
62
|
+
|
63
|
+
# Timestamp for when the order was last updated. In RFC 3339 format, e.g., \"2016-09-04T23:59:33.123Z\".
|
64
|
+
attr_accessor :updated_at
|
65
|
+
|
66
|
+
# Timestamp for when the order was closed. In RFC 3339 format, e.g., \"2016-09-04T23:59:33.123Z\".
|
67
|
+
attr_accessor :closed_at
|
68
|
+
|
69
|
+
# The current state of the order. `OPEN`,`COMPLETED`,`CANCELED` See [OrderState](#type-orderstate) for possible values
|
70
|
+
attr_accessor :state
|
71
|
+
|
39
72
|
# The total amount of money to collect for the order.
|
40
73
|
attr_accessor :total_money
|
41
74
|
|
@@ -45,6 +78,27 @@ module SquareConnect
|
|
45
78
|
# The total discount amount of money to collect for the order.
|
46
79
|
attr_accessor :total_discount_money
|
47
80
|
|
81
|
+
class EnumAttributeValidator
|
82
|
+
attr_reader :datatype
|
83
|
+
attr_reader :allowable_values
|
84
|
+
|
85
|
+
def initialize(datatype, allowable_values)
|
86
|
+
@allowable_values = allowable_values.map do |value|
|
87
|
+
case datatype.to_s
|
88
|
+
when /Integer/i
|
89
|
+
value.to_i
|
90
|
+
when /Float/i
|
91
|
+
value.to_f
|
92
|
+
else
|
93
|
+
value
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def valid?(value)
|
99
|
+
!value || allowable_values.include?(value)
|
100
|
+
end
|
101
|
+
end
|
48
102
|
|
49
103
|
# Attribute mapping from ruby-style variable name to JSON key.
|
50
104
|
def self.attribute_map
|
@@ -53,10 +107,21 @@ module SquareConnect
|
|
53
107
|
:'location_id' => :'location_id',
|
54
108
|
:'reference_id' => :'reference_id',
|
55
109
|
:'source' => :'source',
|
110
|
+
:'customer_id' => :'customer_id',
|
56
111
|
:'line_items' => :'line_items',
|
57
112
|
:'taxes' => :'taxes',
|
58
113
|
:'discounts' => :'discounts',
|
59
114
|
:'fulfillments' => :'fulfillments',
|
115
|
+
:'returns' => :'returns',
|
116
|
+
:'return_amounts' => :'return_amounts',
|
117
|
+
:'net_amounts' => :'net_amounts',
|
118
|
+
:'rounding_adjustment' => :'rounding_adjustment',
|
119
|
+
:'tenders' => :'tenders',
|
120
|
+
:'refunds' => :'refunds',
|
121
|
+
:'created_at' => :'created_at',
|
122
|
+
:'updated_at' => :'updated_at',
|
123
|
+
:'closed_at' => :'closed_at',
|
124
|
+
:'state' => :'state',
|
60
125
|
:'total_money' => :'total_money',
|
61
126
|
:'total_tax_money' => :'total_tax_money',
|
62
127
|
:'total_discount_money' => :'total_discount_money'
|
@@ -70,10 +135,21 @@ module SquareConnect
|
|
70
135
|
:'location_id' => :'String',
|
71
136
|
:'reference_id' => :'String',
|
72
137
|
:'source' => :'OrderSource',
|
138
|
+
:'customer_id' => :'String',
|
73
139
|
:'line_items' => :'Array<OrderLineItem>',
|
74
140
|
:'taxes' => :'Array<OrderLineItemTax>',
|
75
141
|
:'discounts' => :'Array<OrderLineItemDiscount>',
|
76
142
|
:'fulfillments' => :'Array<OrderFulfillment>',
|
143
|
+
:'returns' => :'Array<OrderReturn>',
|
144
|
+
:'return_amounts' => :'OrderMoneyAmounts',
|
145
|
+
:'net_amounts' => :'OrderMoneyAmounts',
|
146
|
+
:'rounding_adjustment' => :'OrderRoundingAdjustment',
|
147
|
+
:'tenders' => :'Array<Tender>',
|
148
|
+
:'refunds' => :'Array<Refund>',
|
149
|
+
:'created_at' => :'String',
|
150
|
+
:'updated_at' => :'String',
|
151
|
+
:'closed_at' => :'String',
|
152
|
+
:'state' => :'String',
|
77
153
|
:'total_money' => :'Money',
|
78
154
|
:'total_tax_money' => :'Money',
|
79
155
|
:'total_discount_money' => :'Money'
|
@@ -104,6 +180,10 @@ module SquareConnect
|
|
104
180
|
self.source = attributes[:'source']
|
105
181
|
end
|
106
182
|
|
183
|
+
if attributes.has_key?(:'customer_id')
|
184
|
+
self.customer_id = attributes[:'customer_id']
|
185
|
+
end
|
186
|
+
|
107
187
|
if attributes.has_key?(:'line_items')
|
108
188
|
if (value = attributes[:'line_items']).is_a?(Array)
|
109
189
|
self.line_items = value
|
@@ -128,6 +208,52 @@ module SquareConnect
|
|
128
208
|
end
|
129
209
|
end
|
130
210
|
|
211
|
+
if attributes.has_key?(:'returns')
|
212
|
+
if (value = attributes[:'returns']).is_a?(Array)
|
213
|
+
self.returns = value
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
if attributes.has_key?(:'return_amounts')
|
218
|
+
self.return_amounts = attributes[:'return_amounts']
|
219
|
+
end
|
220
|
+
|
221
|
+
if attributes.has_key?(:'net_amounts')
|
222
|
+
self.net_amounts = attributes[:'net_amounts']
|
223
|
+
end
|
224
|
+
|
225
|
+
if attributes.has_key?(:'rounding_adjustment')
|
226
|
+
self.rounding_adjustment = attributes[:'rounding_adjustment']
|
227
|
+
end
|
228
|
+
|
229
|
+
if attributes.has_key?(:'tenders')
|
230
|
+
if (value = attributes[:'tenders']).is_a?(Array)
|
231
|
+
self.tenders = value
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
if attributes.has_key?(:'refunds')
|
236
|
+
if (value = attributes[:'refunds']).is_a?(Array)
|
237
|
+
self.refunds = value
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
if attributes.has_key?(:'created_at')
|
242
|
+
self.created_at = attributes[:'created_at']
|
243
|
+
end
|
244
|
+
|
245
|
+
if attributes.has_key?(:'updated_at')
|
246
|
+
self.updated_at = attributes[:'updated_at']
|
247
|
+
end
|
248
|
+
|
249
|
+
if attributes.has_key?(:'closed_at')
|
250
|
+
self.closed_at = attributes[:'closed_at']
|
251
|
+
end
|
252
|
+
|
253
|
+
if attributes.has_key?(:'state')
|
254
|
+
self.state = attributes[:'state']
|
255
|
+
end
|
256
|
+
|
131
257
|
if attributes.has_key?(:'total_money')
|
132
258
|
self.total_money = attributes[:'total_money']
|
133
259
|
end
|
@@ -167,6 +293,8 @@ module SquareConnect
|
|
167
293
|
return false if @location_id.nil?
|
168
294
|
return false if @location_id.to_s.length < 1
|
169
295
|
return false if !@reference_id.nil? && @reference_id.to_s.length > 40
|
296
|
+
state_validator = EnumAttributeValidator.new('String', ["OPEN", "COMPLETED", "CANCELED"])
|
297
|
+
return false unless state_validator.valid?(@state)
|
170
298
|
return true
|
171
299
|
end
|
172
300
|
|
@@ -195,6 +323,16 @@ module SquareConnect
|
|
195
323
|
@reference_id = reference_id
|
196
324
|
end
|
197
325
|
|
326
|
+
# Custom attribute writer method checking allowed values (enum).
|
327
|
+
# @param [Object] state Object to be assigned
|
328
|
+
def state=(state)
|
329
|
+
validator = EnumAttributeValidator.new('String', ["OPEN", "COMPLETED", "CANCELED"])
|
330
|
+
unless validator.valid?(state)
|
331
|
+
fail ArgumentError, "invalid value for 'state', must be one of #{validator.allowable_values}."
|
332
|
+
end
|
333
|
+
@state = state
|
334
|
+
end
|
335
|
+
|
198
336
|
# Checks equality by comparing each attribute.
|
199
337
|
# @param [Object] Object to be compared
|
200
338
|
def ==(o)
|
@@ -204,10 +342,21 @@ module SquareConnect
|
|
204
342
|
location_id == o.location_id &&
|
205
343
|
reference_id == o.reference_id &&
|
206
344
|
source == o.source &&
|
345
|
+
customer_id == o.customer_id &&
|
207
346
|
line_items == o.line_items &&
|
208
347
|
taxes == o.taxes &&
|
209
348
|
discounts == o.discounts &&
|
210
349
|
fulfillments == o.fulfillments &&
|
350
|
+
returns == o.returns &&
|
351
|
+
return_amounts == o.return_amounts &&
|
352
|
+
net_amounts == o.net_amounts &&
|
353
|
+
rounding_adjustment == o.rounding_adjustment &&
|
354
|
+
tenders == o.tenders &&
|
355
|
+
refunds == o.refunds &&
|
356
|
+
created_at == o.created_at &&
|
357
|
+
updated_at == o.updated_at &&
|
358
|
+
closed_at == o.closed_at &&
|
359
|
+
state == o.state &&
|
211
360
|
total_money == o.total_money &&
|
212
361
|
total_tax_money == o.total_tax_money &&
|
213
362
|
total_discount_money == o.total_discount_money
|
@@ -222,7 +371,7 @@ module SquareConnect
|
|
222
371
|
# Calculates hash code according to all attributes.
|
223
372
|
# @return [Fixnum] Hash code
|
224
373
|
def hash
|
225
|
-
[id, location_id, reference_id, source, line_items, taxes, discounts, fulfillments, total_money, total_tax_money, total_discount_money].hash
|
374
|
+
[id, location_id, reference_id, source, customer_id, line_items, taxes, discounts, fulfillments, returns, return_amounts, net_amounts, rounding_adjustment, tenders, refunds, created_at, updated_at, closed_at, state, total_money, total_tax_money, total_discount_money].hash
|
226
375
|
end
|
227
376
|
|
228
377
|
# Builds the object from hash
|