zippendo 1.2.4 → 1.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/docs/CreateOrderChannelRequest.md +26 -0
  3. data/docs/CreateOrderChannelRequestSettings.md +42 -0
  4. data/docs/CreateOrderChannelRequestSettingsShippingMethodMappingsInner.md +22 -0
  5. data/docs/CreateOrderChannelWebhookSecret201Response.md +22 -0
  6. data/docs/CreateOrderRequest.md +4 -0
  7. data/docs/GetOrderChannelWebhookStatus200Response.md +22 -0
  8. data/docs/GetOrderChannelWebhookStatus200ResponseWebhooksInner.md +28 -0
  9. data/docs/ListOrderChannels200Response.md +26 -0
  10. data/docs/ListOrderChannels200ResponseDataInner.md +44 -0
  11. data/docs/ListOrderChannels200ResponseDataInnerSettings.md +50 -0
  12. data/docs/ListOrderChannels200ResponseDataInnerSettingsShippingMethodMappingsInner.md +22 -0
  13. data/docs/OrderChannelsApi.md +599 -0
  14. data/docs/RevokeOrderChannelWebhookSecret200Response.md +18 -0
  15. data/docs/UpdateOrderChannelRequest.md +28 -0
  16. data/docs/UpdateOrderChannelRequestSettings.md +42 -0
  17. data/docs/UpdateOrgRequest.md +0 -2
  18. data/lib/zippendo/api/order_channels_api.rb +629 -0
  19. data/lib/zippendo/models/batch_send_shipments200_response_results_inner.rb +2 -2
  20. data/lib/zippendo/models/create_order_channel_request.rb +266 -0
  21. data/lib/zippendo/models/create_order_channel_request_settings.rb +359 -0
  22. data/lib/zippendo/models/create_order_channel_request_settings_shipping_method_mappings_inner.rb +254 -0
  23. data/lib/zippendo/models/create_order_channel_webhook_secret201_response.rb +230 -0
  24. data/lib/zippendo/models/create_order_request.rb +23 -1
  25. data/lib/zippendo/models/get_order_channel_webhook_status200_response.rb +221 -0
  26. data/lib/zippendo/models/get_order_channel_webhook_status200_response_webhooks_inner.rb +266 -0
  27. data/lib/zippendo/models/list_api_tokens401_response.rb +2 -2
  28. data/lib/zippendo/models/list_order_channels200_response.rb +275 -0
  29. data/lib/zippendo/models/list_order_channels200_response_data_inner.rb +478 -0
  30. data/lib/zippendo/models/list_order_channels200_response_data_inner_settings.rb +509 -0
  31. data/lib/zippendo/models/list_order_channels200_response_data_inner_settings_shipping_method_mappings_inner.rb +254 -0
  32. data/lib/zippendo/models/list_orders200_response_data_inner_order_channel.rb +2 -2
  33. data/lib/zippendo/models/revoke_order_channel_webhook_secret200_response.rb +165 -0
  34. data/lib/zippendo/models/send_shipment422_response.rb +2 -2
  35. data/lib/zippendo/models/update_order_channel_request.rb +231 -0
  36. data/lib/zippendo/models/update_order_channel_request_settings.rb +360 -0
  37. data/lib/zippendo/models/update_org_request.rb +1 -11
  38. data/lib/zippendo/version.rb +1 -1
  39. data/lib/zippendo.rb +14 -0
  40. metadata +29 -1
