svix 0.32.0 → 0.38.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/lib/svix/api/endpoint_api.rb +507 -0
  4. data/lib/svix/api/event_type_api.rb +83 -6
  5. data/lib/svix/api/message_api.rb +2 -2
  6. data/lib/svix/api/message_attempt_api.rb +4 -4
  7. data/lib/svix/api/organization_settings_api.rb +79 -0
  8. data/lib/svix/api/statistics_api.rb +205 -0
  9. data/lib/svix/endpoint_api.rb +22 -1
  10. data/lib/svix/event_type_api.rb +4 -0
  11. data/lib/svix/models/application_out.rb +18 -4
  12. data/lib/svix/models/attempt_statistics_data.rb +231 -0
  13. data/lib/svix/models/attempt_statistics_response.rb +265 -0
  14. data/lib/svix/models/border_radii_config.rb +236 -0
  15. data/lib/svix/models/border_radius_config.rb +236 -0
  16. data/lib/svix/models/border_radius_enum.rb +40 -0
  17. data/lib/svix/models/custom_theme_override.rb +227 -0
  18. data/lib/svix/models/endpoint_created_event_data.rb +36 -0
  19. data/lib/svix/models/endpoint_deleted_event_data.rb +36 -0
  20. data/lib/svix/models/endpoint_disabled_event_data.rb +36 -0
  21. data/lib/svix/models/endpoint_headers_in.rb +225 -0
  22. data/lib/svix/models/endpoint_headers_out.rb +252 -0
  23. data/lib/svix/models/endpoint_in.rb +26 -0
  24. data/lib/svix/models/endpoint_out.rb +24 -1
  25. data/lib/svix/models/endpoint_secret_out.rb +21 -0
  26. data/lib/svix/models/endpoint_secret_rotate_in.rb +236 -0
  27. data/lib/svix/models/endpoint_update.rb +9 -0
  28. data/lib/svix/models/endpoint_updated_event.rb +269 -0
  29. data/lib/svix/models/endpoint_updated_event_data.rb +36 -0
  30. data/lib/svix/models/event_type_example_out.rb +223 -0
  31. data/lib/svix/models/event_type_in.rb +12 -1
  32. data/lib/svix/models/event_type_out.rb +43 -4
  33. data/lib/svix/models/event_type_schema_in.rb +224 -0
  34. data/lib/svix/models/event_type_update.rb +12 -1
  35. data/lib/svix/models/font_size_config.rb +218 -0
  36. data/lib/svix/models/message_attempt_exhausted_event_data.rb +36 -0
  37. data/lib/svix/models/message_endpoint_out.rb +9 -0
  38. data/lib/svix/models/portal_settings_out.rb +286 -0
  39. data/lib/svix/models/radii_enum.rb +39 -0
  40. data/lib/svix/models/recover_in.rb +223 -0
  41. data/lib/svix/models/settings_out.rb +323 -0
  42. data/lib/svix/models/statistics_period.rb +37 -0
  43. data/lib/svix/models/webhook_types.rb +1 -1
  44. data/lib/svix/version.rb +1 -1
  45. data/lib/svix.rb +6 -2
  46. metadata +22 -2
@@ -15,6 +15,10 @@ require 'time'
15
15
 
16
16
  module Svix
17
17
  class EventTypeOut
18
+ attr_accessor :archived
19
+
20
+ attr_accessor :created_at
21
+
18
22
  attr_accessor :description
19
23
 
20
24
  attr_accessor :name
@@ -22,12 +26,17 @@ module Svix
22
26
  # The schema for the event type for a specific version as a JSON schema.
23
27
  attr_accessor :schemas
24
28
 
29
+ attr_accessor :updated_at
30
+
25
31
  # Attribute mapping from ruby-style variable name to JSON key.
26
32
  def self.attribute_map
27
33
  {
34
+ :'archived' => :'archived',
35
+ :'created_at' => :'createdAt',
28
36
  :'description' => :'description',
29
37
  :'name' => :'name',
30
- :'schemas' => :'schemas'
38
+ :'schemas' => :'schemas',
39
+ :'updated_at' => :'updatedAt'
31
40
  }
32
41
  end
33
42
 
@@ -39,9 +48,12 @@ module Svix
39
48
  # Attribute type mapping.
40
49
  def self.openapi_types
41
50
  {
51
+ :'archived' => :'Boolean',
52
+ :'created_at' => :'Time',
42
53
  :'description' => :'String',
43
54
  :'name' => :'String',
44
- :'schemas' => :'Hash<String, Object>'
55
+ :'schemas' => :'Hash<String, Object>',
56
+ :'updated_at' => :'Time'
45
57
  }
