svix 0.34.1 → 0.36.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7bd53602e0ef0e6f125b8d2e842ba2c59e7af478e8bc4cd90cfd06178ccbac89
4
- data.tar.gz: e05198a5e8852907c3c2a16fd79ae7dc8751883af100f1b215d017bd069ecdd4
3
+ metadata.gz: f95c57f3344edeaf62293bbf269d8cfe03c5d2563d80eff42722916347d344b3
4
+ data.tar.gz: d0191414de2e6b9340010ca98d603bc23dfc7a5ef683ad70832777d56a633537
5
5
  SHA512:
6
- metadata.gz: f03f41f3113b63c4d13137264d11ce3aaad60857c96888a6a47efcc5c03a5f6f59437160ba51ad91609ef7ec6bb139c15290491359afd0b4d746bf1ca382c188
7
- data.tar.gz: 6057e1433ffdb75bba004340ad643e03fae147df58b6fe8ecbddedc3a763850d37b9adbb94e561deb8d58ee522be0237a9711a031a50b7805cbba628997ed5e7
6
+ metadata.gz: 9c4a7fd0b5a450dc07823a5f1c99753a683ac28dff04ff1c317a8080813294a0a5826cf9db6b499910f87b0f01d40e68d9511787455e5a957f725a68075b95af
7
+ data.tar.gz: b2d16ec4e9262a9e93a0d69fd1efb0bac68eae7e9c7ae788a94751d3fc72925295a172ea574f8f71f7803abb358e87a1f5a297b2df2da642cb2ebb0d6d6fb66e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- svix (0.34.1)
4
+ svix (0.36.0)
5
5
  typhoeus (~> 1.0, >= 1.0.1)
6
6
 
7
7
  GEM
@@ -565,6 +565,109 @@ module Svix
565
565
  return data, status_code, headers
566
566
  end
567
567
 