@@ -0,0 +1,509 @@
1
+ =begin
2
+ #Zippendo Public API
3
+
4
+ #Public API documentation for Zippendo. Authenticate using your API token (Bearer token prefixed with zipp_). **Brands (sub-accounts).** An organization can be split into brands, each keeping its own orders, shipments and configuration separate. There are two ways to scope requests to one brand, and NEITHER changes any request body: 1. **Bind the token.** Create an API token with a `brandId` and every request it makes is confined to that brand — reads filtered, writes stamped. This is the recommended way to give a single brand's team its own credential. 2. **Send the `X-Zippendo-Brand` header.** An organization-wide token can scope an individual request by sending the brand's id or slug in this header. Most SDKs let you set it once on the client so every call inherits it. A brand-bound token that receives an `X-Zippendo-Brand` header naming a different brand is rejected with `403 BRAND_ACCESS_DENIED` — the binding is never widened. Omit both and requests cover the whole organization, which is the behaviour of every existing token. Records that belong to no brand carry `brandId: null`. Configuration (carriers, shipping rules, addresses) with a null brand is organization-wide and remains visible inside every brand; orders and shipments with a null brand are only visible organization-wide. List endpoints additionally take a `?brandScope=own|shared|both` parameter to narrow further within whichever brand context already applies. `own` returns only rows assigned to that brand, and requires a brand context — a brand-bound token, a resolved brand session, or the `X-Zippendo-Brand` header above — otherwise `400`. `shared` returns only the organization-wide rows (equivalent to filtering `brandId=none`). The default, `both`, keeps the existing behaviour: a brand context sees its own rows plus the organization-wide ones. Set `X-Zippendo-Brand-Scope` as a client default to apply the same choice to every request instead of repeating the query parameter on each call — an explicit `brandScope` query parameter always wins over the header, and a blank header value is ignored. Brands themselves are managed under the **Brands** tag. Retiring a brand is done with `POST /orgs/{orgId}/brands/{brandId}/archive` — permanent deletion is a dashboard-only action, since it is refused while any order, shipment, member or token still references the brand. Brands require a plan that includes them; creating one beyond your plan's limit returns `403`.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: support@zippendo.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.24.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Zippendo
17
+ # Channel settings (webhook secret and checkout token hash omitted).
18
+ class ListOrderChannels200ResponseDataInnerSettings < ApiModelBase
19
+ # Use webhooks for real-time order sync.
20
+ attr_accessor :use_webhooks
21
+
22
+ # External webhook identifier for management.
23
+ attr_accessor :webhook_id
24
+
25
+ # Registered WooCommerce webhook ids.
26
+ attr_accessor :webhook_ids
27
+
28
+ # When the custom channel's webhook signing secret was issued. A non-secret signal so clients can show that a secret exists; the secret itself is never returned after creation.
29
+ attr_accessor :webhook_secret_created_at
30
+
31
+ # WooCommerce store URL.
32
+ attr_accessor :site_url
33
+
34
+ # Push tracking back to the platform when a shipment is dispatched. Enabled by default (opt-out) — set to false to disable write-back; an unset value still syncs.
35
+ attr_accessor :auto_fulfill
36
+
37
+ # When the checkout token was issued (internal; never exposed in API responses).
38
+ attr_accessor :checkout_token_created_at
39
+
40
+ # Periodically poll the channel for new orders.
41
+ attr_accessor :auto_sync
42
+
43
+ # Polling interval in minutes (5-1440).
44
+ attr_accessor :sync_interval_minutes
45
+
46
+ # Create a shipment automatically when an order arrives.
47
+ attr_accessor :auto_ship_on_create
48
+
49
+ # Default carrier ID for auto-shipping.
50
+ attr_accessor :default_carrier_id
51
+
52
+ # Default carrier product ID for auto-shipping.
53
+ attr_accessor :default_product_id
54
+
55
+ # Default sender address ID for auto-shipping.
56
+ attr_accessor :default_address_id
57
+
58
+ # Map imported shipping-method titles to shipping rules, for channels without checkout rate integration.
59
+ attr_accessor :shipping_method_mappings
60
+
61
+ # Only import orders that are not yet fulfilled.
62
+ attr_accessor :sync_only_unfulfilled
63
+
64
+ # Only sync orders placed at or after this timestamp.
65
+ attr_accessor :sync_orders_since
66
+
67
+ # Number of service points to show at checkout (1-20).
68
+ attr_accessor :service_point_count
69
+
70
+ # Attribute mapping from ruby-style variable name to JSON key.
71
+ def self.attribute_map
72
+ {
73
+ :'use_webhooks' => :'useWebhooks',
74
+ :'webhook_id' => :'webhookId',
75
+ :'webhook_ids' => :'webhookIds',
76
+ :'webhook_secret_created_at' => :'webhookSecretCreatedAt',
77
+ :'site_url' => :'siteUrl',
78
+ :'auto_fulfill' => :'autoFulfill',
79
+ :'checkout_token_created_at' => :'checkoutTokenCreatedAt',
80
+ :'auto_sync' => :'autoSync',
81
+ :'sync_interval_minutes' => :'syncIntervalMinutes',
82
+ :'auto_ship_on_create' => :'autoShipOnCreate',
83
+ :'default_carrier_id' => :'defaultCarrierId',
84
+ :'default_product_id' => :'defaultProductId',
85
+ :'default_address_id' => :'defaultAddressId',
86
+ :'shipping_method_mappings' => :'shippingMethodMappings',
87
+ :'sync_only_unfulfilled' => :'syncOnlyUnfulfilled',
88
+ :'sync_orders_since' => :'syncOrdersSince',
89
+ :'service_point_count' => :'servicePointCount'
90
+ }
91
+ end
92
+
93
+ # Returns attribute mapping this model knows about
94
+ def self.acceptable_attribute_map
95
+ attribute_map
96
+ end
97
+
98
+ # Returns all the JSON keys this model knows about
99
+ def self.acceptable_attributes
100
+ acceptable_attribute_map.values
101
+ end
102
+
103
+ # Attribute type mapping.
104
+ def self.openapi_types
105
+ {
106
+ :'use_webhooks' => :'Boolean',
107
+ :'webhook_id' => :'String',
108
+ :'webhook_ids' => :'Array<Integer>',
109
+ :'webhook_secret_created_at' => :'Time',
110
+ :'site_url' => :'String',
111
+ :'auto_fulfill' => :'Boolean',
112
+ :'checkout_token_created_at' => :'Time',
113
+ :'auto_sync' => :'Boolean',
114
+ :'sync_interval_minutes' => :'Integer',
115
+ :'auto_ship_on_create' => :'Boolean',
116
+ :'default_carrier_id' => :'String',
117
+ :'default_product_id' => :'String',
118
+ :'default_address_id' => :'String',
119
+ :'shipping_method_mappings' => :'Array<ListOrderChannels200ResponseDataInnerSettingsShippingMethodMappingsInner>',
120
+ :'sync_only_unfulfilled' => :'Boolean',
121
+ :'sync_orders_since' => :'Time',
122
+ :'service_point_count' => :'Integer'
123
+ }
124
+ end
125
+
126
+ # List of attributes with nullable: true
127
+ def self.openapi_nullable
128
+ Set.new([
129
+ :'webhook_id',
130
+ :'webhook_secret_created_at',
131
+ :'checkout_token_created_at',
132
+ :'default_carrier_id',
133
+ :'default_product_id',
134
+ :'default_address_id',
135
+ :'sync_orders_since',
136
+ ])
137
+ end
138
+
139
+ # Initializes the object
140
+ # @param [Hash] attributes Model attributes in the form of hash
141
+ def initialize(attributes = {})
142
+ if (!attributes.is_a?(Hash))
143
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zippendo::ListOrderChannels200ResponseDataInnerSettings` initialize method"
144
+ end
145
+
146
+ # check to see if the attribute exists and convert string to symbol for hash key
147
+ acceptable_attribute_map = self.class.acceptable_attribute_map
148
+ attributes = attributes.each_with_object({}) { |(k, v), h|
149
+ if (!acceptable_attribute_map.key?(k.to_sym))
150
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zippendo::ListOrderChannels200ResponseDataInnerSettings`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
151
+ end
152
+ h[k.to_sym] = v
153
+ }
154
+
155
+ if attributes.key?(:'use_webhooks')
156
+ self.use_webhooks = attributes[:'use_webhooks']
157
+ else
158
+ self.use_webhooks = true
159
+ end
160
+
161
+ if attributes.key?(:'webhook_id')
162
+ self.webhook_id = attributes[:'webhook_id']
163
+ end
164
+
165
+ if attributes.key?(:'webhook_ids')
166
+ if (value = attributes[:'webhook_ids']).is_a?(Array)
167
+ self.webhook_ids = value
168
+ end
169
+ end
170
+
171
+ if attributes.key?(:'webhook_secret_created_at')
172
+ self.webhook_secret_created_at = attributes[:'webhook_secret_created_at']
173
+ end
174
+
175
+ if attributes.key?(:'site_url')
176
+ self.site_url = attributes[:'site_url']
177
+ end
178
+
179
+ if attributes.key?(:'auto_fulfill')
180
+ self.auto_fulfill = attributes[:'auto_fulfill']
181
+ end
182
+
183
+ if attributes.key?(:'checkout_token_created_at')
184
+ self.checkout_token_created_at = attributes[:'checkout_token_created_at']
185
+ end
186
+
187
+ if attributes.key?(:'auto_sync')
188
+ self.auto_sync = attributes[:'auto_sync']
189
+ else
190
+ self.auto_sync = false
191
+ end
192
+
193
+ if attributes.key?(:'sync_interval_minutes')
194
+ self.sync_interval_minutes = attributes[:'sync_interval_minutes']
195
+ else
196
+ self.sync_interval_minutes = 15
197
+ end
198
+
199
+ if attributes.key?(:'auto_ship_on_create')
200
+ self.auto_ship_on_create = attributes[:'auto_ship_on_create']
201
+ else
202
+ self.auto_ship_on_create = false
203
+ end
204
+
205
+ if attributes.key?(:'default_carrier_id')
206
+ self.default_carrier_id = attributes[:'default_carrier_id']
207
+ end
208
+
209
+ if attributes.key?(:'default_product_id')
210
+ self.default_product_id = attributes[:'default_product_id']
211
+ end
212
+
213
+ if attributes.key?(:'default_address_id')
214
+ self.default_address_id = attributes[:'default_address_id']
215
+ end
216
+
217
+ if attributes.key?(:'shipping_method_mappings')
218
+ if (value = attributes[:'shipping_method_mappings']).is_a?(Array)
219
+ self.shipping_method_mappings = value
220
+ end
221
+ end
222
+
223
+ if attributes.key?(:'sync_only_unfulfilled')
224
+ self.sync_only_unfulfilled = attributes[:'sync_only_unfulfilled']
225
+ else
226
+ self.sync_only_unfulfilled = true
227
+ end
228
+
229
+ if attributes.key?(:'sync_orders_since')
230
+ self.sync_orders_since = attributes[:'sync_orders_since']
231
+ end
232
+
233
+ if attributes.key?(:'service_point_count')
234
+ self.service_point_count = attributes[:'service_point_count']
235
+ else
236
+ self.service_point_count = 6
237
+ end
238
+ end
239
+
240
+ # Show invalid properties with the reasons. Usually used together with valid?
241
+ # @return Array for valid properties with the reasons
242
+ def list_invalid_properties
243
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
244
+ invalid_properties = Array.new
245
+ if @use_webhooks.nil?
246
+ invalid_properties.push('invalid value for "use_webhooks", use_webhooks cannot be nil.')
247
+ end
248
+
249
+ pattern = Regexp.new(/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$/)
250
+ if !@webhook_secret_created_at.nil? && @webhook_secret_created_at !~ pattern
251
+ invalid_properties.push("invalid value for \"webhook_secret_created_at\", must conform to the pattern #{pattern}.")
252
+ end
253
+
254
+ pattern = Regexp.new(/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$/)
255
+ if !@checkout_token_created_at.nil? && @checkout_token_created_at !~ pattern
256
+ invalid_properties.push("invalid value for \"checkout_token_created_at\", must conform to the pattern #{pattern}.")
257
+ end
258
+
259
+ if @auto_sync.nil?
260
+ invalid_properties.push('invalid value for "auto_sync", auto_sync cannot be nil.')
261
+ end
262
+
263
+ if @sync_interval_minutes.nil?
264
+ invalid_properties.push('invalid value for "sync_interval_minutes", sync_interval_minutes cannot be nil.')
265
+ end
266
+
267
+ if @sync_interval_minutes > 1440
268
+ invalid_properties.push('invalid value for "sync_interval_minutes", must be smaller than or equal to 1440.')
269
+ end
270
+
271
+ if @sync_interval_minutes < 5
272
+ invalid_properties.push('invalid value for "sync_interval_minutes", must be greater than or equal to 5.')
273
+ end
274
+
275
+ if @auto_ship_on_create.nil?
276
+ invalid_properties.push('invalid value for "auto_ship_on_create", auto_ship_on_create cannot be nil.')
277
+ end
278
+
279
+ if @sync_only_unfulfilled.nil?
280
+ invalid_properties.push('invalid value for "sync_only_unfulfilled", sync_only_unfulfilled cannot be nil.')
281
+ end
282
+
283
+ pattern = Regexp.new(/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$/)
284
+ if !@sync_orders_since.nil? && @sync_orders_since !~ pattern
285
+ invalid_properties.push("invalid value for \"sync_orders_since\", must conform to the pattern #{pattern}.")
286
+ end
287
+
288
+ if @service_point_count.nil?
289
+ invalid_properties.push('invalid value for "service_point_count", service_point_count cannot be nil.')
290
+ end
291
+
292
+ if @service_point_count > 20
293
+ invalid_properties.push('invalid value for "service_point_count", must be smaller than or equal to 20.')
294
+ end
295
+
296
+ if @service_point_count < 1
297
+ invalid_properties.push('invalid value for "service_point_count", must be greater than or equal to 1.')
298
+ end
299
+
300
+ invalid_properties
301
+ end
302
+
303
+ # Check to see if the all the properties in the model are valid
304
+ # @return true if the model is valid
305
+ def valid?
306
+ warn '[DEPRECATED] the `valid?` method is obsolete'
307
+ return false if @use_webhooks.nil?
308
+ return false if !@webhook_secret_created_at.nil? && @webhook_secret_created_at !~ Regexp.new(/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$/)
309
+ return false if !@checkout_token_created_at.nil? && @checkout_token_created_at !~ Regexp.new(/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$/)
310
+ return false if @auto_sync.nil?
311
+ return false if @sync_interval_minutes.nil?
312
+ return false if @sync_interval_minutes > 1440
313
+ return false if @sync_interval_minutes < 5
314
+ return false if @auto_ship_on_create.nil?
315
+ return false if @sync_only_unfulfilled.nil?
316
+ return false if !@sync_orders_since.nil? && @sync_orders_since !~ Regexp.new(/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$/)
317
+ return false if @service_point_count.nil?
318
+ return false if @service_point_count > 20
319
+ return false if @service_point_count < 1
320
+ true
321
+ end
322
+
323
+ # Custom attribute writer method with validation
324
+ # @param [Object] use_webhooks Value to be assigned
325
+ def use_webhooks=(use_webhooks)
326
+ if use_webhooks.nil?
327
+ fail ArgumentError, 'use_webhooks cannot be nil'
328
+ end
329
+
330
+ @use_webhooks = use_webhooks
331
+ end
332
+
333
+ # Custom attribute writer method with validation
334
+ # @param [Object] webhook_secret_created_at Value to be assigned
335
+ def webhook_secret_created_at=(webhook_secret_created_at)
336
+ pattern = Regexp.new(/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$/)
337
+ if !webhook_secret_created_at.nil? && webhook_secret_created_at !~ pattern
338
+ fail ArgumentError, "invalid value for \"webhook_secret_created_at\", must conform to the pattern #{pattern}."
339
+ end
340
+
341
+ @webhook_secret_created_at = webhook_secret_created_at
342
+ end
343
+
344
+ # Custom attribute writer method with validation
345
+ # @param [Object] checkout_token_created_at Value to be assigned
346
+ def checkout_token_created_at=(checkout_token_created_at)
347
+ pattern = Regexp.new(/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$/)
348
+ if !checkout_token_created_at.nil? && checkout_token_created_at !~ pattern
349
+ fail ArgumentError, "invalid value for \"checkout_token_created_at\", must conform to the pattern #{pattern}."
350
+ end
351
+
352
+ @checkout_token_created_at = checkout_token_created_at
353
+ end
354
+
355
+ # Custom attribute writer method with validation
356
+ # @param [Object] auto_sync Value to be assigned
357
+ def auto_sync=(auto_sync)
358
+ if auto_sync.nil?
359
+ fail ArgumentError, 'auto_sync cannot be nil'
360
+ end
361
+
362
+ @auto_sync = auto_sync
363
+ end
364
+
365
+ # Custom attribute writer method with validation
366
+ # @param [Object] sync_interval_minutes Value to be assigned
367
+ def sync_interval_minutes=(sync_interval_minutes)
368
+ if sync_interval_minutes.nil?
369
+ fail ArgumentError, 'sync_interval_minutes cannot be nil'
370
+ end
371
+
372
+ if sync_interval_minutes > 1440
373
+ fail ArgumentError, 'invalid value for "sync_interval_minutes", must be smaller than or equal to 1440.'
374
+ end
375
+
376
+ if sync_interval_minutes < 5
377
+ fail ArgumentError, 'invalid value for "sync_interval_minutes", must be greater than or equal to 5.'
378
+ end
379
+
380
+ @sync_interval_minutes = sync_interval_minutes
381
+ end
382
+
383
+ # Custom attribute writer method with validation
384
+ # @param [Object] auto_ship_on_create Value to be assigned
385
+ def auto_ship_on_create=(auto_ship_on_create)
386
+ if auto_ship_on_create.nil?
387
+ fail ArgumentError, 'auto_ship_on_create cannot be nil'
388
+ end
389
+
390
+ @auto_ship_on_create = auto_ship_on_create
391
+ end
392
+
393
+ # Custom attribute writer method with validation
394
+ # @param [Object] sync_only_unfulfilled Value to be assigned
395
+ def sync_only_unfulfilled=(sync_only_unfulfilled)
396
+ if sync_only_unfulfilled.nil?
397
+ fail ArgumentError, 'sync_only_unfulfilled cannot be nil'
398
+ end
399
+
400
+ @sync_only_unfulfilled = sync_only_unfulfilled
401
+ end
402
+
403
+ # Custom attribute writer method with validation
404
+ # @param [Object] sync_orders_since Value to be assigned
405
+ def sync_orders_since=(sync_orders_since)
406
+ pattern = Regexp.new(/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$/)
407
+ if !sync_orders_since.nil? && sync_orders_since !~ pattern
408
+ fail ArgumentError, "invalid value for \"sync_orders_since\", must conform to the pattern #{pattern}."
409
+ end
410
+
411
+ @sync_orders_since = sync_orders_since
412
+ end
413
+
414
+ # Custom attribute writer method with validation
415
+ # @param [Object] service_point_count Value to be assigned
416
+ def service_point_count=(service_point_count)
417
+ if service_point_count.nil?
418
+ fail ArgumentError, 'service_point_count cannot be nil'
419
+ end
420
+
421
+ if service_point_count > 20
422
+ fail ArgumentError, 'invalid value for "service_point_count", must be smaller than or equal to 20.'
423
+ end
424
+
425
+ if service_point_count < 1
426
+ fail ArgumentError, 'invalid value for "service_point_count", must be greater than or equal to 1.'
427
+ end
428
+
429
+ @service_point_count = service_point_count
430
+ end
431
+
432
+ # Checks equality by comparing each attribute.
433
+ # @param [Object] Object to be compared
434
+ def ==(o)
435
+ return true if self.equal?(o)
436
+ self.class == o.class &&
437
+ use_webhooks == o.use_webhooks &&
438
+ webhook_id == o.webhook_id &&
439
+ webhook_ids == o.webhook_ids &&
440
+ webhook_secret_created_at == o.webhook_secret_created_at &&
441
+ site_url == o.site_url &&
442
+ auto_fulfill == o.auto_fulfill &&
443
+ checkout_token_created_at == o.checkout_token_created_at &&
444
+ auto_sync == o.auto_sync &&
445
+ sync_interval_minutes == o.sync_interval_minutes &&
446
+ auto_ship_on_create == o.auto_ship_on_create &&
447
+ default_carrier_id == o.default_carrier_id &&
448
+ default_product_id == o.default_product_id &&
449
+ default_address_id == o.default_address_id &&
450
+ shipping_method_mappings == o.shipping_method_mappings &&
451
+ sync_only_unfulfilled == o.sync_only_unfulfilled &&
452
+ sync_orders_since == o.sync_orders_since &&
453
+ service_point_count == o.service_point_count
454
+ end
455
+
456
+ # @see the `==` method
457
+ # @param [Object] Object to be compared
458
+ def eql?(o)
459
+ self == o
460
+ end
461
+
462
+ # Calculates hash code according to all attributes.
463
+ # @return [Integer] Hash code
464
+ def hash
465
+ [use_webhooks, webhook_id, webhook_ids, webhook_secret_created_at, site_url, auto_fulfill, checkout_token_created_at, auto_sync, sync_interval_minutes, auto_ship_on_create, default_carrier_id, default_product_id, default_address_id, shipping_method_mappings, sync_only_unfulfilled, sync_orders_since, service_point_count].hash
466
+ end
467
+
468
+ # Builds the object from hash
469
+ # @param [Hash] attributes Model attributes in the form of hash
470
+ # @return [Object] Returns the model itself
471
+ def self.build_from_hash(attributes)
472
+ return nil unless attributes.is_a?(Hash)
473
+ attributes = attributes.transform_keys(&:to_sym)
474
+ transformed_hash = {}
475
+ openapi_types.each_pair do |key, type|
476
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
477
+ transformed_hash["#{key}"] = nil
478
+ elsif type =~ /\AArray<(.*)>/i
479
+ # check to ensure the input is an array given that the attribute
480
+ # is documented as an array but the input is not
481
+ if attributes[attribute_map[key]].is_a?(Array)
482
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
483
+ end
484
+ elsif !attributes[attribute_map[key]].nil?
485
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
486
+ end
487
+ end
488
+ new(transformed_hash)
489
+ end
490
+
491
+ # Returns the object in the form of hash
492
+ # @return [Hash] Returns the object in the form of hash
493
+ def to_hash
494
+ hash = {}
495
+ self.class.attribute_map.each_pair do |attr, param|
496
+ value = self.send(attr)
497
+ if value.nil?
498
+ is_nullable = self.class.openapi_nullable.include?(attr)
499
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
500
+ end
501
+
502
+ hash[param] = _to_hash(value)
503
+ end
504
+ hash
505
+ end
506
+
507
+ end
508
+
509
+ end