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
@@ -36,13 +36,13 @@ module SquareConnect
|
|
36
36
|
# The ID of the customer to associate this transaction with. This field is required if you provide a value for `customer_card_id`, and optional otherwise.
|
37
37
|
attr_accessor :customer_id
|
38
38
|
|
39
|
-
# The buyer's billing address.
|
39
|
+
# The buyer's billing address.
|
40
40
|
attr_accessor :billing_address
|
41
41
|
|
42
|
-
# The buyer's shipping address, if available.
|
42
|
+
# The buyer's shipping address, if available.
|
43
43
|
attr_accessor :shipping_address
|
44
44
|
|
45
|
-
# The buyer's email address, if available.
|
45
|
+
# The buyer's email address, if available.
|
46
46
|
attr_accessor :buyer_email_address
|
47
47
|
|
48
48
|
# The ID of the order to associate with this transaction. If you provide this value, the `amount_money` value of your request must __exactly match__ the value of the order's `total_money` field.
|
@@ -18,7 +18,7 @@ module SquareConnect
|
|
18
18
|
# A value you specify that uniquely identifies this order among orders you've created. If you're unsure whether a particular order was created successfully, you can reattempt it with the same idempotency key without worrying about creating duplicate orders. See [Idempotency](/basics/api101/idempotency) for more information.
|
19
19
|
attr_accessor :idempotency_key
|
20
20
|
|
21
|
-
# __Deprecated__: Please set the reference_id on the nested [order](#type-order) field instead. 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.
|
21
|
+
# __Deprecated__: Please set the reference_id on the nested [order](#type-order) field instead. 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. -- Top-level fields necessary to support the connect v2 CreateOrderRequest shape.
|
22
22
|
attr_accessor :reference_id
|
23
23
|
|
24
24
|
# __Deprecated__: Please set the line_items on the nested [order](#type-order) field instead. The line items to associate with this order. Each line item represents a different product to include in a purchase.
|
@@ -18,7 +18,7 @@ module SquareConnect
|
|
18
18
|
# Only used for ad hoc taxes. The tax's name. Do not provide a value for this field if you set `catalog_object_id`.
|
19
19
|
attr_accessor :name
|
20
20
|
|
21
|
-
# Only used for ad hoc taxes. Indicates the calculation method used to apply the line item tax. Default: `ADDITIVE`; See [OrderLineItemTaxType](#type-orderlineitemtaxtype) for possible values
|
21
|
+
# Only used for ad hoc taxes. Indicates the calculation method used to apply the line item tax. Default: `ADDITIVE`; See [OrderLineItemTaxType](#type-orderlineitemtaxtype) for possible values. See [OrderLineItemTaxType](#type-orderlineitemtaxtype) for possible values
|
22
22
|
attr_accessor :type
|
23
23
|
|
24
24
|
# Only used for ad hoc taxes. 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%. This value range between 0.0 up to 100.0
|
@@ -0,0 +1,24 @@
|
|
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 DayOfWeek
|
14
|
+
|
15
|
+
SUN = "SUN".freeze
|
16
|
+
MON = "MON".freeze
|
17
|
+
TUE = "TUE".freeze
|
18
|
+
WED = "WED".freeze
|
19
|
+
THU = "THU".freeze
|
20
|
+
FRI = "FRI".freeze
|
21
|
+
SAT = "SAT".freeze
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -114,7 +114,7 @@ module SquareConnect
|
|
114
114
|
category_validator = EnumAttributeValidator.new('String', ["API_ERROR", "AUTHENTICATION_ERROR", "INVALID_REQUEST_ERROR", "RATE_LIMIT_ERROR", "PAYMENT_METHOD_ERROR", "REFUND_ERROR"])
|
115
115
|
return false unless category_validator.valid?(@category)
|
116
116
|
return false if @code.nil?
|
117
|
-
code_validator = EnumAttributeValidator.new('String', ["INTERNAL_SERVER_ERROR", "UNAUTHORIZED", "ACCESS_TOKEN_EXPIRED", "ACCESS_TOKEN_REVOKED", "FORBIDDEN", "INSUFFICIENT_SCOPES", "APPLICATION_DISABLED", "V1_APPLICATION", "V1_ACCESS_TOKEN", "CARD_PROCESSING_NOT_ENABLED", "BAD_REQUEST", "MISSING_REQUIRED_PARAMETER", "INCORRECT_TYPE", "INVALID_TIME", "INVALID_TIME_RANGE", "INVALID_VALUE", "INVALID_CURSOR", "UNKNOWN_QUERY_PARAMETER", "CONFLICTING_PARAMETERS", "EXPECTED_JSON_BODY", "INVALID_SORT_ORDER", "VALUE_REGEX_MISMATCH", "VALUE_TOO_SHORT", "VALUE_TOO_LONG", "VALUE_TOO_LOW", "VALUE_TOO_HIGH", "VALUE_EMPTY", "ARRAY_LENGTH_TOO_LONG", "ARRAY_LENGTH_TOO_SHORT", "ARRAY_EMPTY", "EXPECTED_BOOLEAN", "EXPECTED_INTEGER", "EXPECTED_FLOAT", "EXPECTED_STRING", "EXPECTED_OBJECT", "EXPECTED_ARRAY", "EXPECTED_MAP", "EXPECTED_BASE64_ENCODED_BYTE_ARRAY", "INVALID_ARRAY_VALUE", "INVALID_ENUM_VALUE", "INVALID_CONTENT_TYPE", "INVALID_FORM_VALUE", "ONE_INSTRUMENT_EXPECTED", "NO_FIELDS_SET", "DEPRECATED_FIELD_SET", "CARD_EXPIRED", "INVALID_EXPIRATION", "INVALID_EXPIRATION_YEAR", "INVALID_EXPIRATION_DATE", "UNSUPPORTED_CARD_BRAND", "UNSUPPORTED_ENTRY_METHOD", "INVALID_ENCRYPTED_CARD", "INVALID_CARD", "DELAYED_TRANSACTION_EXPIRED", "DELAYED_TRANSACTION_CANCELED", "DELAYED_TRANSACTION_CAPTURED", "DELAYED_TRANSACTION_FAILED", "CARD_TOKEN_EXPIRED", "CARD_TOKEN_USED", "AMOUNT_TOO_HIGH", "UNSUPPORTED_INSTRUMENT_TYPE", "REFUND_AMOUNT_INVALID", "REFUND_ALREADY_PENDING", "PAYMENT_NOT_REFUNDABLE", "INVALID_CARD_DATA", "LOCATION_MISMATCH", "IDEMPOTENCY_KEY_REUSED", "UNEXPECTED_VALUE", "SANDBOX_NOT_SUPPORTED", "INVALID_EMAIL_ADDRESS", "INVALID_PHONE_NUMBER", "CHECKOUT_EXPIRED", "BAD_CERTIFICATE", "CARD_DECLINED", "VERIFY_CVV_FAILURE", "VERIFY_AVS_FAILURE", "CARD_DECLINED_CALL_ISSUER", "NOT_FOUND", "APPLE_PAYMENT_PROCESSING_CERTIFICATE_HASH_NOT_FOUND", "METHOD_NOT_ALLOWED", "NOT_ACCEPTABLE", "REQUEST_TIMEOUT", "CONFLICT", "REQUEST_ENTITY_TOO_LARGE", "UNSUPPORTED_MEDIA_TYPE", "RATE_LIMITED", "NOT_IMPLEMENTED", "SERVICE_UNAVAILABLE", "GATEWAY_TIMEOUT"])
|
117
|
+
code_validator = EnumAttributeValidator.new('String', ["INTERNAL_SERVER_ERROR", "UNAUTHORIZED", "ACCESS_TOKEN_EXPIRED", "ACCESS_TOKEN_REVOKED", "FORBIDDEN", "INSUFFICIENT_SCOPES", "APPLICATION_DISABLED", "V1_APPLICATION", "V1_ACCESS_TOKEN", "CARD_PROCESSING_NOT_ENABLED", "BAD_REQUEST", "MISSING_REQUIRED_PARAMETER", "INCORRECT_TYPE", "INVALID_TIME", "INVALID_TIME_RANGE", "INVALID_VALUE", "INVALID_CURSOR", "UNKNOWN_QUERY_PARAMETER", "CONFLICTING_PARAMETERS", "EXPECTED_JSON_BODY", "INVALID_SORT_ORDER", "VALUE_REGEX_MISMATCH", "VALUE_TOO_SHORT", "VALUE_TOO_LONG", "VALUE_TOO_LOW", "VALUE_TOO_HIGH", "VALUE_EMPTY", "ARRAY_LENGTH_TOO_LONG", "ARRAY_LENGTH_TOO_SHORT", "ARRAY_EMPTY", "EXPECTED_BOOLEAN", "EXPECTED_INTEGER", "EXPECTED_FLOAT", "EXPECTED_STRING", "EXPECTED_OBJECT", "EXPECTED_ARRAY", "EXPECTED_MAP", "EXPECTED_BASE64_ENCODED_BYTE_ARRAY", "INVALID_ARRAY_VALUE", "INVALID_ENUM_VALUE", "INVALID_CONTENT_TYPE", "INVALID_FORM_VALUE", "ONE_INSTRUMENT_EXPECTED", "NO_FIELDS_SET", "DEPRECATED_FIELD_SET", "CARD_EXPIRED", "INVALID_EXPIRATION", "INVALID_EXPIRATION_YEAR", "INVALID_EXPIRATION_DATE", "UNSUPPORTED_CARD_BRAND", "UNSUPPORTED_ENTRY_METHOD", "INVALID_ENCRYPTED_CARD", "INVALID_CARD", "DELAYED_TRANSACTION_EXPIRED", "DELAYED_TRANSACTION_CANCELED", "DELAYED_TRANSACTION_CAPTURED", "DELAYED_TRANSACTION_FAILED", "CARD_TOKEN_EXPIRED", "CARD_TOKEN_USED", "AMOUNT_TOO_HIGH", "UNSUPPORTED_INSTRUMENT_TYPE", "REFUND_AMOUNT_INVALID", "REFUND_ALREADY_PENDING", "PAYMENT_NOT_REFUNDABLE", "INVALID_CARD_DATA", "LOCATION_MISMATCH", "IDEMPOTENCY_KEY_REUSED", "UNEXPECTED_VALUE", "SANDBOX_NOT_SUPPORTED", "INVALID_EMAIL_ADDRESS", "INVALID_PHONE_NUMBER", "CHECKOUT_EXPIRED", "BAD_CERTIFICATE", "INVALID_SQUARE_VERSION_FORMAT", "API_VERSION_INCOMPATIBLE", "CARD_DECLINED", "VERIFY_CVV_FAILURE", "VERIFY_AVS_FAILURE", "CARD_DECLINED_CALL_ISSUER", "NOT_FOUND", "APPLE_PAYMENT_PROCESSING_CERTIFICATE_HASH_NOT_FOUND", "METHOD_NOT_ALLOWED", "NOT_ACCEPTABLE", "REQUEST_TIMEOUT", "CONFLICT", "REQUEST_ENTITY_TOO_LARGE", "UNSUPPORTED_MEDIA_TYPE", "RATE_LIMITED", "NOT_IMPLEMENTED", "SERVICE_UNAVAILABLE", "GATEWAY_TIMEOUT"])
|
118
118
|
return false unless code_validator.valid?(@code)
|
119
119
|
return true
|
120
120
|
end
|
@@ -132,7 +132,7 @@ module SquareConnect
|
|
132
132
|
# Custom attribute writer method checking allowed values (enum).
|
133
133
|
# @param [Object] code Object to be assigned
|
134
134
|
def code=(code)
|
135
|
-
validator = EnumAttributeValidator.new('String', ["INTERNAL_SERVER_ERROR", "UNAUTHORIZED", "ACCESS_TOKEN_EXPIRED", "ACCESS_TOKEN_REVOKED", "FORBIDDEN", "INSUFFICIENT_SCOPES", "APPLICATION_DISABLED", "V1_APPLICATION", "V1_ACCESS_TOKEN", "CARD_PROCESSING_NOT_ENABLED", "BAD_REQUEST", "MISSING_REQUIRED_PARAMETER", "INCORRECT_TYPE", "INVALID_TIME", "INVALID_TIME_RANGE", "INVALID_VALUE", "INVALID_CURSOR", "UNKNOWN_QUERY_PARAMETER", "CONFLICTING_PARAMETERS", "EXPECTED_JSON_BODY", "INVALID_SORT_ORDER", "VALUE_REGEX_MISMATCH", "VALUE_TOO_SHORT", "VALUE_TOO_LONG", "VALUE_TOO_LOW", "VALUE_TOO_HIGH", "VALUE_EMPTY", "ARRAY_LENGTH_TOO_LONG", "ARRAY_LENGTH_TOO_SHORT", "ARRAY_EMPTY", "EXPECTED_BOOLEAN", "EXPECTED_INTEGER", "EXPECTED_FLOAT", "EXPECTED_STRING", "EXPECTED_OBJECT", "EXPECTED_ARRAY", "EXPECTED_MAP", "EXPECTED_BASE64_ENCODED_BYTE_ARRAY", "INVALID_ARRAY_VALUE", "INVALID_ENUM_VALUE", "INVALID_CONTENT_TYPE", "INVALID_FORM_VALUE", "ONE_INSTRUMENT_EXPECTED", "NO_FIELDS_SET", "DEPRECATED_FIELD_SET", "CARD_EXPIRED", "INVALID_EXPIRATION", "INVALID_EXPIRATION_YEAR", "INVALID_EXPIRATION_DATE", "UNSUPPORTED_CARD_BRAND", "UNSUPPORTED_ENTRY_METHOD", "INVALID_ENCRYPTED_CARD", "INVALID_CARD", "DELAYED_TRANSACTION_EXPIRED", "DELAYED_TRANSACTION_CANCELED", "DELAYED_TRANSACTION_CAPTURED", "DELAYED_TRANSACTION_FAILED", "CARD_TOKEN_EXPIRED", "CARD_TOKEN_USED", "AMOUNT_TOO_HIGH", "UNSUPPORTED_INSTRUMENT_TYPE", "REFUND_AMOUNT_INVALID", "REFUND_ALREADY_PENDING", "PAYMENT_NOT_REFUNDABLE", "INVALID_CARD_DATA", "LOCATION_MISMATCH", "IDEMPOTENCY_KEY_REUSED", "UNEXPECTED_VALUE", "SANDBOX_NOT_SUPPORTED", "INVALID_EMAIL_ADDRESS", "INVALID_PHONE_NUMBER", "CHECKOUT_EXPIRED", "BAD_CERTIFICATE", "CARD_DECLINED", "VERIFY_CVV_FAILURE", "VERIFY_AVS_FAILURE", "CARD_DECLINED_CALL_ISSUER", "NOT_FOUND", "APPLE_PAYMENT_PROCESSING_CERTIFICATE_HASH_NOT_FOUND", "METHOD_NOT_ALLOWED", "NOT_ACCEPTABLE", "REQUEST_TIMEOUT", "CONFLICT", "REQUEST_ENTITY_TOO_LARGE", "UNSUPPORTED_MEDIA_TYPE", "RATE_LIMITED", "NOT_IMPLEMENTED", "SERVICE_UNAVAILABLE", "GATEWAY_TIMEOUT"])
|
135
|
+
validator = EnumAttributeValidator.new('String', ["INTERNAL_SERVER_ERROR", "UNAUTHORIZED", "ACCESS_TOKEN_EXPIRED", "ACCESS_TOKEN_REVOKED", "FORBIDDEN", "INSUFFICIENT_SCOPES", "APPLICATION_DISABLED", "V1_APPLICATION", "V1_ACCESS_TOKEN", "CARD_PROCESSING_NOT_ENABLED", "BAD_REQUEST", "MISSING_REQUIRED_PARAMETER", "INCORRECT_TYPE", "INVALID_TIME", "INVALID_TIME_RANGE", "INVALID_VALUE", "INVALID_CURSOR", "UNKNOWN_QUERY_PARAMETER", "CONFLICTING_PARAMETERS", "EXPECTED_JSON_BODY", "INVALID_SORT_ORDER", "VALUE_REGEX_MISMATCH", "VALUE_TOO_SHORT", "VALUE_TOO_LONG", "VALUE_TOO_LOW", "VALUE_TOO_HIGH", "VALUE_EMPTY", "ARRAY_LENGTH_TOO_LONG", "ARRAY_LENGTH_TOO_SHORT", "ARRAY_EMPTY", "EXPECTED_BOOLEAN", "EXPECTED_INTEGER", "EXPECTED_FLOAT", "EXPECTED_STRING", "EXPECTED_OBJECT", "EXPECTED_ARRAY", "EXPECTED_MAP", "EXPECTED_BASE64_ENCODED_BYTE_ARRAY", "INVALID_ARRAY_VALUE", "INVALID_ENUM_VALUE", "INVALID_CONTENT_TYPE", "INVALID_FORM_VALUE", "ONE_INSTRUMENT_EXPECTED", "NO_FIELDS_SET", "DEPRECATED_FIELD_SET", "CARD_EXPIRED", "INVALID_EXPIRATION", "INVALID_EXPIRATION_YEAR", "INVALID_EXPIRATION_DATE", "UNSUPPORTED_CARD_BRAND", "UNSUPPORTED_ENTRY_METHOD", "INVALID_ENCRYPTED_CARD", "INVALID_CARD", "DELAYED_TRANSACTION_EXPIRED", "DELAYED_TRANSACTION_CANCELED", "DELAYED_TRANSACTION_CAPTURED", "DELAYED_TRANSACTION_FAILED", "CARD_TOKEN_EXPIRED", "CARD_TOKEN_USED", "AMOUNT_TOO_HIGH", "UNSUPPORTED_INSTRUMENT_TYPE", "REFUND_AMOUNT_INVALID", "REFUND_ALREADY_PENDING", "PAYMENT_NOT_REFUNDABLE", "INVALID_CARD_DATA", "LOCATION_MISMATCH", "IDEMPOTENCY_KEY_REUSED", "UNEXPECTED_VALUE", "SANDBOX_NOT_SUPPORTED", "INVALID_EMAIL_ADDRESS", "INVALID_PHONE_NUMBER", "CHECKOUT_EXPIRED", "BAD_CERTIFICATE", "INVALID_SQUARE_VERSION_FORMAT", "API_VERSION_INCOMPATIBLE", "CARD_DECLINED", "VERIFY_CVV_FAILURE", "VERIFY_AVS_FAILURE", "CARD_DECLINED_CALL_ISSUER", "NOT_FOUND", "APPLE_PAYMENT_PROCESSING_CERTIFICATE_HASH_NOT_FOUND", "METHOD_NOT_ALLOWED", "NOT_ACCEPTABLE", "REQUEST_TIMEOUT", "CONFLICT", "REQUEST_ENTITY_TOO_LARGE", "UNSUPPORTED_MEDIA_TYPE", "RATE_LIMITED", "NOT_IMPLEMENTED", "SERVICE_UNAVAILABLE", "GATEWAY_TIMEOUT"])
|
136
136
|
unless validator.valid?(code)
|
137
137
|
fail ArgumentError, "invalid value for 'code', must be one of #{validator.allowable_values}."
|
138
138
|
end
|
@@ -85,6 +85,8 @@ module SquareConnect
|
|
85
85
|
INVALID_PHONE_NUMBER = "INVALID_PHONE_NUMBER".freeze
|
86
86
|
CHECKOUT_EXPIRED = "CHECKOUT_EXPIRED".freeze
|
87
87
|
BAD_CERTIFICATE = "BAD_CERTIFICATE".freeze
|
88
|
+
INVALID_SQUARE_VERSION_FORMAT = "INVALID_SQUARE_VERSION_FORMAT".freeze
|
89
|
+
API_VERSION_INCOMPATIBLE = "API_VERSION_INCOMPATIBLE".freeze
|
88
90
|
CARD_DECLINED = "CARD_DECLINED".freeze
|
89
91
|
VERIFY_CVV_FAILURE = "VERIFY_CVV_FAILURE".freeze
|
90
92
|
VERIFY_AVS_FAILURE = "VERIFY_AVS_FAILURE".freeze
|
@@ -33,7 +33,7 @@ module SquareConnect
|
|
33
33
|
# The [CatalogObjectType](#type-catalogobjecttype) of the [CatalogObject](#type-catalogobject) being tracked. Tracking is only supported for the `ITEM_VARIATION` type.
|
34
34
|
attr_accessor :catalog_object_type
|
35
35
|
|
36
|
-
# The number of items affected by the adjustment as a decimal string.
|
36
|
+
# The number of items affected by the adjustment as a decimal string. Can support up to 5 digits after the decimal point. _Important_: The Point of Sale app and Dashboard do not currently support decimal quantities. If a Point of Sale app or Dashboard attempts to read a decimal quantity on inventory counts or adjustments, the quantity will be rounded down to the nearest integer. For example, `2.5` will become `2`, and `-2.5` will become `-3`. Read [Decimal Quantities (BETA)](/more-apis/inventory/overview#decimal-quantities-beta) for more information.
|
37
37
|
attr_accessor :quantity
|
38
38
|
|
39
39
|
# The read-only total price paid for goods associated with the adjustment. Present if and only if `to_state` is `SOLD`. Always non-negative.
|
@@ -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
|
13
|
+
# Represents Square's estimated quantity of items in a particular state at a particular location based on the known history of physical counts and inventory adjustments
|
14
14
|
class InventoryCount
|
15
15
|
# The Square generated ID of the [CatalogObject](#type-catalogobject) being tracked.
|
16
16
|
attr_accessor :catalog_object_id
|
@@ -24,7 +24,7 @@ module SquareConnect
|
|
24
24
|
# The Square ID of the [Location](#type-location) where the related quantity of items are being tracked.
|
25
25
|
attr_accessor :location_id
|
26
26
|
|
27
|
-
# The number of items in the count as a decimal string.
|
27
|
+
# The number of items in the count as a decimal string. Can support up to 5 digits after the decimal point. _Important_: The Point of Sale app and Dashboard do not currently support decimal quantities. If a Point of Sale app or Dashboard attempts to read a decimal quantity on inventory counts or adjustments, the quantity will be rounded down to the nearest integer. For example, `2.5` will become `2`, and `-2.5` will become `-3`. Read [Decimal Quantities (BETA)](/more-apis/inventory/overview#decimal-quantities-beta) for more information.
|
28
28
|
attr_accessor :quantity
|
29
29
|
|
30
30
|
# A read-only timestamp in RFC 3339 format that indicates when Square received the most recent physical count or adjustment that had an affect on the estimated count.
|
@@ -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
|
13
|
+
# Represents the quantity of an item variation that is physically present at a specific location, verified by a seller or a seller's employee. For example, a physical count might come from an employee counting the item variations on hand or from syncing with an external system.
|
14
14
|
class InventoryPhysicalCount
|
15
15
|
# A unique ID generated by Square for the [InventoryPhysicalCount](#type-inventoryphysicalcount).
|
16
16
|
attr_accessor :id
|
@@ -30,7 +30,7 @@ module SquareConnect
|
|
30
30
|
# The Square ID of the [Location](#type-location) where the related quantity of items are being tracked.
|
31
31
|
attr_accessor :location_id
|
32
32
|
|
33
|
-
# The number of items affected by the physical count as a decimal string.
|
33
|
+
# The number of items affected by the physical count as a decimal string. Can support up to 5 digits after the decimal point. _Important_: The Point of Sale app and Dashboard do not currently support decimal quantities. If a Point of Sale app or Dashboard attempts to read a decimal quantity on inventory counts or adjustments, the quantity will be rounded down to the nearest integer. For example, `2.5` will become `2`, and `-2.5` will become `-3`. Read [Decimal Quantities (BETA)](/more-apis/inventory/overview#decimal-quantities-beta) for more information.
|
34
34
|
attr_accessor :quantity
|
35
35
|
|
36
36
|
# Read-only information about the application that submitted the physical count.
|
@@ -33,7 +33,7 @@ module SquareConnect
|
|
33
33
|
# The [CatalogObjectType](#type-catalogobjecttype) of the [CatalogObject](#type-catalogobject) being tracked.Tracking is only supported for the `ITEM_VARIATION` type.
|
34
34
|
attr_accessor :catalog_object_type
|
35
35
|
|
36
|
-
# The number of items affected by the transfer as a decimal string.
|
36
|
+
# The number of items affected by the transfer as a decimal string. Can support up to 5 digits after the decimal point. _Important_: The Point of Sale app and Dashboard do not currently support decimal quantities. If a Point of Sale app or Dashboard attempts to read a decimal quantity on inventory counts or adjustments, the quantity will be rounded down to the nearest integer. For example, `2.5` will become `2`, and `-2.5` will become `-3`. Read [Decimal Quantities (BETA)](/more-apis/inventory/overview#decimal-quantities-beta) for more information.
|
37
37
|
attr_accessor :quantity
|
38
38
|
|
39
39
|
# A client-generated timestamp in RFC 3339 format that indicates when the transfer took place. For write actions, the `occurred_at` timestamp cannot be older than 24 hours or in the future relative to the time of the request.
|
@@ -57,6 +57,9 @@ module SquareConnect
|
|
57
57
|
# The location's website, as set by the account owner in the Square dashboard. Default: none; only exists if explicitly set.
|
58
58
|
attr_accessor :website_url
|
59
59
|
|
60
|
+
# The hours of operation for a business location. Default: none; only exists if explicitly set.
|
61
|
+
attr_accessor :business_hours
|
62
|
+
|
60
63
|
class EnumAttributeValidator
|
61
64
|
attr_reader :datatype
|
62
65
|
attr_reader :allowable_values
|
@@ -96,7 +99,8 @@ module SquareConnect
|
|
96
99
|
:'phone_number' => :'phone_number',
|
97
100
|
:'business_name' => :'business_name',
|
98
101
|
:'type' => :'type',
|
99
|
-
:'website_url' => :'website_url'
|
102
|
+
:'website_url' => :'website_url',
|
103
|
+
:'business_hours' => :'business_hours'
|
100
104
|
}
|
101
105
|
end
|
102
106
|
|
@@ -117,7 +121,8 @@ module SquareConnect
|
|
117
121
|
:'phone_number' => :'String',
|
118
122
|
:'business_name' => :'String',
|
119
123
|
:'type' => :'String',
|
120
|
-
:'website_url' => :'String'
|
124
|
+
:'website_url' => :'String',
|
125
|
+
:'business_hours' => :'BusinessHours'
|
121
126
|
}
|
122
127
|
end
|
123
128
|
|
@@ -191,6 +196,10 @@ module SquareConnect
|
|
191
196
|
self.website_url = attributes[:'website_url']
|
192
197
|
end
|
193
198
|
|
199
|
+
if attributes.has_key?(:'business_hours')
|
200
|
+
self.business_hours = attributes[:'business_hours']
|
201
|
+
end
|
202
|
+
|
194
203
|
end
|
195
204
|
|
196
205
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -273,7 +282,8 @@ module SquareConnect
|
|
273
282
|
phone_number == o.phone_number &&
|
274
283
|
business_name == o.business_name &&
|
275
284
|
type == o.type &&
|
276
|
-
website_url == o.website_url
|
285
|
+
website_url == o.website_url &&
|
286
|
+
business_hours == o.business_hours
|
277
287
|
end
|
278
288
|
|
279
289
|
# @see the `==` method
|
@@ -285,7 +295,7 @@ module SquareConnect
|
|
285
295
|
# Calculates hash code according to all attributes.
|
286
296
|
# @return [Fixnum] Hash code
|
287
297
|
def hash
|
288
|
-
[id, name, address, timezone, capabilities, status, created_at, merchant_id, country, language_code, currency, phone_number, business_name, type, website_url].hash
|
298
|
+
[id, name, address, timezone, capabilities, status, created_at, merchant_id, country, language_code, currency, phone_number, business_name, type, website_url, business_hours].hash
|
289
299
|
end
|
290
300
|
|
291
301
|
# Builds the object from hash
|
@@ -0,0 +1,295 @@
|
|
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 unit of measurement to use with a quantity, such as ounces or inches. Exactly one of the following fields are required: `custom_unit`, `area_unit`, `length_unit`, `volume_unit`, and `weight_unit`. The `family` field describes the type of measurement. For example, ounces are in the weight family.
|
14
|
+
class MeasurementUnit
|
15
|
+
# A custom unit of measurement defined by the seller using the Point of Sale app or ad-hoc as an order line item.
|
16
|
+
attr_accessor :custom_unit
|
17
|
+
|
18
|
+
# Represents a standard area unit. See [MeasurementUnitArea](#type-measurementunitarea) for possible values
|
19
|
+
attr_accessor :area_unit
|
20
|
+
|
21
|
+
# Represents a standard length unit. See [MeasurementUnitLength](#type-measurementunitlength) for possible values
|
22
|
+
attr_accessor :length_unit
|
23
|
+
|
24
|
+
# Represents a standard volume unit. See [MeasurementUnitVolume](#type-measurementunitvolume) for possible values
|
25
|
+
attr_accessor :volume_unit
|
26
|
+
|
27
|
+
# Represents a standard unit of weight or mass. See [MeasurementUnitWeight](#type-measurementunitweight) for possible values
|
28
|
+
attr_accessor :weight_unit
|
29
|
+
|
30
|
+
class EnumAttributeValidator
|
31
|
+
attr_reader :datatype
|
32
|
+
attr_reader :allowable_values
|
33
|
+
|
34
|
+
def initialize(datatype, allowable_values)
|
35
|
+
@allowable_values = allowable_values.map do |value|
|
36
|
+
case datatype.to_s
|
37
|
+
when /Integer/i
|
38
|
+
value.to_i
|
39
|
+
when /Float/i
|
40
|
+
value.to_f
|
41
|
+
else
|
42
|
+
value
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def valid?(value)
|
48
|
+
!value || allowable_values.include?(value)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
53
|
+
def self.attribute_map
|
54
|
+
{
|
55
|
+
:'custom_unit' => :'custom_unit',
|
56
|
+
:'area_unit' => :'area_unit',
|
57
|
+
:'length_unit' => :'length_unit',
|
58
|
+
:'volume_unit' => :'volume_unit',
|
59
|
+
:'weight_unit' => :'weight_unit'
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
63
|
+
# Attribute type mapping.
|
64
|
+
def self.swagger_types
|
65
|
+
{
|
66
|
+
:'custom_unit' => :'MeasurementUnitCustom',
|
67
|
+
:'area_unit' => :'String',
|
68
|
+
:'length_unit' => :'String',
|
69
|
+
:'volume_unit' => :'String',
|
70
|
+
:'weight_unit' => :'String'
|
71
|
+
}
|
72
|
+
end
|
73
|
+
|
74
|
+
# Initializes the object
|
75
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
76
|
+
def initialize(attributes = {})
|
77
|
+
return unless attributes.is_a?(Hash)
|
78
|
+
|
79
|
+
# convert string to symbol for hash key
|
80
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
81
|
+
|
82
|
+
if attributes.has_key?(:'custom_unit')
|
83
|
+
self.custom_unit = attributes[:'custom_unit']
|
84
|
+
end
|
85
|
+
|
86
|
+
if attributes.has_key?(:'area_unit')
|
87
|
+
self.area_unit = attributes[:'area_unit']
|
88
|
+
end
|
89
|
+
|
90
|
+
if attributes.has_key?(:'length_unit')
|
91
|
+
self.length_unit = attributes[:'length_unit']
|
92
|
+
end
|
93
|
+
|
94
|
+
if attributes.has_key?(:'volume_unit')
|
95
|
+
self.volume_unit = attributes[:'volume_unit']
|
96
|
+
end
|
97
|
+
|
98
|
+
if attributes.has_key?(:'weight_unit')
|
99
|
+
self.weight_unit = attributes[:'weight_unit']
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
103
|
+
|
104
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
105
|
+
# @return Array for valid properies with the reasons
|
106
|
+
def list_invalid_properties
|
107
|
+
invalid_properties = Array.new
|
108
|
+
return invalid_properties
|
109
|
+
end
|
110
|
+
|
111
|
+
# Check to see if the all the properties in the model are valid
|
112
|
+
# @return true if the model is valid
|
113
|
+
def valid?
|
114
|
+
area_unit_validator = EnumAttributeValidator.new('String', ["IMPERIAL_ACRE", "IMPERIAL_SQUARE_INCH", "IMPERIAL_SQUARE_FOOT", "IMPERIAL_SQUARE_YARD", "IMPERIAL_SQUARE_MILE", "METRIC_SQUARE_CENTIMETER", "METRIC_SQUARE_METER", "METRIC_SQUARE_KILOMETER"])
|
115
|
+
return false unless area_unit_validator.valid?(@area_unit)
|
116
|
+
length_unit_validator = EnumAttributeValidator.new('String', ["IMPERIAL_INCH", "IMPERIAL_FOOT", "IMPERIAL_YARD", "IMPERIAL_MILE", "METRIC_MILLIMETER", "METRIC_CENTIMETER", "METRIC_METER", "METRIC_KILOMETER"])
|
117
|
+
return false unless length_unit_validator.valid?(@length_unit)
|
118
|
+
volume_unit_validator = EnumAttributeValidator.new('String', ["GENERIC_FLUID_OUNCE", "GENERIC_SHOT", "GENERIC_CUP", "GENERIC_PINT", "GENERIC_QUART", "GENERIC_GALLON", "IMPERIAL_CUBIC_INCH", "IMPERIAL_CUBIC_FOOT", "IMPERIAL_CUBIC_YARD", "METRIC_MILLILITER", "METRIC_LITER"])
|
119
|
+
return false unless volume_unit_validator.valid?(@volume_unit)
|
120
|
+
weight_unit_validator = EnumAttributeValidator.new('String', ["IMPERIAL_WEIGHT_OUNCE", "IMPERIAL_POUND", "IMPERIAL_STONE", "METRIC_MILLIGRAM", "METRIC_GRAM", "METRIC_KILOGRAM"])
|
121
|
+
return false unless weight_unit_validator.valid?(@weight_unit)
|
122
|
+
return true
|
123
|
+
end
|
124
|
+
|
125
|
+
# Custom attribute writer method checking allowed values (enum).
|
126
|
+
# @param [Object] area_unit Object to be assigned
|
127
|
+
def area_unit=(area_unit)
|
128
|
+
validator = EnumAttributeValidator.new('String', ["IMPERIAL_ACRE", "IMPERIAL_SQUARE_INCH", "IMPERIAL_SQUARE_FOOT", "IMPERIAL_SQUARE_YARD", "IMPERIAL_SQUARE_MILE", "METRIC_SQUARE_CENTIMETER", "METRIC_SQUARE_METER", "METRIC_SQUARE_KILOMETER"])
|
129
|
+
unless validator.valid?(area_unit)
|
130
|
+
fail ArgumentError, "invalid value for 'area_unit', must be one of #{validator.allowable_values}."
|
131
|
+
end
|
132
|
+
@area_unit = area_unit
|
133
|
+
end
|
134
|
+
|
135
|
+
# Custom attribute writer method checking allowed values (enum).
|
136
|
+
# @param [Object] length_unit Object to be assigned
|
137
|
+
def length_unit=(length_unit)
|
138
|
+
validator = EnumAttributeValidator.new('String', ["IMPERIAL_INCH", "IMPERIAL_FOOT", "IMPERIAL_YARD", "IMPERIAL_MILE", "METRIC_MILLIMETER", "METRIC_CENTIMETER", "METRIC_METER", "METRIC_KILOMETER"])
|
139
|
+
unless validator.valid?(length_unit)
|
140
|
+
fail ArgumentError, "invalid value for 'length_unit', must be one of #{validator.allowable_values}."
|
141
|
+
end
|
142
|
+
@length_unit = length_unit
|
143
|
+
end
|
144
|
+
|
145
|
+
# Custom attribute writer method checking allowed values (enum).
|
146
|
+
# @param [Object] volume_unit Object to be assigned
|
147
|
+
def volume_unit=(volume_unit)
|
148
|
+
validator = EnumAttributeValidator.new('String', ["GENERIC_FLUID_OUNCE", "GENERIC_SHOT", "GENERIC_CUP", "GENERIC_PINT", "GENERIC_QUART", "GENERIC_GALLON", "IMPERIAL_CUBIC_INCH", "IMPERIAL_CUBIC_FOOT", "IMPERIAL_CUBIC_YARD", "METRIC_MILLILITER", "METRIC_LITER"])
|
149
|
+
unless validator.valid?(volume_unit)
|
150
|
+
fail ArgumentError, "invalid value for 'volume_unit', must be one of #{validator.allowable_values}."
|
151
|
+
end
|
152
|
+
@volume_unit = volume_unit
|
153
|
+
end
|
154
|
+
|
155
|
+
# Custom attribute writer method checking allowed values (enum).
|
156
|
+
# @param [Object] weight_unit Object to be assigned
|
157
|
+
def weight_unit=(weight_unit)
|
158
|
+
validator = EnumAttributeValidator.new('String', ["IMPERIAL_WEIGHT_OUNCE", "IMPERIAL_POUND", "IMPERIAL_STONE", "METRIC_MILLIGRAM", "METRIC_GRAM", "METRIC_KILOGRAM"])
|
159
|
+
unless validator.valid?(weight_unit)
|
160
|
+
fail ArgumentError, "invalid value for 'weight_unit', must be one of #{validator.allowable_values}."
|
161
|
+
end
|
162
|
+
@weight_unit = weight_unit
|
163
|
+
end
|
164
|
+
|
165
|
+
# Checks equality by comparing each attribute.
|
166
|
+
# @param [Object] Object to be compared
|
167
|
+
def ==(o)
|
168
|
+
return true if self.equal?(o)
|
169
|
+
self.class == o.class &&
|
170
|
+
custom_unit == o.custom_unit &&
|
171
|
+
area_unit == o.area_unit &&
|
172
|
+
length_unit == o.length_unit &&
|
173
|
+
volume_unit == o.volume_unit &&
|
174
|
+
weight_unit == o.weight_unit
|
175
|
+
end
|
176
|
+
|
177
|
+
# @see the `==` method
|
178
|
+
# @param [Object] Object to be compared
|
179
|
+
def eql?(o)
|
180
|
+
self == o
|
181
|
+
end
|
182
|
+
|
183
|
+
# Calculates hash code according to all attributes.
|
184
|
+
# @return [Fixnum] Hash code
|
185
|
+
def hash
|
186
|
+
[custom_unit, area_unit, length_unit, volume_unit, weight_unit].hash
|
187
|
+
end
|
188
|
+
|
189
|
+
# Builds the object from hash
|
190
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
191
|
+
# @return [Object] Returns the model itself
|
192
|
+
def build_from_hash(attributes)
|
193
|
+
return nil unless attributes.is_a?(Hash)
|
194
|
+
self.class.swagger_types.each_pair do |key, type|
|
195
|
+
if type =~ /\AArray<(.*)>/i
|
196
|
+
# check to ensure the input is an array given that the the attribute
|
197
|
+
# is documented as an array but the input is not
|
198
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
199
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
200
|
+
end
|
201
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
202
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
203
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
204
|
+
end
|
205
|
+
|
206
|
+
self
|
207
|
+
end
|
208
|
+
|
209
|
+
# Deserializes the data based on type
|
210
|
+
# @param string type Data type
|
211
|
+
# @param string value Value to be deserialized
|
212
|
+
# @return [Object] Deserialized data
|
213
|
+
def _deserialize(type, value)
|
214
|
+
case type.to_sym
|
215
|
+
when :DateTime
|
216
|
+
DateTime.parse(value)
|
217
|
+
when :Date
|
218
|
+
Date.parse(value)
|
219
|
+
when :String
|
220
|
+
value.to_s
|
221
|
+
when :Integer
|
222
|
+
value.to_i
|
223
|
+
when :Float
|
224
|
+
value.to_f
|
225
|
+
when :BOOLEAN
|
226
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
227
|
+
true
|
228
|
+
else
|
229
|
+
false
|
230
|
+
end
|
231
|
+
when :Object
|
232
|
+
# generic object (usually a Hash), return directly
|
233
|
+
value
|
234
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
235
|
+
inner_type = Regexp.last_match[:inner_type]
|
236
|
+
value.map { |v| _deserialize(inner_type, v) }
|
237
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
238
|
+
k_type = Regexp.last_match[:k_type]
|
239
|
+
v_type = Regexp.last_match[:v_type]
|
240
|
+
{}.tap do |hash|
|
241
|
+
value.each do |k, v|
|
242
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
243
|
+
end
|
244
|
+
end
|
245
|
+
else # model
|
246
|
+
temp_model = SquareConnect.const_get(type).new
|
247
|
+
temp_model.build_from_hash(value)
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
# Returns the string representation of the object
|
252
|
+
# @return [String] String presentation of the object
|
253
|
+
def to_s
|
254
|
+
to_hash.to_s
|
255
|
+
end
|
256
|
+
|
257
|
+
# to_body is an alias to to_hash (backward compatibility)
|
258
|
+
# @return [Hash] Returns the object in the form of hash
|
259
|
+
def to_body
|
260
|
+
to_hash
|
261
|
+
end
|
262
|
+
|
263
|
+
# Returns the object in the form of hash
|
264
|
+
# @return [Hash] Returns the object in the form of hash
|
265
|
+
def to_hash
|
266
|
+
hash = {}
|
267
|
+
self.class.attribute_map.each_pair do |attr, param|
|
268
|
+
value = self.send(attr)
|
269
|
+
next if value.nil?
|
270
|
+
hash[param] = _to_hash(value)
|
271
|
+
end
|
272
|
+
hash
|
273
|
+
end
|
274
|
+
|
275
|
+
# Outputs non-array value in the form of hash
|
276
|
+
# For object, use to_hash. Otherwise, just return the value
|
277
|
+
# @param [Object] value Any valid value
|
278
|
+
# @return [Hash] Returns the value in the form of hash
|
279
|
+
def _to_hash(value)
|
280
|
+
if value.is_a?(Array)
|
281
|
+
value.compact.map{ |v| _to_hash(v) }
|
282
|
+
elsif value.is_a?(Hash)
|
283
|
+
{}.tap do |hash|
|
284
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
285
|
+
end
|
286
|
+
elsif value.respond_to? :to_hash
|
287
|
+
value.to_hash
|
288
|
+
else
|
289
|
+
value
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
end
|
294
|
+
|
295
|
+
end
|