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,269 @@
|
|
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 SearchCatalogObjectsRequest
|
15
|
+
# The pagination cursor returned in the previous response. Leave unset for an initial request. See [Paginating results](#paginatingresults) for more information.
|
16
|
+
attr_accessor :cursor
|
17
|
+
|
18
|
+
# The desired set of object types to apper in the search results. The legal values are taken from the [CatalogObjectType](#type-catalogobjecttype) enumeration, namely `\"ITEM\"`, `\"ITEM_VARIATION\"`, `\"CATEGORY\"`, `\"DISCOUNT\"`, `\"TAX\"`, `\"MODIFIER\"`, or `\"MODIFIER_LIST\"`.
|
19
|
+
attr_accessor :object_types
|
20
|
+
|
21
|
+
# If `true`, deleted objects will be included in the results. Deleted objects will have their `is_deleted` field set to `true`.
|
22
|
+
attr_accessor :include_deleted_objects
|
23
|
+
|
24
|
+
# If `true`, the response will include additional objects that are related to the requested object, as follows: If a [CatalogItem](#type-catalogitem) is returned in the object field of the response, its associated [CatalogCategory](#type-catalogcategory), [CatalogTax](#type-catalogtax)es, and [CatalogModifierList](#type-catalogmodifierlist)s will be included in the `related_objects` field of the response. If a [CatalogItemVariation](#type-catalogitemvariation) is returned in the object field of the response, its parent [CatalogItem](#type-catalogitem) will be included in the `related_objects` field of the response.
|
25
|
+
attr_accessor :include_related_objects
|
26
|
+
|
27
|
+
# Return only objects that have been modified after this [timestamp](#workingwithdates) (in RFC 3339 format, e.g., \"2016-09-04T23:59:33.123Z\").
|
28
|
+
attr_accessor :begin_time
|
29
|
+
|
30
|
+
# A query to be used to filter or sort the results. If no query is specified, the entire catalog will be returned.
|
31
|
+
attr_accessor :query
|
32
|
+
|
33
|
+
# A limit on the number of results to be returned in a single page. The limit is advisory - the implementation may return more or fewer results. If the supplied limit is negative, zero, or is higher than the maximum limit of 1,000, it will be ignored.
|
34
|
+
attr_accessor :limit
|
35
|
+
|
36
|
+
class EnumAttributeValidator
|
37
|
+
attr_reader :datatype
|
38
|
+
attr_reader :allowable_values
|
39
|
+
|
40
|
+
def initialize(datatype, allowable_values)
|
41
|
+
@allowable_values = allowable_values.map do |value|
|
42
|
+
case datatype.to_s
|
43
|
+
when /Integer/i
|
44
|
+
value.to_i
|
45
|
+
when /Float/i
|
46
|
+
value.to_f
|
47
|
+
else
|
48
|
+
value
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def valid?(value)
|
54
|
+
!value || allowable_values.include?(value)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
59
|
+
def self.attribute_map
|
60
|
+
{
|
61
|
+
:'cursor' => :'cursor',
|
62
|
+
:'object_types' => :'object_types',
|
63
|
+
:'include_deleted_objects' => :'include_deleted_objects',
|
64
|
+
:'include_related_objects' => :'include_related_objects',
|
65
|
+
:'begin_time' => :'begin_time',
|
66
|
+
:'query' => :'query',
|
67
|
+
:'limit' => :'limit'
|
68
|
+
}
|
69
|
+
end
|
70
|
+
|
71
|
+
# Attribute type mapping.
|
72
|
+
def self.swagger_types
|
73
|
+
{
|
74
|
+
:'cursor' => :'String',
|
75
|
+
:'object_types' => :'Array<String>',
|
76
|
+
:'include_deleted_objects' => :'BOOLEAN',
|
77
|
+
:'include_related_objects' => :'BOOLEAN',
|
78
|
+
:'begin_time' => :'String',
|
79
|
+
:'query' => :'CatalogQuery',
|
80
|
+
:'limit' => :'Integer'
|
81
|
+
}
|
82
|
+
end
|
83
|
+
|
84
|
+
# Initializes the object
|
85
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
86
|
+
def initialize(attributes = {})
|
87
|
+
return unless attributes.is_a?(Hash)
|
88
|
+
|
89
|
+
# convert string to symbol for hash key
|
90
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
91
|
+
|
92
|
+
if attributes.has_key?(:'cursor')
|
93
|
+
self.cursor = attributes[:'cursor']
|
94
|
+
end
|
95
|
+
|
96
|
+
if attributes.has_key?(:'object_types')
|
97
|
+
if (value = attributes[:'object_types']).is_a?(Array)
|
98
|
+
self.object_types = value
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
if attributes.has_key?(:'include_deleted_objects')
|
103
|
+
self.include_deleted_objects = attributes[:'include_deleted_objects']
|
104
|
+
end
|
105
|
+
|
106
|
+
if attributes.has_key?(:'include_related_objects')
|
107
|
+
self.include_related_objects = attributes[:'include_related_objects']
|
108
|
+
end
|
109
|
+
|
110
|
+
if attributes.has_key?(:'begin_time')
|
111
|
+
self.begin_time = attributes[:'begin_time']
|
112
|
+
end
|
113
|
+
|
114
|
+
if attributes.has_key?(:'query')
|
115
|
+
self.query = attributes[:'query']
|
116
|
+
end
|
117
|
+
|
118
|
+
if attributes.has_key?(:'limit')
|
119
|
+
self.limit = attributes[:'limit']
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
123
|
+
|
124
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
125
|
+
# @return Array for valid properies with the reasons
|
126
|
+
def list_invalid_properties
|
127
|
+
invalid_properties = Array.new
|
128
|
+
return invalid_properties
|
129
|
+
end
|
130
|
+
|
131
|
+
# Check to see if the all the properties in the model are valid
|
132
|
+
# @return true if the model is valid
|
133
|
+
def valid?
|
134
|
+
return true
|
135
|
+
end
|
136
|
+
|
137
|
+
# Checks equality by comparing each attribute.
|
138
|
+
# @param [Object] Object to be compared
|
139
|
+
def ==(o)
|
140
|
+
return true if self.equal?(o)
|
141
|
+
self.class == o.class &&
|
142
|
+
cursor == o.cursor &&
|
143
|
+
object_types == o.object_types &&
|
144
|
+
include_deleted_objects == o.include_deleted_objects &&
|
145
|
+
include_related_objects == o.include_related_objects &&
|
146
|
+
begin_time == o.begin_time &&
|
147
|
+
query == o.query &&
|
148
|
+
limit == o.limit
|
149
|
+
end
|
150
|
+
|
151
|
+
# @see the `==` method
|
152
|
+
# @param [Object] Object to be compared
|
153
|
+
def eql?(o)
|
154
|
+
self == o
|
155
|
+
end
|
156
|
+
|
157
|
+
# Calculates hash code according to all attributes.
|
158
|
+
# @return [Fixnum] Hash code
|
159
|
+
def hash
|
160
|
+
[cursor, object_types, include_deleted_objects, include_related_objects, begin_time, query, limit].hash
|
161
|
+
end
|
162
|
+
|
163
|
+
# Builds the object from hash
|
164
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
165
|
+
# @return [Object] Returns the model itself
|
166
|
+
def build_from_hash(attributes)
|
167
|
+
return nil unless attributes.is_a?(Hash)
|
168
|
+
self.class.swagger_types.each_pair do |key, type|
|
169
|
+
if type =~ /\AArray<(.*)>/i
|
170
|
+
# check to ensure the input is an array given that the the attribute
|
171
|
+
# is documented as an array but the input is not
|
172
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
173
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
174
|
+
end
|
175
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
176
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
177
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
178
|
+
end
|
179
|
+
|
180
|
+
self
|
181
|
+
end
|
182
|
+
|
183
|
+
# Deserializes the data based on type
|
184
|
+
# @param string type Data type
|
185
|
+
# @param string value Value to be deserialized
|
186
|
+
# @return [Object] Deserialized data
|
187
|
+
def _deserialize(type, value)
|
188
|
+
case type.to_sym
|
189
|
+
when :DateTime
|
190
|
+
DateTime.parse(value)
|
191
|
+
when :Date
|
192
|
+
Date.parse(value)
|
193
|
+
when :String
|
194
|
+
value.to_s
|
195
|
+
when :Integer
|
196
|
+
value.to_i
|
197
|
+
when :Float
|
198
|
+
value.to_f
|
199
|
+
when :BOOLEAN
|
200
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
201
|
+
true
|
202
|
+
else
|
203
|
+
false
|
204
|
+
end
|
205
|
+
when :Object
|
206
|
+
# generic object (usually a Hash), return directly
|
207
|
+
value
|
208
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
209
|
+
inner_type = Regexp.last_match[:inner_type]
|
210
|
+
value.map { |v| _deserialize(inner_type, v) }
|
211
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
212
|
+
k_type = Regexp.last_match[:k_type]
|
213
|
+
v_type = Regexp.last_match[:v_type]
|
214
|
+
{}.tap do |hash|
|
215
|
+
value.each do |k, v|
|
216
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
217
|
+
end
|
218
|
+
end
|
219
|
+
else # model
|
220
|
+
temp_model = SquareConnect.const_get(type).new
|
221
|
+
temp_model.build_from_hash(value)
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
# Returns the string representation of the object
|
226
|
+
# @return [String] String presentation of the object
|
227
|
+
def to_s
|
228
|
+
to_hash.to_s
|
229
|
+
end
|
230
|
+
|
231
|
+
# to_body is an alias to to_hash (backward compatibility)
|
232
|
+
# @return [Hash] Returns the object in the form of hash
|
233
|
+
def to_body
|
234
|
+
to_hash
|
235
|
+
end
|
236
|
+
|
237
|
+
# Returns the object in the form of hash
|
238
|
+
# @return [Hash] Returns the object in the form of hash
|
239
|
+
def to_hash
|
240
|
+
hash = {}
|
241
|
+
self.class.attribute_map.each_pair do |attr, param|
|
242
|
+
value = self.send(attr)
|
243
|
+
next if value.nil?
|
244
|
+
hash[param] = _to_hash(value)
|
245
|
+
end
|
246
|
+
hash
|
247
|
+
end
|
248
|
+
|
249
|
+
# Outputs non-array value in the form of hash
|
250
|
+
# For object, use to_hash. Otherwise, just return the value
|
251
|
+
# @param [Object] value Any valid value
|
252
|
+
# @return [Hash] Returns the value in the form of hash
|
253
|
+
def _to_hash(value)
|
254
|
+
if value.is_a?(Array)
|
255
|
+
value.compact.map{ |v| _to_hash(v) }
|
256
|
+
elsif value.is_a?(Hash)
|
257
|
+
{}.tap do |hash|
|
258
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
259
|
+
end
|
260
|
+
elsif value.respond_to? :to_hash
|
261
|
+
value.to_hash
|
262
|
+
else
|
263
|
+
value
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
end
|
268
|
+
|
269
|
+
end
|
@@ -0,0 +1,222 @@
|
|
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 SearchCatalogObjectsResponse
|
15
|
+
# The set of [Error](#type-error)s encountered.
|
16
|
+
attr_accessor :errors
|
17
|
+
|
18
|
+
# The pagination cursor to be used in a subsequent request. If unset, this is the final response. See [Paginating results](#paginatingresults) for more information.
|
19
|
+
attr_accessor :cursor
|
20
|
+
|
21
|
+
# The [CatalogObject](#type-catalogobject)s returned.
|
22
|
+
attr_accessor :objects
|
23
|
+
|
24
|
+
# A list of [CatalogObject](#type-catalogobject)s referenced by the objects in the `objects` field.
|
25
|
+
attr_accessor :related_objects
|
26
|
+
|
27
|
+
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
+
def self.attribute_map
|
30
|
+
{
|
31
|
+
:'errors' => :'errors',
|
32
|
+
:'cursor' => :'cursor',
|
33
|
+
:'objects' => :'objects',
|
34
|
+
:'related_objects' => :'related_objects'
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
# Attribute type mapping.
|
39
|
+
def self.swagger_types
|
40
|
+
{
|
41
|
+
:'errors' => :'Array<Error>',
|
42
|
+
:'cursor' => :'String',
|
43
|
+
:'objects' => :'Array<CatalogObject>',
|
44
|
+
:'related_objects' => :'Array<CatalogObject>'
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
# Initializes the object
|
49
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
50
|
+
def initialize(attributes = {})
|
51
|
+
return unless attributes.is_a?(Hash)
|
52
|
+
|
53
|
+
# convert string to symbol for hash key
|
54
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
55
|
+
|
56
|
+
if attributes.has_key?(:'errors')
|
57
|
+
if (value = attributes[:'errors']).is_a?(Array)
|
58
|
+
self.errors = value
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
if attributes.has_key?(:'cursor')
|
63
|
+
self.cursor = attributes[:'cursor']
|
64
|
+
end
|
65
|
+
|
66
|
+
if attributes.has_key?(:'objects')
|
67
|
+
if (value = attributes[:'objects']).is_a?(Array)
|
68
|
+
self.objects = value
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
if attributes.has_key?(:'related_objects')
|
73
|
+
if (value = attributes[:'related_objects']).is_a?(Array)
|
74
|
+
self.related_objects = value
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
81
|
+
# @return Array for valid properies with the reasons
|
82
|
+
def list_invalid_properties
|
83
|
+
invalid_properties = Array.new
|
84
|
+
return invalid_properties
|
85
|
+
end
|
86
|
+
|
87
|
+
# Check to see if the all the properties in the model are valid
|
88
|
+
# @return true if the model is valid
|
89
|
+
def valid?
|
90
|
+
return true
|
91
|
+
end
|
92
|
+
|
93
|
+
# Checks equality by comparing each attribute.
|
94
|
+
# @param [Object] Object to be compared
|
95
|
+
def ==(o)
|
96
|
+
return true if self.equal?(o)
|
97
|
+
self.class == o.class &&
|
98
|
+
errors == o.errors &&
|
99
|
+
cursor == o.cursor &&
|
100
|
+
objects == o.objects &&
|
101
|
+
related_objects == o.related_objects
|
102
|
+
end
|
103
|
+
|
104
|
+
# @see the `==` method
|
105
|
+
# @param [Object] Object to be compared
|
106
|
+
def eql?(o)
|
107
|
+
self == o
|
108
|
+
end
|
109
|
+
|
110
|
+
# Calculates hash code according to all attributes.
|
111
|
+
# @return [Fixnum] Hash code
|
112
|
+
def hash
|
113
|
+
[errors, cursor, objects, related_objects].hash
|
114
|
+
end
|
115
|
+
|
116
|
+
# Builds the object from hash
|
117
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
118
|
+
# @return [Object] Returns the model itself
|
119
|
+
def build_from_hash(attributes)
|
120
|
+
return nil unless attributes.is_a?(Hash)
|
121
|
+
self.class.swagger_types.each_pair do |key, type|
|
122
|
+
if type =~ /\AArray<(.*)>/i
|
123
|
+
# check to ensure the input is an array given that the the attribute
|
124
|
+
# is documented as an array but the input is not
|
125
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
126
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
127
|
+
end
|
128
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
129
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
130
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
131
|
+
end
|
132
|
+
|
133
|
+
self
|
134
|
+
end
|
135
|
+
|
136
|
+
# Deserializes the data based on type
|
137
|
+
# @param string type Data type
|
138
|
+
# @param string value Value to be deserialized
|
139
|
+
# @return [Object] Deserialized data
|
140
|
+
def _deserialize(type, value)
|
141
|
+
case type.to_sym
|
142
|
+
when :DateTime
|
143
|
+
DateTime.parse(value)
|
144
|
+
when :Date
|
145
|
+
Date.parse(value)
|
146
|
+
when :String
|
147
|
+
value.to_s
|
148
|
+
when :Integer
|
149
|
+
value.to_i
|
150
|
+
when :Float
|
151
|
+
value.to_f
|
152
|
+
when :BOOLEAN
|
153
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
154
|
+
true
|
155
|
+
else
|
156
|
+
false
|
157
|
+
end
|
158
|
+
when :Object
|
159
|
+
# generic object (usually a Hash), return directly
|
160
|
+
value
|
161
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
162
|
+
inner_type = Regexp.last_match[:inner_type]
|
163
|
+
value.map { |v| _deserialize(inner_type, v) }
|
164
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
165
|
+
k_type = Regexp.last_match[:k_type]
|
166
|
+
v_type = Regexp.last_match[:v_type]
|
167
|
+
{}.tap do |hash|
|
168
|
+
value.each do |k, v|
|
169
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
else # model
|
173
|
+
temp_model = SquareConnect.const_get(type).new
|
174
|
+
temp_model.build_from_hash(value)
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
# Returns the string representation of the object
|
179
|
+
# @return [String] String presentation of the object
|
180
|
+
def to_s
|
181
|
+
to_hash.to_s
|
182
|
+
end
|
183
|
+
|
184
|
+
# to_body is an alias to to_hash (backward compatibility)
|
185
|
+
# @return [Hash] Returns the object in the form of hash
|
186
|
+
def to_body
|
187
|
+
to_hash
|
188
|
+
end
|
189
|
+
|
190
|
+
# Returns the object in the form of hash
|
191
|
+
# @return [Hash] Returns the object in the form of hash
|
192
|
+
def to_hash
|
193
|
+
hash = {}
|
194
|
+
self.class.attribute_map.each_pair do |attr, param|
|
195
|
+
value = self.send(attr)
|
196
|
+
next if value.nil?
|
197
|
+
hash[param] = _to_hash(value)
|
198
|
+
end
|
199
|
+
hash
|
200
|
+
end
|
201
|
+
|
202
|
+
# Outputs non-array value in the form of hash
|
203
|
+
# For object, use to_hash. Otherwise, just return the value
|
204
|
+
# @param [Object] value Any valid value
|
205
|
+
# @return [Hash] Returns the value in the form of hash
|
206
|
+
def _to_hash(value)
|
207
|
+
if value.is_a?(Array)
|
208
|
+
value.compact.map{ |v| _to_hash(v) }
|
209
|
+
elsif value.is_a?(Hash)
|
210
|
+
{}.tap do |hash|
|
211
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
212
|
+
end
|
213
|
+
elsif value.respond_to? :to_hash
|
214
|
+
value.to_hash
|
215
|
+
else
|
216
|
+
value
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
end
|
221
|
+
|
222
|
+
end
|