568
+ # Resend Failed Webhooks
569
+ # Resend all failed messages since a given time.
570
+ # @param app_id [String]
571
+ # @param endpoint_id [String]
572
+ # @param recover_in [RecoverIn]
573
+ # @param [Hash] opts the optional parameters
574
+ # @return [Object]
575
+ def resend_failed_webhooks_api_v1_app_app_id_endpoint_endpoint_id_recover_post(app_id, endpoint_id, recover_in, opts = {})
576
+ data, _status_code, _headers = resend_failed_webhooks_api_v1_app_app_id_endpoint_endpoint_id_recover_post_with_http_info(app_id, endpoint_id, recover_in, opts)
577
+ data
578
+ end
579
+
580
+ # Resend Failed Webhooks
581
+ # Resend all failed messages since a given time.
582
+ # @param app_id [String]
583
+ # @param endpoint_id [String]
584
+ # @param recover_in [RecoverIn]
585
+ # @param [Hash] opts the optional parameters
586
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
587
+ def resend_failed_webhooks_api_v1_app_app_id_endpoint_endpoint_id_recover_post_with_http_info(app_id, endpoint_id, recover_in, opts = {})
588
+ if @api_client.config.debugging
589
+ @api_client.config.logger.debug 'Calling API: EndpointApi.resend_failed_webhooks_api_v1_app_app_id_endpoint_endpoint_id_recover_post ...'
590
+ end
591
+ # verify the required parameter 'app_id' is set
592
+ if @api_client.config.client_side_validation && app_id.nil?
593
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling EndpointApi.resend_failed_webhooks_api_v1_app_app_id_endpoint_endpoint_id_recover_post"
594
+ end
595
+ if @api_client.config.client_side_validation && app_id.to_s.length > 256
596
+ fail ArgumentError, 'invalid value for "app_id" when calling EndpointApi.resend_failed_webhooks_api_v1_app_app_id_endpoint_endpoint_id_recover_post, the character length must be smaller than or equal to 256.'
597
+ end
598
+
599
+ if @api_client.config.client_side_validation && app_id.to_s.length < 1
600
+ fail ArgumentError, 'invalid value for "app_id" when calling EndpointApi.resend_failed_webhooks_api_v1_app_app_id_endpoint_endpoint_id_recover_post, the character length must be great than or equal to 1.'
601
+ end
602
+
603
+ pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
604
+ if @api_client.config.client_side_validation && app_id !~ pattern
605
+ fail ArgumentError, "invalid value for 'app_id' when calling EndpointApi.resend_failed_webhooks_api_v1_app_app_id_endpoint_endpoint_id_recover_post, must conform to the pattern #{pattern}."
606
+ end
607
+
608
+ # verify the required parameter 'endpoint_id' is set
609
+ if @api_client.config.client_side_validation && endpoint_id.nil?
610
+ fail ArgumentError, "Missing the required parameter 'endpoint_id' when calling EndpointApi.resend_failed_webhooks_api_v1_app_app_id_endpoint_endpoint_id_recover_post"
611
+ end
612
+ if @api_client.config.client_side_validation && endpoint_id.to_s.length > 256
613
+ fail ArgumentError, 'invalid value for "endpoint_id" when calling EndpointApi.resend_failed_webhooks_api_v1_app_app_id_endpoint_endpoint_id_recover_post, the character length must be smaller than or equal to 256.'
614
+ end
615
+
616
+ if @api_client.config.client_side_validation && endpoint_id.to_s.length < 1
617
+ fail ArgumentError, 'invalid value for "endpoint_id" when calling EndpointApi.resend_failed_webhooks_api_v1_app_app_id_endpoint_endpoint_id_recover_post, the character length must be great than or equal to 1.'
618
+ end
619
+
620
+ pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
621
+ if @api_client.config.client_side_validation && endpoint_id !~ pattern
622
+ fail ArgumentError, "invalid value for 'endpoint_id' when calling EndpointApi.resend_failed_webhooks_api_v1_app_app_id_endpoint_endpoint_id_recover_post, must conform to the pattern #{pattern}."
623
+ end
624
+
625
+ # verify the required parameter 'recover_in' is set
626
+ if @api_client.config.client_side_validation && recover_in.nil?
627
+ fail ArgumentError, "Missing the required parameter 'recover_in' when calling EndpointApi.resend_failed_webhooks_api_v1_app_app_id_endpoint_endpoint_id_recover_post"
628
+ end
629
+ # resource path
630
+ local_var_path = '/api/v1/app/{app_id}/endpoint/{endpoint_id}/recover/'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'endpoint_id' + '}', CGI.escape(endpoint_id.to_s))
631
+
632
+ # query parameters
633
+ query_params = opts[:query_params] || {}
634
+
635
+ # header parameters
636
+ header_params = opts[:header_params] || {}
637
+ # HTTP header 'Accept' (if needed)
638
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
639
+ # HTTP header 'Content-Type'
640
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
641
+
642
+ # form parameters
643
+ form_params = opts[:form_params] || {}
644
+
645
+ # http body (model)
646
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(recover_in)
647
+
648
+ # return_type
649
+ return_type = opts[:debug_return_type] || 'Object'
650
+
651
+ # auth_names
652
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
653
+
654
+ new_options = opts.merge(
655
+ :operation => :"EndpointApi.resend_failed_webhooks_api_v1_app_app_id_endpoint_endpoint_id_recover_post",
656
+ :header_params => header_params,
657
+ :query_params => query_params,
658
+ :form_params => form_params,
659
+ :body => post_body,
660
+ :auth_names => auth_names,
661
+ :return_type => return_type
662
+ )
663
+
664
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
665
+ if @api_client.config.debugging
666
+ @api_client.config.logger.debug "API called: EndpointApi#resend_failed_webhooks_api_v1_app_app_id_endpoint_endpoint_id_recover_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
667
+ end
668
+ return data, status_code, headers
669
+ end
670
+
568
671
  # Rotate Endpoint Secret
569
672
  # Rotates the endpoint's signing secret. The previous secret will be valid for the next 24 hours.
