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,478 @@
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
+ class ListOrderChannels200ResponseDataInner < ApiModelBase
18
+ # Unique order channel ID.
19
+ attr_accessor :id
20
+
21
+ # Display name of the channel.
22
+ attr_accessor :name
23
+
24
+ # Type of the order channel (sales platform).
25
+ attr_accessor :type
26
+
27
+ # Whether the channel is active.
28
+ attr_accessor :enabled
29
+
30
+ # Brand this channel belongs to, or null for organization-wide. Orders synced from this channel inherit it, and so do the shipments and documents made from them.
31
+ attr_accessor :brand_id
32
+
33
+ # Whether credentials are configured (values are never exposed).
34
+ attr_accessor :has_credentials
35
+
36
+ attr_accessor :settings
37
+
38
+ # Whether real-time webhooks are enabled.
39
+ attr_accessor :webhooks_enabled
40
+
41
+ # Timestamp of the last successful sync.
42
+ attr_accessor :last_sync_at
43
+
44
+ # Error message from the last failed sync.
45
+ attr_accessor :last_sync_error
46
+
47
+ # IDs of shipping rules linked to this channel.
48
+ attr_accessor :shipping_rule_ids
49
+
50
+ # Owning organization ID.
51
+ attr_accessor :org_id
52
+
53
+ # Creation timestamp (ISO 8601).
54
+ attr_accessor :created_at
55
+
56
+ # Last update timestamp (ISO 8601).
57
+ attr_accessor :updated_at
58
+
59
+ class EnumAttributeValidator
60
+ attr_reader :datatype
61
+ attr_reader :allowable_values
62
+
63
+ def initialize(datatype, allowable_values)
64
+ @allowable_values = allowable_values.map do |value|
65
+ case datatype.to_s
66
+ when /Integer/i
67
+ value.to_i
68
+ when /Float/i
69
+ value.to_f
70
+ else
71
+ value
72
+ end
73
+ end
74
+ end
75
+
76
+ def valid?(value)
77
+ !value || allowable_values.include?(value)
78
+ end
79
+ end
80
+
81
+ # Attribute mapping from ruby-style variable name to JSON key.
82
+ def self.attribute_map
83
+ {
84
+ :'id' => :'id',
85
+ :'name' => :'name',
86
+ :'type' => :'type',
87
+ :'enabled' => :'enabled',
88
+ :'brand_id' => :'brandId',
89
+ :'has_credentials' => :'hasCredentials',
90
+ :'settings' => :'settings',
91
+ :'webhooks_enabled' => :'webhooksEnabled',
92
+ :'last_sync_at' => :'lastSyncAt',
93
+ :'last_sync_error' => :'lastSyncError',
94
+ :'shipping_rule_ids' => :'shippingRuleIds',
95
+ :'org_id' => :'orgId',
96
+ :'created_at' => :'createdAt',
97
+ :'updated_at' => :'updatedAt'
98
+ }
99
+ end
100
+
101
+ # Returns attribute mapping this model knows about
102
+ def self.acceptable_attribute_map
103
+ attribute_map
104
+ end
105
+
106
+ # Returns all the JSON keys this model knows about
107
+ def self.acceptable_attributes
108
+ acceptable_attribute_map.values
109
+ end
110
+
111
+ # Attribute type mapping.
112
+ def self.openapi_types
113
+ {
114
+ :'id' => :'String',
115
+ :'name' => :'String',
116
+ :'type' => :'String',
117
+ :'enabled' => :'Boolean',
118
+ :'brand_id' => :'String',
119
+ :'has_credentials' => :'Boolean',
120
+ :'settings' => :'ListOrderChannels200ResponseDataInnerSettings',
121
+ :'webhooks_enabled' => :'Boolean',
122
+ :'last_sync_at' => :'Time',
123
+ :'last_sync_error' => :'String',
124
+ :'shipping_rule_ids' => :'Array<String>',
125
+ :'org_id' => :'String',
126
+ :'created_at' => :'String',
127
+ :'updated_at' => :'String'
128
+ }
129
+ end
130
+
131
+ # List of attributes with nullable: true
132
+ def self.openapi_nullable
133
+ Set.new([
134
+ :'brand_id',
135
+ :'last_sync_at',
136
+ :'last_sync_error',
137
+ ])
138
+ end
139
+
140
+ # Initializes the object
141
+ # @param [Hash] attributes Model attributes in the form of hash
142
+ def initialize(attributes = {})
143
+ if (!attributes.is_a?(Hash))
144
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zippendo::ListOrderChannels200ResponseDataInner` initialize method"
145
+ end
146
+
147
+ # check to see if the attribute exists and convert string to symbol for hash key
148
+ acceptable_attribute_map = self.class.acceptable_attribute_map
149
+ attributes = attributes.each_with_object({}) { |(k, v), h|
150
+ if (!acceptable_attribute_map.key?(k.to_sym))
151
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zippendo::ListOrderChannels200ResponseDataInner`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
152
+ end
153
+ h[k.to_sym] = v
154
+ }
155
+
156
+ if attributes.key?(:'id')
157
+ self.id = attributes[:'id']
158
+ else
159
+ self.id = nil
160
+ end
161
+
162
+ if attributes.key?(:'name')
163
+ self.name = attributes[:'name']
164
+ else
165
+ self.name = nil
166
+ end
167
+
168
+ if attributes.key?(:'type')
169
+ self.type = attributes[:'type']
170
+ else
171
+ self.type = nil
172
+ end
173
+
174
+ if attributes.key?(:'enabled')
175
+ self.enabled = attributes[:'enabled']
176
+ else
177
+ self.enabled = nil
178
+ end
179
+
180
+ if attributes.key?(:'brand_id')
181
+ self.brand_id = attributes[:'brand_id']
182
+ else
183
+ self.brand_id = nil
184
+ end
185
+
186
+ if attributes.key?(:'has_credentials')
187
+ self.has_credentials = attributes[:'has_credentials']
188
+ else
189
+ self.has_credentials = nil
190
+ end
191
+
192
+ if attributes.key?(:'settings')
193
+ self.settings = attributes[:'settings']
194
+ else
195
+ self.settings = nil
196
+ end
197
+
198
+ if attributes.key?(:'webhooks_enabled')
199
+ self.webhooks_enabled = attributes[:'webhooks_enabled']
200
+ end
201
+
202
+ if attributes.key?(:'last_sync_at')
203
+ self.last_sync_at = attributes[:'last_sync_at']
204
+ end
205
+
206
+ if attributes.key?(:'last_sync_error')
207
+ self.last_sync_error = attributes[:'last_sync_error']
208
+ end
209
+
210
+ if attributes.key?(:'shipping_rule_ids')
211
+ if (value = attributes[:'shipping_rule_ids']).is_a?(Array)
212
+ self.shipping_rule_ids = value
213
+ end
214
+ end
215
+
216
+ if attributes.key?(:'org_id')
217
+ self.org_id = attributes[:'org_id']
218
+ else
219
+ self.org_id = nil
220
+ end
221
+
222
+ if attributes.key?(:'created_at')
223
+ self.created_at = attributes[:'created_at']
224
+ else
225
+ self.created_at = nil
226
+ end
227
+
228
+ if attributes.key?(:'updated_at')
229
+ self.updated_at = attributes[:'updated_at']
230
+ else
231
+ self.updated_at = nil
232
+ end
233
+ end
234
+
235
+ # Show invalid properties with the reasons. Usually used together with valid?
236
+ # @return Array for valid properties with the reasons
237
+ def list_invalid_properties
238
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
239
+ invalid_properties = Array.new
240
+ if @id.nil?
241
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
242
+ end
243
+
244
+ if @name.nil?
245
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
246
+ end
247
+
248
+ if @type.nil?
249
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
250
+ end
251
+
252
+ if @enabled.nil?
253
+ invalid_properties.push('invalid value for "enabled", enabled cannot be nil.')
254
+ end
255
+
256
+ if @has_credentials.nil?
257
+ invalid_properties.push('invalid value for "has_credentials", has_credentials cannot be nil.')
258
+ end
259
+
260
+ if @settings.nil?
261
+ invalid_properties.push('invalid value for "settings", settings cannot be nil.')
262
+ end
263
+
264
+ 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))$/)
265
+ if !@last_sync_at.nil? && @last_sync_at !~ pattern
266
+ invalid_properties.push("invalid value for \"last_sync_at\", must conform to the pattern #{pattern}.")
267
+ end
268
+
269
+ if @org_id.nil?
270
+ invalid_properties.push('invalid value for "org_id", org_id cannot be nil.')
271
+ end
272
+
273
+ if @created_at.nil?
274
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
275
+ end
276
+
277
+ if @updated_at.nil?
278
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
279
+ end
280
+
281
+ invalid_properties
282
+ end
283
+
284
+ # Check to see if the all the properties in the model are valid
285
+ # @return true if the model is valid
286
+ def valid?
287
+ warn '[DEPRECATED] the `valid?` method is obsolete'
288
+ return false if @id.nil?
289
+ return false if @name.nil?
290
+ return false if @type.nil?
291
+ type_validator = EnumAttributeValidator.new('String', ["shopify", "woocommerce", "manual", "custom"])
292
+ return false unless type_validator.valid?(@type)
293
+ return false if @enabled.nil?
294
+ return false if @has_credentials.nil?
295
+ return false if @settings.nil?
296
+ return false if !@last_sync_at.nil? && @last_sync_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))$/)
297
+ return false if @org_id.nil?
298
+ return false if @created_at.nil?
299
+ return false if @updated_at.nil?
300
+ true
301
+ end
302
+
303
+ # Custom attribute writer method with validation
304
+ # @param [Object] id Value to be assigned
305
+ def id=(id)
306
+ if id.nil?
307
+ fail ArgumentError, 'id cannot be nil'
308
+ end
309
+
310
+ @id = id
311
+ end
312
+
313
+ # Custom attribute writer method with validation
314
+ # @param [Object] name Value to be assigned
315
+ def name=(name)
316
+ if name.nil?
317
+ fail ArgumentError, 'name cannot be nil'
318
+ end
319
+
320
+ @name = name
321
+ end
322
+
323
+ # Custom attribute writer method checking allowed values (enum).
324
+ # @param [Object] type Object to be assigned
325
+ def type=(type)
326
+ validator = EnumAttributeValidator.new('String', ["shopify", "woocommerce", "manual", "custom"])
327
+ unless validator.valid?(type)
328
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
329
+ end
330
+ @type = type
331
+ end
332
+
333
+ # Custom attribute writer method with validation
334
+ # @param [Object] enabled Value to be assigned
335
+ def enabled=(enabled)
336
+ if enabled.nil?
337
+ fail ArgumentError, 'enabled cannot be nil'
338
+ end
339
+
340
+ @enabled = enabled
341
+ end
342
+
343
+ # Custom attribute writer method with validation
344
+ # @param [Object] has_credentials Value to be assigned
345
+ def has_credentials=(has_credentials)
346
+ if has_credentials.nil?
347
+ fail ArgumentError, 'has_credentials cannot be nil'
348
+ end
349
+
350
+ @has_credentials = has_credentials
351
+ end
352
+
353
+ # Custom attribute writer method with validation
354
+ # @param [Object] settings Value to be assigned
355
+ def settings=(settings)
356
+ if settings.nil?
357
+ fail ArgumentError, 'settings cannot be nil'
358
+ end
359
+
360
+ @settings = settings
361
+ end
362
+
363
+ # Custom attribute writer method with validation
364
+ # @param [Object] last_sync_at Value to be assigned
365
+ def last_sync_at=(last_sync_at)
366
+ 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))$/)
367
+ if !last_sync_at.nil? && last_sync_at !~ pattern
368
+ fail ArgumentError, "invalid value for \"last_sync_at\", must conform to the pattern #{pattern}."
369
+ end
370
+
371
+ @last_sync_at = last_sync_at
372
+ end
373
+
374
+ # Custom attribute writer method with validation
375
+ # @param [Object] org_id Value to be assigned
376
+ def org_id=(org_id)
377
+ if org_id.nil?
378
+ fail ArgumentError, 'org_id cannot be nil'
379
+ end
380
+
381
+ @org_id = org_id
382
+ end
383
+
384
+ # Custom attribute writer method with validation
385
+ # @param [Object] created_at Value to be assigned
386
+ def created_at=(created_at)
387
+ if created_at.nil?
388
+ fail ArgumentError, 'created_at cannot be nil'
389
+ end
390
+
391
+ @created_at = created_at
392
+ end
393
+
394
+ # Custom attribute writer method with validation
395
+ # @param [Object] updated_at Value to be assigned
396
+ def updated_at=(updated_at)
397
+ if updated_at.nil?
398
+ fail ArgumentError, 'updated_at cannot be nil'
399
+ end
400
+
401
+ @updated_at = updated_at
402
+ end
403
+
404
+ # Checks equality by comparing each attribute.
405
+ # @param [Object] Object to be compared
406
+ def ==(o)
407
+ return true if self.equal?(o)
408
+ self.class == o.class &&
409
+ id == o.id &&
410
+ name == o.name &&
411
+ type == o.type &&
412
+ enabled == o.enabled &&
413
+ brand_id == o.brand_id &&
414
+ has_credentials == o.has_credentials &&
415
+ settings == o.settings &&
416
+ webhooks_enabled == o.webhooks_enabled &&
417
+ last_sync_at == o.last_sync_at &&
418
+ last_sync_error == o.last_sync_error &&
419
+ shipping_rule_ids == o.shipping_rule_ids &&
420
+ org_id == o.org_id &&
421
+ created_at == o.created_at &&
422
+ updated_at == o.updated_at
423
+ end
424
+
425
+ # @see the `==` method
426
+ # @param [Object] Object to be compared
427
+ def eql?(o)
428
+ self == o
429
+ end
430
+
431
+ # Calculates hash code according to all attributes.
432
+ # @return [Integer] Hash code
433
+ def hash
434
+ [id, name, type, enabled, brand_id, has_credentials, settings, webhooks_enabled, last_sync_at, last_sync_error, shipping_rule_ids, org_id, created_at, updated_at].hash
435
+ end
436
+
437
+ # Builds the object from hash
438
+ # @param [Hash] attributes Model attributes in the form of hash
439
+ # @return [Object] Returns the model itself
440
+ def self.build_from_hash(attributes)
441
+ return nil unless attributes.is_a?(Hash)
442
+ attributes = attributes.transform_keys(&:to_sym)
443
+ transformed_hash = {}
444
+ openapi_types.each_pair do |key, type|
445
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
446
+ transformed_hash["#{key}"] = nil
447
+ elsif type =~ /\AArray<(.*)>/i
448
+ # check to ensure the input is an array given that the attribute
449
+ # is documented as an array but the input is not
450
+ if attributes[attribute_map[key]].is_a?(Array)
451
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
452
+ end
453
+ elsif !attributes[attribute_map[key]].nil?
454
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
455
+ end
456
+ end
457
+ new(transformed_hash)
458
+ end
459
+
460
+ # Returns the object in the form of hash
461
+ # @return [Hash] Returns the object in the form of hash
462
+ def to_hash
463
+ hash = {}
464
+ self.class.attribute_map.each_pair do |attr, param|
465
+ value = self.send(attr)
466
+ if value.nil?
467
+ is_nullable = self.class.openapi_nullable.include?(attr)
468
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
469
+ end
470
+
471
+ hash[param] = _to_hash(value)
472
+ end
473
+ hash
474
+ end
475
+
476
+ end
477
+
478
+ end