46
58
  end
47
59
 
@@ -66,6 +78,16 @@ module Svix
66
78
  h[k.to_sym] = v
67
79
  }
68
80
 
81
+ if attributes.key?(:'archived')
82
+ self.archived = attributes[:'archived']
83
+ else
84
+ self.archived = false
85
+ end
86
+
87
+ if attributes.key?(:'created_at')
88
+ self.created_at = attributes[:'created_at']
89
+ end
90
+
69
91
  if attributes.key?(:'description')
70
92
  self.description = attributes[:'description']
71
93
  end
@@ -79,12 +101,20 @@ module Svix
79
101
  self.schemas = value
80
102
  end
81
103
  end
104
+
105
+ if attributes.key?(:'updated_at')
106
+ self.updated_at = attributes[:'updated_at']
107
+ end
82
108
  end
83
109
 
84
110
  # Show invalid properties with the reasons. Usually used together with valid?
85
111
  # @return Array for valid properties with the reasons
86
112
  def list_invalid_properties
87
113
  invalid_properties = Array.new
114
+ if @created_at.nil?
115
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
116
+ end
117
+
88
118
  if @description.nil?
89
119
  invalid_properties.push('invalid value for "description", description cannot be nil.')
90
120
  end
@@ -102,16 +132,22 @@ module Svix
102
132
  invalid_properties.push("invalid value for \"name\", must conform to the pattern #{pattern}.")
103
133
  end
104
134
 
135
+ if @updated_at.nil?
136
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
137
+ end
138
+
105
139
  invalid_properties
106
140
  end
107
141
 
108
142
  # Check to see if the all the properties in the model are valid
109
143
  # @return true if the model is valid
110
144
  def valid?
145
+ return false if @created_at.nil?
111
146
  return false if @description.nil?
112
147
  return false if @name.nil?
113
148
  return false if @name.to_s.length > 256
114
149
  return false if @name !~ Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
150
+ return false if @updated_at.nil?
115
151
  true
116
152
  end
117
153
 
@@ -139,9 +175,12 @@ module Svix
139
175
  def ==(o)
140
176
  return true if self.equal?(o)
141
177
  self.class == o.class &&
178
+ archived == o.archived &&
179
+ created_at == o.created_at &&
142
180
  description == o.description &&
143
181
  name == o.name &&
144
- schemas == o.schemas
182
+ schemas == o.schemas &&
183
+ updated_at == o.updated_at
145
184
  end
146
185
 
147
186
  # @see the `==` method
@@ -153,7 +192,7 @@ module Svix
153
192
  # Calculates hash code according to all attributes.
154
193
  # @return [Integer] Hash code
155
194
  def hash
156
- [description, name, schemas].hash
195
+ [archived, created_at, description, name, schemas, updated_at].hash
157
196
  end
158
197
 
159
198
  # Builds the object from hash