570
673
  # @param endpoint_id [String]
@@ -34,5 +34,10 @@ module Svix
34
34
  return @api.rotate_endpoint_secret_api_v1_app_app_id_endpoint_endpoint_id_secret_rotate_post(endpoint_id, app_id, endpoint_secret_rotate_in)
35
35
  end
36
36
 
37
+ def recover(app_id, endpoint_id, recover_in)
38
+ @api.resend_failed_webhooks_api_v1_app_app_id_endpoint_endpoint_id_recover_post(app_id, endpoint_id, recover_in)
39
+ nil
40
+ end
41
+
37
42
  end
38
43
  end
@@ -26,6 +26,8 @@ module Svix
26
26
  # Optional unique identifier for the application
27
27
  attr_accessor :uid
28
28
 
29
+ attr_accessor :updated_at
30
+
29
31
  # Attribute mapping from ruby-style variable name to JSON key.
30
32
  def self.attribute_map
31
33
  {
@@ -33,7 +35,8 @@ module Svix
33
35
  :'id' => :'id',
34
36
  :'name' => :'name',
35
37
  :'rate_limit' => :'rateLimit',
36
- :'uid' => :'uid'
38
+ :'uid' => :'uid',
39
+ :'updated_at' => :'updatedAt'
37
40
  }
38
41
  end
39
42
 
@@ -49,7 +52,8 @@ module Svix
49
52
  :'id' => :'String',
50
53
  :'name' => :'String',
51
54
  :'rate_limit' => :'Integer',
52
- :'uid' => :'String'
55
+ :'uid' => :'String',
56
+ :'updated_at' => :'Time'
53
57
  }
54
58
  end
55
59
 
@@ -93,6 +97,10 @@ module Svix
93
97
  if attributes.key?(:'uid')
94
98
  self.uid = attributes[:'uid']
95
99
  end
100
+
101
+ if attributes.key?(:'updated_at')
102
+ self.updated_at = attributes[:'updated_at']
103
+ end
96
104
  end
97
105
 
98
106
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -124,6 +132,10 @@ module Svix
124
132
  invalid_properties.push("invalid value for \"uid\", must conform to the pattern #{pattern}.")
125
133
  end
126
134
 
135
+ if @updated_at.nil?
136
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
137
+ end
138
+
127
139
  invalid_properties
128
140
  end
129
141
 
@@ -136,6 +148,7 @@ module Svix
136
148
  return false if !@uid.nil? && @uid.to_s.length > 256
137
149
  return false if !@uid.nil? && @uid.to_s.length < 1
138
150
  return false if !@uid.nil? && @uid !~ Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
151
+ return false if @updated_at.nil?
139
152
  true
140
153
  end
141
154
 
@@ -167,7 +180,8 @@ module Svix
167
180
  id == o.id &&
168
181
  name == o.name &&
169
182
  rate_limit == o.rate_limit &&
170
- uid == o.uid
183
+ uid == o.uid &&
184
+ updated_at == o.updated_at
171
185
  end
172
186
 
173
187
  # @see the `==` method
@@ -179,7 +193,7 @@ module Svix
179
193
  # Calculates hash code according to all attributes.
180
194
  # @return [Integer] Hash code
181
195
  def hash
182
- [created_at, id, name, rate_limit, uid].hash
196
+ [created_at, id, name, rate_limit, uid, updated_at].hash
183
197
  end
184
198
 
185
199
  # Builds the object from hash
@@ -30,6 +30,8 @@ module Svix
30
30
  # Optional unique identifier for the endpoint
31
31
  attr_accessor :uid
32
32
 
33
+ attr_accessor :updated_at
34
+
33
35
  attr_accessor :url
34
36
 
35
37
  attr_accessor :version
@@ -44,6 +46,7 @@ module Svix
44
46
  :'id' => :'id',
45
47
  :'rate_limit' => :'rateLimit',
46
48
  :'uid' => :'uid',
