square_connect 2.20180712.2.237 → 2.20180918.0.244

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +20 -1
  3. data/README.md +33 -1
  4. data/docs/BatchChangeInventoryRequest.md +14 -0
  5. data/docs/BatchChangeInventoryResponse.md +13 -0
  6. data/docs/BatchRetrieveInventoryChangesRequest.md +18 -0
  7. data/docs/BatchRetrieveInventoryChangesResponse.md +14 -0
  8. data/docs/BatchRetrieveInventoryCountsRequest.md +15 -0
  9. data/docs/BatchRetrieveInventoryCountsResponse.md +14 -0
  10. data/docs/Card.md +1 -1
  11. data/docs/CreateCustomerRequest.md +1 -0
  12. data/docs/Customer.md +1 -0
  13. data/docs/CustomersApi.md +2 -2
  14. data/docs/ErrorCode.md +2 -0
  15. data/docs/InventoryAdjustment.md +28 -0
  16. data/docs/InventoryApi.md +391 -0
  17. data/docs/InventoryChange.md +15 -0
  18. data/docs/InventoryChangeType.md +14 -0
  19. data/docs/InventoryCount.md +17 -0
  20. data/docs/InventoryPhysicalCount.md +22 -0
  21. data/docs/InventoryState.md +23 -0
  22. data/docs/InventoryTransfer.md +23 -0
  23. data/docs/Product.md +19 -0
  24. data/docs/RetrieveInventoryAdjustmentRequest.md +11 -0
  25. data/docs/RetrieveInventoryAdjustmentResponse.md +13 -0
  26. data/docs/RetrieveInventoryChangesRequest.md +13 -0
  27. data/docs/RetrieveInventoryChangesResponse.md +14 -0
  28. data/docs/RetrieveInventoryCountRequest.md +13 -0
  29. data/docs/RetrieveInventoryCountResponse.md +14 -0
  30. data/docs/RetrieveInventoryPhysicalCountRequest.md +11 -0
  31. data/docs/RetrieveInventoryPhysicalCountResponse.md +13 -0
  32. data/docs/SourceApplication.md +14 -0
  33. data/docs/TransactionsApi.md +1 -1
  34. data/docs/UpdateCustomerRequest.md +1 -0
  35. data/docs/V1Timecard.md +4 -1
  36. data/lib/square_connect.rb +24 -0
  37. data/lib/square_connect/api/apple_pay_api.rb +1 -1
  38. data/lib/square_connect/api/catalog_api.rb +11 -11
  39. data/lib/square_connect/api/checkout_api.rb +1 -1
  40. data/lib/square_connect/api/customers_api.rb +12 -12
  41. data/lib/square_connect/api/inventory_api.rb +417 -0
  42. data/lib/square_connect/api/locations_api.rb +1 -1
  43. data/lib/square_connect/api/mobile_authorization_api.rb +1 -1
  44. data/lib/square_connect/api/o_auth_api.rb +3 -3
  45. data/lib/square_connect/api/orders_api.rb +2 -2
  46. data/lib/square_connect/api/reporting_api.rb +2 -2
  47. data/lib/square_connect/api/transactions_api.rb +9 -9
  48. data/lib/square_connect/api_client.rb +1 -1
  49. data/lib/square_connect/models/batch_change_inventory_request.rb +208 -0
  50. data/lib/square_connect/models/batch_change_inventory_response.rb +200 -0
  51. data/lib/square_connect/models/batch_retrieve_inventory_changes_request.rb +275 -0
  52. data/lib/square_connect/models/batch_retrieve_inventory_changes_response.rb +210 -0
  53. data/lib/square_connect/models/batch_retrieve_inventory_counts_request.rb +220 -0
  54. data/lib/square_connect/models/batch_retrieve_inventory_counts_response.rb +210 -0
  55. data/lib/square_connect/models/card.rb +1 -1
  56. data/lib/square_connect/models/create_customer_request.rb +14 -4
  57. data/lib/square_connect/models/customer.rb +11 -1
  58. data/lib/square_connect/models/error.rb +2 -2
  59. data/lib/square_connect/models/error_code.rb +2 -0
  60. data/lib/square_connect/models/inventory_adjustment.rb +391 -0
  61. data/lib/square_connect/models/inventory_change.rb +249 -0
  62. data/lib/square_connect/models/inventory_change_type.rb +20 -0
  63. data/lib/square_connect/models/inventory_count.rb +269 -0
  64. data/lib/square_connect/models/inventory_physical_count.rb +319 -0
  65. data/lib/square_connect/models/inventory_state.rb +29 -0
  66. data/lib/square_connect/models/inventory_transfer.rb +329 -0
  67. data/lib/square_connect/models/money.rb +0 -9
  68. data/lib/square_connect/models/product.rb +25 -0
  69. data/lib/square_connect/models/retrieve_inventory_adjustment_request.rb +176 -0
  70. data/lib/square_connect/models/retrieve_inventory_adjustment_response.rb +198 -0
  71. data/lib/square_connect/models/retrieve_inventory_changes_request.rb +196 -0
  72. data/lib/square_connect/models/retrieve_inventory_changes_response.rb +210 -0
  73. data/lib/square_connect/models/retrieve_inventory_count_request.rb +196 -0
  74. data/lib/square_connect/models/retrieve_inventory_count_response.rb +210 -0
  75. data/lib/square_connect/models/retrieve_inventory_physical_count_request.rb +176 -0
  76. data/lib/square_connect/models/retrieve_inventory_physical_count_response.rb +198 -0
  77. data/lib/square_connect/models/source_application.rb +239 -0
  78. data/lib/square_connect/models/update_customer_request.rb +14 -4
  79. data/lib/square_connect/models/v1_timecard.rb +35 -5
  80. data/lib/square_connect/version.rb +1 -1
  81. data/spec/api/inventory_api_spec.rb +120 -0
  82. data/spec/models/batch_change_inventory_request_spec.rb +51 -0
  83. data/spec/models/batch_change_inventory_response_spec.rb +45 -0
  84. data/spec/models/batch_retrieve_inventory_changes_request_spec.rb +83 -0
  85. data/spec/models/batch_retrieve_inventory_changes_response_spec.rb +51 -0
  86. data/spec/models/batch_retrieve_inventory_counts_request_spec.rb +57 -0
  87. data/spec/models/batch_retrieve_inventory_counts_response_spec.rb +51 -0
  88. data/spec/models/inventory_adjustment_spec.rb +143 -0
  89. data/spec/models/inventory_change_spec.rb +61 -0
  90. data/spec/models/inventory_change_type_spec.rb +33 -0
  91. data/spec/models/inventory_count_spec.rb +73 -0
  92. data/spec/models/inventory_physical_count_spec.rb +103 -0
  93. data/spec/models/inventory_state_spec.rb +33 -0
  94. data/spec/models/inventory_transfer_spec.rb +109 -0
  95. data/spec/models/product_spec.rb +33 -0
  96. data/spec/models/retrieve_inventory_adjustment_request_spec.rb +33 -0
  97. data/spec/models/retrieve_inventory_adjustment_response_spec.rb +45 -0
  98. data/spec/models/retrieve_inventory_changes_request_spec.rb +45 -0
  99. data/spec/models/retrieve_inventory_changes_response_spec.rb +51 -0
  100. data/spec/models/retrieve_inventory_count_request_spec.rb +45 -0
  101. data/spec/models/retrieve_inventory_count_response_spec.rb +51 -0
  102. data/spec/models/retrieve_inventory_physical_count_request_spec.rb +33 -0
  103. data/spec/models/retrieve_inventory_physical_count_response_spec.rb +45 -0
  104. data/spec/models/source_application_spec.rb +55 -0
  105. metadata +99 -3
