square_connect 2.1.0.beta → 2.1.0.78
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +71 -8
- data/docs/BatchDeleteCatalogObjectsRequest.md +12 -0
- data/docs/BatchDeleteCatalogObjectsResponse.md +14 -0
- data/docs/BatchRetrieveCatalogObjectsRequest.md +13 -0
- data/docs/BatchRetrieveCatalogObjectsResponse.md +14 -0
- data/docs/BatchUpsertCatalogObjectsRequest.md +13 -0
- data/docs/BatchUpsertCatalogObjectsResponse.md +15 -0
- data/docs/CatalogApi.md +592 -0
- data/docs/CatalogCategory.md +12 -0
- data/docs/CatalogDiscount.md +17 -0
- data/docs/CatalogDiscountType.md +15 -0
- data/docs/CatalogIdMapping.md +13 -0
- data/docs/CatalogInfoRequest.md +11 -0
- data/docs/CatalogInfoResponse.md +13 -0
- data/docs/CatalogInfoResponseLimits.md +22 -0
- data/docs/CatalogItem.md +25 -0
- data/docs/CatalogItemModifierListInfo.md +16 -0
- data/docs/CatalogItemProductType.md +16 -0
- data/docs/CatalogItemVariation.md +23 -0
- data/docs/CatalogModifier.md +13 -0
- data/docs/CatalogModifierList.md +14 -0
- data/docs/CatalogModifierListSelectionType.md +13 -0
- data/docs/CatalogModifierOverride.md +13 -0
- data/docs/CatalogObject.md +27 -0
- data/docs/CatalogObjectBatch.md +12 -0
- data/docs/CatalogObjectType.md +18 -0
- data/docs/CatalogPricingType.md +13 -0
- data/docs/CatalogQuery.md +18 -0
- data/docs/CatalogQueryExact.md +13 -0
- data/docs/CatalogQueryItemsForModifierList.md +12 -0
- data/docs/CatalogQueryItemsForTax.md +12 -0
- data/docs/CatalogQueryPrefix.md +13 -0
- data/docs/CatalogQueryRange.md +14 -0
- data/docs/CatalogQuerySortedAttribute.md +14 -0
- data/docs/CatalogQueryText.md +12 -0
- data/docs/CatalogTax.md +17 -0
- data/docs/CatalogV1Id.md +13 -0
- data/docs/Checkout.md +4 -4
- data/docs/CreateCheckoutRequest.md +5 -5
- data/docs/DeleteCatalogObjectRequest.md +11 -0
- data/docs/DeleteCatalogObjectResponse.md +14 -0
- data/docs/ErrorCode.md +2 -0
- data/docs/InventoryAlertType.md +13 -0
- data/docs/ItemVariationLocationOverrides.md +17 -0
- data/docs/ListCatalogRequest.md +13 -0
- data/docs/ListCatalogResponse.md +14 -0
- data/docs/RetrieveCatalogObjectRequest.md +12 -0
- data/docs/RetrieveCatalogObjectResponse.md +14 -0
- data/docs/SearchCatalogObjectsRequest.md +18 -0
- data/docs/SearchCatalogObjectsResponse.md +15 -0
- data/docs/TaxCalculationPhase.md +13 -0
- data/docs/TaxInclusionType.md +13 -0
- data/docs/UpdateItemModifierListsRequest.md +14 -0
- data/docs/UpdateItemModifierListsResponse.md +13 -0
- data/docs/UpdateItemTaxesRequest.md +14 -0
- data/docs/UpdateItemTaxesResponse.md +13 -0
- data/docs/UpsertCatalogObjectRequest.md +13 -0
- data/docs/UpsertCatalogObjectResponse.md +14 -0
- data/docs/V1Item.md +1 -1
- data/docs/V1Variation.md +0 -1
- data/lib/square_connect.rb +54 -1
- data/lib/square_connect/api/catalog_api.rb +604 -0
- data/lib/square_connect/models/batch_delete_catalog_objects_request.rb +188 -0
- data/lib/square_connect/models/batch_delete_catalog_objects_response.rb +210 -0
- data/lib/square_connect/models/batch_retrieve_catalog_objects_request.rb +203 -0
- data/lib/square_connect/models/batch_retrieve_catalog_objects_response.rb +212 -0
- data/lib/square_connect/models/batch_upsert_catalog_objects_request.rb +222 -0
- data/lib/square_connect/models/batch_upsert_catalog_objects_response.rb +222 -0
- data/lib/square_connect/models/catalog_category.rb +210 -0
- data/lib/square_connect/models/catalog_discount.rb +293 -0
- data/lib/square_connect/models/catalog_discount_type.rb +21 -0
- data/lib/square_connect/models/catalog_id_mapping.rb +196 -0
- data/lib/square_connect/models/catalog_info_request.rb +176 -0
- data/lib/square_connect/models/catalog_info_response.rb +198 -0
- data/lib/square_connect/models/catalog_info_response_limits.rb +286 -0
- data/lib/square_connect/models/catalog_item.rb +379 -0
- data/lib/square_connect/models/catalog_item_modifier_list_info.rb +252 -0
- data/lib/square_connect/models/catalog_item_product_type.rb +22 -0
- data/lib/square_connect/models/catalog_item_variation.rb +343 -0
- data/lib/square_connect/models/catalog_modifier.rb +220 -0
- data/lib/square_connect/models/catalog_modifier_list.rb +265 -0
- data/lib/square_connect/models/catalog_modifier_list_selection_type.rb +19 -0
- data/lib/square_connect/models/catalog_modifier_override.rb +220 -0
- data/lib/square_connect/models/catalog_object.rb +404 -0
- data/lib/square_connect/models/catalog_object_batch.rb +188 -0
- data/lib/square_connect/models/catalog_object_type.rb +24 -0
- data/lib/square_connect/models/catalog_pricing_type.rb +19 -0
- data/lib/square_connect/models/catalog_query.rb +246 -0
- data/lib/square_connect/models/catalog_query_exact.rb +225 -0
- data/lib/square_connect/models/catalog_query_items_for_modifier_list.rb +193 -0
- data/lib/square_connect/models/catalog_query_items_for_tax.rb +193 -0
- data/lib/square_connect/models/catalog_query_prefix.rb +244 -0
- data/lib/square_connect/models/catalog_query_range.rb +230 -0
- data/lib/square_connect/models/catalog_query_sorted_attribute.rb +263 -0
- data/lib/square_connect/models/catalog_query_text.rb +193 -0
- data/lib/square_connect/models/catalog_tax.rb +305 -0
- data/lib/square_connect/models/catalog_v1_id.rb +196 -0
- data/lib/square_connect/models/checkout.rb +4 -4
- data/lib/square_connect/models/create_checkout_request.rb +5 -5
- data/lib/square_connect/models/delete_catalog_object_request.rb +176 -0
- data/lib/square_connect/models/delete_catalog_object_response.rb +210 -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_alert_type.rb +19 -0
- data/lib/square_connect/models/item_variation_location_overrides.rb +281 -0
- data/lib/square_connect/models/list_catalog_request.rb +196 -0
- data/lib/square_connect/models/list_catalog_response.rb +210 -0
- data/lib/square_connect/models/retrieve_catalog_object_request.rb +186 -0
- data/lib/square_connect/models/retrieve_catalog_object_response.rb +210 -0
- data/lib/square_connect/models/search_catalog_objects_request.rb +269 -0
- data/lib/square_connect/models/search_catalog_objects_response.rb +222 -0
- data/lib/square_connect/models/tax_calculation_phase.rb +19 -0
- data/lib/square_connect/models/tax_inclusion_type.rb +19 -0
- data/lib/square_connect/models/update_item_modifier_lists_request.rb +217 -0
- data/lib/square_connect/models/update_item_modifier_lists_response.rb +198 -0
- data/lib/square_connect/models/update_item_taxes_request.rb +217 -0
- data/lib/square_connect/models/update_item_taxes_response.rb +198 -0
- data/lib/square_connect/models/{create_order_request.rb → upsert_catalog_object_request.rb} +14 -23
- data/lib/square_connect/models/upsert_catalog_object_response.rb +210 -0
- data/lib/square_connect/models/v1_item.rb +1 -1
- data/lib/square_connect/models/v1_variation.rb +1 -11
- data/lib/square_connect/version.rb +1 -1
- data/spec/api/catalog_api_spec.rb +611 -0
- data/spec/models/batch_delete_catalog_objects_request_spec.rb +39 -0
- data/spec/models/batch_delete_catalog_objects_response_spec.rb +51 -0
- data/spec/models/batch_retrieve_catalog_objects_request_spec.rb +45 -0
- data/spec/models/batch_retrieve_catalog_objects_response_spec.rb +51 -0
- data/spec/models/batch_upsert_catalog_objects_request_spec.rb +45 -0
- data/spec/models/batch_upsert_catalog_objects_response_spec.rb +57 -0
- data/spec/models/catalog_category_spec.rb +39 -0
- data/spec/models/catalog_discount_spec.rb +73 -0
- data/spec/models/catalog_discount_type_spec.rb +33 -0
- data/spec/models/catalog_id_mapping_spec.rb +45 -0
- data/spec/models/catalog_info_request_spec.rb +33 -0
- data/spec/models/catalog_info_response_limits_spec.rb +99 -0
- data/spec/models/catalog_info_response_spec.rb +45 -0
- data/spec/models/catalog_item_modifier_list_info_spec.rb +63 -0
- data/spec/models/catalog_item_product_type_spec.rb +33 -0
- data/spec/models/catalog_item_spec.rb +121 -0
- data/spec/models/catalog_item_variation_spec.rb +113 -0
- data/spec/models/catalog_modifier_list_selection_type_spec.rb +33 -0
- data/spec/models/catalog_modifier_list_spec.rb +55 -0
- data/spec/models/catalog_modifier_override_spec.rb +45 -0
- data/spec/models/catalog_modifier_spec.rb +45 -0
- data/spec/models/catalog_object_batch_spec.rb +39 -0
- data/spec/models/catalog_object_spec.rb +133 -0
- data/spec/models/catalog_object_type_spec.rb +33 -0
- data/spec/models/catalog_pricing_type_spec.rb +33 -0
- data/spec/models/catalog_query_exact_spec.rb +45 -0
- data/spec/models/catalog_query_items_for_modifier_list_spec.rb +39 -0
- data/spec/models/catalog_query_items_for_tax_spec.rb +39 -0
- data/spec/models/catalog_query_prefix_spec.rb +45 -0
- data/spec/models/catalog_query_range_spec.rb +51 -0
- data/spec/models/catalog_query_sorted_attribute_spec.rb +55 -0
- data/spec/models/catalog_query_spec.rb +75 -0
- data/spec/models/catalog_query_text_spec.rb +39 -0
- data/spec/models/catalog_tax_spec.rb +77 -0
- data/spec/models/catalog_v1_id_spec.rb +45 -0
- data/spec/models/delete_catalog_object_request_spec.rb +39 -0
- data/spec/models/delete_catalog_object_response_spec.rb +51 -0
- data/spec/models/inventory_alert_type_spec.rb +33 -0
- data/spec/models/item_variation_location_overrides_spec.rb +77 -0
- data/spec/models/list_catalog_request_spec.rb +45 -0
- data/spec/models/list_catalog_response_spec.rb +51 -0
- data/spec/models/retrieve_catalog_object_request_spec.rb +45 -0
- data/spec/models/retrieve_catalog_object_response_spec.rb +51 -0
- data/spec/models/search_catalog_objects_request_spec.rb +79 -0
- data/spec/models/search_catalog_objects_response_spec.rb +57 -0
- data/spec/models/tax_calculation_phase_spec.rb +33 -0
- data/spec/models/tax_inclusion_type_spec.rb +33 -0
- data/spec/models/update_item_modifier_lists_request_spec.rb +51 -0
- data/spec/models/update_item_modifier_lists_response_spec.rb +45 -0
- data/spec/models/update_item_taxes_request_spec.rb +51 -0
- data/spec/models/update_item_taxes_response_spec.rb +45 -0
- data/spec/models/{create_order_request_spec.rb → upsert_catalog_object_request_spec.rb} +7 -7
- data/spec/models/upsert_catalog_object_response_spec.rb +51 -0
- data/square_connect.gemspec +1 -1
- data/travis-ci/accounts.enc +0 -0
- metadata +222 -17
- data/docs/CreateOrderRequest.md +0 -13
- data/docs/V1LocationApi.md +0 -102
- data/lib/.DS_Store +0 -0
- data/lib/square_connect/.DS_Store +0 -0
- data/spec/.DS_Store +0 -0
- data/square_connect-2.0.2.gem +0 -0
- data/square_connect-2.1.0.gem +0 -0
- data/square_connect-2.1.0beta.gem +0 -0
@@ -0,0 +1,286 @@
|
|
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
|
+
#
|
14
|
+
class CatalogInfoResponseLimits
|
15
|
+
# The maximum number of objects that may appear within a single batch in a `/v2/catalog/batch-upsert` request.
|
16
|
+
attr_accessor :batch_upsert_max_objects_per_batch
|
17
|
+
|
18
|
+
# The maximum number of objects that may appear across all batches in a `/v2/catalog/batch-upsert` request.
|
19
|
+
attr_accessor :batch_upsert_max_total_objects
|
20
|
+
|
21
|
+
# The maximum number of object IDs that may appear in a `/v2/catalog/batch-retrieve` request.
|
22
|
+
attr_accessor :batch_retrieve_max_object_ids
|
23
|
+
|
24
|
+
# The maximum number of results that may be returned in a page of a `/v2/catalog/search` response.
|
25
|
+
attr_accessor :search_max_page_limit
|
26
|
+
|
27
|
+
# The maximum number of object IDs that may be included in a single `/v2/catalog/batch-delete` request.
|
28
|
+
attr_accessor :batch_delete_max_object_ids
|
29
|
+
|
30
|
+
# The maximum number of item IDs that may be included in a single `/v2/catalog/update-item-taxes` request.
|
31
|
+
attr_accessor :update_item_taxes_max_item_ids
|
32
|
+
|
33
|
+
# The maximum number of tax IDs to be enabled that may be included in a single `/v2/catalog/update-item-taxes` request.
|
34
|
+
attr_accessor :update_item_taxes_max_taxes_to_enable
|
35
|
+
|
36
|
+
# The maximum number of tax IDs to be disabled that may be included in a single `/v2/catalog/update-item-taxes` request.
|
37
|
+
attr_accessor :update_item_taxes_max_taxes_to_disable
|
38
|
+
|
39
|
+
# The maximum number of item IDs that may be included in a single `/v2/catalog/update-item-modifier-lists` request.
|
40
|
+
attr_accessor :update_item_modifier_lists_max_item_ids
|
41
|
+
|
42
|
+
# The maximum number of modifier list IDs to be enabled that may be included in a single `/v2/catalog/update-item-modifier-lists` request.
|
43
|
+
attr_accessor :update_item_modifier_lists_max_modifier_lists_to_enable
|
44
|
+
|
45
|
+
# The maximum number of modifier list IDs to be disabled that may be included in a single `/v2/catalog/update-item-modifier-lists` request.
|
46
|
+
attr_accessor :update_item_modifier_lists_max_modifier_lists_to_disable
|
47
|
+
|
48
|
+
|
49
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
50
|
+
def self.attribute_map
|
51
|
+
{
|
52
|
+
:'batch_upsert_max_objects_per_batch' => :'batch_upsert_max_objects_per_batch',
|
53
|
+
:'batch_upsert_max_total_objects' => :'batch_upsert_max_total_objects',
|
54
|
+
:'batch_retrieve_max_object_ids' => :'batch_retrieve_max_object_ids',
|
55
|
+
:'search_max_page_limit' => :'search_max_page_limit',
|
56
|
+
:'batch_delete_max_object_ids' => :'batch_delete_max_object_ids',
|
57
|
+
:'update_item_taxes_max_item_ids' => :'update_item_taxes_max_item_ids',
|
58
|
+
:'update_item_taxes_max_taxes_to_enable' => :'update_item_taxes_max_taxes_to_enable',
|
59
|
+
:'update_item_taxes_max_taxes_to_disable' => :'update_item_taxes_max_taxes_to_disable',
|
60
|
+
:'update_item_modifier_lists_max_item_ids' => :'update_item_modifier_lists_max_item_ids',
|
61
|
+
:'update_item_modifier_lists_max_modifier_lists_to_enable' => :'update_item_modifier_lists_max_modifier_lists_to_enable',
|
62
|
+
:'update_item_modifier_lists_max_modifier_lists_to_disable' => :'update_item_modifier_lists_max_modifier_lists_to_disable'
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
# Attribute type mapping.
|
67
|
+
def self.swagger_types
|
68
|
+
{
|
69
|
+
:'batch_upsert_max_objects_per_batch' => :'Integer',
|
70
|
+
:'batch_upsert_max_total_objects' => :'Integer',
|
71
|
+
:'batch_retrieve_max_object_ids' => :'Integer',
|
72
|
+
:'search_max_page_limit' => :'Integer',
|
73
|
+
:'batch_delete_max_object_ids' => :'Integer',
|
74
|
+
:'update_item_taxes_max_item_ids' => :'Integer',
|
75
|
+
:'update_item_taxes_max_taxes_to_enable' => :'Integer',
|
76
|
+
:'update_item_taxes_max_taxes_to_disable' => :'Integer',
|
77
|
+
:'update_item_modifier_lists_max_item_ids' => :'Integer',
|
78
|
+
:'update_item_modifier_lists_max_modifier_lists_to_enable' => :'Integer',
|
79
|
+
:'update_item_modifier_lists_max_modifier_lists_to_disable' => :'Integer'
|
80
|
+
}
|
81
|
+
end
|
82
|
+
|
83
|
+
# Initializes the object
|
84
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
85
|
+
def initialize(attributes = {})
|
86
|
+
return unless attributes.is_a?(Hash)
|
87
|
+
|
88
|
+
# convert string to symbol for hash key
|
89
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
90
|
+
|
91
|
+
if attributes.has_key?(:'batch_upsert_max_objects_per_batch')
|
92
|
+
self.batch_upsert_max_objects_per_batch = attributes[:'batch_upsert_max_objects_per_batch']
|
93
|
+
end
|
94
|
+
|
95
|
+
if attributes.has_key?(:'batch_upsert_max_total_objects')
|
96
|
+
self.batch_upsert_max_total_objects = attributes[:'batch_upsert_max_total_objects']
|
97
|
+
end
|
98
|
+
|
99
|
+
if attributes.has_key?(:'batch_retrieve_max_object_ids')
|
100
|
+
self.batch_retrieve_max_object_ids = attributes[:'batch_retrieve_max_object_ids']
|
101
|
+
end
|
102
|
+
|
103
|
+
if attributes.has_key?(:'search_max_page_limit')
|
104
|
+
self.search_max_page_limit = attributes[:'search_max_page_limit']
|
105
|
+
end
|
106
|
+
|
107
|
+
if attributes.has_key?(:'batch_delete_max_object_ids')
|
108
|
+
self.batch_delete_max_object_ids = attributes[:'batch_delete_max_object_ids']
|
109
|
+
end
|
110
|
+
|
111
|
+
if attributes.has_key?(:'update_item_taxes_max_item_ids')
|
112
|
+
self.update_item_taxes_max_item_ids = attributes[:'update_item_taxes_max_item_ids']
|
113
|
+
end
|
114
|
+
|
115
|
+
if attributes.has_key?(:'update_item_taxes_max_taxes_to_enable')
|
116
|
+
self.update_item_taxes_max_taxes_to_enable = attributes[:'update_item_taxes_max_taxes_to_enable']
|
117
|
+
end
|
118
|
+
|
119
|
+
if attributes.has_key?(:'update_item_taxes_max_taxes_to_disable')
|
120
|
+
self.update_item_taxes_max_taxes_to_disable = attributes[:'update_item_taxes_max_taxes_to_disable']
|
121
|
+
end
|
122
|
+
|
123
|
+
if attributes.has_key?(:'update_item_modifier_lists_max_item_ids')
|
124
|
+
self.update_item_modifier_lists_max_item_ids = attributes[:'update_item_modifier_lists_max_item_ids']
|
125
|
+
end
|
126
|
+
|
127
|
+
if attributes.has_key?(:'update_item_modifier_lists_max_modifier_lists_to_enable')
|
128
|
+
self.update_item_modifier_lists_max_modifier_lists_to_enable = attributes[:'update_item_modifier_lists_max_modifier_lists_to_enable']
|
129
|
+
end
|
130
|
+
|
131
|
+
if attributes.has_key?(:'update_item_modifier_lists_max_modifier_lists_to_disable')
|
132
|
+
self.update_item_modifier_lists_max_modifier_lists_to_disable = attributes[:'update_item_modifier_lists_max_modifier_lists_to_disable']
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
136
|
+
|
137
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
138
|
+
# @return Array for valid properies with the reasons
|
139
|
+
def list_invalid_properties
|
140
|
+
invalid_properties = Array.new
|
141
|
+
return invalid_properties
|
142
|
+
end
|
143
|
+
|
144
|
+
# Check to see if the all the properties in the model are valid
|
145
|
+
# @return true if the model is valid
|
146
|
+
def valid?
|
147
|
+
return true
|
148
|
+
end
|
149
|
+
|
150
|
+
# Checks equality by comparing each attribute.
|
151
|
+
# @param [Object] Object to be compared
|
152
|
+
def ==(o)
|
153
|
+
return true if self.equal?(o)
|
154
|
+
self.class == o.class &&
|
155
|
+
batch_upsert_max_objects_per_batch == o.batch_upsert_max_objects_per_batch &&
|
156
|
+
batch_upsert_max_total_objects == o.batch_upsert_max_total_objects &&
|
157
|
+
batch_retrieve_max_object_ids == o.batch_retrieve_max_object_ids &&
|
158
|
+
search_max_page_limit == o.search_max_page_limit &&
|
159
|
+
batch_delete_max_object_ids == o.batch_delete_max_object_ids &&
|
160
|
+
update_item_taxes_max_item_ids == o.update_item_taxes_max_item_ids &&
|
161
|
+
update_item_taxes_max_taxes_to_enable == o.update_item_taxes_max_taxes_to_enable &&
|
162
|
+
update_item_taxes_max_taxes_to_disable == o.update_item_taxes_max_taxes_to_disable &&
|
163
|
+
update_item_modifier_lists_max_item_ids == o.update_item_modifier_lists_max_item_ids &&
|
164
|
+
update_item_modifier_lists_max_modifier_lists_to_enable == o.update_item_modifier_lists_max_modifier_lists_to_enable &&
|
165
|
+
update_item_modifier_lists_max_modifier_lists_to_disable == o.update_item_modifier_lists_max_modifier_lists_to_disable
|
166
|
+
end
|
167
|
+
|
168
|
+
# @see the `==` method
|
169
|
+
# @param [Object] Object to be compared
|
170
|
+
def eql?(o)
|
171
|
+
self == o
|
172
|
+
end
|
173
|
+
|
174
|
+
# Calculates hash code according to all attributes.
|
175
|
+
# @return [Fixnum] Hash code
|
176
|
+
def hash
|
177
|
+
[batch_upsert_max_objects_per_batch, batch_upsert_max_total_objects, batch_retrieve_max_object_ids, search_max_page_limit, batch_delete_max_object_ids, update_item_taxes_max_item_ids, update_item_taxes_max_taxes_to_enable, update_item_taxes_max_taxes_to_disable, update_item_modifier_lists_max_item_ids, update_item_modifier_lists_max_modifier_lists_to_enable, update_item_modifier_lists_max_modifier_lists_to_disable].hash
|
178
|
+
end
|
179
|
+
|
180
|
+
# Builds the object from hash
|
181
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
182
|
+
# @return [Object] Returns the model itself
|
183
|
+
def build_from_hash(attributes)
|
184
|
+
return nil unless attributes.is_a?(Hash)
|
185
|
+
self.class.swagger_types.each_pair do |key, type|
|
186
|
+
if type =~ /\AArray<(.*)>/i
|
187
|
+
# check to ensure the input is an array given that the the attribute
|
188
|
+
# is documented as an array but the input is not
|
189
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
190
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
191
|
+
end
|
192
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
193
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
194
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
195
|
+
end
|
196
|
+
|
197
|
+
self
|
198
|
+
end
|
199
|
+
|
200
|
+
# Deserializes the data based on type
|
201
|
+
# @param string type Data type
|
202
|
+
# @param string value Value to be deserialized
|
203
|
+
# @return [Object] Deserialized data
|
204
|
+
def _deserialize(type, value)
|
205
|
+
case type.to_sym
|
206
|
+
when :DateTime
|
207
|
+
DateTime.parse(value)
|
208
|
+
when :Date
|
209
|
+
Date.parse(value)
|
210
|
+
when :String
|
211
|
+
value.to_s
|
212
|
+
when :Integer
|
213
|
+
value.to_i
|
214
|
+
when :Float
|
215
|
+
value.to_f
|
216
|
+
when :BOOLEAN
|
217
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
218
|
+
true
|
219
|
+
else
|
220
|
+
false
|
221
|
+
end
|
222
|
+
when :Object
|
223
|
+
# generic object (usually a Hash), return directly
|
224
|
+
value
|
225
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
226
|
+
inner_type = Regexp.last_match[:inner_type]
|
227
|
+
value.map { |v| _deserialize(inner_type, v) }
|
228
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
229
|
+
k_type = Regexp.last_match[:k_type]
|
230
|
+
v_type = Regexp.last_match[:v_type]
|
231
|
+
{}.tap do |hash|
|
232
|
+
value.each do |k, v|
|
233
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
234
|
+
end
|
235
|
+
end
|
236
|
+
else # model
|
237
|
+
temp_model = SquareConnect.const_get(type).new
|
238
|
+
temp_model.build_from_hash(value)
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
# Returns the string representation of the object
|
243
|
+
# @return [String] String presentation of the object
|
244
|
+
def to_s
|
245
|
+
to_hash.to_s
|
246
|
+
end
|
247
|
+
|
248
|
+
# to_body is an alias to to_hash (backward compatibility)
|
249
|
+
# @return [Hash] Returns the object in the form of hash
|
250
|
+
def to_body
|
251
|
+
to_hash
|
252
|
+
end
|
253
|
+
|
254
|
+
# Returns the object in the form of hash
|
255
|
+
# @return [Hash] Returns the object in the form of hash
|
256
|
+
def to_hash
|
257
|
+
hash = {}
|
258
|
+
self.class.attribute_map.each_pair do |attr, param|
|
259
|
+
value = self.send(attr)
|
260
|
+
next if value.nil?
|
261
|
+
hash[param] = _to_hash(value)
|
262
|
+
end
|
263
|
+
hash
|
264
|
+
end
|
265
|
+
|
266
|
+
# Outputs non-array value in the form of hash
|
267
|
+
# For object, use to_hash. Otherwise, just return the value
|
268
|
+
# @param [Object] value Any valid value
|
269
|
+
# @return [Hash] Returns the value in the form of hash
|
270
|
+
def _to_hash(value)
|
271
|
+
if value.is_a?(Array)
|
272
|
+
value.compact.map{ |v| _to_hash(v) }
|
273
|
+
elsif value.is_a?(Hash)
|
274
|
+
{}.tap do |hash|
|
275
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
276
|
+
end
|
277
|
+
elsif value.respond_to? :to_hash
|
278
|
+
value.to_hash
|
279
|
+
else
|
280
|
+
value
|
281
|
+
end
|
282
|
+
end
|
283
|
+
|
284
|
+
end
|
285
|
+
|
286
|
+
end
|
@@ -0,0 +1,379 @@
|
|
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
|
+
# An item (i.e., product family) in the Catalog object model.
|
14
|
+
class CatalogItem
|
15
|
+
# The item's name. Searchable.
|
16
|
+
attr_accessor :name
|
17
|
+
|
18
|
+
# The item's description. Searchable.
|
19
|
+
attr_accessor :description
|
20
|
+
|
21
|
+
# The text of the item's display label in the Square Point of Sale app. Only up to the first five characters of the string are used. Searchable.
|
22
|
+
attr_accessor :abbreviation
|
23
|
+
|
24
|
+
# The color of the item's display label in the Square Point of Sale app. Searchable.
|
25
|
+
attr_accessor :label_color
|
26
|
+
|
27
|
+
# If `true`, the item can be added to shipping orders from the merchant's online store.
|
28
|
+
attr_accessor :available_online
|
29
|
+
|
30
|
+
# If `true`, the item can be added to pickup orders from the merchant's online store.
|
31
|
+
attr_accessor :available_for_pickup
|
32
|
+
|
33
|
+
# If `true`, the item can be added to electronically fulfilled orders from the merchant's online store.
|
34
|
+
attr_accessor :available_electronically
|
35
|
+
|
36
|
+
# The ID of the item's category, if any.
|
37
|
+
attr_accessor :category_id
|
38
|
+
|
39
|
+
# A set of IDs indicating the [CatalogTax](#type-catalogtax)es that are enabled for this item. When updating an item, any taxes listed here will be added to the item. [CatalogTax](#type-catalogtax)es may also be added to or deleted from an item using `UpdateItemTaxes`.
|
40
|
+
attr_accessor :tax_ids
|
41
|
+
|
42
|
+
# A set of [CatalogItemModifierListInfo](#type-catalogitemmodifierlistinfo) objects representing the modifier lists that apply to this item, along with the overrides and min and max limits that are specific to this item. [CatalogModifierList](#type-catalogmodifierlist)s may also be added to or deleted from an item using `UpdateItemModifierLists`.
|
43
|
+
attr_accessor :modifier_list_info
|
44
|
+
|
45
|
+
# The URL of an image representing this item.
|
46
|
+
attr_accessor :image_url
|
47
|
+
|
48
|
+
# A list of [CatalogObject](#type-catalogobject)s containing the [CatalogItemVariation](#type-catalogitemvariation)s for this item.
|
49
|
+
attr_accessor :variations
|
50
|
+
|
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 all possible values.
|
52
|
+
attr_accessor :product_type
|
53
|
+
|
54
|
+
# If `false`, the Square Point of Sale app will present the [CatalogItem](#type-catalogitem)'s details screen immediately, allowing the merchant to choose [CatalogModifier](#type-catalogmodifier)s before adding the item to the cart. This is the default behavior. If `true`, the Square Point of Sale app will immediately add the item to the cart with the pre-selected modifiers, and merchants can edit modifiers by drilling down onto the item's details. Third-party clients are encouraged to implement similar behaviors.
|
55
|
+
attr_accessor :skip_modifier_screen
|
56
|
+
|
57
|
+
class EnumAttributeValidator
|
58
|
+
attr_reader :datatype
|
59
|
+
attr_reader :allowable_values
|
60
|
+
|
61
|
+
def initialize(datatype, allowable_values)
|
62
|
+
@allowable_values = allowable_values.map do |value|
|
63
|
+
case datatype.to_s
|
64
|
+
when /Integer/i
|
65
|
+
value.to_i
|
66
|
+
when /Float/i
|
67
|
+
value.to_f
|
68
|
+
else
|
69
|
+
value
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def valid?(value)
|
75
|
+
!value || allowable_values.include?(value)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
80
|
+
def self.attribute_map
|
81
|
+
{
|
82
|
+
:'name' => :'name',
|
83
|
+
:'description' => :'description',
|
84
|
+
:'abbreviation' => :'abbreviation',
|
85
|
+
:'label_color' => :'label_color',
|
86
|
+
:'available_online' => :'available_online',
|
87
|
+
:'available_for_pickup' => :'available_for_pickup',
|
88
|
+
:'available_electronically' => :'available_electronically',
|
89
|
+
:'category_id' => :'category_id',
|
90
|
+
:'tax_ids' => :'tax_ids',
|
91
|
+
:'modifier_list_info' => :'modifier_list_info',
|
92
|
+
:'image_url' => :'image_url',
|
93
|
+
:'variations' => :'variations',
|
94
|
+
:'product_type' => :'product_type',
|
95
|
+
:'skip_modifier_screen' => :'skip_modifier_screen'
|
96
|
+
}
|
97
|
+
end
|
98
|
+
|
99
|
+
# Attribute type mapping.
|
100
|
+
def self.swagger_types
|
101
|
+
{
|
102
|
+
:'name' => :'String',
|
103
|
+
:'description' => :'String',
|
104
|
+
:'abbreviation' => :'String',
|
105
|
+
:'label_color' => :'String',
|
106
|
+
:'available_online' => :'BOOLEAN',
|
107
|
+
:'available_for_pickup' => :'BOOLEAN',
|
108
|
+
:'available_electronically' => :'BOOLEAN',
|
109
|
+
:'category_id' => :'String',
|
110
|
+
:'tax_ids' => :'Array<String>',
|
111
|
+
:'modifier_list_info' => :'Array<CatalogItemModifierListInfo>',
|
112
|
+
:'image_url' => :'String',
|
113
|
+
:'variations' => :'Array<CatalogObject>',
|
114
|
+
:'product_type' => :'String',
|
115
|
+
:'skip_modifier_screen' => :'BOOLEAN'
|
116
|
+
}
|
117
|
+
end
|
118
|
+
|
119
|
+
# Initializes the object
|
120
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
121
|
+
def initialize(attributes = {})
|
122
|
+
return unless attributes.is_a?(Hash)
|
123
|
+
|
124
|
+
# convert string to symbol for hash key
|
125
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
126
|
+
|
127
|
+
if attributes.has_key?(:'name')
|
128
|
+
self.name = attributes[:'name']
|
129
|
+
end
|
130
|
+
|
131
|
+
if attributes.has_key?(:'description')
|
132
|
+
self.description = attributes[:'description']
|
133
|
+
end
|
134
|
+
|
135
|
+
if attributes.has_key?(:'abbreviation')
|
136
|
+
self.abbreviation = attributes[:'abbreviation']
|
137
|
+
end
|
138
|
+
|
139
|
+
if attributes.has_key?(:'label_color')
|
140
|
+
self.label_color = attributes[:'label_color']
|
141
|
+
end
|
142
|
+
|
143
|
+
if attributes.has_key?(:'available_online')
|
144
|
+
self.available_online = attributes[:'available_online']
|
145
|
+
end
|
146
|
+
|
147
|
+
if attributes.has_key?(:'available_for_pickup')
|
148
|
+
self.available_for_pickup = attributes[:'available_for_pickup']
|
149
|
+
end
|
150
|
+
|
151
|
+
if attributes.has_key?(:'available_electronically')
|
152
|
+
self.available_electronically = attributes[:'available_electronically']
|
153
|
+
end
|
154
|
+
|
155
|
+
if attributes.has_key?(:'category_id')
|
156
|
+
self.category_id = attributes[:'category_id']
|
157
|
+
end
|
158
|
+
|
159
|
+
if attributes.has_key?(:'tax_ids')
|
160
|
+
if (value = attributes[:'tax_ids']).is_a?(Array)
|
161
|
+
self.tax_ids = value
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
if attributes.has_key?(:'modifier_list_info')
|
166
|
+
if (value = attributes[:'modifier_list_info']).is_a?(Array)
|
167
|
+
self.modifier_list_info = value
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
if attributes.has_key?(:'image_url')
|
172
|
+
self.image_url = attributes[:'image_url']
|
173
|
+
end
|
174
|
+
|
175
|
+
if attributes.has_key?(:'variations')
|
176
|
+
if (value = attributes[:'variations']).is_a?(Array)
|
177
|
+
self.variations = value
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
if attributes.has_key?(:'product_type')
|
182
|
+
self.product_type = attributes[:'product_type']
|
183
|
+
end
|
184
|
+
|
185
|
+
if attributes.has_key?(:'skip_modifier_screen')
|
186
|
+
self.skip_modifier_screen = attributes[:'skip_modifier_screen']
|
187
|
+
end
|
188
|
+
|
189
|
+
end
|
190
|
+
|
191
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
192
|
+
# @return Array for valid properies with the reasons
|
193
|
+
def list_invalid_properties
|
194
|
+
invalid_properties = Array.new
|
195
|
+
if @name.nil?
|
196
|
+
invalid_properties.push("invalid value for 'name', name cannot be nil.")
|
197
|
+
end
|
198
|
+
|
199
|
+
if @name.to_s.length < 1
|
200
|
+
invalid_properties.push("invalid value for 'name', the character length must be great than or equal to 1.")
|
201
|
+
end
|
202
|
+
|
203
|
+
return invalid_properties
|
204
|
+
end
|
205
|
+
|
206
|
+
# Check to see if the all the properties in the model are valid
|
207
|
+
# @return true if the model is valid
|
208
|
+
def valid?
|
209
|
+
return false if @name.nil?
|
210
|
+
return false if @name.to_s.length < 1
|
211
|
+
product_type_validator = EnumAttributeValidator.new('String', ["REGULAR", "GIFT_CARD", "APPOINTMENTS_SERVICE", "RETAIL_ITEM", "RESTAURANT_ITEM"])
|
212
|
+
return false unless product_type_validator.valid?(@product_type)
|
213
|
+
return true
|
214
|
+
end
|
215
|
+
|
216
|
+
# Custom attribute writer method with validation
|
217
|
+
# @param [Object] name Value to be assigned
|
218
|
+
def name=(name)
|
219
|
+
if name.nil?
|
220
|
+
fail ArgumentError, "name cannot be nil"
|
221
|
+
end
|
222
|
+
|
223
|
+
if name.to_s.length < 1
|
224
|
+
fail ArgumentError, "invalid value for 'name', the character length must be great than or equal to 1."
|
225
|
+
end
|
226
|
+
|
227
|
+
@name = name
|
228
|
+
end
|
229
|
+
|
230
|
+
# Custom attribute writer method checking allowed values (enum).
|
231
|
+
# @param [Object] product_type Object to be assigned
|
232
|
+
def product_type=(product_type)
|
233
|
+
validator = EnumAttributeValidator.new('String', ["REGULAR", "GIFT_CARD", "APPOINTMENTS_SERVICE", "RETAIL_ITEM", "RESTAURANT_ITEM"])
|
234
|
+
unless validator.valid?(product_type)
|
235
|
+
fail ArgumentError, "invalid value for 'product_type', must be one of #{validator.allowable_values}."
|
236
|
+
end
|
237
|
+
@product_type = product_type
|
238
|
+
end
|
239
|
+
|
240
|
+
# Checks equality by comparing each attribute.
|
241
|
+
# @param [Object] Object to be compared
|
242
|
+
def ==(o)
|
243
|
+
return true if self.equal?(o)
|
244
|
+
self.class == o.class &&
|
245
|
+
name == o.name &&
|
246
|
+
description == o.description &&
|
247
|
+
abbreviation == o.abbreviation &&
|
248
|
+
label_color == o.label_color &&
|
249
|
+
available_online == o.available_online &&
|
250
|
+
available_for_pickup == o.available_for_pickup &&
|
251
|
+
available_electronically == o.available_electronically &&
|
252
|
+
category_id == o.category_id &&
|
253
|
+
tax_ids == o.tax_ids &&
|
254
|
+
modifier_list_info == o.modifier_list_info &&
|
255
|
+
image_url == o.image_url &&
|
256
|
+
variations == o.variations &&
|
257
|
+
product_type == o.product_type &&
|
258
|
+
skip_modifier_screen == o.skip_modifier_screen
|
259
|
+
end
|
260
|
+
|
261
|
+
# @see the `==` method
|
262
|
+
# @param [Object] Object to be compared
|
263
|
+
def eql?(o)
|
264
|
+
self == o
|
265
|
+
end
|
266
|
+
|
267
|
+
# Calculates hash code according to all attributes.
|
268
|
+
# @return [Fixnum] Hash code
|
269
|
+
def hash
|
270
|
+
[name, description, abbreviation, label_color, available_online, available_for_pickup, available_electronically, category_id, tax_ids, modifier_list_info, image_url, variations, product_type, skip_modifier_screen].hash
|
271
|
+
end
|
272
|
+
|
273
|
+
# Builds the object from hash
|
274
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
275
|
+
# @return [Object] Returns the model itself
|
276
|
+
def build_from_hash(attributes)
|
277
|
+
return nil unless attributes.is_a?(Hash)
|
278
|
+
self.class.swagger_types.each_pair do |key, type|
|
279
|
+
if type =~ /\AArray<(.*)>/i
|
280
|
+
# check to ensure the input is an array given that the the attribute
|
281
|
+
# is documented as an array but the input is not
|
282
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
283
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
284
|
+
end
|
285
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
286
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
287
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
288
|
+
end
|
289
|
+
|
290
|
+
self
|
291
|
+
end
|
292
|
+
|
293
|
+
# Deserializes the data based on type
|
294
|
+
# @param string type Data type
|
295
|
+
# @param string value Value to be deserialized
|
296
|
+
# @return [Object] Deserialized data
|
297
|
+
def _deserialize(type, value)
|
298
|
+
case type.to_sym
|
299
|
+
when :DateTime
|
300
|
+
DateTime.parse(value)
|
301
|
+
when :Date
|
302
|
+
Date.parse(value)
|
303
|
+
when :String
|
304
|
+
value.to_s
|
305
|
+
when :Integer
|
306
|
+
value.to_i
|
307
|
+
when :Float
|
308
|
+
value.to_f
|
309
|
+
when :BOOLEAN
|
310
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
311
|
+
true
|
312
|
+
else
|
313
|
+
false
|
314
|
+
end
|
315
|
+
when :Object
|
316
|
+
# generic object (usually a Hash), return directly
|
317
|
+
value
|
318
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
319
|
+
inner_type = Regexp.last_match[:inner_type]
|
320
|
+
value.map { |v| _deserialize(inner_type, v) }
|
321
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
322
|
+
k_type = Regexp.last_match[:k_type]
|
323
|
+
v_type = Regexp.last_match[:v_type]
|
324
|
+
{}.tap do |hash|
|
325
|
+
value.each do |k, v|
|
326
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
327
|
+
end
|
328
|
+
end
|
329
|
+
else # model
|
330
|
+
temp_model = SquareConnect.const_get(type).new
|
331
|
+
temp_model.build_from_hash(value)
|
332
|
+
end
|
333
|
+
end
|
334
|
+
|
335
|
+
# Returns the string representation of the object
|
336
|
+
# @return [String] String presentation of the object
|
337
|
+
def to_s
|
338
|
+
to_hash.to_s
|
339
|
+
end
|
340
|
+
|
341
|
+
# to_body is an alias to to_hash (backward compatibility)
|
342
|
+
# @return [Hash] Returns the object in the form of hash
|
343
|
+
def to_body
|
344
|
+
to_hash
|
345
|
+
end
|
346
|
+
|
347
|
+
# Returns the object in the form of hash
|
348
|
+
# @return [Hash] Returns the object in the form of hash
|
349
|
+
def to_hash
|
350
|
+
hash = {}
|
351
|
+
self.class.attribute_map.each_pair do |attr, param|
|
352
|
+
value = self.send(attr)
|
353
|
+
next if value.nil?
|
354
|
+
hash[param] = _to_hash(value)
|
355
|
+
end
|
356
|
+
hash
|
357
|
+
end
|
358
|
+
|
359
|
+
# Outputs non-array value in the form of hash
|
360
|
+
# For object, use to_hash. Otherwise, just return the value
|
361
|
+
# @param [Object] value Any valid value
|
362
|
+
# @return [Hash] Returns the value in the form of hash
|
363
|
+
def _to_hash(value)
|
364
|
+
if value.is_a?(Array)
|
365
|
+
value.compact.map{ |v| _to_hash(v) }
|
366
|
+
elsif value.is_a?(Hash)
|
367
|
+
{}.tap do |hash|
|
368
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
369
|
+
end
|
370
|
+
elsif value.respond_to? :to_hash
|
371
|
+
value.to_hash
|
372
|
+
else
|
373
|
+
value
|
374
|
+
end
|
375
|
+
end
|
376
|
+
|
377
|
+
end
|
378
|
+
|
379
|
+
end
|