square_connect 2.20190508.0.304 → 2.20190612.0.309
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +12 -4
- data/README.md +13 -1
- data/docs/AggregationStrategy.md +15 -0
- data/docs/ApplePayApi.md +1 -1
- data/docs/BatchRetrieveCatalogObjectsRequest.md +1 -1
- data/docs/Card.md +1 -1
- data/docs/CatalogApi.md +3 -3
- data/docs/CatalogInfoResponse.md +1 -0
- data/docs/CatalogItem.md +1 -1
- data/docs/CatalogItemVariation.md +3 -1
- data/docs/CatalogMeasurementUnit.md +13 -0
- data/docs/CatalogObject.md +1 -0
- data/docs/CatalogObjectType.md +3 -0
- data/docs/CatalogPricingRule.md +24 -0
- data/docs/CatalogProductSet.md +18 -0
- data/docs/CatalogTimePeriod.md +12 -0
- data/docs/Coordinates.md +13 -0
- data/docs/CreateOrderRequest.md +1 -1
- data/docs/DayOfWeek.md +1 -1
- data/docs/ErrorCode.md +1 -0
- data/docs/Location.md +6 -0
- data/docs/MeasurementUnit.md +1 -0
- data/docs/MeasurementUnitGeneric.md +13 -0
- data/docs/OAuthApi.md +1 -1
- data/docs/ObtainTokenResponse.md +2 -2
- data/docs/Order.md +13 -11
- data/docs/OrderLineItem.md +5 -5
- data/docs/OrderLineItemDiscount.md +1 -1
- data/docs/OrderLineItemModifier.md +1 -1
- data/docs/OrderLineItemTax.md +1 -1
- data/docs/OrderReturn.md +2 -1
- data/docs/OrderReturnDiscount.md +1 -1
- data/docs/OrderReturnLineItem.md +4 -4
- data/docs/OrderReturnLineItemModifier.md +1 -1
- data/docs/OrderReturnServiceCharge.md +23 -0
- data/docs/OrderReturnTax.md +1 -1
- data/docs/OrderRoundingAdjustment.md +1 -1
- data/docs/OrderServiceCharge.md +22 -0
- data/docs/OrderServiceChargeCalculationPhase.md +13 -0
- data/docs/OrdersApi.md +1 -1
- data/docs/RenewTokenResponse.md +2 -2
- data/docs/RetrieveCatalogObjectRequest.md +1 -1
- data/docs/SearchCatalogObjectsRequest.md +1 -1
- data/docs/StandardUnitDescription.md +14 -0
- data/docs/StandardUnitDescriptionGroup.md +13 -0
- data/lib/square_connect.rb +12 -0
- data/lib/square_connect/api/apple_pay_api.rb +3 -3
- data/lib/square_connect/api/catalog_api.rb +15 -15
- 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 +5 -5
- data/lib/square_connect/api/orders_api.rb +5 -5
- data/lib/square_connect/api/reporting_api.rb +2 -2
- data/lib/square_connect/api/transactions_api.rb +7 -7
- 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/aggregation_strategy.rb +21 -0
- data/lib/square_connect/models/batch_retrieve_catalog_objects_request.rb +1 -1
- data/lib/square_connect/models/card.rb +1 -1
- data/lib/square_connect/models/catalog_info_response.rb +14 -4
- data/lib/square_connect/models/catalog_item.rb +1 -1
- data/lib/square_connect/models/catalog_item_variation.rb +25 -5
- data/lib/square_connect/models/catalog_measurement_unit.rb +196 -0
- data/lib/square_connect/models/catalog_object.rb +16 -6
- data/lib/square_connect/models/catalog_object_type.rb +3 -0
- data/lib/square_connect/models/catalog_pricing_rule.rb +341 -0
- data/lib/square_connect/models/catalog_product_set.rb +250 -0
- data/lib/square_connect/models/catalog_time_period.rb +186 -0
- data/lib/square_connect/models/coordinates.rb +196 -0
- data/lib/square_connect/models/create_order_request.rb +1 -1
- data/lib/square_connect/models/error.rb +2 -2
- data/lib/square_connect/models/error_code.rb +1 -0
- data/lib/square_connect/models/location.rb +64 -4
- data/lib/square_connect/models/measurement_unit.rb +26 -4
- data/lib/square_connect/models/measurement_unit_generic.rb +19 -0
- data/lib/square_connect/models/money.rb +0 -16
- data/lib/square_connect/models/obtain_token_response.rb +2 -2
- data/lib/square_connect/models/order.rb +37 -15
- data/lib/square_connect/models/order_line_item.rb +5 -5
- data/lib/square_connect/models/order_line_item_discount.rb +1 -1
- data/lib/square_connect/models/order_line_item_modifier.rb +1 -1
- data/lib/square_connect/models/order_line_item_tax.rb +1 -1
- data/lib/square_connect/models/order_return.rb +14 -2
- data/lib/square_connect/models/order_return_discount.rb +1 -1
- data/lib/square_connect/models/order_return_line_item.rb +4 -4
- data/lib/square_connect/models/order_return_line_item_modifier.rb +1 -1
- data/lib/square_connect/models/order_return_service_charge.rb +411 -0
- data/lib/square_connect/models/order_return_tax.rb +1 -1
- data/lib/square_connect/models/order_rounding_adjustment.rb +1 -1
- data/lib/square_connect/models/order_service_charge.rb +385 -0
- data/lib/square_connect/models/order_service_charge_calculation_phase.rb +19 -0
- data/lib/square_connect/models/renew_token_response.rb +2 -2
- 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/standard_unit_description.rb +206 -0
- data/lib/square_connect/models/standard_unit_description_group.rb +198 -0
- data/lib/square_connect/version.rb +1 -1
- data/spec/models/aggregation_strategy_spec.rb +33 -0
- data/spec/models/catalog_measurement_unit_spec.rb +45 -0
- data/spec/models/catalog_pricing_rule_spec.rb +115 -0
- data/spec/models/catalog_product_set_spec.rb +75 -0
- data/spec/models/catalog_time_period_spec.rb +39 -0
- data/spec/models/coordinates_spec.rb +45 -0
- data/spec/models/measurement_unit_generic_spec.rb +33 -0
- data/spec/models/order_return_service_charge_spec.rb +109 -0
- data/spec/models/order_service_charge_calculation_phase_spec.rb +33 -0
- data/spec/models/order_service_charge_spec.rb +103 -0
- data/spec/models/standard_unit_description_group_spec.rb +45 -0
- data/spec/models/standard_unit_description_spec.rb +51 -0
- metadata +50 -2
@@ -47,7 +47,7 @@ module SquareConnect
|
|
47
47
|
# HTTP header 'Content-Type'
|
48
48
|
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
49
49
|
|
50
|
-
header_params['Square-Version'] = "2019-
|
50
|
+
header_params['Square-Version'] = "2019-06-12"
|
51
51
|
|
52
52
|
# form parameters
|
53
53
|
form_params = {}
|
@@ -98,7 +98,7 @@ module SquareConnect
|
|
98
98
|
# HTTP header 'Content-Type'
|
99
99
|
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
100
100
|
|
101
|
-
header_params['Square-Version'] = "2019-
|
101
|
+
header_params['Square-Version'] = "2019-06-12"
|
102
102
|
|
103
103
|
# form parameters
|
104
104
|
form_params = {}
|
@@ -55,7 +55,7 @@ module SquareConnect
|
|
55
55
|
# HTTP header 'Content-Type'
|
56
56
|
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
57
57
|
|
58
|
-
header_params['Square-Version'] = "2019-
|
58
|
+
header_params['Square-Version'] = "2019-06-12"
|
59
59
|
|
60
60
|
# form parameters
|
61
61
|
form_params = {}
|
@@ -110,7 +110,7 @@ module SquareConnect
|
|
110
110
|
# HTTP header 'Content-Type'
|
111
111
|
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
112
112
|
|
113
|
-
header_params['Square-Version'] = "2019-
|
113
|
+
header_params['Square-Version'] = "2019-06-12"
|
114
114
|
|
115
115
|
# form parameters
|
116
116
|
form_params = {}
|
@@ -177,7 +177,7 @@ module SquareConnect
|
|
177
177
|
# HTTP header 'Content-Type'
|
178
178
|
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
179
179
|
|
180
|
-
header_params['Square-Version'] = "2019-
|
180
|
+
header_params['Square-Version'] = "2019-06-12"
|
181
181
|
|
182
182
|
# form parameters
|
183
183
|
form_params = {}
|
@@ -253,7 +253,7 @@ module SquareConnect
|
|
253
253
|
# HTTP header 'Content-Type'
|
254
254
|
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
255
255
|
|
256
|
-
header_params['Square-Version'] = "2019-
|
256
|
+
header_params['Square-Version'] = "2019-06-12"
|
257
257
|
|
258
258
|
# form parameters
|
259
259
|
form_params = {}
|
@@ -326,7 +326,7 @@ module SquareConnect
|
|
326
326
|
# HTTP header 'Content-Type'
|
327
327
|
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
328
328
|
|
329
|
-
header_params['Square-Version'] = "2019-
|
329
|
+
header_params['Square-Version'] = "2019-06-12"
|
330
330
|
|
331
331
|
# form parameters
|
332
332
|
form_params = {}
|
@@ -405,7 +405,7 @@ module SquareConnect
|
|
405
405
|
# HTTP header 'Content-Type'
|
406
406
|
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
407
407
|
|
408
|
-
header_params['Square-Version'] = "2019-
|
408
|
+
header_params['Square-Version'] = "2019-06-12"
|
409
409
|
|
410
410
|
# form parameters
|
411
411
|
form_params = {}
|
@@ -464,7 +464,7 @@ module SquareConnect
|
|
464
464
|
# HTTP header 'Content-Type'
|
465
465
|
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
466
466
|
|
467
|
-
header_params['Square-Version'] = "2019-
|
467
|
+
header_params['Square-Version'] = "2019-06-12"
|
468
468
|
|
469
469
|
# form parameters
|
470
470
|
form_params = {}
|
@@ -523,7 +523,7 @@ module SquareConnect
|
|
523
523
|
# HTTP header 'Content-Type'
|
524
524
|
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
525
525
|
|
526
|
-
header_params['Square-Version'] = "2019-
|
526
|
+
header_params['Square-Version'] = "2019-06-12"
|
527
527
|
|
528
528
|
# form parameters
|
529
529
|
form_params = {}
|
@@ -582,7 +582,7 @@ module SquareConnect
|
|
582
582
|
# HTTP header 'Content-Type'
|
583
583
|
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
584
584
|
|
585
|
-
header_params['Square-Version'] = "2019-
|
585
|
+
header_params['Square-Version'] = "2019-06-12"
|
586
586
|
|
587
587
|
# form parameters
|
588
588
|
form_params = {}
|
@@ -641,7 +641,7 @@ module SquareConnect
|
|
641
641
|
# HTTP header 'Content-Type'
|
642
642
|
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
643
643
|
|
644
|
-
header_params['Square-Version'] = "2019-
|
644
|
+
header_params['Square-Version'] = "2019-06-12"
|
645
645
|
|
646
646
|
# form parameters
|
647
647
|
form_params = {}
|
@@ -704,7 +704,7 @@ module SquareConnect
|
|
704
704
|
# HTTP header 'Content-Type'
|
705
705
|
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
706
706
|
|
707
|
-
header_params['Square-Version'] = "2019-
|
707
|
+
header_params['Square-Version'] = "2019-06-12"
|
708
708
|
|
709
709
|
# form parameters
|
710
710
|
form_params = {}
|
@@ -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.20190612.0"
|
34
34
|
|
35
35
|
@default_headers = {
|
36
36
|
'Content-Type' => "application/json",
|
@@ -0,0 +1,21 @@
|
|
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 AggregationStrategy
|
14
|
+
|
15
|
+
UNKNOWN = "UNKNOWN".freeze
|
16
|
+
BASE = "BASE".freeze
|
17
|
+
STACKABLE = "STACKABLE".freeze
|
18
|
+
EXCLUSIVE = "EXCLUSIVE".freeze
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -15,7 +15,7 @@ module SquareConnect
|
|
15
15
|
# The IDs of the [CatalogObject](#type-catalogobject)s to be retrieved.
|
16
16
|
attr_accessor :object_ids
|
17
17
|
|
18
|
-
# If `true`, the response will include additional objects that are related to the requested objects, as follows: If the `objects` field of the response contains a [CatalogItem](#type-catalogitem),
|
18
|
+
# If `true`, the response will include additional objects that are related to the requested objects, as follows: If the `objects` field of the response contains a [CatalogItem](#type-catalogitem), its associated [CatalogCategory](#type-catalogcategory), [CatalogTax](#type-catalogtax)es, [CatalogImage](#type-catalogimage)s and [CatalogModifierList](#type-catalogmodifierlist)s will be returned in the `related_objects` field of the response. If the `objects` 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.
|
19
19
|
attr_accessor :include_related_objects
|
20
20
|
|
21
21
|
|
@@ -33,7 +33,7 @@ module SquareConnect
|
|
33
33
|
# The billing address for this card.
|
34
34
|
attr_accessor :billing_address
|
35
35
|
|
36
|
-
#
|
36
|
+
# A unique, Square-assigned ID that identifies the card across multiple locations and applications for a single Square account.
|
37
37
|
attr_accessor :fingerprint
|
38
38
|
|
39
39
|
class EnumAttributeValidator
|
@@ -18,12 +18,16 @@ module SquareConnect
|
|
18
18
|
#
|
19
19
|
attr_accessor :limits
|
20
20
|
|
21
|
+
# Names and abbreviations for standard units.
|
22
|
+
attr_accessor :standard_unit_description_group
|
23
|
+
|
21
24
|
|
22
25
|
# Attribute mapping from ruby-style variable name to JSON key.
|
23
26
|
def self.attribute_map
|
24
27
|
{
|
25
28
|
:'errors' => :'errors',
|
26
|
-
:'limits' => :'limits'
|
29
|
+
:'limits' => :'limits',
|
30
|
+
:'standard_unit_description_group' => :'standard_unit_description_group'
|
27
31
|
}
|
28
32
|
end
|
29
33
|
|
@@ -31,7 +35,8 @@ module SquareConnect
|
|
31
35
|
def self.swagger_types
|
32
36
|
{
|
33
37
|
:'errors' => :'Array<Error>',
|
34
|
-
:'limits' => :'CatalogInfoResponseLimits'
|
38
|
+
:'limits' => :'CatalogInfoResponseLimits',
|
39
|
+
:'standard_unit_description_group' => :'StandardUnitDescriptionGroup'
|
35
40
|
}
|
36
41
|
end
|
37
42
|
|
@@ -53,6 +58,10 @@ module SquareConnect
|
|
53
58
|
self.limits = attributes[:'limits']
|
54
59
|
end
|
55
60
|
|
61
|
+
if attributes.has_key?(:'standard_unit_description_group')
|
62
|
+
self.standard_unit_description_group = attributes[:'standard_unit_description_group']
|
63
|
+
end
|
64
|
+
|
56
65
|
end
|
57
66
|
|
58
67
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -74,7 +83,8 @@ module SquareConnect
|
|
74
83
|
return true if self.equal?(o)
|
75
84
|
self.class == o.class &&
|
76
85
|
errors == o.errors &&
|
77
|
-
limits == o.limits
|
86
|
+
limits == o.limits &&
|
87
|
+
standard_unit_description_group == o.standard_unit_description_group
|
78
88
|
end
|
79
89
|
|
80
90
|
# @see the `==` method
|
@@ -86,7 +96,7 @@ module SquareConnect
|
|
86
96
|
# Calculates hash code according to all attributes.
|
87
97
|
# @return [Fixnum] Hash code
|
88
98
|
def hash
|
89
|
-
[errors, limits].hash
|
99
|
+
[errors, limits, standard_unit_description_group].hash
|
90
100
|
end
|
91
101
|
|
92
102
|
# Builds the object from hash
|
@@ -45,7 +45,7 @@ module SquareConnect
|
|
45
45
|
# __Deprecated__. The URL of an image representing this item. Deprecated in favor of `image_id` in [`CatalogObject`](#type-catalogobject).
|
46
46
|
attr_accessor :image_url
|
47
47
|
|
48
|
-
# A list of [CatalogObject](#type-catalogobject)s containing the [CatalogItemVariation](#type-catalogitemvariation)s for this item.
|
48
|
+
# A list of [CatalogObject](#type-catalogobject)s containing the [CatalogItemVariation](#type-catalogitemvariation)s for this item. Maximum: 250 item variations
|
49
49
|
attr_accessor :variations
|
50
50
|
|
51
51
|
# The product type of the item. May not be changed once an item has been created. Only items of product type `REGULAR` may be created by this API; items with other product types are read-only. See [CatalogItemProductType](#type-catalogitemproducttype) for possible values
|
@@ -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
|
-
# An item variation (i.e., product) in the Catalog object model.
|
13
|
+
# An item variation (i.e., product) in the Catalog object model. Each item may have a maximum of 250 item variations.
|
14
14
|
class CatalogItemVariation
|
15
15
|
# The ID of the [CatalogItem](#type-catalogitem) associated with this item variation. Searchable.
|
16
16
|
attr_accessor :item_id
|
@@ -51,6 +51,12 @@ module SquareConnect
|
|
51
51
|
# If the [CatalogItem](#type-catalogitem) that owns this item variation is of type `APPOINTMENTS_SERVICE`, then this is the duration of the service in milliseconds. For example, a 30 minute appointment would have the value `1800000`, which is equal to 30 (minutes) * 60 (seconds per minute) * 1000 (milliseconds per second).
|
52
52
|
attr_accessor :service_duration
|
53
53
|
|
54
|
+
# Represents the unit used to measure a [CatalogItemVariation](#type-catalogitemvariation) and specifies the precision for decimal quantities.
|
55
|
+
attr_accessor :catalog_measurement_unit_id
|
56
|
+
|
57
|
+
# ID of the ‘CatalogMeasurementUnit’ that is used to measure the quantity sold of this item variation. If left unset, the item will be sold in whole quantities.
|
58
|
+
attr_accessor :measurement_unit_id
|
59
|
+
|
54
60
|
class EnumAttributeValidator
|
55
61
|
attr_reader :datatype
|
56
62
|
attr_reader :allowable_values
|
@@ -88,7 +94,9 @@ module SquareConnect
|
|
88
94
|
:'inventory_alert_type' => :'inventory_alert_type',
|
89
95
|
:'inventory_alert_threshold' => :'inventory_alert_threshold',
|
90
96
|
:'user_data' => :'user_data',
|
91
|
-
:'service_duration' => :'service_duration'
|
97
|
+
:'service_duration' => :'service_duration',
|
98
|
+
:'catalog_measurement_unit_id' => :'catalog_measurement_unit_id',
|
99
|
+
:'measurement_unit_id' => :'measurement_unit_id'
|
92
100
|
}
|
93
101
|
end
|
94
102
|
|
@@ -107,7 +115,9 @@ module SquareConnect
|
|
107
115
|
:'inventory_alert_type' => :'String',
|
108
116
|
:'inventory_alert_threshold' => :'Integer',
|
109
117
|
:'user_data' => :'String',
|
110
|
-
:'service_duration' => :'Integer'
|
118
|
+
:'service_duration' => :'Integer',
|
119
|
+
:'catalog_measurement_unit_id' => :'String',
|
120
|
+
:'measurement_unit_id' => :'String'
|
111
121
|
}
|
112
122
|
end
|
113
123
|
|
@@ -173,6 +183,14 @@ module SquareConnect
|
|
173
183
|
self.service_duration = attributes[:'service_duration']
|
174
184
|
end
|
175
185
|
|
186
|
+
if attributes.has_key?(:'catalog_measurement_unit_id')
|
187
|
+
self.catalog_measurement_unit_id = attributes[:'catalog_measurement_unit_id']
|
188
|
+
end
|
189
|
+
|
190
|
+
if attributes.has_key?(:'measurement_unit_id')
|
191
|
+
self.measurement_unit_id = attributes[:'measurement_unit_id']
|
192
|
+
end
|
193
|
+
|
176
194
|
end
|
177
195
|
|
178
196
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -229,7 +247,9 @@ module SquareConnect
|
|
229
247
|
inventory_alert_type == o.inventory_alert_type &&
|
230
248
|
inventory_alert_threshold == o.inventory_alert_threshold &&
|
231
249
|
user_data == o.user_data &&
|
232
|
-
service_duration == o.service_duration
|
250
|
+
service_duration == o.service_duration &&
|
251
|
+
catalog_measurement_unit_id == o.catalog_measurement_unit_id &&
|
252
|
+
measurement_unit_id == o.measurement_unit_id
|
233
253
|
end
|
234
254
|
|
235
255
|
# @see the `==` method
|
@@ -241,7 +261,7 @@ module SquareConnect
|
|
241
261
|
# Calculates hash code according to all attributes.
|
242
262
|
# @return [Fixnum] Hash code
|
243
263
|
def hash
|
244
|
-
[item_id, name, sku, upc, ordinal, pricing_type, price_money, location_overrides, track_inventory, inventory_alert_type, inventory_alert_threshold, user_data, service_duration].hash
|
264
|
+
[item_id, name, sku, upc, ordinal, pricing_type, price_money, location_overrides, track_inventory, inventory_alert_type, inventory_alert_threshold, user_data, service_duration, catalog_measurement_unit_id, measurement_unit_id].hash
|
245
265
|
end
|
246
266
|
|
247
267
|
# Builds the object from hash
|
@@ -0,0 +1,196 @@
|
|
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 the unit used to measure a [CatalogItemVariation](#type-catalogitemvariation) and specifies the precision for decimal quantities.
|
14
|
+
class CatalogMeasurementUnit
|
15
|
+
# Indicates the unit used to measure the quantity of a catalog item variation.
|
16
|
+
attr_accessor :measurement_unit
|
17
|
+
|
18
|
+
# Represents the maximum number of positions allowed after the decimal in quantities measured with this unit. For example, if the precision is 2, then an itemization’s quantity can be 0.01, 0.12, etc. Min: 0 Max: 5 Default: 3
|
19
|
+
attr_accessor :precision
|
20
|
+
|
21
|
+
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
+
def self.attribute_map
|
24
|
+
{
|
25
|
+
:'measurement_unit' => :'measurement_unit',
|
26
|
+
:'precision' => :'precision'
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
# Attribute type mapping.
|
31
|
+
def self.swagger_types
|
32
|
+
{
|
33
|
+
:'measurement_unit' => :'MeasurementUnit',
|
34
|
+
:'precision' => :'Integer'
|
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?(:'measurement_unit')
|
47
|
+
self.measurement_unit = attributes[:'measurement_unit']
|
48
|
+
end
|
49
|
+
|
50
|
+
if attributes.has_key?(:'precision')
|
51
|
+
self.precision = attributes[:'precision']
|
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
|
+
return invalid_properties
|
61
|
+
end
|
62
|
+
|
63
|
+
# Check to see if the all the properties in the model are valid
|
64
|
+
# @return true if the model is valid
|
65
|
+
def valid?
|
66
|
+
return true
|
67
|
+
end
|
68
|
+
|
69
|
+
# Checks equality by comparing each attribute.
|
70
|
+
# @param [Object] Object to be compared
|
71
|
+
def ==(o)
|
72
|
+
return true if self.equal?(o)
|
73
|
+
self.class == o.class &&
|
74
|
+
measurement_unit == o.measurement_unit &&
|
75
|
+
precision == o.precision
|
76
|
+
end
|
77
|
+
|
78
|
+
# @see the `==` method
|
79
|
+
# @param [Object] Object to be compared
|
80
|
+
def eql?(o)
|
81
|
+
self == o
|
82
|
+
end
|
83
|
+
|
84
|
+
# Calculates hash code according to all attributes.
|
85
|
+
# @return [Fixnum] Hash code
|
86
|
+
def hash
|
87
|
+
[measurement_unit, precision].hash
|
88
|
+
end
|
89
|
+
|
90
|
+
# Builds the object from hash
|
91
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
92
|
+
# @return [Object] Returns the model itself
|
93
|
+
def build_from_hash(attributes)
|
94
|
+
return nil unless attributes.is_a?(Hash)
|
95
|
+
self.class.swagger_types.each_pair do |key, type|
|
96
|
+
if type =~ /\AArray<(.*)>/i
|
97
|
+
# check to ensure the input is an array given that the the attribute
|
98
|
+
# is documented as an array but the input is not
|
99
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
100
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
101
|
+
end
|
102
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
103
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
104
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
105
|
+
end
|
106
|
+
|
107
|
+
self
|
108
|
+
end
|
109
|
+
|
110
|
+
# Deserializes the data based on type
|
111
|
+
# @param string type Data type
|
112
|
+
# @param string value Value to be deserialized
|
113
|
+
# @return [Object] Deserialized data
|
114
|
+
def _deserialize(type, value)
|
115
|
+
case type.to_sym
|
116
|
+
when :DateTime
|
117
|
+
DateTime.parse(value)
|
118
|
+
when :Date
|
119
|
+
Date.parse(value)
|
120
|
+
when :String
|
121
|
+
value.to_s
|
122
|
+
when :Integer
|
123
|
+
value.to_i
|
124
|
+
when :Float
|
125
|
+
value.to_f
|
126
|
+
when :BOOLEAN
|
127
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
128
|
+
true
|
129
|
+
else
|
130
|
+
false
|
131
|
+
end
|
132
|
+
when :Object
|
133
|
+
# generic object (usually a Hash), return directly
|
134
|
+
value
|
135
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
136
|
+
inner_type = Regexp.last_match[:inner_type]
|
137
|
+
value.map { |v| _deserialize(inner_type, v) }
|
138
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
139
|
+
k_type = Regexp.last_match[:k_type]
|
140
|
+
v_type = Regexp.last_match[:v_type]
|
141
|
+
{}.tap do |hash|
|
142
|
+
value.each do |k, v|
|
143
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
else # model
|
147
|
+
temp_model = SquareConnect.const_get(type).new
|
148
|
+
temp_model.build_from_hash(value)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
# Returns the string representation of the object
|
153
|
+
# @return [String] String presentation of the object
|
154
|
+
def to_s
|
155
|
+
to_hash.to_s
|
156
|
+
end
|
157
|
+
|
158
|
+
# to_body is an alias to to_hash (backward compatibility)
|
159
|
+
# @return [Hash] Returns the object in the form of hash
|
160
|
+
def to_body
|
161
|
+
to_hash
|
162
|
+
end
|
163
|
+
|
164
|
+
# Returns the object in the form of hash
|
165
|
+
# @return [Hash] Returns the object in the form of hash
|
166
|
+
def to_hash
|
167
|
+
hash = {}
|
168
|
+
self.class.attribute_map.each_pair do |attr, param|
|
169
|
+
value = self.send(attr)
|
170
|
+
next if value.nil?
|
171
|
+
hash[param] = _to_hash(value)
|
172
|
+
end
|
173
|
+
hash
|
174
|
+
end
|
175
|
+
|
176
|
+
# Outputs non-array value in the form of hash
|
177
|
+
# For object, use to_hash. Otherwise, just return the value
|
178
|
+
# @param [Object] value Any valid value
|
179
|
+
# @return [Hash] Returns the value in the form of hash
|
180
|
+
def _to_hash(value)
|
181
|
+
if value.is_a?(Array)
|
182
|
+
value.compact.map{ |v| _to_hash(v) }
|
183
|
+
elsif value.is_a?(Hash)
|
184
|
+
{}.tap do |hash|
|
185
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
186
|
+
end
|
187
|
+
elsif value.respond_to? :to_hash
|
188
|
+
value.to_hash
|
189
|
+
else
|
190
|
+
value
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
end
|
195
|
+
|
196
|
+
end
|