@@ -0,0 +1,224 @@
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 EventTypeSchemaIn
18
+ # The schema for an event type
19
+ attr_accessor :schema
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'schema' => :'schema'
25
+ }
26
+ end
27
+
28
+ # Returns all the JSON keys this model knows about
29
+ def self.acceptable_attributes
30
+ attribute_map.values
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.openapi_types
35
+ {
36
+ :'schema' => :'Object'
37
+ }
38
+ end
39
+
40
+ # List of attributes with nullable: true
41
+ def self.openapi_nullable
42
+ Set.new([
43
+ ])
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ if (!attributes.is_a?(Hash))
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::EventTypeSchemaIn` initialize method"
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::EventTypeSchemaIn`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ end
58
+ h[k.to_sym] = v
59
+ }
60
+
61
+ if attributes.key?(:'schema')
62
+ self.schema = attributes[:'schema']
63
+ end
64
+ end
65
+
66
+ # Show invalid properties with the reasons. Usually used together with valid?
67
+ # @return Array for valid properties with the reasons
68
+ def list_invalid_properties
69
+ invalid_properties = Array.new
70
+ if @schema.nil?
71
+ invalid_properties.push('invalid value for "schema", schema cannot be nil.')
72
+ end
73
+
74
+ invalid_properties
75
+ end
76
+
77
+ # Check to see if the all the properties in the model are valid
78
+ # @return true if the model is valid
79
+ def valid?
80
+ return false if @schema.nil?
81
+ true
82
+ end
83
+
84
+ # Checks equality by comparing each attribute.
85
+ # @param [Object] Object to be compared
86
+ def ==(o)
87
+ return true if self.equal?(o)
88
+ self.class == o.class &&
89
+ schema == o.schema
90
+ end
91
+
92
+ # @see the `==` method
93
+ # @param [Object] Object to be compared
94
+ def eql?(o)
95
+ self == o
96
+ end
97
+
98
+ # Calculates hash code according to all attributes.
99
+ # @return [Integer] Hash code
100
+ def hash
101
+ [schema].hash
102
+ end
103
+
104
+ # Builds the object from hash
105
+ # @param [Hash] attributes Model attributes in the form of hash
106
+ # @return [Object] Returns the model itself
107
+ def self.build_from_hash(attributes)
108
+ new.build_from_hash(attributes)
109
+ end
110
+
111
+ # Builds the object from hash
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ # @return [Object] Returns the model itself
114
+ def build_from_hash(attributes)
115
+ return nil unless attributes.is_a?(Hash)
116
+ self.class.openapi_types.each_pair do |key, type|
117
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
118
+ self.send("#{key}=", nil)
119
+ elsif type =~ /\AArray<(.*)>/i
120
+ # check to ensure the input is an array given that the attribute
121
+ # is documented as an array but the input is not
122
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
123
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
124
+ end
125
+ elsif !attributes[self.class.attribute_map[key]].nil?
126
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
127
+ end
128
+ end
129
+
130
+ self
131
+ end
132
+
133
+ # Deserializes the data based on type
134
+ # @param string type Data type
135
+ # @param string value Value to be deserialized
136
+ # @return [Object] Deserialized data
137
+ def _deserialize(type, value)
138
+ case type.to_sym
139
+ when :Time
140
+ Time.parse(value)
141
+ when :Date
142
+ Date.parse(value)
143
+ when :String
144
+ value.to_s
145
+ when :Integer
146
+ value.to_i
147
+ when :Float
148
+ value.to_f
149
+ when :Boolean
150
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
151
+ true
152
+ else
153
+ false
154
+ end
155
+ when :Object
156
+ # generic object (usually a Hash), return directly
157
+ value
158
+ when /\AArray<(?<inner_type>.+)>\z/
159
+ inner_type = Regexp.last_match[:inner_type]
160
+ value.map { |v| _deserialize(inner_type, v) }
161
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
162
+ k_type = Regexp.last_match[:k_type]
163
+ v_type = Regexp.last_match[:v_type]
164
+ {}.tap do |hash|
165
+ value.each do |k, v|
166
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
167
+ end
168
+ end
169
+ else # model
170
+ # models (e.g. Pet) or oneOf
171
+ klass = Svix.const_get(type)
172
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
173
+ end
174
+ end
175
+
176
+ # Returns the string representation of the object
177
+ # @return [String] String presentation of the object
178
+ def to_s
179
+ to_hash.to_s
180
+ end
181
+
182
+ # to_body is an alias to to_hash (backward compatibility)
183
+ # @return [Hash] Returns the object in the form of hash
184
+ def to_body
185
+ to_hash
186
+ end
187
+
188
+ # Returns the object in the form of hash
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_hash
191
+ hash = {}
192
+ self.class.attribute_map.each_pair do |attr, param|
193
+ value = self.send(attr)
194
+ if value.nil?
195
+ is_nullable = self.class.openapi_nullable.include?(attr)
196
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
197
+ end
198
+
199
+ hash[param] = _to_hash(value)
200
+ end
201
+ hash
202
+ end
203
+
204
+ # Outputs non-array value in the form of hash
205
+ # For object, use to_hash. Otherwise, just return the value
206
+ # @param [Object] value Any valid value
207
+ # @return [Hash] Returns the value in the form of hash
208
+ def _to_hash(value)
209
+ if value.is_a?(Array)
210
+ value.compact.map { |v| _to_hash(v) }
211
+ elsif value.is_a?(Hash)
212
+ {}.tap do |hash|
213
+ value.each { |k, v| hash[k] = _to_hash(v) }
214
+ end
215
+ elsif value.respond_to? :to_hash
216
+ value.to_hash
217
+ else
218
+ value
219
+ end
220
+ end
221
+
222
+ end
223
+
224
+ end
@@ -15,6 +15,8 @@ require 'time'
15
15
 
16
16
  module Svix
17
17
  class EventTypeUpdate
18
+ attr_accessor :archived
19
+
18
20
  attr_accessor :description
19
21
 
20
22
  # The schema for the event type for a specific version as a JSON schema.