49
+ :'updated_at' => :'updatedAt',
47
50
  :'url' => :'url',
48
51
  :'version' => :'version'
49
52
  }
@@ -64,6 +67,7 @@ module Svix
64
67
  :'id' => :'String',
65
68
  :'rate_limit' => :'Integer',
66
69
  :'uid' => :'String',
70
+ :'updated_at' => :'Time',
67
71
  :'url' => :'String',
68
72
  :'version' => :'Integer'
69
73
  }
@@ -124,6 +128,10 @@ module Svix
124
128
  self.uid = attributes[:'uid']
125
129
  end
126
130
 
131
+ if attributes.key?(:'updated_at')
132
+ self.updated_at = attributes[:'updated_at']
133
+ end
134
+
127
135
  if attributes.key?(:'url')
128
136
  self.url = attributes[:'url']
129
137
  end
@@ -162,6 +170,10 @@ module Svix
162
170
  invalid_properties.push("invalid value for \"uid\", must conform to the pattern #{pattern}.")
163
171
  end
164
172
 
173
+ if @updated_at.nil?
174
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
175
+ end
176
+
165
177
  if @url.nil?
166
178
  invalid_properties.push('invalid value for "url", url cannot be nil.')
167
179
  end
@@ -190,6 +202,7 @@ module Svix
190
202
  return false if !@uid.nil? && @uid.to_s.length > 256
191
203
  return false if !@uid.nil? && @uid.to_s.length < 1
192
204
  return false if !@uid.nil? && @uid !~ Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
205
+ return false if @updated_at.nil?
193
206
  return false if @url.nil?
194
207
  return false if @url.to_s.length > 65536
195
208
  return false if @url.to_s.length < 1
@@ -256,6 +269,7 @@ module Svix
256
269
  id == o.id &&
257
270
  rate_limit == o.rate_limit &&
258
271
  uid == o.uid &&
272
+ updated_at == o.updated_at &&
259
273
  url == o.url &&
260
274
  version == o.version
261
275
  end
@@ -269,7 +283,7 @@ module Svix
269
283
  # Calculates hash code according to all attributes.
270
284
  # @return [Integer] Hash code
271
285
  def hash
272
- [created_at, description, disabled, filter_types, id, rate_limit, uid, url, version].hash
286
+ [created_at, description, disabled, filter_types, id, rate_limit, uid, updated_at, url, version].hash
273
287
  end
274
288
 
275
289
  # Builds the object from hash
@@ -17,6 +17,8 @@ module Svix
17
17
  class EventTypeOut
18
18
  attr_accessor :archived
19
19
 
20
+ attr_accessor :created_at
21
+
20
22
  attr_accessor :description
21
23
 
22
24
  attr_accessor :name
@@ -24,13 +26,17 @@ module Svix
24
26
  # The schema for the event type for a specific version as a JSON schema.
25
27
  attr_accessor :schemas
26
28
 
29
+ attr_accessor :updated_at
30
+
27
31
  # Attribute mapping from ruby-style variable name to JSON key.
28
32
  def self.attribute_map
29
33
  {
30
34
  :'archived' => :'archived',
35
+ :'created_at' => :'createdAt',
31
36
  :'description' => :'description',
32
37
  :'name' => :'name',
33
- :'schemas' => :'schemas'
38
+ :'schemas' => :'schemas',
39
+ :'updated_at' => :'updatedAt'
34
40
  }
35
41
  end
36
42
 
@@ -43,9 +49,11 @@ module Svix
43
49
  def self.openapi_types
44
50
  {
45
51
  :'archived' => :'Boolean',
52
+ :'created_at' => :'Time',
46
53
  :'description' => :'String',
47
54
  :'name' => :'String',
48
- :'schemas' => :'Hash<String, Object>'
55
+ :'schemas' => :'Hash<String, Object>',
56
+ :'updated_at' => :'Time'
49
57
  }
50
58
  end
51
59
 
@@ -76,6 +84,10 @@ module Svix
76
84
  self.archived = false
