square_connect 2.20181212.0.267 → 2.20190213.0.274
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +21 -0
- data/README.md +8 -1
- data/docs/CardBrand.md +1 -1
- data/docs/CatalogCategory.md +1 -1
- data/docs/CatalogDiscount.md +2 -2
- data/docs/CatalogItem.md +4 -4
- data/docs/CatalogItemVariation.md +2 -2
- data/docs/CatalogModifier.md +1 -1
- data/docs/CatalogModifierList.md +1 -1
- data/docs/CatalogObject.md +1 -1
- data/docs/CatalogObjectType.md +1 -1
- data/docs/CatalogTax.md +1 -1
- data/docs/CheckoutApi.md +1 -1
- data/docs/CreateOrderRequest.md +5 -4
- data/docs/CreateOrderRequestDiscount.md +1 -1
- data/docs/CreateOrderRequestLineItem.md +1 -1
- data/docs/CreateOrderRequestModifier.md +1 -1
- data/docs/CreateOrderRequestTax.md +1 -1
- data/docs/ErrorCode.md +1 -0
- data/docs/Order.md +4 -1
- data/docs/OrderFulfillment.md +14 -0
- data/docs/OrderFulfillmentPickupDetails.md +27 -0
- data/docs/OrderFulfillmentPickupDetailsScheduleType.md +13 -0
- data/docs/OrderFulfillmentRecipient.md +15 -0
- data/docs/OrderFulfillmentState.md +17 -0
- data/docs/OrderFulfillmentType.md +12 -0
- data/docs/OrderLineItem.md +2 -2
- data/docs/OrderLineItemDiscount.md +1 -1
- data/docs/OrderLineItemTax.md +1 -0
- data/docs/OrderLineItemTaxScope.md +14 -0
- data/docs/V1Timecard.md +1 -1
- 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 +3 -3
- data/lib/square_connect/api/customers_api.rb +8 -8
- data/lib/square_connect/api/inventory_api.rb +7 -7
- 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 +2 -2
- data/lib/square_connect/api/reporting_api.rb +2 -2
- data/lib/square_connect/api/transactions_api.rb +7 -7
- data/lib/square_connect/api_client.rb +1 -1
- data/lib/square_connect/models/catalog_category.rb +1 -1
- data/lib/square_connect/models/catalog_discount.rb +2 -2
- data/lib/square_connect/models/catalog_item.rb +4 -4
- data/lib/square_connect/models/catalog_item_variation.rb +2 -2
- data/lib/square_connect/models/catalog_modifier.rb +1 -1
- data/lib/square_connect/models/catalog_modifier_list.rb +1 -1
- data/lib/square_connect/models/catalog_object.rb +1 -1
- data/lib/square_connect/models/catalog_tax.rb +1 -1
- data/lib/square_connect/models/create_order_request.rb +15 -10
- data/lib/square_connect/models/create_order_request_discount.rb +1 -1
- data/lib/square_connect/models/create_order_request_line_item.rb +1 -1
- data/lib/square_connect/models/create_order_request_modifier.rb +1 -1
- data/lib/square_connect/models/create_order_request_tax.rb +1 -1
- data/lib/square_connect/models/error.rb +2 -2
- data/lib/square_connect/models/error_code.rb +1 -0
- data/lib/square_connect/models/order.rb +38 -7
- data/lib/square_connect/models/order_fulfillment.rb +251 -0
- data/lib/square_connect/models/order_fulfillment_pickup_details.rb +401 -0
- data/lib/square_connect/models/order_fulfillment_pickup_details_schedule_type.rb +19 -0
- data/lib/square_connect/models/order_fulfillment_recipient.rb +264 -0
- data/lib/square_connect/models/order_fulfillment_state.rb +23 -0
- data/lib/square_connect/models/order_fulfillment_type.rb +18 -0
- data/lib/square_connect/models/order_line_item.rb +2 -2
- data/lib/square_connect/models/order_line_item_discount.rb +1 -1
- data/lib/square_connect/models/order_line_item_tax.rb +26 -4
- data/lib/square_connect/models/order_line_item_tax_scope.rb +20 -0
- data/lib/square_connect/models/v1_timecard.rb +1 -1
- data/lib/square_connect/version.rb +1 -1
- data/lib/square_connect.rb +7 -0
- data/spec/api/checkout_api_spec.rb +1 -1
- data/spec/models/order_fulfillment_pickup_details_schedule_type_spec.rb +33 -0
- data/spec/models/order_fulfillment_pickup_details_spec.rb +133 -0
- data/spec/models/order_fulfillment_recipient_spec.rb +57 -0
- data/spec/models/order_fulfillment_spec.rb +59 -0
- data/spec/models/order_fulfillment_state_spec.rb +33 -0
- data/spec/models/order_fulfillment_type_spec.rb +33 -0
- data/spec/models/order_line_item_tax_scope_spec.rb +33 -0
- metadata +31 -4
@@ -0,0 +1,401 @@
|
|
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
|
+
# Contains details necessary to fulfill a pickup order.
|
14
|
+
class OrderFulfillmentPickupDetails
|
15
|
+
# The recipient of this pickup fulfillment.
|
16
|
+
attr_accessor :recipient
|
17
|
+
|
18
|
+
# The expiry [timestamp](#workingwithdates) in RFC 3339 format, e.g., \"2016-09-04T23:59:33.123Z\". This timestamp indicates when the pickup fulfillment will expire if it is not accepted by the merchant. Expiration time can only be set up to 7 days in the future. If not set, this pickup fulfillment will be automatically accepted when placed.
|
19
|
+
attr_accessor :expires_at
|
20
|
+
|
21
|
+
# The auto completion duration in RFC3339 duration format, e.g., \"P1W3D\". If set, an open and accepted pickup fulfillment will automatically move to the `COMPLETED` state after this period of time. If not set, this pickup fulfillment will remain accepted until it is canceled or completed.
|
22
|
+
attr_accessor :auto_complete_duration
|
23
|
+
|
24
|
+
# The schedule type of the pickup fulfillment. Defaults to `SCHEDULED`.
|
25
|
+
attr_accessor :schedule_type
|
26
|
+
|
27
|
+
# The pickup [timestamp](#workingwithdates) in RFC3339 timestamp format, e.g., \"2016-09-04T23:59:33.123Z\". For fulfillments with the schedule type `ASAP`, this is automatically set to the current time plus the expected duration to prepare the fulfillment. This represents the start of the pickup window.
|
28
|
+
attr_accessor :pickup_at
|
29
|
+
|
30
|
+
# The pickup window duration in RFC3339 duration format, e.g., \"P1W3D\". This duration represents the window of time for which the order should be picked up after the `pickup_at` time. Can be used as an informational guideline for merchants.
|
31
|
+
attr_accessor :pickup_window_duration
|
32
|
+
|
33
|
+
# The preparation time duration in RFC3339 duration format, e.g., \"P1W3D\". This duration indicates how long it takes the merchant to prepare this fulfillment.
|
34
|
+
attr_accessor :prep_time_duration
|
35
|
+
|
36
|
+
# A general note about the pickup fulfillment. Notes are useful for providing additional instructions and are displayed in Square apps.
|
37
|
+
attr_accessor :note
|
38
|
+
|
39
|
+
# The [timestamp](#workingwithdates) in RFC3339 timestamp format, e.g., \"2016-09-04T23:59:33.123Z\", indicating when the fulfillment was placed.
|
40
|
+
attr_accessor :placed_at
|
41
|
+
|
42
|
+
# The [timestamp](#workingwithdates) in RFC3339 timestamp format, e.g., \"2016-09-04T23:59:33.123Z\", indicating when the fulfillment was accepted by the merchant.
|
43
|
+
attr_accessor :accepted_at
|
44
|
+
|
45
|
+
# The [timestamp](#workingwithdates) in RFC3339 timestamp format, e.g., \"2016-09-04T23:59:33.123Z\", indicating when the fulfillment was rejected.
|
46
|
+
attr_accessor :rejected_at
|
47
|
+
|
48
|
+
# The [timestamp](#workingwithdates) in RFC3339 timestamp format, e.g., \"2016-09-04T23:59:33.123Z\", indicating when the merchant set the fulfillment as ready for pickup.
|
49
|
+
attr_accessor :ready_at
|
50
|
+
|
51
|
+
# The [timestamp](#workingwithdates) in RFC3339 timestamp format, e.g., \"2016-09-04T23:59:33.123Z\", indicating when the fulfillment expired.
|
52
|
+
attr_accessor :expired_at
|
53
|
+
|
54
|
+
# The [timestamp](#workingwithdates) in RFC3339 timestamp format, e.g., \"2016-09-04T23:59:33.123Z\", indicating when the fulfillment was picked up by the recipient.
|
55
|
+
attr_accessor :picked_up_at
|
56
|
+
|
57
|
+
# The [timestamp](#workingwithdates) in RFC3339 timestamp format, e.g., \"2016-09-04T23:59:33.123Z\", indicating when the fulfillment was canceled by the merchant or buyer.
|
58
|
+
attr_accessor :canceled_at
|
59
|
+
|
60
|
+
# A description of why the pickup was canceled. Max length is 100 characters.
|
61
|
+
attr_accessor :cancel_reason
|
62
|
+
|
63
|
+
class EnumAttributeValidator
|
64
|
+
attr_reader :datatype
|
65
|
+
attr_reader :allowable_values
|
66
|
+
|
67
|
+
def initialize(datatype, allowable_values)
|
68
|
+
@allowable_values = allowable_values.map do |value|
|
69
|
+
case datatype.to_s
|
70
|
+
when /Integer/i
|
71
|
+
value.to_i
|
72
|
+
when /Float/i
|
73
|
+
value.to_f
|
74
|
+
else
|
75
|
+
value
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def valid?(value)
|
81
|
+
!value || allowable_values.include?(value)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
86
|
+
def self.attribute_map
|
87
|
+
{
|
88
|
+
:'recipient' => :'recipient',
|
89
|
+
:'expires_at' => :'expires_at',
|
90
|
+
:'auto_complete_duration' => :'auto_complete_duration',
|
91
|
+
:'schedule_type' => :'schedule_type',
|
92
|
+
:'pickup_at' => :'pickup_at',
|
93
|
+
:'pickup_window_duration' => :'pickup_window_duration',
|
94
|
+
:'prep_time_duration' => :'prep_time_duration',
|
95
|
+
:'note' => :'note',
|
96
|
+
:'placed_at' => :'placed_at',
|
97
|
+
:'accepted_at' => :'accepted_at',
|
98
|
+
:'rejected_at' => :'rejected_at',
|
99
|
+
:'ready_at' => :'ready_at',
|
100
|
+
:'expired_at' => :'expired_at',
|
101
|
+
:'picked_up_at' => :'picked_up_at',
|
102
|
+
:'canceled_at' => :'canceled_at',
|
103
|
+
:'cancel_reason' => :'cancel_reason'
|
104
|
+
}
|
105
|
+
end
|
106
|
+
|
107
|
+
# Attribute type mapping.
|
108
|
+
def self.swagger_types
|
109
|
+
{
|
110
|
+
:'recipient' => :'OrderFulfillmentRecipient',
|
111
|
+
:'expires_at' => :'String',
|
112
|
+
:'auto_complete_duration' => :'String',
|
113
|
+
:'schedule_type' => :'String',
|
114
|
+
:'pickup_at' => :'String',
|
115
|
+
:'pickup_window_duration' => :'String',
|
116
|
+
:'prep_time_duration' => :'String',
|
117
|
+
:'note' => :'String',
|
118
|
+
:'placed_at' => :'String',
|
119
|
+
:'accepted_at' => :'String',
|
120
|
+
:'rejected_at' => :'String',
|
121
|
+
:'ready_at' => :'String',
|
122
|
+
:'expired_at' => :'String',
|
123
|
+
:'picked_up_at' => :'String',
|
124
|
+
:'canceled_at' => :'String',
|
125
|
+
:'cancel_reason' => :'String'
|
126
|
+
}
|
127
|
+
end
|
128
|
+
|
129
|
+
# Initializes the object
|
130
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
131
|
+
def initialize(attributes = {})
|
132
|
+
return unless attributes.is_a?(Hash)
|
133
|
+
|
134
|
+
# convert string to symbol for hash key
|
135
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
136
|
+
|
137
|
+
if attributes.has_key?(:'recipient')
|
138
|
+
self.recipient = attributes[:'recipient']
|
139
|
+
end
|
140
|
+
|
141
|
+
if attributes.has_key?(:'expires_at')
|
142
|
+
self.expires_at = attributes[:'expires_at']
|
143
|
+
end
|
144
|
+
|
145
|
+
if attributes.has_key?(:'auto_complete_duration')
|
146
|
+
self.auto_complete_duration = attributes[:'auto_complete_duration']
|
147
|
+
end
|
148
|
+
|
149
|
+
if attributes.has_key?(:'schedule_type')
|
150
|
+
self.schedule_type = attributes[:'schedule_type']
|
151
|
+
end
|
152
|
+
|
153
|
+
if attributes.has_key?(:'pickup_at')
|
154
|
+
self.pickup_at = attributes[:'pickup_at']
|
155
|
+
end
|
156
|
+
|
157
|
+
if attributes.has_key?(:'pickup_window_duration')
|
158
|
+
self.pickup_window_duration = attributes[:'pickup_window_duration']
|
159
|
+
end
|
160
|
+
|
161
|
+
if attributes.has_key?(:'prep_time_duration')
|
162
|
+
self.prep_time_duration = attributes[:'prep_time_duration']
|
163
|
+
end
|
164
|
+
|
165
|
+
if attributes.has_key?(:'note')
|
166
|
+
self.note = attributes[:'note']
|
167
|
+
end
|
168
|
+
|
169
|
+
if attributes.has_key?(:'placed_at')
|
170
|
+
self.placed_at = attributes[:'placed_at']
|
171
|
+
end
|
172
|
+
|
173
|
+
if attributes.has_key?(:'accepted_at')
|
174
|
+
self.accepted_at = attributes[:'accepted_at']
|
175
|
+
end
|
176
|
+
|
177
|
+
if attributes.has_key?(:'rejected_at')
|
178
|
+
self.rejected_at = attributes[:'rejected_at']
|
179
|
+
end
|
180
|
+
|
181
|
+
if attributes.has_key?(:'ready_at')
|
182
|
+
self.ready_at = attributes[:'ready_at']
|
183
|
+
end
|
184
|
+
|
185
|
+
if attributes.has_key?(:'expired_at')
|
186
|
+
self.expired_at = attributes[:'expired_at']
|
187
|
+
end
|
188
|
+
|
189
|
+
if attributes.has_key?(:'picked_up_at')
|
190
|
+
self.picked_up_at = attributes[:'picked_up_at']
|
191
|
+
end
|
192
|
+
|
193
|
+
if attributes.has_key?(:'canceled_at')
|
194
|
+
self.canceled_at = attributes[:'canceled_at']
|
195
|
+
end
|
196
|
+
|
197
|
+
if attributes.has_key?(:'cancel_reason')
|
198
|
+
self.cancel_reason = attributes[:'cancel_reason']
|
199
|
+
end
|
200
|
+
|
201
|
+
end
|
202
|
+
|
203
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
204
|
+
# @return Array for valid properies with the reasons
|
205
|
+
def list_invalid_properties
|
206
|
+
invalid_properties = Array.new
|
207
|
+
if !@note.nil? && @note.to_s.length > 500
|
208
|
+
invalid_properties.push("invalid value for 'note', the character length must be smaller than or equal to 500.")
|
209
|
+
end
|
210
|
+
|
211
|
+
if !@cancel_reason.nil? && @cancel_reason.to_s.length > 100
|
212
|
+
invalid_properties.push("invalid value for 'cancel_reason', the character length must be smaller than or equal to 100.")
|
213
|
+
end
|
214
|
+
|
215
|
+
return invalid_properties
|
216
|
+
end
|
217
|
+
|
218
|
+
# Check to see if the all the properties in the model are valid
|
219
|
+
# @return true if the model is valid
|
220
|
+
def valid?
|
221
|
+
schedule_type_validator = EnumAttributeValidator.new('String', ["SCHEDULED", "ASAP"])
|
222
|
+
return false unless schedule_type_validator.valid?(@schedule_type)
|
223
|
+
return false if !@note.nil? && @note.to_s.length > 500
|
224
|
+
return false if !@cancel_reason.nil? && @cancel_reason.to_s.length > 100
|
225
|
+
return true
|
226
|
+
end
|
227
|
+
|
228
|
+
# Custom attribute writer method checking allowed values (enum).
|
229
|
+
# @param [Object] schedule_type Object to be assigned
|
230
|
+
def schedule_type=(schedule_type)
|
231
|
+
validator = EnumAttributeValidator.new('String', ["SCHEDULED", "ASAP"])
|
232
|
+
unless validator.valid?(schedule_type)
|
233
|
+
fail ArgumentError, "invalid value for 'schedule_type', must be one of #{validator.allowable_values}."
|
234
|
+
end
|
235
|
+
@schedule_type = schedule_type
|
236
|
+
end
|
237
|
+
|
238
|
+
# Custom attribute writer method with validation
|
239
|
+
# @param [Object] note Value to be assigned
|
240
|
+
def note=(note)
|
241
|
+
|
242
|
+
if !note.nil? && note.to_s.length > 500
|
243
|
+
fail ArgumentError, "invalid value for 'note', the character length must be smaller than or equal to 500."
|
244
|
+
end
|
245
|
+
|
246
|
+
@note = note
|
247
|
+
end
|
248
|
+
|
249
|
+
# Custom attribute writer method with validation
|
250
|
+
# @param [Object] cancel_reason Value to be assigned
|
251
|
+
def cancel_reason=(cancel_reason)
|
252
|
+
|
253
|
+
if !cancel_reason.nil? && cancel_reason.to_s.length > 100
|
254
|
+
fail ArgumentError, "invalid value for 'cancel_reason', the character length must be smaller than or equal to 100."
|
255
|
+
end
|
256
|
+
|
257
|
+
@cancel_reason = cancel_reason
|
258
|
+
end
|
259
|
+
|
260
|
+
# Checks equality by comparing each attribute.
|
261
|
+
# @param [Object] Object to be compared
|
262
|
+
def ==(o)
|
263
|
+
return true if self.equal?(o)
|
264
|
+
self.class == o.class &&
|
265
|
+
recipient == o.recipient &&
|
266
|
+
expires_at == o.expires_at &&
|
267
|
+
auto_complete_duration == o.auto_complete_duration &&
|
268
|
+
schedule_type == o.schedule_type &&
|
269
|
+
pickup_at == o.pickup_at &&
|
270
|
+
pickup_window_duration == o.pickup_window_duration &&
|
271
|
+
prep_time_duration == o.prep_time_duration &&
|
272
|
+
note == o.note &&
|
273
|
+
placed_at == o.placed_at &&
|
274
|
+
accepted_at == o.accepted_at &&
|
275
|
+
rejected_at == o.rejected_at &&
|
276
|
+
ready_at == o.ready_at &&
|
277
|
+
expired_at == o.expired_at &&
|
278
|
+
picked_up_at == o.picked_up_at &&
|
279
|
+
canceled_at == o.canceled_at &&
|
280
|
+
cancel_reason == o.cancel_reason
|
281
|
+
end
|
282
|
+
|
283
|
+
# @see the `==` method
|
284
|
+
# @param [Object] Object to be compared
|
285
|
+
def eql?(o)
|
286
|
+
self == o
|
287
|
+
end
|
288
|
+
|
289
|
+
# Calculates hash code according to all attributes.
|
290
|
+
# @return [Fixnum] Hash code
|
291
|
+
def hash
|
292
|
+
[recipient, expires_at, auto_complete_duration, schedule_type, pickup_at, pickup_window_duration, prep_time_duration, note, placed_at, accepted_at, rejected_at, ready_at, expired_at, picked_up_at, canceled_at, cancel_reason].hash
|
293
|
+
end
|
294
|
+
|
295
|
+
# Builds the object from hash
|
296
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
297
|
+
# @return [Object] Returns the model itself
|
298
|
+
def build_from_hash(attributes)
|
299
|
+
return nil unless attributes.is_a?(Hash)
|
300
|
+
self.class.swagger_types.each_pair do |key, type|
|
301
|
+
if type =~ /\AArray<(.*)>/i
|
302
|
+
# check to ensure the input is an array given that the the attribute
|
303
|
+
# is documented as an array but the input is not
|
304
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
305
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
306
|
+
end
|
307
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
308
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
309
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
310
|
+
end
|
311
|
+
|
312
|
+
self
|
313
|
+
end
|
314
|
+
|
315
|
+
# Deserializes the data based on type
|
316
|
+
# @param string type Data type
|
317
|
+
# @param string value Value to be deserialized
|
318
|
+
# @return [Object] Deserialized data
|
319
|
+
def _deserialize(type, value)
|
320
|
+
case type.to_sym
|
321
|
+
when :DateTime
|
322
|
+
DateTime.parse(value)
|
323
|
+
when :Date
|
324
|
+
Date.parse(value)
|
325
|
+
when :String
|
326
|
+
value.to_s
|
327
|
+
when :Integer
|
328
|
+
value.to_i
|
329
|
+
when :Float
|
330
|
+
value.to_f
|
331
|
+
when :BOOLEAN
|
332
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
333
|
+
true
|
334
|
+
else
|
335
|
+
false
|
336
|
+
end
|
337
|
+
when :Object
|
338
|
+
# generic object (usually a Hash), return directly
|
339
|
+
value
|
340
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
341
|
+
inner_type = Regexp.last_match[:inner_type]
|
342
|
+
value.map { |v| _deserialize(inner_type, v) }
|
343
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
344
|
+
k_type = Regexp.last_match[:k_type]
|
345
|
+
v_type = Regexp.last_match[:v_type]
|
346
|
+
{}.tap do |hash|
|
347
|
+
value.each do |k, v|
|
348
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
349
|
+
end
|
350
|
+
end
|
351
|
+
else # model
|
352
|
+
temp_model = SquareConnect.const_get(type).new
|
353
|
+
temp_model.build_from_hash(value)
|
354
|
+
end
|
355
|
+
end
|
356
|
+
|
357
|
+
# Returns the string representation of the object
|
358
|
+
# @return [String] String presentation of the object
|
359
|
+
def to_s
|
360
|
+
to_hash.to_s
|
361
|
+
end
|
362
|
+
|
363
|
+
# to_body is an alias to to_hash (backward compatibility)
|
364
|
+
# @return [Hash] Returns the object in the form of hash
|
365
|
+
def to_body
|
366
|
+
to_hash
|
367
|
+
end
|
368
|
+
|
369
|
+
# Returns the object in the form of hash
|
370
|
+
# @return [Hash] Returns the object in the form of hash
|
371
|
+
def to_hash
|
372
|
+
hash = {}
|
373
|
+
self.class.attribute_map.each_pair do |attr, param|
|
374
|
+
value = self.send(attr)
|
375
|
+
next if value.nil?
|
376
|
+
hash[param] = _to_hash(value)
|
377
|
+
end
|
378
|
+
hash
|
379
|
+
end
|
380
|
+
|
381
|
+
# Outputs non-array value in the form of hash
|
382
|
+
# For object, use to_hash. Otherwise, just return the value
|
383
|
+
# @param [Object] value Any valid value
|
384
|
+
# @return [Hash] Returns the value in the form of hash
|
385
|
+
def _to_hash(value)
|
386
|
+
if value.is_a?(Array)
|
387
|
+
value.compact.map{ |v| _to_hash(v) }
|
388
|
+
elsif value.is_a?(Hash)
|
389
|
+
{}.tap do |hash|
|
390
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
391
|
+
end
|
392
|
+
elsif value.respond_to? :to_hash
|
393
|
+
value.to_hash
|
394
|
+
else
|
395
|
+
value
|
396
|
+
end
|
397
|
+
end
|
398
|
+
|
399
|
+
end
|
400
|
+
|
401
|
+
end
|
@@ -0,0 +1,19 @@
|
|
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 OrderFulfillmentPickupDetailsScheduleType
|
14
|
+
|
15
|
+
SCHEDULED = "SCHEDULED".freeze
|
16
|
+
ASAP = "ASAP".freeze
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,264 @@
|
|
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
|
+
# The recipient of a fulfillment.
|
14
|
+
class OrderFulfillmentRecipient
|
15
|
+
# The Customer ID of the customer associated with the fulfillment. If customer_id is provided, the corresponding recipient information fields (`display_name`, `email_address`, and `phone_number`) are automatically populated from the relevant customer profile. If the targeted profile information does not contain the necessary required information, the request will result in an error.
|
16
|
+
attr_accessor :customer_id
|
17
|
+
|
18
|
+
# The display name of the fulfillment recipient. If provided, overrides the value from customer profile indicated by customer_id.
|
19
|
+
attr_accessor :display_name
|
20
|
+
|
21
|
+
# The email address of the fulfillment recipient. If provided, overrides the value from customer profile indicated by customer_id.
|
22
|
+
attr_accessor :email_address
|
23
|
+
|
24
|
+
# The phone number of the fulfillment recipient. If provided, overrides the value from customer profile indicated by customer_id.
|
25
|
+
attr_accessor :phone_number
|
26
|
+
|
27
|
+
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
+
def self.attribute_map
|
30
|
+
{
|
31
|
+
:'customer_id' => :'customer_id',
|
32
|
+
:'display_name' => :'display_name',
|
33
|
+
:'email_address' => :'email_address',
|
34
|
+
:'phone_number' => :'phone_number'
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
# Attribute type mapping.
|
39
|
+
def self.swagger_types
|
40
|
+
{
|
41
|
+
:'customer_id' => :'String',
|
42
|
+
:'display_name' => :'String',
|
43
|
+
:'email_address' => :'String',
|
44
|
+
:'phone_number' => :'String'
|
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?(:'customer_id')
|
57
|
+
self.customer_id = attributes[:'customer_id']
|
58
|
+
end
|
59
|
+
|
60
|
+
if attributes.has_key?(:'display_name')
|
61
|
+
self.display_name = attributes[:'display_name']
|
62
|
+
end
|
63
|
+
|
64
|
+
if attributes.has_key?(:'email_address')
|
65
|
+
self.email_address = attributes[:'email_address']
|
66
|
+
end
|
67
|
+
|
68
|
+
if attributes.has_key?(:'phone_number')
|
69
|
+
self.phone_number = attributes[:'phone_number']
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
75
|
+
# @return Array for valid properies with the reasons
|
76
|
+
def list_invalid_properties
|
77
|
+
invalid_properties = Array.new
|
78
|
+
if !@display_name.nil? && @display_name.to_s.length > 255
|
79
|
+
invalid_properties.push("invalid value for 'display_name', the character length must be smaller than or equal to 255.")
|
80
|
+
end
|
81
|
+
|
82
|
+
if !@email_address.nil? && @email_address.to_s.length > 255
|
83
|
+
invalid_properties.push("invalid value for 'email_address', the character length must be smaller than or equal to 255.")
|
84
|
+
end
|
85
|
+
|
86
|
+
if !@phone_number.nil? && @phone_number.to_s.length > 16
|
87
|
+
invalid_properties.push("invalid value for 'phone_number', the character length must be smaller than or equal to 16.")
|
88
|
+
end
|
89
|
+
|
90
|
+
return invalid_properties
|
91
|
+
end
|
92
|
+
|
93
|
+
# Check to see if the all the properties in the model are valid
|
94
|
+
# @return true if the model is valid
|
95
|
+
def valid?
|
96
|
+
return false if !@display_name.nil? && @display_name.to_s.length > 255
|
97
|
+
return false if !@email_address.nil? && @email_address.to_s.length > 255
|
98
|
+
return false if !@phone_number.nil? && @phone_number.to_s.length > 16
|
99
|
+
return true
|
100
|
+
end
|
101
|
+
|
102
|
+
# Custom attribute writer method with validation
|
103
|
+
# @param [Object] display_name Value to be assigned
|
104
|
+
def display_name=(display_name)
|
105
|
+
|
106
|
+
if !display_name.nil? && display_name.to_s.length > 255
|
107
|
+
fail ArgumentError, "invalid value for 'display_name', the character length must be smaller than or equal to 255."
|
108
|
+
end
|
109
|
+
|
110
|
+
@display_name = display_name
|
111
|
+
end
|
112
|
+
|
113
|
+
# Custom attribute writer method with validation
|
114
|
+
# @param [Object] email_address Value to be assigned
|
115
|
+
def email_address=(email_address)
|
116
|
+
|
117
|
+
if !email_address.nil? && email_address.to_s.length > 255
|
118
|
+
fail ArgumentError, "invalid value for 'email_address', the character length must be smaller than or equal to 255."
|
119
|
+
end
|
120
|
+
|
121
|
+
@email_address = email_address
|
122
|
+
end
|
123
|
+
|
124
|
+
# Custom attribute writer method with validation
|
125
|
+
# @param [Object] phone_number Value to be assigned
|
126
|
+
def phone_number=(phone_number)
|
127
|
+
|
128
|
+
if !phone_number.nil? && phone_number.to_s.length > 16
|
129
|
+
fail ArgumentError, "invalid value for 'phone_number', the character length must be smaller than or equal to 16."
|
130
|
+
end
|
131
|
+
|
132
|
+
@phone_number = phone_number
|
133
|
+
end
|
134
|
+
|
135
|
+
# Checks equality by comparing each attribute.
|
136
|
+
# @param [Object] Object to be compared
|
137
|
+
def ==(o)
|
138
|
+
return true if self.equal?(o)
|
139
|
+
self.class == o.class &&
|
140
|
+
customer_id == o.customer_id &&
|
141
|
+
display_name == o.display_name &&
|
142
|
+
email_address == o.email_address &&
|
143
|
+
phone_number == o.phone_number
|
144
|
+
end
|
145
|
+
|
146
|
+
# @see the `==` method
|
147
|
+
# @param [Object] Object to be compared
|
148
|
+
def eql?(o)
|
149
|
+
self == o
|
150
|
+
end
|
151
|
+
|
152
|
+
# Calculates hash code according to all attributes.
|
153
|
+
# @return [Fixnum] Hash code
|
154
|
+
def hash
|
155
|
+
[customer_id, display_name, email_address, phone_number].hash
|
156
|
+
end
|
157
|
+
|
158
|
+
# Builds the object from hash
|
159
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
160
|
+
# @return [Object] Returns the model itself
|
161
|
+
def build_from_hash(attributes)
|
162
|
+
return nil unless attributes.is_a?(Hash)
|
163
|
+
self.class.swagger_types.each_pair do |key, type|
|
164
|
+
if type =~ /\AArray<(.*)>/i
|
165
|
+
# check to ensure the input is an array given that the the attribute
|
166
|
+
# is documented as an array but the input is not
|
167
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
168
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
169
|
+
end
|
170
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
171
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
172
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
173
|
+
end
|
174
|
+
|
175
|
+
self
|
176
|
+
end
|
177
|
+
|
178
|
+
# Deserializes the data based on type
|
179
|
+
# @param string type Data type
|
180
|
+
# @param string value Value to be deserialized
|
181
|
+
# @return [Object] Deserialized data
|
182
|
+
def _deserialize(type, value)
|
183
|
+
case type.to_sym
|
184
|
+
when :DateTime
|
185
|
+
DateTime.parse(value)
|
186
|
+
when :Date
|
187
|
+
Date.parse(value)
|
188
|
+
when :String
|
189
|
+
value.to_s
|
190
|
+
when :Integer
|
191
|
+
value.to_i
|
192
|
+
when :Float
|
193
|
+
value.to_f
|
194
|
+
when :BOOLEAN
|
195
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
196
|
+
true
|
197
|
+
else
|
198
|
+
false
|
199
|
+
end
|
200
|
+
when :Object
|
201
|
+
# generic object (usually a Hash), return directly
|
202
|
+
value
|
203
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
204
|
+
inner_type = Regexp.last_match[:inner_type]
|
205
|
+
value.map { |v| _deserialize(inner_type, v) }
|
206
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
207
|
+
k_type = Regexp.last_match[:k_type]
|
208
|
+
v_type = Regexp.last_match[:v_type]
|
209
|
+
{}.tap do |hash|
|
210
|
+
value.each do |k, v|
|
211
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
212
|
+
end
|
213
|
+
end
|
214
|
+
else # model
|
215
|
+
temp_model = SquareConnect.const_get(type).new
|
216
|
+
temp_model.build_from_hash(value)
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
# Returns the string representation of the object
|
221
|
+
# @return [String] String presentation of the object
|
222
|
+
def to_s
|
223
|
+
to_hash.to_s
|
224
|
+
end
|
225
|
+
|
226
|
+
# to_body is an alias to to_hash (backward compatibility)
|
227
|
+
# @return [Hash] Returns the object in the form of hash
|
228
|
+
def to_body
|
229
|
+
to_hash
|
230
|
+
end
|
231
|
+
|
232
|
+
# Returns the object in the form of hash
|
233
|
+
# @return [Hash] Returns the object in the form of hash
|
234
|
+
def to_hash
|
235
|
+
hash = {}
|
236
|
+
self.class.attribute_map.each_pair do |attr, param|
|
237
|
+
value = self.send(attr)
|
238
|
+
next if value.nil?
|
239
|
+
hash[param] = _to_hash(value)
|
240
|
+
end
|
241
|
+
hash
|
242
|
+
end
|
243
|
+
|
244
|
+
# Outputs non-array value in the form of hash
|
245
|
+
# For object, use to_hash. Otherwise, just return the value
|
246
|
+
# @param [Object] value Any valid value
|
247
|
+
# @return [Hash] Returns the value in the form of hash
|
248
|
+
def _to_hash(value)
|
249
|
+
if value.is_a?(Array)
|
250
|
+
value.compact.map{ |v| _to_hash(v) }
|
251
|
+
elsif value.is_a?(Hash)
|
252
|
+
{}.tap do |hash|
|
253
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
254
|
+
end
|
255
|
+
elsif value.respond_to? :to_hash
|
256
|
+
value.to_hash
|
257
|
+
else
|
258
|
+
value
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
end
|
263
|
+
|
264
|
+
end
|