@@ -23,6 +25,7 @@ module Svix
23
25
  # Attribute mapping from ruby-style variable name to JSON key.
24
26
  def self.attribute_map
25
27
  {
28
+ :'archived' => :'archived',
26
29
  :'description' => :'description',
27
30
  :'schemas' => :'schemas'
28
31
  }
@@ -36,6 +39,7 @@ module Svix
36
39
  # Attribute type mapping.
37
40
  def self.openapi_types
38
41
  {
42
+ :'archived' => :'Boolean',
39
43
  :'description' => :'String',
40
44
  :'schemas' => :'Hash<String, Object>'
41
45
  }
@@ -62,6 +66,12 @@ module Svix
62
66
  h[k.to_sym] = v
63
67
  }
64
68
 
69
+ if attributes.key?(:'archived')
70
+ self.archived = attributes[:'archived']
71
+ else
72
+ self.archived = false
73
+ end
74
+
65
75
  if attributes.key?(:'description')
66
76
  self.description = attributes[:'description']
67
77
  end
@@ -96,6 +106,7 @@ module Svix
96
106
  def ==(o)
97
107
  return true if self.equal?(o)
98
108
  self.class == o.class &&
109
+ archived == o.archived &&
99
110
  description == o.description &&
100
111
  schemas == o.schemas
101
112
  end
@@ -109,7 +120,7 @@ module Svix
109
120
  # Calculates hash code according to all attributes.
110
121
  # @return [Integer] Hash code
111
122
  def hash
112
- [description, schemas].hash
123
+ [archived, description, schemas].hash
113
124
  end
114
125
 
115
126
  # Builds the object from hash
@@ -0,0 +1,218 @@
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 FontSizeConfig
18
+ attr_accessor :base
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'base' => :'base'
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
+ :'base' => :'Integer'
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::FontSizeConfig` 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::FontSizeConfig`. 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?(:'base')
61
+ self.base = attributes[:'base']
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
+ invalid_properties
70
+ end
71
+
72
+ # Check to see if the all the properties in the model are valid
73
+ # @return true if the model is valid
74
+ def valid?
75
+ true
76
+ end
77
+
78
+ # Checks equality by comparing each attribute.
79
+ # @param [Object] Object to be compared
80
+ def ==(o)
81
+ return true if self.equal?(o)
82
+ self.class == o.class &&
83
+ base == o.base
84
+ end
85
+
86
+ # @see the `==` method
87
+ # @param [Object] Object to be compared
88
+ def eql?(o)
89
+ self == o
90
+ end
91
+
92
+ # Calculates hash code according to all attributes.
93
+ # @return [Integer] Hash code
94
+ def hash
95
+ [base].hash
96
+ end
97
+
98
+ # Builds the object from hash
99
+ # @param [Hash] attributes Model attributes in the form of hash
100
+ # @return [Object] Returns the model itself
101
+ def self.build_from_hash(attributes)
102
+ new.build_from_hash(attributes)
103
+ end
104
+
105
+ # Builds the object from hash
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ # @return [Object] Returns the model itself
108
+ def build_from_hash(attributes)
109
+ return nil unless attributes.is_a?(Hash)
110
+ self.class.openapi_types.each_pair do |key, type|
111
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
112
+ self.send("#{key}=", nil)
113
+ elsif type =~ /\AArray<(.*)>/i
114
+ # check to ensure the input is an array given that the attribute
115
+ # is documented as an array but the input is not
116
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
117
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
118
+ end
119
+ elsif !attributes[self.class.attribute_map[key]].nil?
120
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
121
+ end
122
+ end
123
+
124
+ self
125
+ end
126
+
127
+ # Deserializes the data based on type
128
+ # @param string type Data type
129
+ # @param string value Value to be deserialized
130
+ # @return [Object] Deserialized data
131
+ def _deserialize(type, value)
132
+ case type.to_sym
133
+ when :Time
134
+ Time.parse(value)
135
+ when :Date
136
+ Date.parse(value)
137
+ when :String
138
+ value.to_s
139
+ when :Integer
140
+ value.to_i
141
+ when :Float
142
+ value.to_f
143
+ when :Boolean
144
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
145
+ true
146
+ else
147
+ false
148
+ end
149
+ when :Object
150
+ # generic object (usually a Hash), return directly
151
+ value
152
+ when /\AArray<(?<inner_type>.+)>\z/
153
+ inner_type = Regexp.last_match[:inner_type]
154
+ value.map { |v| _deserialize(inner_type, v) }
155
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
156
+ k_type = Regexp.last_match[:k_type]
157
+ v_type = Regexp.last_match[:v_type]
158
+ {}.tap do |hash|
159
+ value.each do |k, v|
160
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
161
+ end
162
+ end
163
+ else # model
164
+ # models (e.g. Pet) or oneOf
165
+ klass = Svix.const_get(type)
166
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
167
+ end
168
+ end
169
+
170
+ # Returns the string representation of the object
171
+ # @return [String] String presentation of the object
172
+ def to_s
173
+ to_hash.to_s
174
+ end
175
+
176
+ # to_body is an alias to to_hash (backward compatibility)
177
+ # @return [Hash] Returns the object in the form of hash
178
+ def to_body
179
+ to_hash
180
+ end
181
+
182
+ # Returns the object in the form of hash
183
+ # @return [Hash] Returns the object in the form of hash
184
+ def to_hash
185
+ hash = {}
186
+ self.class.attribute_map.each_pair do |attr, param|
187
+ value = self.send(attr)
188
+ if value.nil?
189
+ is_nullable = self.class.openapi_nullable.include?(attr)
190
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
191
+ end
192
+
193
+ hash[param] = _to_hash(value)
194
+ end
195
+ hash
196
+ end
197
+
198
+ # Outputs non-array value in the form of hash
199
+ # For object, use to_hash. Otherwise, just return the value
200
+ # @param [Object] value Any valid value
201
+ # @return [Hash] Returns the value in the form of hash
202
+ def _to_hash(value)
203
+ if value.is_a?(Array)
204
+ value.compact.map { |v| _to_hash(v) }
205
+ elsif value.is_a?(Hash)
206
+ {}.tap do |hash|
207
+ value.each { |k, v| hash[k] = _to_hash(v) }
208
+ end
209
+ elsif value.respond_to? :to_hash
210
+ value.to_hash
211
+ else
212
+ value
213
+ end
214
+ end
215
+
216
+ end
217
+
218
+ end
@@ -17,6 +17,7 @@ module Svix
17
17
  class MessageAttemptExhaustedEventData
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
@@ -102,6 +103,19 @@ module Svix
102
103
  invalid_properties.push('invalid value for "app_id", app_id cannot be nil.')
