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,230 @@
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 CreateOrderChannelWebhookSecret201Response < ApiModelBase
18
+ # The webhook signing secret. Returned only once — store it in your system; every push to the ingest URL must carry an HMAC-SHA256 hex signature of the raw body computed with it.
19
+ attr_accessor :secret
20
+
21
+ # The ingest URL your system pushes signed order events to.
22
+ attr_accessor :webhook_url
23
+
24
+ # When this secret was issued (ISO 8601).
25
+ attr_accessor :created_at
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'secret' => :'secret',
31
+ :'webhook_url' => :'webhookUrl',
32
+ :'created_at' => :'createdAt'
33
+ }
34
+ end
35
+
36
+ # Returns attribute mapping this model knows about
37
+ def self.acceptable_attribute_map
38
+ attribute_map
39
+ end
40
+
41
+ # Returns all the JSON keys this model knows about
42
+ def self.acceptable_attributes
43
+ acceptable_attribute_map.values
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.openapi_types
48
+ {
49
+ :'secret' => :'String',
50
+ :'webhook_url' => :'String',
51
+ :'created_at' => :'Time'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ ])
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zippendo::CreateOrderChannelWebhookSecret201Response` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ acceptable_attribute_map = self.class.acceptable_attribute_map
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!acceptable_attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zippendo::CreateOrderChannelWebhookSecret201Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:'secret')
78
+ self.secret = attributes[:'secret']
79
+ else
80
+ self.secret = nil
81
+ end
82
+
83
+ if attributes.key?(:'webhook_url')
84
+ self.webhook_url = attributes[:'webhook_url']
85
+ else
86
+ self.webhook_url = nil
87
+ end
88
+
89
+ if attributes.key?(:'created_at')
90
+ self.created_at = attributes[:'created_at']
91
+ else
92
+ self.created_at = nil
93
+ end
94
+ end
95
+
96
+ # Show invalid properties with the reasons. Usually used together with valid?
97
+ # @return Array for valid properties with the reasons
98
+ def list_invalid_properties
99
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
100
+ invalid_properties = Array.new
101
+ if @secret.nil?
102
+ invalid_properties.push('invalid value for "secret", secret cannot be nil.')
103
+ end
104
+
105
+ if @webhook_url.nil?
106
+ invalid_properties.push('invalid value for "webhook_url", webhook_url cannot be nil.')
107
+ end
108
+
109
+ if @created_at.nil?
110
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
111
+ end
112
+
113
+ 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))$/)
114
+ if @created_at !~ pattern
115
+ invalid_properties.push("invalid value for \"created_at\", must conform to the pattern #{pattern}.")
116
+ end
117
+
118
+ invalid_properties
119
+ end
120
+
121
+ # Check to see if the all the properties in the model are valid
122
+ # @return true if the model is valid
123
+ def valid?
124
+ warn '[DEPRECATED] the `valid?` method is obsolete'
125
+ return false if @secret.nil?
126
+ return false if @webhook_url.nil?
127
+ return false if @created_at.nil?
128
+ return false if @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))$/)
129
+ true
130
+ end
131
+
132
+ # Custom attribute writer method with validation
133
+ # @param [Object] secret Value to be assigned
134
+ def secret=(secret)
135
+ if secret.nil?
136
+ fail ArgumentError, 'secret cannot be nil'
137
+ end
138
+
139
+ @secret = secret
140
+ end
141
+
142
+ # Custom attribute writer method with validation
143
+ # @param [Object] webhook_url Value to be assigned
144
+ def webhook_url=(webhook_url)
145
+ if webhook_url.nil?
146
+ fail ArgumentError, 'webhook_url cannot be nil'
147
+ end
148
+
149
+ @webhook_url = webhook_url
150
+ end
151
+
152
+ # Custom attribute writer method with validation
153
+ # @param [Object] created_at Value to be assigned
154
+ def created_at=(created_at)
155
+ if created_at.nil?
156
+ fail ArgumentError, 'created_at cannot be nil'
157
+ end
158
+
159
+ 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))$/)
160
+ if created_at !~ pattern
161
+ fail ArgumentError, "invalid value for \"created_at\", must conform to the pattern #{pattern}."
162
+ end
163
+
164
+ @created_at = created_at
165
+ end
166
+
167
+ # Checks equality by comparing each attribute.
168
+ # @param [Object] Object to be compared
169
+ def ==(o)
170
+ return true if self.equal?(o)
171
+ self.class == o.class &&
172
+ secret == o.secret &&
173
+ webhook_url == o.webhook_url &&
174
+ created_at == o.created_at
175
+ end
176
+
177
+ # @see the `==` method
178
+ # @param [Object] Object to be compared
179
+ def eql?(o)
180
+ self == o
181
+ end
182
+
183
+ # Calculates hash code according to all attributes.
184
+ # @return [Integer] Hash code
185
+ def hash
186
+ [secret, webhook_url, created_at].hash
187
+ end
188
+
189
+ # Builds the object from hash
190
+ # @param [Hash] attributes Model attributes in the form of hash
191
+ # @return [Object] Returns the model itself
192
+ def self.build_from_hash(attributes)
193
+ return nil unless attributes.is_a?(Hash)
194
+ attributes = attributes.transform_keys(&:to_sym)
195
+ transformed_hash = {}
196
+ openapi_types.each_pair do |key, type|
197
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
198
+ transformed_hash["#{key}"] = nil
199
+ elsif type =~ /\AArray<(.*)>/i
200
+ # check to ensure the input is an array given that the attribute
201
+ # is documented as an array but the input is not
202
+ if attributes[attribute_map[key]].is_a?(Array)
203
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
204
+ end
205
+ elsif !attributes[attribute_map[key]].nil?
206
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
207
+ end
208
+ end
209
+ new(transformed_hash)
210
+ end
211
+
212
+ # Returns the object in the form of hash
213
+ # @return [Hash] Returns the object in the form of hash
214
+ def to_hash
215
+ hash = {}
216
+ self.class.attribute_map.each_pair do |attr, param|
217
+ value = self.send(attr)
218
+ if value.nil?
219
+ is_nullable = self.class.openapi_nullable.include?(attr)
220
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
221
+ end
222
+
223
+ hash[param] = _to_hash(value)
224
+ end
225
+ hash
226
+ end
227
+
228
+ end
229
+
230
+ end
@@ -47,6 +47,12 @@ module Zippendo
47
47
  # Free-form internal notes.
48
48
  attr_accessor :notes
49
49
 
50
+ # Shipping rule to ship this order with. When set, a shipment is created immediately (and dispatched if the channel has autoShipOnCreate enabled).
51
+ attr_accessor :shipping_rule_id
52
+
53
+ # Shipping-method title from the source checkout; matched against the order channel's shipping-method mappings to pick a shipping rule.
54
+ attr_accessor :shipping_method_title
55
+
50
56
  # Raw platform-specific payload for reference.
51
57
  attr_accessor :external_data
52
58
 
@@ -64,6 +70,8 @@ module Zippendo
64
70
  :'total_amount' => :'totalAmount',
65
71
  :'currency' => :'currency',
66
72
  :'notes' => :'notes',
73
+ :'shipping_rule_id' => :'shippingRuleId',
74
+ :'shipping_method_title' => :'shippingMethodTitle',
67
75
  :'external_data' => :'externalData'
68
76
  }
69
77
  end
@@ -92,6 +100,8 @@ module Zippendo
92
100
  :'total_amount' => :'Float',
93
101
  :'currency' => :'String',
94
102
  :'notes' => :'String',
103
+ :'shipping_rule_id' => :'String',
104
+ :'shipping_method_title' => :'String',
95
105
  :'external_data' => :'Hash<String, Object>'
96
106
  }
97
107
  end
@@ -107,6 +117,8 @@ module Zippendo
107
117
  :'total_amount',
108
118
  :'currency',
109
119
  :'notes',
120
+ :'shipping_rule_id',
121
+ :'shipping_method_title',
110
122
  :'external_data'
111
123
  ])
112
124
  end
@@ -179,6 +191,14 @@ module Zippendo
179
191
  self.notes = attributes[:'notes']
180
192
  end
181
193
 
194
+ if attributes.key?(:'shipping_rule_id')
195
+ self.shipping_rule_id = attributes[:'shipping_rule_id']
196
+ end
197
+
198
+ if attributes.key?(:'shipping_method_title')
199
+ self.shipping_method_title = attributes[:'shipping_method_title']
200
+ end
201
+
182
202
  if attributes.key?(:'external_data')
183
203
  if (value = attributes[:'external_data']).is_a?(Hash)
184
204
  self.external_data = value
@@ -351,6 +371,8 @@ module Zippendo
351
371
  total_amount == o.total_amount &&
352
372
  currency == o.currency &&
353
373
  notes == o.notes &&
374
+ shipping_rule_id == o.shipping_rule_id &&
375
+ shipping_method_title == o.shipping_method_title &&
354
376
  external_data == o.external_data
355
377
  end
356
378
 
@@ -363,7 +385,7 @@ module Zippendo
363
385
  # Calculates hash code according to all attributes.
364
386
  # @return [Integer] Hash code
365
387
  def hash
366
- [order_number, external_id, order_channel_id, customer_name, customer_email, shipping_address, order_lines, subtotal_amount, total_amount, currency, notes, external_data].hash
388
+ [order_number, external_id, order_channel_id, customer_name, customer_email, shipping_address, order_lines, subtotal_amount, total_amount, currency, notes, shipping_rule_id, shipping_method_title, external_data].hash
367
389
  end
368
390
 
369
391
  # Builds the object from hash
@@ -0,0 +1,221 @@
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 GetOrderChannelWebhookStatus200Response < ApiModelBase
18
+ # Whether webhooks are enabled for the channel.
19
+ attr_accessor :enabled
20
+
21
+ # Expected callback URL for this channel.
22
+ attr_accessor :webhook_url
23
+
24
+ # Webhooks registered for this channel's callback URL.
25
+ attr_accessor :webhooks
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'enabled' => :'enabled',
31
+ :'webhook_url' => :'webhookUrl',
32
+ :'webhooks' => :'webhooks'
33
+ }
34
+ end
35
+
36
+ # Returns attribute mapping this model knows about
37
+ def self.acceptable_attribute_map
38
+ attribute_map
39
+ end
40
+
41
+ # Returns all the JSON keys this model knows about
42
+ def self.acceptable_attributes
43
+ acceptable_attribute_map.values
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.openapi_types
48
+ {
49
+ :'enabled' => :'Boolean',
50
+ :'webhook_url' => :'String',
51
+ :'webhooks' => :'Array<GetOrderChannelWebhookStatus200ResponseWebhooksInner>'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ ])
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zippendo::GetOrderChannelWebhookStatus200Response` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ acceptable_attribute_map = self.class.acceptable_attribute_map
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!acceptable_attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zippendo::GetOrderChannelWebhookStatus200Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:'enabled')
78
+ self.enabled = attributes[:'enabled']
79
+ else
80
+ self.enabled = nil
81
+ end
82
+
83
+ if attributes.key?(:'webhook_url')
84
+ self.webhook_url = attributes[:'webhook_url']
85
+ else
86
+ self.webhook_url = nil
87
+ end
88
+
89
+ if attributes.key?(:'webhooks')
90
+ if (value = attributes[:'webhooks']).is_a?(Array)
91
+ self.webhooks = value
92
+ end
93
+ else
94
+ self.webhooks = nil
95
+ end
96
+ end
97
+
98
+ # Show invalid properties with the reasons. Usually used together with valid?
99
+ # @return Array for valid properties with the reasons
100
+ def list_invalid_properties
101
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
102
+ invalid_properties = Array.new
103
+ if @enabled.nil?
104
+ invalid_properties.push('invalid value for "enabled", enabled cannot be nil.')
105
+ end
106
+
107
+ if @webhook_url.nil?
108
+ invalid_properties.push('invalid value for "webhook_url", webhook_url cannot be nil.')
109
+ end
110
+
111
+ if @webhooks.nil?
112
+ invalid_properties.push('invalid value for "webhooks", webhooks cannot be nil.')
113
+ end
114
+
115
+ invalid_properties
116
+ end
117
+
118
+ # Check to see if the all the properties in the model are valid
119
+ # @return true if the model is valid
120
+ def valid?
121
+ warn '[DEPRECATED] the `valid?` method is obsolete'
122
+ return false if @enabled.nil?
123
+ return false if @webhook_url.nil?
124
+ return false if @webhooks.nil?
125
+ true
126
+ end
127
+
128
+ # Custom attribute writer method with validation
129
+ # @param [Object] enabled Value to be assigned
130
+ def enabled=(enabled)
131
+ if enabled.nil?
132
+ fail ArgumentError, 'enabled cannot be nil'
133
+ end
134
+
135
+ @enabled = enabled
136
+ end
137
+
138
+ # Custom attribute writer method with validation
139
+ # @param [Object] webhook_url Value to be assigned
140
+ def webhook_url=(webhook_url)
141
+ if webhook_url.nil?
142
+ fail ArgumentError, 'webhook_url cannot be nil'
143
+ end
144
+
145
+ @webhook_url = webhook_url
146
+ end
147
+
148
+ # Custom attribute writer method with validation
149
+ # @param [Object] webhooks Value to be assigned
150
+ def webhooks=(webhooks)
151
+ if webhooks.nil?
152
+ fail ArgumentError, 'webhooks cannot be nil'
153
+ end
154
+
155
+ @webhooks = webhooks
156
+ end
157
+
158
+ # Checks equality by comparing each attribute.
159
+ # @param [Object] Object to be compared
160
+ def ==(o)
161
+ return true if self.equal?(o)
162
+ self.class == o.class &&
163
+ enabled == o.enabled &&
164
+ webhook_url == o.webhook_url &&
165
+ webhooks == o.webhooks
166
+ end
167
+
168
+ # @see the `==` method
169
+ # @param [Object] Object to be compared
170
+ def eql?(o)
171
+ self == o
172
+ end
173
+
174
+ # Calculates hash code according to all attributes.
175
+ # @return [Integer] Hash code
176
+ def hash
177
+ [enabled, webhook_url, webhooks].hash
178
+ end
179
+
180
+ # Builds the object from hash
181
+ # @param [Hash] attributes Model attributes in the form of hash
182
+ # @return [Object] Returns the model itself
183
+ def self.build_from_hash(attributes)
184
+ return nil unless attributes.is_a?(Hash)
185
+ attributes = attributes.transform_keys(&:to_sym)
186
+ transformed_hash = {}
187
+ openapi_types.each_pair do |key, type|
188
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
189
+ transformed_hash["#{key}"] = nil
190
+ elsif type =~ /\AArray<(.*)>/i
191
+ # check to ensure the input is an array given that the attribute
192
+ # is documented as an array but the input is not
193
+ if attributes[attribute_map[key]].is_a?(Array)
194
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
195
+ end
196
+ elsif !attributes[attribute_map[key]].nil?
197
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
198
+ end
199
+ end
200
+ new(transformed_hash)
201
+ end
202
+
203
+ # Returns the object in the form of hash
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_hash
206
+ hash = {}
207
+ self.class.attribute_map.each_pair do |attr, param|
208
+ value = self.send(attr)
209
+ if value.nil?
210
+ is_nullable = self.class.openapi_nullable.include?(attr)
211
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
+ end
213
+
214
+ hash[param] = _to_hash(value)
215
+ end
216
+ hash
217
+ end
218
+
219
+ end
220
+
221
+ end