svix 0.32.0 → 0.38.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/svix/api/endpoint_api.rb +507 -0
- data/lib/svix/api/event_type_api.rb +83 -6
- data/lib/svix/api/message_api.rb +2 -2
- data/lib/svix/api/message_attempt_api.rb +4 -4
- data/lib/svix/api/organization_settings_api.rb +79 -0
- data/lib/svix/api/statistics_api.rb +205 -0
- data/lib/svix/endpoint_api.rb +22 -1
- data/lib/svix/event_type_api.rb +4 -0
- data/lib/svix/models/application_out.rb +18 -4
- data/lib/svix/models/attempt_statistics_data.rb +231 -0
- data/lib/svix/models/attempt_statistics_response.rb +265 -0
- data/lib/svix/models/border_radii_config.rb +236 -0
- data/lib/svix/models/border_radius_config.rb +236 -0
- data/lib/svix/models/border_radius_enum.rb +40 -0
- data/lib/svix/models/custom_theme_override.rb +227 -0
- data/lib/svix/models/endpoint_created_event_data.rb +36 -0
- data/lib/svix/models/endpoint_deleted_event_data.rb +36 -0
- data/lib/svix/models/endpoint_disabled_event_data.rb +36 -0
- data/lib/svix/models/endpoint_headers_in.rb +225 -0
- data/lib/svix/models/endpoint_headers_out.rb +252 -0
- data/lib/svix/models/endpoint_in.rb +26 -0
- data/lib/svix/models/endpoint_out.rb +24 -1
- data/lib/svix/models/endpoint_secret_out.rb +21 -0
- data/lib/svix/models/endpoint_secret_rotate_in.rb +236 -0
- data/lib/svix/models/endpoint_update.rb +9 -0
- data/lib/svix/models/endpoint_updated_event.rb +269 -0
- data/lib/svix/models/endpoint_updated_event_data.rb +36 -0
- data/lib/svix/models/event_type_example_out.rb +223 -0
- data/lib/svix/models/event_type_in.rb +12 -1
- data/lib/svix/models/event_type_out.rb +43 -4
- data/lib/svix/models/event_type_schema_in.rb +224 -0
- data/lib/svix/models/event_type_update.rb +12 -1
- data/lib/svix/models/font_size_config.rb +218 -0
- data/lib/svix/models/message_attempt_exhausted_event_data.rb +36 -0
- data/lib/svix/models/message_endpoint_out.rb +9 -0
- data/lib/svix/models/portal_settings_out.rb +286 -0
- data/lib/svix/models/radii_enum.rb +39 -0
- data/lib/svix/models/recover_in.rb +223 -0
- data/lib/svix/models/settings_out.rb +323 -0
- data/lib/svix/models/statistics_period.rb +37 -0
- data/lib/svix/models/webhook_types.rb +1 -1
- data/lib/svix/version.rb +1 -1
- data/lib/svix.rb +6 -2
- metadata +22 -2
@@ -121,6 +121,10 @@ module Svix
|
|
121
121
|
# @return Array for valid properties with the reasons
|
122
122
|
def list_invalid_properties
|
123
123
|
invalid_properties = Array.new
|
124
|
+
if !@filter_types.nil? && @filter_types.length < 1
|
125
|
+
invalid_properties.push('invalid value for "filter_types", number of items must be greater than or equal to 1.')
|
126
|
+
end
|
127
|
+
|
124
128
|
if !@uid.nil? && @uid.to_s.length > 256
|
125
129
|
invalid_properties.push('invalid value for "uid", the character length must be smaller than or equal to 256.')
|
126
130
|
end
|
@@ -156,6 +160,7 @@ module Svix
|
|
156
160
|
# Check to see if the all the properties in the model are valid
|
157
161
|
# @return true if the model is valid
|
158
162
|
def valid?
|
163
|
+
return false if !@filter_types.nil? && @filter_types.length < 1
|
159
164
|
return false if !@uid.nil? && @uid.to_s.length > 256
|
160
165
|
return false if !@uid.nil? && @uid.to_s.length < 1
|
161
166
|
return false if !@uid.nil? && @uid !~ Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
|
@@ -169,6 +174,10 @@ module Svix
|
|
169
174
|
# Custom attribute writer method with validation
|
170
175
|
# @param [Object] filter_types Value to be assigned
|
171
176
|
def filter_types=(filter_types)
|
177
|
+
if !filter_types.nil? && filter_types.length < 1
|
178
|
+
fail ArgumentError, 'invalid value for "filter_types", number of items must be greater than or equal to 1.'
|
179
|
+
end
|
180
|
+
|
172
181
|
@filter_types = filter_types
|
173
182
|
end
|
174
183
|
|
@@ -0,0 +1,269 @@
|
|
1
|
+
=begin
|
2
|
+
#Svix API
|
3
|
+
|
4
|
+
#Welcome to the Svix API documentation! Useful links: [Homepage](https://www.svix.com) | [Support email](mailto:support+docs@svix.com) | [Blog](https://www.svix.com/blog/) | [Slack Community](https://www.svix.com/slack/) # Introduction This is the reference documentation and schemas for the [Svix webhook service](https://www.svix.com) API. For tutorials and other documentation please refer to [the documentation](https://docs.svix.com). ## Main concepts In Svix you have four important entities you will be interacting with: - `messages`: these are the webhooks being sent. They can have contents and a few other properties. - `application`: this is where `messages` are sent to. Usually you want to create one application for each of your users. - `endpoint`: endpoints are the URLs messages will be sent to. Each application can have multiple `endpoints` and each message sent to that application will be sent to all of them (unless they are not subscribed to the sent event type). - `event-type`: event types are identifiers denoting the type of the message being sent. Event types are primarily used to decide which events are sent to which endpoint. ## Authentication Get your authentication token (`AUTH_TOKEN`) from the [Svix dashboard](https://dashboard.svix.com) and use it as part of the `Authorization` header as such: `Authorization: Bearer ${AUTH_TOKEN}`. <SecurityDefinitions /> ## Code samples The code samples assume you already have the respective libraries installed and you know how to use them. For the latest information on how to do that, please refer to [the documentation](https://docs.svix.com/). ## Cross-Origin Resource Sharing This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). And that allows cross-domain communication from the browser. All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.4
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.2.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Svix
|
17
|
+
# Sent when an endpoint is updated.
|
18
|
+
class EndpointUpdatedEvent
|
19
|
+
attr_accessor :data
|
20
|
+
|
21
|
+
attr_accessor :type
|
22
|
+
|
23
|
+
class EnumAttributeValidator
|
24
|
+
attr_reader :datatype
|
25
|
+
attr_reader :allowable_values
|
26
|
+
|
27
|
+
def initialize(datatype, allowable_values)
|
28
|
+
@allowable_values = allowable_values.map do |value|
|
29
|
+
case datatype.to_s
|
30
|
+
when /Integer/i
|
31
|
+
value.to_i
|
32
|
+
when /Float/i
|
33
|
+
value.to_f
|
34
|
+
else
|
35
|
+
value
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def valid?(value)
|
41
|
+
!value || allowable_values.include?(value)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
46
|
+
def self.attribute_map
|
47
|
+
{
|
48
|
+
:'data' => :'data',
|
49
|
+
:'type' => :'type'
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
# Returns all the JSON keys this model knows about
|
54
|
+
def self.acceptable_attributes
|
55
|
+
attribute_map.values
|
56
|
+
end
|
57
|
+
|
58
|
+
# Attribute type mapping.
|
59
|
+
def self.openapi_types
|
60
|
+
{
|
61
|
+
:'data' => :'EndpointUpdatedEventData',
|
62
|
+
:'type' => :'String'
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
# List of attributes with nullable: true
|
67
|
+
def self.openapi_nullable
|
68
|
+
Set.new([
|
69
|
+
])
|
70
|
+
end
|
71
|
+
|
72
|
+
# Initializes the object
|
73
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
74
|
+
def initialize(attributes = {})
|
75
|
+
if (!attributes.is_a?(Hash))
|
76
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::EndpointUpdatedEvent` initialize method"
|
77
|
+
end
|
78
|
+
|
79
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
80
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
81
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
82
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::EndpointUpdatedEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
83
|
+
end
|
84
|
+
h[k.to_sym] = v
|
85
|
+
}
|
86
|
+
|
87
|
+
if attributes.key?(:'data')
|
88
|
+
self.data = attributes[:'data']
|
89
|
+
end
|
90
|
+
|
91
|
+
if attributes.key?(:'type')
|
92
|
+
self.type = attributes[:'type']
|
93
|
+
else
|
94
|
+
self.type = 'endpoint.updated'
|
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
|
+
invalid_properties = Array.new
|
102
|
+
if @data.nil?
|
103
|
+
invalid_properties.push('invalid value for "data", data cannot be nil.')
|
104
|
+
end
|
105
|
+
|
106
|
+
invalid_properties
|
107
|
+
end
|
108
|
+
|
109
|
+
# Check to see if the all the properties in the model are valid
|
110
|
+
# @return true if the model is valid
|
111
|
+
def valid?
|
112
|
+
return false if @data.nil?
|
113
|
+
type_validator = EnumAttributeValidator.new('String', ["endpoint.updated"])
|
114
|
+
return false unless type_validator.valid?(@type)
|
115
|
+
true
|
116
|
+
end
|
117
|
+
|
118
|
+
# Custom attribute writer method checking allowed values (enum).
|
119
|
+
# @param [Object] type Object to be assigned
|
120
|
+
def type=(type)
|
121
|
+
validator = EnumAttributeValidator.new('String', ["endpoint.updated"])
|
122
|
+
unless validator.valid?(type)
|
123
|
+
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
124
|
+
end
|
125
|
+
@type = type
|
126
|
+
end
|
127
|
+
|
128
|
+
# Checks equality by comparing each attribute.
|
129
|
+
# @param [Object] Object to be compared
|
130
|
+
def ==(o)
|
131
|
+
return true if self.equal?(o)
|
132
|
+
self.class == o.class &&
|
133
|
+
data == o.data &&
|
134
|
+
type == o.type
|
135
|
+
end
|
136
|
+
|
137
|
+
# @see the `==` method
|
138
|
+
# @param [Object] Object to be compared
|
139
|
+
def eql?(o)
|
140
|
+
self == o
|
141
|
+
end
|
142
|
+
|
143
|
+
# Calculates hash code according to all attributes.
|
144
|
+
# @return [Integer] Hash code
|
145
|
+
def hash
|
146
|
+
[data, type].hash
|
147
|
+
end
|
148
|
+
|
149
|
+
# Builds the object from hash
|
150
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
151
|
+
# @return [Object] Returns the model itself
|
152
|
+
def self.build_from_hash(attributes)
|
153
|
+
new.build_from_hash(attributes)
|
154
|
+
end
|
155
|
+
|
156
|
+
# Builds the object from hash
|
157
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
158
|
+
# @return [Object] Returns the model itself
|
159
|
+
def build_from_hash(attributes)
|
160
|
+
return nil unless attributes.is_a?(Hash)
|
161
|
+
self.class.openapi_types.each_pair do |key, type|
|
162
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
163
|
+
self.send("#{key}=", nil)
|
164
|
+
elsif type =~ /\AArray<(.*)>/i
|
165
|
+
# check to ensure the input is an array given that the attribute
|
166
|
+
# is documented as an array but the input is not
|
167
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
168
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
169
|
+
end
|
170
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
171
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
self
|
176
|
+
end
|
177
|
+
|
178
|
+
# Deserializes the data based on type
|
179
|
+
# @param string type Data type
|
180
|
+
# @param string value Value to be deserialized
|
181
|
+
# @return [Object] Deserialized data
|
182
|
+
def _deserialize(type, value)
|
183
|
+
case type.to_sym
|
184
|
+
when :Time
|
185
|
+
Time.parse(value)
|
186
|
+
when :Date
|
187
|
+
Date.parse(value)
|
188
|
+
when :String
|
189
|
+
value.to_s
|
190
|
+
when :Integer
|
191
|
+
value.to_i
|
192
|
+
when :Float
|
193
|
+
value.to_f
|
194
|
+
when :Boolean
|
195
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
196
|
+
true
|
197
|
+
else
|
198
|
+
false
|
199
|
+
end
|
200
|
+
when :Object
|
201
|
+
# generic object (usually a Hash), return directly
|
202
|
+
value
|
203
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
204
|
+
inner_type = Regexp.last_match[:inner_type]
|
205
|
+
value.map { |v| _deserialize(inner_type, v) }
|
206
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
207
|
+
k_type = Regexp.last_match[:k_type]
|
208
|
+
v_type = Regexp.last_match[:v_type]
|
209
|
+
{}.tap do |hash|
|
210
|
+
value.each do |k, v|
|
211
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
212
|
+
end
|
213
|
+
end
|
214
|
+
else # model
|
215
|
+
# models (e.g. Pet) or oneOf
|
216
|
+
klass = Svix.const_get(type)
|
217
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
# Returns the string representation of the object
|
222
|
+
# @return [String] String presentation of the object
|
223
|
+
def to_s
|
224
|
+
to_hash.to_s
|
225
|
+
end
|
226
|
+
|
227
|
+
# to_body is an alias to to_hash (backward compatibility)
|
228
|
+
# @return [Hash] Returns the object in the form of hash
|
229
|
+
def to_body
|
230
|
+
to_hash
|
231
|
+
end
|
232
|
+
|
233
|
+
# Returns the object in the form of hash
|
234
|
+
# @return [Hash] Returns the object in the form of hash
|
235
|
+
def to_hash
|
236
|
+
hash = {}
|
237
|
+
self.class.attribute_map.each_pair do |attr, param|
|
238
|
+
value = self.send(attr)
|
239
|
+
if value.nil?
|
240
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
241
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
242
|
+
end
|
243
|
+
|
244
|
+
hash[param] = _to_hash(value)
|
245
|
+
end
|
246
|
+
hash
|
247
|
+
end
|
248
|
+
|
249
|
+
# Outputs non-array value in the form of hash
|
250
|
+
# For object, use to_hash. Otherwise, just return the value
|
251
|
+
# @param [Object] value Any valid value
|
252
|
+
# @return [Hash] Returns the value in the form of hash
|
253
|
+
def _to_hash(value)
|
254
|
+
if value.is_a?(Array)
|
255
|
+
value.compact.map { |v| _to_hash(v) }
|
256
|
+
elsif value.is_a?(Hash)
|
257
|
+
{}.tap do |hash|
|
258
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
259
|
+
end
|
260
|
+
elsif value.respond_to? :to_hash
|
261
|
+
value.to_hash
|
262
|
+
else
|
263
|
+
value
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
end
|
268
|
+
|
269
|
+
end
|
@@ -17,6 +17,7 @@ module Svix
|
|
17
17
|
class EndpointUpdatedEventData
|
18
18
|
attr_accessor :app_id
|
19
19
|
|
20
|
+
# Optional unique identifier for the application
|
20
21
|
attr_accessor :app_uid
|
21
22
|
|
22
23
|
attr_accessor :endpoint_id
|
@@ -86,6 +87,19 @@ module Svix
|
|
86
87
|
invalid_properties.push('invalid value for "app_id", app_id cannot be nil.')
|
87
88
|
end
|
88
89
|
|
90
|
+
if !@app_uid.nil? && @app_uid.to_s.length > 256
|
91
|
+
invalid_properties.push('invalid value for "app_uid", the character length must be smaller than or equal to 256.')
|
92
|
+
end
|
93
|
+
|
94
|
+
if !@app_uid.nil? && @app_uid.to_s.length < 1
|
95
|
+
invalid_properties.push('invalid value for "app_uid", the character length must be great than or equal to 1.')
|
96
|
+
end
|
97
|
+
|
98
|
+
pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
|
99
|
+
if !@app_uid.nil? && @app_uid !~ pattern
|
100
|
+
invalid_properties.push("invalid value for \"app_uid\", must conform to the pattern #{pattern}.")
|
101
|
+
end
|
102
|
+
|
89
103
|
if @endpoint_id.nil?
|
90
104
|
invalid_properties.push('invalid value for "endpoint_id", endpoint_id cannot be nil.')
|
91
105
|
end
|
@@ -97,10 +111,32 @@ module Svix
|
|
97
111
|
# @return true if the model is valid
|
98
112
|
def valid?
|
99
113
|
return false if @app_id.nil?
|
114
|
+
return false if !@app_uid.nil? && @app_uid.to_s.length > 256
|
115
|
+
return false if !@app_uid.nil? && @app_uid.to_s.length < 1
|
116
|
+
return false if !@app_uid.nil? && @app_uid !~ Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
|
100
117
|
return false if @endpoint_id.nil?
|
101
118
|
true
|
102
119
|
end
|
103
120
|
|
121
|
+
# Custom attribute writer method with validation
|
122
|
+
# @param [Object] app_uid Value to be assigned
|
123
|
+
def app_uid=(app_uid)
|
124
|
+
if !app_uid.nil? && app_uid.to_s.length > 256
|
125
|
+
fail ArgumentError, 'invalid value for "app_uid", the character length must be smaller than or equal to 256.'
|
126
|
+
end
|
127
|
+
|
128
|
+
if !app_uid.nil? && app_uid.to_s.length < 1
|
129
|
+
fail ArgumentError, 'invalid value for "app_uid", the character length must be great than or equal to 1.'
|
130
|
+
end
|
131
|
+
|
132
|
+
pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
|
133
|
+
if !app_uid.nil? && app_uid !~ pattern
|
134
|
+
fail ArgumentError, "invalid value for \"app_uid\", must conform to the pattern #{pattern}."
|
135
|
+
end
|
136
|
+
|
137
|
+
@app_uid = app_uid
|
138
|
+
end
|
139
|
+
|
104
140
|
# Checks equality by comparing each attribute.
|
105
141
|
# @param [Object] Object to be compared
|
106
142
|
def ==(o)
|
@@ -0,0 +1,223 @@
|
|
1
|
+
=begin
|
2
|
+
#Svix API
|
3
|
+
|
4
|
+
#Welcome to the Svix API documentation! Useful links: [Homepage](https://www.svix.com) | [Support email](mailto:support+docs@svix.com) | [Blog](https://www.svix.com/blog/) | [Slack Community](https://www.svix.com/slack/) # Introduction This is the reference documentation and schemas for the [Svix webhook service](https://www.svix.com) API. For tutorials and other documentation please refer to [the documentation](https://docs.svix.com). ## Main concepts In Svix you have four important entities you will be interacting with: - `messages`: these are the webhooks being sent. They can have contents and a few other properties. - `application`: this is where `messages` are sent to. Usually you want to create one application for each of your users. - `endpoint`: endpoints are the URLs messages will be sent to. Each application can have multiple `endpoints` and each message sent to that application will be sent to all of them (unless they are not subscribed to the sent event type). - `event-type`: event types are identifiers denoting the type of the message being sent. Event types are primarily used to decide which events are sent to which endpoint. ## Authentication Get your authentication token (`AUTH_TOKEN`) from the [Svix dashboard](https://dashboard.svix.com) and use it as part of the `Authorization` header as such: `Authorization: Bearer ${AUTH_TOKEN}`. <SecurityDefinitions /> ## Code samples The code samples assume you already have the respective libraries installed and you know how to use them. For the latest information on how to do that, please refer to [the documentation](https://docs.svix.com/). ## Cross-Origin Resource Sharing This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). And that allows cross-domain communication from the browser. All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.4
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.2.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Svix
|
17
|
+
class EventTypeExampleOut
|
18
|
+
attr_accessor :example
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'example' => :'example'
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
# Returns all the JSON keys this model knows about
|
28
|
+
def self.acceptable_attributes
|
29
|
+
attribute_map.values
|
30
|
+
end
|
31
|
+
|
32
|
+
# Attribute type mapping.
|
33
|
+
def self.openapi_types
|
34
|
+
{
|
35
|
+
:'example' => :'Object'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# List of attributes with nullable: true
|
40
|
+
def self.openapi_nullable
|
41
|
+
Set.new([
|
42
|
+
])
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes the object
|
46
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
+
def initialize(attributes = {})
|
48
|
+
if (!attributes.is_a?(Hash))
|
49
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::EventTypeExampleOut` initialize method"
|
50
|
+
end
|
51
|
+
|
52
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::EventTypeExampleOut`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
56
|
+
end
|
57
|
+
h[k.to_sym] = v
|
58
|
+
}
|
59
|
+
|
60
|
+
if attributes.key?(:'example')
|
61
|
+
self.example = attributes[:'example']
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
66
|
+
# @return Array for valid properties with the reasons
|
67
|
+
def list_invalid_properties
|
68
|
+
invalid_properties = Array.new
|
69
|
+
if @example.nil?
|
70
|
+
invalid_properties.push('invalid value for "example", example cannot be nil.')
|
71
|
+
end
|
72
|
+
|
73
|
+
invalid_properties
|
74
|
+
end
|
75
|
+
|
76
|
+
# Check to see if the all the properties in the model are valid
|
77
|
+
# @return true if the model is valid
|
78
|
+
def valid?
|
79
|
+
return false if @example.nil?
|
80
|
+
true
|
81
|
+
end
|
82
|
+
|
83
|
+
# Checks equality by comparing each attribute.
|
84
|
+
# @param [Object] Object to be compared
|
85
|
+
def ==(o)
|
86
|
+
return true if self.equal?(o)
|
87
|
+
self.class == o.class &&
|
88
|
+
example == o.example
|
89
|
+
end
|
90
|
+
|
91
|
+
# @see the `==` method
|
92
|
+
# @param [Object] Object to be compared
|
93
|
+
def eql?(o)
|
94
|
+
self == o
|
95
|
+
end
|
96
|
+
|
97
|
+
# Calculates hash code according to all attributes.
|
98
|
+
# @return [Integer] Hash code
|
99
|
+
def hash
|
100
|
+
[example].hash
|
101
|
+
end
|
102
|
+
|
103
|
+
# Builds the object from hash
|
104
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
105
|
+
# @return [Object] Returns the model itself
|
106
|
+
def self.build_from_hash(attributes)
|
107
|
+
new.build_from_hash(attributes)
|
108
|
+
end
|
109
|
+
|
110
|
+
# Builds the object from hash
|
111
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
112
|
+
# @return [Object] Returns the model itself
|
113
|
+
def build_from_hash(attributes)
|
114
|
+
return nil unless attributes.is_a?(Hash)
|
115
|
+
self.class.openapi_types.each_pair do |key, type|
|
116
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
117
|
+
self.send("#{key}=", nil)
|
118
|
+
elsif type =~ /\AArray<(.*)>/i
|
119
|
+
# check to ensure the input is an array given that the attribute
|
120
|
+
# is documented as an array but the input is not
|
121
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
122
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
123
|
+
end
|
124
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
125
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
self
|
130
|
+
end
|
131
|
+
|
132
|
+
# Deserializes the data based on type
|
133
|
+
# @param string type Data type
|
134
|
+
# @param string value Value to be deserialized
|
135
|
+
# @return [Object] Deserialized data
|
136
|
+
def _deserialize(type, value)
|
137
|
+
case type.to_sym
|
138
|
+
when :Time
|
139
|
+
Time.parse(value)
|
140
|
+
when :Date
|
141
|
+
Date.parse(value)
|
142
|
+
when :String
|
143
|
+
value.to_s
|
144
|
+
when :Integer
|
145
|
+
value.to_i
|
146
|
+
when :Float
|
147
|
+
value.to_f
|
148
|
+
when :Boolean
|
149
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
150
|
+
true
|
151
|
+
else
|
152
|
+
false
|
153
|
+
end
|
154
|
+
when :Object
|
155
|
+
# generic object (usually a Hash), return directly
|
156
|
+
value
|
157
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
158
|
+
inner_type = Regexp.last_match[:inner_type]
|
159
|
+
value.map { |v| _deserialize(inner_type, v) }
|
160
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
161
|
+
k_type = Regexp.last_match[:k_type]
|
162
|
+
v_type = Regexp.last_match[:v_type]
|
163
|
+
{}.tap do |hash|
|
164
|
+
value.each do |k, v|
|
165
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
else # model
|
169
|
+
# models (e.g. Pet) or oneOf
|
170
|
+
klass = Svix.const_get(type)
|
171
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
# Returns the string representation of the object
|
176
|
+
# @return [String] String presentation of the object
|
177
|
+
def to_s
|
178
|
+
to_hash.to_s
|
179
|
+
end
|
180
|
+
|
181
|
+
# to_body is an alias to to_hash (backward compatibility)
|
182
|
+
# @return [Hash] Returns the object in the form of hash
|
183
|
+
def to_body
|
184
|
+
to_hash
|
185
|
+
end
|
186
|
+
|
187
|
+
# Returns the object in the form of hash
|
188
|
+
# @return [Hash] Returns the object in the form of hash
|
189
|
+
def to_hash
|
190
|
+
hash = {}
|
191
|
+
self.class.attribute_map.each_pair do |attr, param|
|
192
|
+
value = self.send(attr)
|
193
|
+
if value.nil?
|
194
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
195
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
196
|
+
end
|
197
|
+
|
198
|
+
hash[param] = _to_hash(value)
|
199
|
+
end
|
200
|
+
hash
|
201
|
+
end
|
202
|
+
|
203
|
+
# Outputs non-array value in the form of hash
|
204
|
+
# For object, use to_hash. Otherwise, just return the value
|
205
|
+
# @param [Object] value Any valid value
|
206
|
+
# @return [Hash] Returns the value in the form of hash
|
207
|
+
def _to_hash(value)
|
208
|
+
if value.is_a?(Array)
|
209
|
+
value.compact.map { |v| _to_hash(v) }
|
210
|
+
elsif value.is_a?(Hash)
|
211
|
+
{}.tap do |hash|
|
212
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
213
|
+
end
|
214
|
+
elsif value.respond_to? :to_hash
|
215
|
+
value.to_hash
|
216
|
+
else
|
217
|
+
value
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
end
|
222
|
+
|
223
|
+
end
|
@@ -15,6 +15,8 @@ require 'time'
|
|
15
15
|
|
16
16
|
module Svix
|
17
17
|
class EventTypeIn
|
18
|
+
attr_accessor :archived
|
19
|
+
|
18
20
|
attr_accessor :description
|
19
21
|
|
20
22
|
attr_accessor :name
|
@@ -25,6 +27,7 @@ module Svix
|
|
25
27
|
# Attribute mapping from ruby-style variable name to JSON key.
|
26
28
|
def self.attribute_map
|
27
29
|
{
|
30
|
+
:'archived' => :'archived',
|
28
31
|
:'description' => :'description',
|
29
32
|
:'name' => :'name',
|
30
33
|
:'schemas' => :'schemas'
|
@@ -39,6 +42,7 @@ module Svix
|
|
39
42
|
# Attribute type mapping.
|
40
43
|
def self.openapi_types
|
41
44
|
{
|
45
|
+
:'archived' => :'Boolean',
|
42
46
|
:'description' => :'String',
|
43
47
|
:'name' => :'String',
|
44
48
|
:'schemas' => :'Hash<String, Object>'
|
@@ -66,6 +70,12 @@ module Svix
|
|
66
70
|
h[k.to_sym] = v
|
67
71
|
}
|
68
72
|
|
73
|
+
if attributes.key?(:'archived')
|
74
|
+
self.archived = attributes[:'archived']
|
75
|
+
else
|
76
|
+
self.archived = false
|
77
|
+
end
|
78
|
+
|
69
79
|
if attributes.key?(:'description')
|
70
80
|
self.description = attributes[:'description']
|
71
81
|
end
|
@@ -139,6 +149,7 @@ module Svix
|
|
139
149
|
def ==(o)
|
140
150
|
return true if self.equal?(o)
|
141
151
|
self.class == o.class &&
|
152
|
+
archived == o.archived &&
|
142
153
|
description == o.description &&
|
143
154
|
name == o.name &&
|
144
155
|
schemas == o.schemas
|
@@ -153,7 +164,7 @@ module Svix
|
|
153
164
|
# Calculates hash code according to all attributes.
|
154
165
|
# @return [Integer] Hash code
|
155
166
|
def hash
|
156
|
-
[description, name, schemas].hash
|
167
|
+
[archived, description, name, schemas].hash
|
157
168
|
end
|
158
169
|
|
159
170
|
# Builds the object from hash
|