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,359 @@
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 CreateOrderChannelRequestSettings < ApiModelBase
18
+ # Use webhooks for real-time order sync.
19
+ attr_accessor :use_webhooks
20
+
21
+ # WooCommerce store URL.
22
+ attr_accessor :site_url
23
+
24
+ # 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.
25
+ attr_accessor :auto_fulfill
26
+
27
+ # Periodically poll the channel for new orders.
28
+ attr_accessor :auto_sync
29
+
30
+ # Polling interval in minutes (5-1440).
31
+ attr_accessor :sync_interval_minutes
32
+
33
+ # Create a shipment automatically when an order arrives.
34
+ attr_accessor :auto_ship_on_create
35
+
36
+ # Default carrier ID for auto-shipping.
37
+ attr_accessor :default_carrier_id
38
+
39
+ # Default carrier product ID for auto-shipping.
40
+ attr_accessor :default_product_id
41
+
42
+ # Default sender address ID for auto-shipping.
43
+ attr_accessor :default_address_id
44
+
45
+ # Map imported shipping-method titles to shipping rules, for channels without checkout rate integration.
46
+ attr_accessor :shipping_method_mappings
47
+
48
+ # Only import orders that are not yet fulfilled.
49
+ attr_accessor :sync_only_unfulfilled
50
+
51
+ # Only sync orders placed at or after this timestamp.
52
+ attr_accessor :sync_orders_since
53
+
54
+ # Number of service points to show at checkout (1-20).
55
+ attr_accessor :service_point_count
56
+
57
+ # Attribute mapping from ruby-style variable name to JSON key.
58
+ def self.attribute_map
59
+ {
60
+ :'use_webhooks' => :'useWebhooks',
61
+ :'site_url' => :'siteUrl',
62
+ :'auto_fulfill' => :'autoFulfill',
63
+ :'auto_sync' => :'autoSync',
64
+ :'sync_interval_minutes' => :'syncIntervalMinutes',
65
+ :'auto_ship_on_create' => :'autoShipOnCreate',
66
+ :'default_carrier_id' => :'defaultCarrierId',
67
+ :'default_product_id' => :'defaultProductId',
68
+ :'default_address_id' => :'defaultAddressId',
69
+ :'shipping_method_mappings' => :'shippingMethodMappings',
70
+ :'sync_only_unfulfilled' => :'syncOnlyUnfulfilled',
71
+ :'sync_orders_since' => :'syncOrdersSince',
72
+ :'service_point_count' => :'servicePointCount'
73
+ }
74
+ end
75
+
76
+ # Returns attribute mapping this model knows about
77
+ def self.acceptable_attribute_map
78
+ attribute_map
79
+ end
80
+
81
+ # Returns all the JSON keys this model knows about
82
+ def self.acceptable_attributes
83
+ acceptable_attribute_map.values
84
+ end
85
+
86
+ # Attribute type mapping.
87
+ def self.openapi_types
88
+ {
89
+ :'use_webhooks' => :'Boolean',
90
+ :'site_url' => :'String',
91
+ :'auto_fulfill' => :'Boolean',
92
+ :'auto_sync' => :'Boolean',
93
+ :'sync_interval_minutes' => :'Integer',
94
+ :'auto_ship_on_create' => :'Boolean',
95
+ :'default_carrier_id' => :'String',
96
+ :'default_product_id' => :'String',
97
+ :'default_address_id' => :'String',
98
+ :'shipping_method_mappings' => :'Array<CreateOrderChannelRequestSettingsShippingMethodMappingsInner>',
99
+ :'sync_only_unfulfilled' => :'Boolean',
100
+ :'sync_orders_since' => :'Time',
101
+ :'service_point_count' => :'Integer'
102
+ }
103
+ end
104
+
105
+ # List of attributes with nullable: true
106
+ def self.openapi_nullable
107
+ Set.new([
108
+ :'default_carrier_id',
109
+ :'default_product_id',
110
+ :'default_address_id',
111
+ :'sync_orders_since',
112
+ ])
113
+ end
114
+
115
+ # Initializes the object
116
+ # @param [Hash] attributes Model attributes in the form of hash
117
+ def initialize(attributes = {})
118
+ if (!attributes.is_a?(Hash))
119
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zippendo::CreateOrderChannelRequestSettings` initialize method"
120
+ end
121
+
122
+ # check to see if the attribute exists and convert string to symbol for hash key
123
+ acceptable_attribute_map = self.class.acceptable_attribute_map
124
+ attributes = attributes.each_with_object({}) { |(k, v), h|
125
+ if (!acceptable_attribute_map.key?(k.to_sym))
126
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zippendo::CreateOrderChannelRequestSettings`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
127
+ end
128
+ h[k.to_sym] = v
129
+ }
130
+
131
+ if attributes.key?(:'use_webhooks')
132
+ self.use_webhooks = attributes[:'use_webhooks']
133
+ else
134
+ self.use_webhooks = true
135
+ end
136
+
137
+ if attributes.key?(:'site_url')
138
+ self.site_url = attributes[:'site_url']
139
+ end
140
+
141
+ if attributes.key?(:'auto_fulfill')
142
+ self.auto_fulfill = attributes[:'auto_fulfill']
143
+ end
144
+
145
+ if attributes.key?(:'auto_sync')
146
+ self.auto_sync = attributes[:'auto_sync']
147
+ else
148
+ self.auto_sync = false
149
+ end
150
+
151
+ if attributes.key?(:'sync_interval_minutes')
152
+ self.sync_interval_minutes = attributes[:'sync_interval_minutes']
153
+ else
154
+ self.sync_interval_minutes = 15
155
+ end
156
+
157
+ if attributes.key?(:'auto_ship_on_create')
158
+ self.auto_ship_on_create = attributes[:'auto_ship_on_create']
159
+ else
160
+ self.auto_ship_on_create = false
161
+ end
162
+
163
+ if attributes.key?(:'default_carrier_id')
164
+ self.default_carrier_id = attributes[:'default_carrier_id']
165
+ end
166
+
167
+ if attributes.key?(:'default_product_id')
168
+ self.default_product_id = attributes[:'default_product_id']
169
+ end
170
+
171
+ if attributes.key?(:'default_address_id')
172
+ self.default_address_id = attributes[:'default_address_id']
173
+ end
174
+
175
+ if attributes.key?(:'shipping_method_mappings')
176
+ if (value = attributes[:'shipping_method_mappings']).is_a?(Array)
177
+ self.shipping_method_mappings = value
178
+ end
179
+ end
180
+
181
+ if attributes.key?(:'sync_only_unfulfilled')
182
+ self.sync_only_unfulfilled = attributes[:'sync_only_unfulfilled']
183
+ else
184
+ self.sync_only_unfulfilled = true
185
+ end
186
+
187
+ if attributes.key?(:'sync_orders_since')
188
+ self.sync_orders_since = attributes[:'sync_orders_since']
189
+ end
190
+
191
+ if attributes.key?(:'service_point_count')
192
+ self.service_point_count = attributes[:'service_point_count']
193
+ else
194
+ self.service_point_count = 6
195
+ end
196
+ end
197
+
198
+ # Show invalid properties with the reasons. Usually used together with valid?
199
+ # @return Array for valid properties with the reasons
200
+ def list_invalid_properties
201
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
202
+ invalid_properties = Array.new
203
+ if !@sync_interval_minutes.nil? && @sync_interval_minutes > 1440
204
+ invalid_properties.push('invalid value for "sync_interval_minutes", must be smaller than or equal to 1440.')
205
+ end
206
+
207
+ if !@sync_interval_minutes.nil? && @sync_interval_minutes < 5
208
+ invalid_properties.push('invalid value for "sync_interval_minutes", must be greater than or equal to 5.')
209
+ end
210
+
211
+ 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))$/)
212
+ if !@sync_orders_since.nil? && @sync_orders_since !~ pattern
213
+ invalid_properties.push("invalid value for \"sync_orders_since\", must conform to the pattern #{pattern}.")
214
+ end
215
+
216
+ if !@service_point_count.nil? && @service_point_count > 20
217
+ invalid_properties.push('invalid value for "service_point_count", must be smaller than or equal to 20.')
218
+ end
219
+
220
+ if !@service_point_count.nil? && @service_point_count < 1
221
+ invalid_properties.push('invalid value for "service_point_count", must be greater than or equal to 1.')
222
+ end
223
+
224
+ invalid_properties
225
+ end
226
+
227
+ # Check to see if the all the properties in the model are valid
228
+ # @return true if the model is valid
229
+ def valid?
230
+ warn '[DEPRECATED] the `valid?` method is obsolete'
231
+ return false if !@sync_interval_minutes.nil? && @sync_interval_minutes > 1440
232
+ return false if !@sync_interval_minutes.nil? && @sync_interval_minutes < 5
233
+ 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))$/)
234
+ return false if !@service_point_count.nil? && @service_point_count > 20
235
+ return false if !@service_point_count.nil? && @service_point_count < 1
236
+ true
237
+ end
238
+
239
+ # Custom attribute writer method with validation
240
+ # @param [Object] sync_interval_minutes Value to be assigned
241
+ def sync_interval_minutes=(sync_interval_minutes)
242
+ if sync_interval_minutes.nil?
243
+ fail ArgumentError, 'sync_interval_minutes cannot be nil'
244
+ end
245
+
246
+ if sync_interval_minutes > 1440
247
+ fail ArgumentError, 'invalid value for "sync_interval_minutes", must be smaller than or equal to 1440.'
248
+ end
249
+
250
+ if sync_interval_minutes < 5
251
+ fail ArgumentError, 'invalid value for "sync_interval_minutes", must be greater than or equal to 5.'
252
+ end
253
+
254
+ @sync_interval_minutes = sync_interval_minutes
255
+ end
256
+
257
+ # Custom attribute writer method with validation
258
+ # @param [Object] sync_orders_since Value to be assigned
259
+ def sync_orders_since=(sync_orders_since)
260
+ 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))$/)
261
+ if !sync_orders_since.nil? && sync_orders_since !~ pattern
262
+ fail ArgumentError, "invalid value for \"sync_orders_since\", must conform to the pattern #{pattern}."
263
+ end
264
+
265
+ @sync_orders_since = sync_orders_since
266
+ end
267
+
268
+ # Custom attribute writer method with validation
269
+ # @param [Object] service_point_count Value to be assigned
270
+ def service_point_count=(service_point_count)
271
+ if service_point_count.nil?
272
+ fail ArgumentError, 'service_point_count cannot be nil'
273
+ end
274
+
275
+ if service_point_count > 20
276
+ fail ArgumentError, 'invalid value for "service_point_count", must be smaller than or equal to 20.'
277
+ end
278
+
279
+ if service_point_count < 1
280
+ fail ArgumentError, 'invalid value for "service_point_count", must be greater than or equal to 1.'
281
+ end
282
+
283
+ @service_point_count = service_point_count
284
+ end
285
+
286
+ # Checks equality by comparing each attribute.
287
+ # @param [Object] Object to be compared
288
+ def ==(o)
289
+ return true if self.equal?(o)
290
+ self.class == o.class &&
291
+ use_webhooks == o.use_webhooks &&
292
+ site_url == o.site_url &&
293
+ auto_fulfill == o.auto_fulfill &&
294
+ auto_sync == o.auto_sync &&
295
+ sync_interval_minutes == o.sync_interval_minutes &&
296
+ auto_ship_on_create == o.auto_ship_on_create &&
297
+ default_carrier_id == o.default_carrier_id &&
298
+ default_product_id == o.default_product_id &&
299
+ default_address_id == o.default_address_id &&
300
+ shipping_method_mappings == o.shipping_method_mappings &&
301
+ sync_only_unfulfilled == o.sync_only_unfulfilled &&
302
+ sync_orders_since == o.sync_orders_since &&
303
+ service_point_count == o.service_point_count
304
+ end
305
+
306
+ # @see the `==` method
307
+ # @param [Object] Object to be compared
308
+ def eql?(o)
309
+ self == o
310
+ end
311
+
312
+ # Calculates hash code according to all attributes.
313
+ # @return [Integer] Hash code
314
+ def hash
315
+ [use_webhooks, site_url, auto_fulfill, 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
316
+ end
317
+
318
+ # Builds the object from hash
319
+ # @param [Hash] attributes Model attributes in the form of hash
320
+ # @return [Object] Returns the model itself
321
+ def self.build_from_hash(attributes)
322
+ return nil unless attributes.is_a?(Hash)
323
+ attributes = attributes.transform_keys(&:to_sym)
324
+ transformed_hash = {}
325
+ openapi_types.each_pair do |key, type|
326
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
327
+ transformed_hash["#{key}"] = nil
328
+ elsif type =~ /\AArray<(.*)>/i
329
+ # check to ensure the input is an array given that the attribute
330
+ # is documented as an array but the input is not
331
+ if attributes[attribute_map[key]].is_a?(Array)
332
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
333
+ end
334
+ elsif !attributes[attribute_map[key]].nil?
335
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
336
+ end
337
+ end
338
+ new(transformed_hash)
339
+ end
340
+
341
+ # Returns the object in the form of hash
342
+ # @return [Hash] Returns the object in the form of hash
343
+ def to_hash
344
+ hash = {}
345
+ self.class.attribute_map.each_pair do |attr, param|
346
+ value = self.send(attr)
347
+ if value.nil?
348
+ is_nullable = self.class.openapi_nullable.include?(attr)
349
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
350
+ end
351
+
352
+ hash[param] = _to_hash(value)
353
+ end
354
+ hash
355
+ end
356
+
357
+ end
358
+
359
+ end
@@ -0,0 +1,254 @@
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 CreateOrderChannelRequestSettingsShippingMethodMappingsInner < ApiModelBase
18
+ # Shipping-method title to match against imported orders (trimmed, case-insensitive, exact).
19
+ attr_accessor :match
20
+
21
+ # Shipping rule applied to orders whose shipping-method title matches.
22
+ attr_accessor :shipping_rule_id
23
+
24
+ # For rules whose product delivers to a service point: 'nearest' auto-selects the closest point to the recipient address; 'manual' keeps the shipment in draft for manual selection.
25
+ attr_accessor :service_point_selection
26
+
27
+ class EnumAttributeValidator
28
+ attr_reader :datatype
29
+ attr_reader :allowable_values
30
+
31
+ def initialize(datatype, allowable_values)
32
+ @allowable_values = allowable_values.map do |value|
33
+ case datatype.to_s
34
+ when /Integer/i
35
+ value.to_i
36
+ when /Float/i
37
+ value.to_f
38
+ else
39
+ value
40
+ end
41
+ end
42
+ end
43
+
44
+ def valid?(value)
45
+ !value || allowable_values.include?(value)
46
+ end
47
+ end
48
+
49
+ # Attribute mapping from ruby-style variable name to JSON key.
50
+ def self.attribute_map
51
+ {
52
+ :'match' => :'match',
53
+ :'shipping_rule_id' => :'shippingRuleId',
54
+ :'service_point_selection' => :'servicePointSelection'
55
+ }
56
+ end
57
+
58
+ # Returns attribute mapping this model knows about
59
+ def self.acceptable_attribute_map
60
+ attribute_map
61
+ end
62
+
63
+ # Returns all the JSON keys this model knows about
64
+ def self.acceptable_attributes
65
+ acceptable_attribute_map.values
66
+ end
67
+
68
+ # Attribute type mapping.
69
+ def self.openapi_types
70
+ {
71
+ :'match' => :'String',
72
+ :'shipping_rule_id' => :'String',
73
+ :'service_point_selection' => :'String'
74
+ }
75
+ end
76
+
77
+ # List of attributes with nullable: true
78
+ def self.openapi_nullable
79
+ Set.new([
80
+ ])
81
+ end
82
+
83
+ # Initializes the object
84
+ # @param [Hash] attributes Model attributes in the form of hash
85
+ def initialize(attributes = {})
86
+ if (!attributes.is_a?(Hash))
87
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zippendo::CreateOrderChannelRequestSettingsShippingMethodMappingsInner` initialize method"
88
+ end
89
+
90
+ # check to see if the attribute exists and convert string to symbol for hash key
91
+ acceptable_attribute_map = self.class.acceptable_attribute_map
92
+ attributes = attributes.each_with_object({}) { |(k, v), h|
93
+ if (!acceptable_attribute_map.key?(k.to_sym))
94
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zippendo::CreateOrderChannelRequestSettingsShippingMethodMappingsInner`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
95
+ end
96
+ h[k.to_sym] = v
97
+ }
98
+
99
+ if attributes.key?(:'match')
100
+ self.match = attributes[:'match']
101
+ else
102
+ self.match = nil
103
+ end
104
+
105
+ if attributes.key?(:'shipping_rule_id')
106
+ self.shipping_rule_id = attributes[:'shipping_rule_id']
107
+ else
108
+ self.shipping_rule_id = nil
109
+ end
110
+
111
+ if attributes.key?(:'service_point_selection')
112
+ self.service_point_selection = attributes[:'service_point_selection']
113
+ end
114
+ end
115
+
116
+ # Show invalid properties with the reasons. Usually used together with valid?
117
+ # @return Array for valid properties with the reasons
118
+ def list_invalid_properties
119
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
120
+ invalid_properties = Array.new
121
+ if @match.nil?
122
+ invalid_properties.push('invalid value for "match", match cannot be nil.')
123
+ end
124
+
125
+ if @match.to_s.length < 1
126
+ invalid_properties.push('invalid value for "match", the character length must be greater than or equal to 1.')
127
+ end
128
+
129
+ if @shipping_rule_id.nil?
130
+ invalid_properties.push('invalid value for "shipping_rule_id", shipping_rule_id cannot be nil.')
131
+ end
132
+
133
+ if @shipping_rule_id.to_s.length < 1
134
+ invalid_properties.push('invalid value for "shipping_rule_id", the character length must be greater than or equal to 1.')
135
+ end
136
+
137
+ invalid_properties
138
+ end
139
+
140
+ # Check to see if the all the properties in the model are valid
141
+ # @return true if the model is valid
142
+ def valid?
143
+ warn '[DEPRECATED] the `valid?` method is obsolete'
144
+ return false if @match.nil?
145
+ return false if @match.to_s.length < 1
146
+ return false if @shipping_rule_id.nil?
147
+ return false if @shipping_rule_id.to_s.length < 1
148
+ service_point_selection_validator = EnumAttributeValidator.new('String', ["nearest", "manual"])
149
+ return false unless service_point_selection_validator.valid?(@service_point_selection)
150
+ true
151
+ end
152
+
153
+ # Custom attribute writer method with validation
154
+ # @param [Object] match Value to be assigned
155
+ def match=(match)
156
+ if match.nil?
157
+ fail ArgumentError, 'match cannot be nil'
158
+ end
159
+
160
+ if match.to_s.length < 1
161
+ fail ArgumentError, 'invalid value for "match", the character length must be greater than or equal to 1.'
162
+ end
163
+
164
+ @match = match
165
+ end
166
+
167
+ # Custom attribute writer method with validation
168
+ # @param [Object] shipping_rule_id Value to be assigned
169
+ def shipping_rule_id=(shipping_rule_id)
170
+ if shipping_rule_id.nil?
171
+ fail ArgumentError, 'shipping_rule_id cannot be nil'
172
+ end
173
+
174
+ if shipping_rule_id.to_s.length < 1
175
+ fail ArgumentError, 'invalid value for "shipping_rule_id", the character length must be greater than or equal to 1.'
176
+ end
177
+
178
+ @shipping_rule_id = shipping_rule_id
179
+ end
180
+
181
+ # Custom attribute writer method checking allowed values (enum).
182
+ # @param [Object] service_point_selection Object to be assigned
183
+ def service_point_selection=(service_point_selection)
184
+ validator = EnumAttributeValidator.new('String', ["nearest", "manual"])
185
+ unless validator.valid?(service_point_selection)
186
+ fail ArgumentError, "invalid value for \"service_point_selection\", must be one of #{validator.allowable_values}."
187
+ end
188
+ @service_point_selection = service_point_selection
189
+ end
190
+
191
+ # Checks equality by comparing each attribute.
192
+ # @param [Object] Object to be compared
193
+ def ==(o)
194
+ return true if self.equal?(o)
195
+ self.class == o.class &&
196
+ match == o.match &&
197
+ shipping_rule_id == o.shipping_rule_id &&
198
+ service_point_selection == o.service_point_selection
199
+ end
200
+
201
+ # @see the `==` method
202
+ # @param [Object] Object to be compared
203
+ def eql?(o)
204
+ self == o
205
+ end
206
+
207
+ # Calculates hash code according to all attributes.
208
+ # @return [Integer] Hash code
209
+ def hash
210
+ [match, shipping_rule_id, service_point_selection].hash
211
+ end
212
+
213
+ # Builds the object from hash
214
+ # @param [Hash] attributes Model attributes in the form of hash
215
+ # @return [Object] Returns the model itself
216
+ def self.build_from_hash(attributes)
217
+ return nil unless attributes.is_a?(Hash)
218
+ attributes = attributes.transform_keys(&:to_sym)
219
+ transformed_hash = {}
220
+ openapi_types.each_pair do |key, type|
221
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
222
+ transformed_hash["#{key}"] = nil
223
+ elsif type =~ /\AArray<(.*)>/i
224
+ # check to ensure the input is an array given that the attribute
225
+ # is documented as an array but the input is not
226
+ if attributes[attribute_map[key]].is_a?(Array)
227
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
228
+ end
229
+ elsif !attributes[attribute_map[key]].nil?
230
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
231
+ end
232
+ end
233
+ new(transformed_hash)
234
+ end
235
+
236
+ # Returns the object in the form of hash
237
+ # @return [Hash] Returns the object in the form of hash
238
+ def to_hash
239
+ hash = {}
240
+ self.class.attribute_map.each_pair do |attr, param|
241
+ value = self.send(attr)
242
+ if value.nil?
243
+ is_nullable = self.class.openapi_nullable.include?(attr)
244
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
245
+ end
246
+
247
+ hash[param] = _to_hash(value)
248
+ end
249
+ hash
250
+ end
251
+
252
+ end
253
+
254
+ end