@@ -0,0 +1,275 @@
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 BatchRetrieveInventoryChangesRequest
15
+ # Filters results by [CatalogObject](#type-catalogobject) ID. Only applied when set. Default: unset.
16
+ attr_accessor :catalog_object_ids
17
+
18
+ # Filters results by [Location](#type-location) ID. Only applied when set. Default: unset.
19
+ attr_accessor :location_ids
20
+
21
+ # Filters results by [InventoryChangeType](#type-inventorychangetype). Default: [`PHYSICAL_COUNT`, `ADJUSTMENT`]. `TRANSFER` is not supported as a filter.
22
+ attr_accessor :types
23
+
24
+ # Filters `ADJUSTMENT` query results by [InventoryState](#type-inventorystate). Only applied when set. Default: unset.
25
+ attr_accessor :states
26
+
27
+ # Provided as an RFC 3339 timestamp. Returns results whose `created_at` or `calculated_at` value is after the given time. Default: UNIX epoch (`1970-01-01T00:00:00Z`).
28
+ attr_accessor :updated_after
29
+
30
+ # Provided as an RFC 3339 timestamp. Returns results whose `created_at` or `calculated_at` value is strictly before the given time. Default: UNIX epoch (`1970-01-01T00:00:00Z`).
31
+ attr_accessor :updated_before
32
+
33
+ # A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for the original query. See [Paginating results](#paginatingresults) for more information.
34
+ attr_accessor :cursor
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
+ :'catalog_object_ids' => :'catalog_object_ids',
62
+ :'location_ids' => :'location_ids',
63
+ :'types' => :'types',
64
+ :'states' => :'states',
65
+ :'updated_after' => :'updated_after',
66
+ :'updated_before' => :'updated_before',
67
+ :'cursor' => :'cursor'
68
+ }
69
+ end
70
+
71
+ # Attribute type mapping.
72
+ def self.swagger_types
73
+ {
74
+ :'catalog_object_ids' => :'Array<String>',
75
+ :'location_ids' => :'Array<String>',
76
+ :'types' => :'Array<String>',
77
+ :'states' => :'Array<String>',
78
+ :'updated_after' => :'String',
79
+ :'updated_before' => :'String',
80
+ :'cursor' => :'String'
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?(:'catalog_object_ids')
93
+ if (value = attributes[:'catalog_object_ids']).is_a?(Array)
94
+ self.catalog_object_ids = value
95
+ end
96
+ end
97
+
98
+ if attributes.has_key?(:'location_ids')
99
+ if (value = attributes[:'location_ids']).is_a?(Array)
100
+ self.location_ids = value
101
+ end
102
+ end
103
+
104
+ if attributes.has_key?(:'types')
105
+ if (value = attributes[:'types']).is_a?(Array)
106
+ self.types = value
107
+ end
108
+ end
109
+
110
+ if attributes.has_key?(:'states')
111
+ if (value = attributes[:'states']).is_a?(Array)
112
+ self.states = value
113
+ end
114
+ end
115
+
116
+ if attributes.has_key?(:'updated_after')
117
+ self.updated_after = attributes[:'updated_after']
118
+ end
119
+
120
+ if attributes.has_key?(:'updated_before')
121
+ self.updated_before = attributes[:'updated_before']
122
+ end
123
+
124
+ if attributes.has_key?(:'cursor')
125
+ self.cursor = attributes[:'cursor']
126
+ end
127
+
128
+ end
129
+
130
+ # Show invalid properties with the reasons. Usually used together with valid?
131
+ # @return Array for valid properies with the reasons
132
+ def list_invalid_properties
133
+ invalid_properties = Array.new
134
+ return invalid_properties
135
+ end
136
+
137
+ # Check to see if the all the properties in the model are valid
138
+ # @return true if the model is valid
139
+ def valid?
140
+ return true
141
+ end
142
+
143
+ # Checks equality by comparing each attribute.
144
+ # @param [Object] Object to be compared
145
+ def ==(o)
146
+ return true if self.equal?(o)
147
+ self.class == o.class &&
148
+ catalog_object_ids == o.catalog_object_ids &&
149
+ location_ids == o.location_ids &&
150
+ types == o.types &&
151
+ states == o.states &&
152
+ updated_after == o.updated_after &&
153
+ updated_before == o.updated_before &&
154
+ cursor == o.cursor
155
+ end
156
+
157
+ # @see the `==` method
158
+ # @param [Object] Object to be compared
159
+ def eql?(o)
160
+ self == o
161
+ end
162
+
163
+ # Calculates hash code according to all attributes.
164
+ # @return [Fixnum] Hash code
165
+ def hash
166
+ [catalog_object_ids, location_ids, types, states, updated_after, updated_before, cursor].hash
167
+ end
168
+
169
+ # Builds the object from hash
170
+ # @param [Hash] attributes Model attributes in the form of hash
171
+ # @return [Object] Returns the model itself
172
+ def build_from_hash(attributes)
173
+ return nil unless attributes.is_a?(Hash)
174
+ self.class.swagger_types.each_pair do |key, type|
175
+ if type =~ /\AArray<(.*)>/i
176
+ # check to ensure the input is an array given that the the attribute
177
+ # is documented as an array but the input is not
178
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
179
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
180
+ end
181
+ elsif !attributes[self.class.attribute_map[key]].nil?
182
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
183
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
184
+ end
185
+
186
+ self
187
+ end
188
+
189
+ # Deserializes the data based on type
190
+ # @param string type Data type
191
+ # @param string value Value to be deserialized
192
+ # @return [Object] Deserialized data
193
+ def _deserialize(type, value)
194
+ case type.to_sym
195
+ when :DateTime
196
+ DateTime.parse(value)
197
+ when :Date
198
+ Date.parse(value)
199
+ when :String
200
+ value.to_s
201
+ when :Integer
202
+ value.to_i
203
+ when :Float
204
+ value.to_f
205
+ when :BOOLEAN
206
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
207
+ true
208
+ else
209
+ false
210
+ end
211
+ when :Object
212
+ # generic object (usually a Hash), return directly
213
+ value
214
+ when /\AArray<(?<inner_type>.+)>\z/
215
+ inner_type = Regexp.last_match[:inner_type]
216
+ value.map { |v| _deserialize(inner_type, v) }
217
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
218
+ k_type = Regexp.last_match[:k_type]
219
+ v_type = Regexp.last_match[:v_type]
220
+ {}.tap do |hash|
221
+ value.each do |k, v|
222
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
223
+ end
224
+ end
225
+ else # model
226
+ temp_model = SquareConnect.const_get(type).new
227
+ temp_model.build_from_hash(value)
228
+ end
229
+ end
230
+
231
+ # Returns the string representation of the object
232
+ # @return [String] String presentation of the object
233
+ def to_s
234
+ to_hash.to_s
235
+ end
236
+
237
+ # to_body is an alias to to_hash (backward compatibility)
238
+ # @return [Hash] Returns the object in the form of hash
239
+ def to_body
240
+ to_hash
241
+ end
242
+
243
+ # Returns the object in the form of hash
244
+ # @return [Hash] Returns the object in the form of hash
245
+ def to_hash
246
+ hash = {}
247
+ self.class.attribute_map.each_pair do |attr, param|
248
+ value = self.send(attr)
249
+ next if value.nil?
250
+ hash[param] = _to_hash(value)
251
+ end
252
+ hash
253
+ end
254
+
255
+ # Outputs non-array value in the form of hash
256
+ # For object, use to_hash. Otherwise, just return the value
257
+ # @param [Object] value Any valid value
258
+ # @return [Hash] Returns the value in the form of hash
259
+ def _to_hash(value)
260
+ if value.is_a?(Array)
261
+ value.compact.map{ |v| _to_hash(v) }
262
+ elsif value.is_a?(Hash)
263
+ {}.tap do |hash|
264
+ value.each { |k, v| hash[k] = _to_hash(v) }
265
+ end
266
+ elsif value.respond_to? :to_hash
267
+ value.to_hash
268
+ else
269
+ value
270
+ end
271
+ end
272
+
273
+ end
274
+
275
+ end
@@ -0,0 +1,210 @@
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 BatchRetrieveInventoryChangesResponse
15
+ # Any errors that occurred during the request.
16
+ attr_accessor :errors
17
+
18
+ # The current calculated inventory changes for the requested objects and locations.
19
+ attr_accessor :changes
20
+
21
+ # The pagination cursor to be used in a subsequent request. If unset, this is the final response. See [Paginating results](#paginatingresults) for more information.
22
+ attr_accessor :cursor
23
+
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'errors' => :'errors',
29
+ :'changes' => :'changes',
30
+ :'cursor' => :'cursor'
31
+ }
32
+ end
33
+
34
+ # Attribute type mapping.
35
+ def self.swagger_types
36
+ {
37
+ :'errors' => :'Array<Error>',
38
+ :'changes' => :'Array<InventoryChange>',
39
+ :'cursor' => :'String'
40
+ }
41
+ end
42
+
43
+ # Initializes the object
44
+ # @param [Hash] attributes Model attributes in the form of hash
45
+ def initialize(attributes = {})
46
+ return unless attributes.is_a?(Hash)
47
+
48
+ # convert string to symbol for hash key
49
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
50
+
51
+ if attributes.has_key?(:'errors')
52
+ if (value = attributes[:'errors']).is_a?(Array)
53
+ self.errors = value
54
+ end
55
+ end
56
+
57
+ if attributes.has_key?(:'changes')
58
+ if (value = attributes[:'changes']).is_a?(Array)
59
+ self.changes = value
60
+ end
61
+ end
62
+
63
+ if attributes.has_key?(:'cursor')
64
+ self.cursor = attributes[:'cursor']
65
+ end
66
+
67
+ end
68
+
69
+ # Show invalid properties with the reasons. Usually used together with valid?
70
+ # @return Array for valid properies with the reasons
71
+ def list_invalid_properties
72
+ invalid_properties = Array.new
73
+ return invalid_properties
74
+ end
75
+
76
+ # Check to see if the all the properties in the model are valid
77
+ # @return true if the model is valid
78
+ def valid?
79
+ return true
80
+ end
81
+
82
+ # Checks equality by comparing each attribute.
83
+ # @param [Object] Object to be compared
84
+ def ==(o)
85
+ return true if self.equal?(o)
86
+ self.class == o.class &&
87
+ errors == o.errors &&
88
+ changes == o.changes &&
89
+ cursor == o.cursor
90
+ end
91
+
92
+ # @see the `==` method
93
+ # @param [Object] Object to be compared
94
+ def eql?(o)
95
+ self == o
96
+ end
97
+
98
+ # Calculates hash code according to all attributes.
99
+ # @return [Fixnum] Hash code
100
+ def hash
101
+ [errors, changes, cursor].hash
102
+ end
103
+
104
+ # Builds the object from hash
105
+ # @param [Hash] attributes Model attributes in the form of hash
106
+ # @return [Object] Returns the model itself
107
+ def build_from_hash(attributes)
108
+ return nil unless attributes.is_a?(Hash)
109
+ self.class.swagger_types.each_pair do |key, type|
110
+ if type =~ /\AArray<(.*)>/i
111
+ # check to ensure the input is an array given that the the attribute
112
+ # is documented as an array but the input is not
113
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
114
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
115
+ end
116
+ elsif !attributes[self.class.attribute_map[key]].nil?
117
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
118
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
119
+ end
120
+
121
+ self
122
+ end
123
+
124
+ # Deserializes the data based on type
125
+ # @param string type Data type
126
+ # @param string value Value to be deserialized
127
+ # @return [Object] Deserialized data
128
+ def _deserialize(type, value)
129
+ case type.to_sym
130
+ when :DateTime
131
+ DateTime.parse(value)
132
+ when :Date
133
+ Date.parse(value)
134
+ when :String
135
+ value.to_s
136
+ when :Integer
137
+ value.to_i
138
+ when :Float
139
+ value.to_f
140
+ when :BOOLEAN
141
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
142
+ true
143
+ else
144
+ false
145
+ end
146
+ when :Object
147
+ # generic object (usually a Hash), return directly
148
+ value
149
+ when /\AArray<(?<inner_type>.+)>\z/
150
+ inner_type = Regexp.last_match[:inner_type]
151
+ value.map { |v| _deserialize(inner_type, v) }
152
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
153
+ k_type = Regexp.last_match[:k_type]
154
+ v_type = Regexp.last_match[:v_type]
155
+ {}.tap do |hash|
156
+ value.each do |k, v|
157
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
158
+ end
159
+ end
160
+ else # model
161
+ temp_model = SquareConnect.const_get(type).new
162
+ temp_model.build_from_hash(value)
163
+ end
164
+ end
165
+
166
+ # Returns the string representation of the object
167
+ # @return [String] String presentation of the object
168
+ def to_s
169
+ to_hash.to_s
170
+ end
171
+
172
+ # to_body is an alias to to_hash (backward compatibility)
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_body
175
+ to_hash
176
+ end
177
+
178
+ # Returns the object in the form of hash
179
+ # @return [Hash] Returns the object in the form of hash
180
+ def to_hash
181
+ hash = {}
182
+ self.class.attribute_map.each_pair do |attr, param|
183
+ value = self.send(attr)
184
+ next if value.nil?
185
+ hash[param] = _to_hash(value)
186
+ end
187
+ hash
188
+ end
189
+
190
+ # Outputs non-array value in the form of hash
191
+ # For object, use to_hash. Otherwise, just return the value
192
+ # @param [Object] value Any valid value
193
+ # @return [Hash] Returns the value in the form of hash
194
+ def _to_hash(value)
195
+ if value.is_a?(Array)
196
+ value.compact.map{ |v| _to_hash(v) }
197
+ elsif value.is_a?(Hash)
198
+ {}.tap do |hash|
199
+ value.each { |k, v| hash[k] = _to_hash(v) }
200
+ end
201
+ elsif value.respond_to? :to_hash
202
+ value.to_hash
203
+ else
204
+ value
205
+ end
206
+ end
207
+
208
+ end
209
+
210
+ end