77
85
  end
78
86
 
87
+ if attributes.key?(:'created_at')
88
+ self.created_at = attributes[:'created_at']
89
+ end
90
+
79
91
  if attributes.key?(:'description')
80
92
  self.description = attributes[:'description']
81
93
  end
@@ -89,12 +101,20 @@ module Svix
89
101
  self.schemas = value
90
102
  end
91
103
  end
104
+
105
+ if attributes.key?(:'updated_at')
106
+ self.updated_at = attributes[:'updated_at']
107
+ end
92
108
  end
93
109
 
94
110
  # Show invalid properties with the reasons. Usually used together with valid?
95
111
  # @return Array for valid properties with the reasons
96
112
  def list_invalid_properties
97
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
+
98
118
  if @description.nil?
99
119
  invalid_properties.push('invalid value for "description", description cannot be nil.')
100
120
  end
@@ -112,16 +132,22 @@ module Svix
112
132
  invalid_properties.push("invalid value for \"name\", must conform to the pattern #{pattern}.")
113
133
  end
114
134
 
135
+ if @updated_at.nil?
136
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
137
+ end
138
+
115
139
  invalid_properties
116
140
  end
117
141
 
118
142
  # Check to see if the all the properties in the model are valid
119
143
  # @return true if the model is valid
120
144
  def valid?
145
+ return false if @created_at.nil?
121
146
  return false if @description.nil?
122
147
  return false if @name.nil?
123
148
  return false if @name.to_s.length > 256
124
149
  return false if @name !~ Regexp.new(/^[a-zA-Z0-9\-_.]+$/)
150
+ return false if @updated_at.nil?
125
151
  true
126
152
  end
127
153
 
@@ -150,9 +176,11 @@ module Svix
150
176
  return true if self.equal?(o)
151
177
  self.class == o.class &&
152
178
  archived == o.archived &&
179
+ created_at == o.created_at &&
153
180
  description == o.description &&
154
181
  name == o.name &&
155
- schemas == o.schemas
182
+ schemas == o.schemas &&
183
+ updated_at == o.updated_at
156
184
  end
157
185
 
158
186
  # @see the `==` method
@@ -164,7 +192,7 @@ module Svix
164
192
  # Calculates hash code according to all attributes.
165
193
  # @return [Integer] Hash code
166
194
  def hash
167
- [archived, description, name, schemas].hash
195
+ [archived, created_at, description, name, schemas, updated_at].hash
168
196
  end
169
197
 
170
198
  # Builds the object from hash
@@ -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 RecoverIn
18
+ attr_accessor :since
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'since' => :'since'
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
+ :'since' => :'Time'
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::RecoverIn` 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::RecoverIn`. 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?(:'since')
61
+ self.since = attributes[:'since']
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 @since.nil?
70
+ invalid_properties.push('invalid value for "since", since 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 @since.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
+ since == o.since
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
+ [since].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
data/lib/svix/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Svix
4
- VERSION = "0.34.1"
4
+ VERSION = "0.36.0"
5
5
  end
data/lib/svix.rb CHANGED
@@ -56,6 +56,7 @@ require "svix/models/message_endpoint_out"
56
56
  require "svix/models/message_in"
57
57
  require "svix/models/message_out"
58
58
  require "svix/models/message_status"
59
+ require "svix/models/recover_in"
59
60
  require "svix/models/validation_error"
60
61
  require "svix/models/webhook_types"
61
62
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: svix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.34.1
4
+ version: 0.36.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Svix
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-28 00:00:00.000000000 Z
11
+ date: 2021-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -147,6 +147,7 @@ files:
147
147
  - lib/svix/models/message_in.rb
148
148
  - lib/svix/models/message_out.rb
149
149
  - lib/svix/models/message_status.rb
150
+ - lib/svix/models/recover_in.rb
150
151
  - lib/svix/models/validation_error.rb
151
152
  - lib/svix/models/webhook_types.rb
152
153
  - lib/svix/svix.rb