103
104
  end
104
105
 
106
+ if !@app_uid.nil? && @app_uid.to_s.length > 256
107
+ invalid_properties.push('invalid value for "app_uid", the character length must be smaller than or equal to 256.')
108
+ end
109
+
110
+ if !@app_uid.nil? && @app_uid.to_s.length < 1
111
+ invalid_properties.push('invalid value for "app_uid", the character length must be great than or equal to 1.')
112
+ end
113
+
114
+ pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
115
+ if !@app_uid.nil? && @app_uid !~ pattern
116
+ invalid_properties.push("invalid value for \"app_uid\", must conform to the pattern #{pattern}.")
117
+ end
118
+
105
119
  if @endpoint_id.nil?
106
120
  invalid_properties.push('invalid value for "endpoint_id", endpoint_id cannot be nil.')
107
121
  end
@@ -121,12 +135,34 @@ module Svix
121
135
  # @return true if the model is valid
122
136
  def valid?
123
137
  return false if @app_id.nil?
138
+ return false if !@app_uid.nil? && @app_uid.to_s.length > 256
139
+ return false if !@app_uid.nil? && @app_uid.to_s.length < 1
140
+ return false if !@app_uid.nil? && @app_uid !~ Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
124
141
  return false if @endpoint_id.nil?
125
142
  return false if @last_attempt.nil?
126
143
  return false if @msg_id.nil?
127
144
  true
128
145
  end
129
146
 
147
+ # Custom attribute writer method with validation
148
+ # @param [Object] app_uid Value to be assigned
149
+ def app_uid=(app_uid)
150
+ if !app_uid.nil? && app_uid.to_s.length > 256
151
+ fail ArgumentError, 'invalid value for "app_uid", the character length must be smaller than or equal to 256.'
152
+ end
153
+
154
+ if !app_uid.nil? && app_uid.to_s.length < 1
155
+ fail ArgumentError, 'invalid value for "app_uid", the character length must be great than or equal to 1.'
156
+ end
157
+
158
+ pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
159
+ if !app_uid.nil? && app_uid !~ pattern
160
+ fail ArgumentError, "invalid value for \"app_uid\", must conform to the pattern #{pattern}."
161
+ end
162
+
163
+ @app_uid = app_uid
164
+ end
165
+
130
166
  # Checks equality by comparing each attribute.
131
167
  # @param [Object] Object to be compared
132
168
  def ==(o)