svix 0.16.0 → 0.34.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +9 -3
- data/README.md +16 -3
- data/lib/svix/api/application_api.rb +386 -0
- data/lib/svix/api/authentication_api.rb +155 -0
- data/lib/svix/api/endpoint_api.rb +877 -0
- data/lib/svix/api/event_type_api.rb +454 -0
- data/lib/svix/api/health_api.rb +77 -0
- data/lib/svix/api/message_api.rb +289 -0
- data/lib/svix/api/message_attempt_api.rb +678 -0
- data/lib/svix/api_client.rb +399 -0
- data/lib/svix/api_error.rb +57 -0
- data/lib/svix/application_api.rb +29 -0
- data/lib/svix/authentication_api.rb +17 -0
- data/lib/svix/configuration.rb +277 -0
- data/lib/svix/endpoint_api.rb +38 -0
- data/{src → lib}/svix/errors.rb +4 -1
- data/lib/svix/event_type_api.rb +25 -0
- data/lib/svix/internal.rb +16 -0
- data/lib/svix/message_api.rb +21 -0
- data/lib/svix/message_attempt_api.rb +33 -0
- data/lib/svix/models/application_in.rb +277 -0
- data/lib/svix/models/application_out.rb +305 -0
- data/lib/svix/models/dashboard_access_out.rb +265 -0
- data/lib/svix/models/endpoint_created_event.rb +269 -0
- data/lib/svix/models/endpoint_created_event_data.rb +282 -0
- data/lib/svix/models/endpoint_deleted_event.rb +269 -0
- data/lib/svix/models/endpoint_deleted_event_data.rb +282 -0
- data/lib/svix/models/endpoint_disabled_event.rb +269 -0
- data/lib/svix/models/endpoint_disabled_event_data.rb +296 -0
- data/lib/svix/models/endpoint_in.rb +394 -0
- data/lib/svix/models/endpoint_message_out.rb +363 -0
- data/lib/svix/models/endpoint_out.rb +395 -0
- data/lib/svix/models/endpoint_secret_out.rb +245 -0
- data/lib/svix/models/endpoint_secret_rotate_in.rb +236 -0
- data/lib/svix/models/endpoint_stats.rb +265 -0
- data/lib/svix/models/endpoint_update.rb +367 -0
- data/lib/svix/models/endpoint_updated_event.rb +269 -0
- data/lib/svix/models/endpoint_updated_event_data.rb +282 -0
- data/lib/svix/models/endpointd_updated_event.rb +269 -0
- data/lib/svix/models/event_example_in.rb +253 -0
- data/lib/svix/models/event_type_example_out.rb +223 -0
- data/lib/svix/models/event_type_in.rb +290 -0
- data/lib/svix/models/event_type_out.rb +290 -0
- data/lib/svix/models/event_type_schema_in.rb +224 -0
- data/lib/svix/models/event_type_update.rb +246 -0
- data/lib/svix/models/http_error_out.rb +237 -0
- data/lib/svix/models/http_validation_error.rb +220 -0
- data/lib/svix/models/list_response_application_out.rb +248 -0
- data/lib/svix/models/list_response_endpoint_message_out.rb +248 -0
- data/lib/svix/models/list_response_endpoint_out.rb +248 -0
- data/lib/svix/models/list_response_event_type_out.rb +248 -0
- data/lib/svix/models/list_response_message_attempt_endpoint_out.rb +248 -0
- data/lib/svix/models/list_response_message_attempt_out.rb +248 -0
- data/lib/svix/models/list_response_message_endpoint_out.rb +248 -0
- data/lib/svix/models/list_response_message_out.rb +248 -0
- data/lib/svix/models/message_attempt_endpoint_out.rb +293 -0
- data/lib/svix/models/message_attempt_exhausted_event.rb +269 -0
- data/lib/svix/models/message_attempt_exhausted_event_data.rb +310 -0
- data/lib/svix/models/message_attempt_failed_event.rb +251 -0
- data/lib/svix/models/message_attempt_out.rb +307 -0
- data/lib/svix/models/message_attempt_trigger_type.rb +37 -0
- data/lib/svix/models/message_endpoint_out.rb +418 -0
- data/lib/svix/models/message_in.rb +312 -0
- data/lib/svix/models/message_out.rb +340 -0
- data/lib/svix/models/message_status.rb +39 -0
- data/lib/svix/models/validation_error.rb +253 -0
- data/lib/svix/models/webhook_types.rb +280 -0
- data/lib/svix/svix.rb +43 -0
- data/{src → lib}/svix/util.rb +1 -1
- data/lib/svix/version.rb +5 -0
- data/lib/svix/webhook.rb +75 -0
- data/lib/svix.rb +77 -0
- data/svix.gemspec +19 -9
- metadata +97 -13
- data/.gitignore +0 -9
- data/src/svix/version.rb +0 -3
- data/src/svix/webhook.rb +0 -33
- data/src/svix.rb +0 -8
data/lib/svix.rb
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require "openssl"
|
5
|
+
require "Base64"
|
6
|
+
|
7
|
+
# API
|
8
|
+
require "svix/api/application_api"
|
9
|
+
require "svix/api/authentication_api"
|
10
|
+
require "svix/api/endpoint_api"
|
11
|
+
require "svix/api/event_type_api"
|
12
|
+
require "svix/api/health_api"
|
13
|
+
require "svix/api/message_api"
|
14
|
+
require "svix/api/message_attempt_api"
|
15
|
+
|
16
|
+
# Models
|
17
|
+
require "svix/models/application_in"
|
18
|
+
require "svix/models/application_out"
|
19
|
+
require "svix/models/dashboard_access_out"
|
20
|
+
require "svix/models/endpoint_created_event_data"
|
21
|
+
require "svix/models/endpoint_created_event"
|
22
|
+
require "svix/models/endpoint_deleted_event_data"
|
23
|
+
require "svix/models/endpoint_deleted_event"
|
24
|
+
require "svix/models/endpoint_disabled_event_data"
|
25
|
+
require "svix/models/endpoint_disabled_event"
|
26
|
+
require "svix/models/endpoint_in"
|
27
|
+
require "svix/models/endpoint_message_out"
|
28
|
+
require "svix/models/endpoint_out"
|
29
|
+
require "svix/models/endpoint_secret_out"
|
30
|
+
require "svix/models/endpoint_secret_rotate_in"
|
31
|
+
require "svix/models/endpoint_stats"
|
32
|
+
require "svix/models/endpoint_update"
|
33
|
+
require "svix/models/endpoint_updated_event_data"
|
34
|
+
require "svix/models/endpoint_updated_event"
|
35
|
+
require "svix/models/event_example_in"
|
36
|
+
require "svix/models/event_type_in"
|
37
|
+
require "svix/models/event_type_out"
|
38
|
+
require "svix/models/event_type_update"
|
39
|
+
require "svix/models/http_error_out"
|
40
|
+
require "svix/models/http_validation_error"
|
41
|
+
require "svix/models/list_response_application_out"
|
42
|
+
require "svix/models/list_response_endpoint_message_out"
|
43
|
+
require "svix/models/list_response_endpoint_out"
|
44
|
+
require "svix/models/list_response_event_type_out"
|
45
|
+
require "svix/models/list_response_message_attempt_endpoint_out"
|
46
|
+
require "svix/models/list_response_message_attempt_out"
|
47
|
+
require "svix/models/list_response_message_endpoint_out"
|
48
|
+
require "svix/models/list_response_message_out"
|
49
|
+
require "svix/models/message_attempt_endpoint_out"
|
50
|
+
require "svix/models/message_attempt_exhausted_event_data"
|
51
|
+
require "svix/models/message_attempt_exhausted_event"
|
52
|
+
require "svix/models/message_attempt_failed_event"
|
53
|
+
require "svix/models/message_attempt_out"
|
54
|
+
require "svix/models/message_attempt_trigger_type"
|
55
|
+
require "svix/models/message_endpoint_out"
|
56
|
+
require "svix/models/message_in"
|
57
|
+
require "svix/models/message_out"
|
58
|
+
require "svix/models/message_status"
|
59
|
+
require "svix/models/validation_error"
|
60
|
+
require "svix/models/webhook_types"
|
61
|
+
|
62
|
+
# Core
|
63
|
+
require "svix/api_client"
|
64
|
+
require "svix/api_error"
|
65
|
+
require "svix/application_api"
|
66
|
+
require "svix/authentication_api"
|
67
|
+
require "svix/configuration"
|
68
|
+
require "svix/endpoint_api"
|
69
|
+
require "svix/errors"
|
70
|
+
require "svix/event_type_api"
|
71
|
+
require "svix/message_api"
|
72
|
+
require "svix/message_attempt_api"
|
73
|
+
require "svix/svix"
|
74
|
+
require "svix/util"
|
75
|
+
require "svix/version"
|
76
|
+
require "svix/webhook"
|
77
|
+
require "svix/internal"
|
data/svix.gemspec
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
lib = File.expand_path("../
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
4
|
require "svix/version"
|
5
5
|
|
@@ -21,23 +21,33 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
22
22
|
|
23
23
|
spec.metadata["homepage_uri"] = spec.homepage
|
24
|
-
spec.metadata["source_code_uri"] = "https://github.com/
|
25
|
-
spec.metadata["changelog_uri"] = "https://github.com/
|
24
|
+
spec.metadata["source_code_uri"] = "https://github.com/svix/svix-libs"
|
25
|
+
spec.metadata["changelog_uri"] = "https://github.com/svix/svix-libs/blob/main/ChangeLog.md"
|
26
26
|
else
|
27
27
|
raise "RubyGems 2.0 or newer is required to protect against " \
|
28
28
|
"public gem pushes."
|
29
29
|
end
|
30
30
|
|
31
31
|
# Specify which files should be added to the gem when it is released.
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
ignored = Regexp.union(
|
33
|
+
/\A\.openapi-generator/,
|
34
|
+
/\Aspec/,
|
35
|
+
/\Apkg/,
|
36
|
+
/\Atemplates/,
|
37
|
+
/\A.gitignore/,
|
38
|
+
/\A.openapi-generator-ignore/,
|
39
|
+
/\Aopenapi-generator-config.json/,
|
40
|
+
/.gem\z/
|
41
|
+
)
|
42
|
+
spec.files = Dir['**/*'].reject {|f| !File.file?(f) || ignored.match(f) }
|
43
|
+
|
36
44
|
spec.bindir = "exe"
|
37
45
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
38
|
-
spec.require_paths = ["
|
46
|
+
spec.require_paths = ["lib"]
|
47
|
+
|
48
|
+
spec.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
|
39
49
|
|
40
50
|
spec.add_development_dependency "bundler", "~> 1.17"
|
41
|
-
spec.add_development_dependency "rake", "~>
|
51
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
42
52
|
spec.add_development_dependency "rspec", "~> 3.2"
|
43
53
|
end
|
metadata
CHANGED
@@ -1,15 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: svix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.34.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Svix
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: typhoeus
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.0.1
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.0'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.0.1
|
13
33
|
- !ruby/object:Gem::Dependency
|
14
34
|
name: bundler
|
15
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -30,14 +50,14 @@ dependencies:
|
|
30
50
|
requirements:
|
31
51
|
- - "~>"
|
32
52
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
53
|
+
version: '13.0'
|
34
54
|
type: :development
|
35
55
|
prerelease: false
|
36
56
|
version_requirements: !ruby/object:Gem::Requirement
|
37
57
|
requirements:
|
38
58
|
- - "~>"
|
39
59
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
60
|
+
version: '13.0'
|
41
61
|
- !ruby/object:Gem::Dependency
|
42
62
|
name: rspec
|
43
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,16 +79,80 @@ executables: []
|
|
59
79
|
extensions: []
|
60
80
|
extra_rdoc_files: []
|
61
81
|
files:
|
62
|
-
- ".gitignore"
|
63
82
|
- Gemfile
|
64
83
|
- Gemfile.lock
|
65
84
|
- README.md
|
66
85
|
- Rakefile
|
67
|
-
-
|
68
|
-
-
|
69
|
-
-
|
70
|
-
-
|
71
|
-
-
|
86
|
+
- lib/svix.rb
|
87
|
+
- lib/svix/api/application_api.rb
|
88
|
+
- lib/svix/api/authentication_api.rb
|
89
|
+
- lib/svix/api/endpoint_api.rb
|
90
|
+
- lib/svix/api/event_type_api.rb
|
91
|
+
- lib/svix/api/health_api.rb
|
92
|
+
- lib/svix/api/message_api.rb
|
93
|
+
- lib/svix/api/message_attempt_api.rb
|
94
|
+
- lib/svix/api_client.rb
|
95
|
+
- lib/svix/api_error.rb
|
96
|
+
- lib/svix/application_api.rb
|
97
|
+
- lib/svix/authentication_api.rb
|
98
|
+
- lib/svix/configuration.rb
|
99
|
+
- lib/svix/endpoint_api.rb
|
100
|
+
- lib/svix/errors.rb
|
101
|
+
- lib/svix/event_type_api.rb
|
102
|
+
- lib/svix/internal.rb
|
103
|
+
- lib/svix/message_api.rb
|
104
|
+
- lib/svix/message_attempt_api.rb
|
105
|
+
- lib/svix/models/application_in.rb
|
106
|
+
- lib/svix/models/application_out.rb
|
107
|
+
- lib/svix/models/dashboard_access_out.rb
|
108
|
+
- lib/svix/models/endpoint_created_event.rb
|
109
|
+
- lib/svix/models/endpoint_created_event_data.rb
|
110
|
+
- lib/svix/models/endpoint_deleted_event.rb
|
111
|
+
- lib/svix/models/endpoint_deleted_event_data.rb
|
112
|
+
- lib/svix/models/endpoint_disabled_event.rb
|
113
|
+
- lib/svix/models/endpoint_disabled_event_data.rb
|
114
|
+
- lib/svix/models/endpoint_in.rb
|
115
|
+
- lib/svix/models/endpoint_message_out.rb
|
116
|
+
- lib/svix/models/endpoint_out.rb
|
117
|
+
- lib/svix/models/endpoint_secret_out.rb
|
118
|
+
- lib/svix/models/endpoint_secret_rotate_in.rb
|
119
|
+
- lib/svix/models/endpoint_stats.rb
|
120
|
+
- lib/svix/models/endpoint_update.rb
|
121
|
+
- lib/svix/models/endpoint_updated_event.rb
|
122
|
+
- lib/svix/models/endpoint_updated_event_data.rb
|
123
|
+
- lib/svix/models/endpointd_updated_event.rb
|
124
|
+
- lib/svix/models/event_example_in.rb
|
125
|
+
- lib/svix/models/event_type_example_out.rb
|
126
|
+
- lib/svix/models/event_type_in.rb
|
127
|
+
- lib/svix/models/event_type_out.rb
|
128
|
+
- lib/svix/models/event_type_schema_in.rb
|
129
|
+
- lib/svix/models/event_type_update.rb
|
130
|
+
- lib/svix/models/http_error_out.rb
|
131
|
+
- lib/svix/models/http_validation_error.rb
|
132
|
+
- lib/svix/models/list_response_application_out.rb
|
133
|
+
- lib/svix/models/list_response_endpoint_message_out.rb
|
134
|
+
- lib/svix/models/list_response_endpoint_out.rb
|
135
|
+
- lib/svix/models/list_response_event_type_out.rb
|
136
|
+
- lib/svix/models/list_response_message_attempt_endpoint_out.rb
|
137
|
+
- lib/svix/models/list_response_message_attempt_out.rb
|
138
|
+
- lib/svix/models/list_response_message_endpoint_out.rb
|
139
|
+
- lib/svix/models/list_response_message_out.rb
|
140
|
+
- lib/svix/models/message_attempt_endpoint_out.rb
|
141
|
+
- lib/svix/models/message_attempt_exhausted_event.rb
|
142
|
+
- lib/svix/models/message_attempt_exhausted_event_data.rb
|
143
|
+
- lib/svix/models/message_attempt_failed_event.rb
|
144
|
+
- lib/svix/models/message_attempt_out.rb
|
145
|
+
- lib/svix/models/message_attempt_trigger_type.rb
|
146
|
+
- lib/svix/models/message_endpoint_out.rb
|
147
|
+
- lib/svix/models/message_in.rb
|
148
|
+
- lib/svix/models/message_out.rb
|
149
|
+
- lib/svix/models/message_status.rb
|
150
|
+
- lib/svix/models/validation_error.rb
|
151
|
+
- lib/svix/models/webhook_types.rb
|
152
|
+
- lib/svix/svix.rb
|
153
|
+
- lib/svix/util.rb
|
154
|
+
- lib/svix/version.rb
|
155
|
+
- lib/svix/webhook.rb
|
72
156
|
- svix.gemspec
|
73
157
|
homepage: https://www.svix.com
|
74
158
|
licenses:
|
@@ -76,12 +160,12 @@ licenses:
|
|
76
160
|
metadata:
|
77
161
|
allowed_push_host: https://rubygems.org
|
78
162
|
homepage_uri: https://www.svix.com
|
79
|
-
source_code_uri: https://github.com/
|
80
|
-
changelog_uri: https://github.com/
|
163
|
+
source_code_uri: https://github.com/svix/svix-libs
|
164
|
+
changelog_uri: https://github.com/svix/svix-libs/blob/main/ChangeLog.md
|
81
165
|
post_install_message:
|
82
166
|
rdoc_options: []
|
83
167
|
require_paths:
|
84
|
-
-
|
168
|
+
- lib
|
85
169
|
required_ruby_version: !ruby/object:Gem::Requirement
|
86
170
|
requirements:
|
87
171
|
- - ">="
|
data/.gitignore
DELETED
data/src/svix/version.rb
DELETED
data/src/svix/webhook.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Svix
|
4
|
-
class Webhook
|
5
|
-
def initialize(secret)
|
6
|
-
@secret = Base64.decode64(secret)
|
7
|
-
end
|
8
|
-
|
9
|
-
def verify(payload, headers)
|
10
|
-
msgId = headers["svix-id"]
|
11
|
-
msgSignature = headers["svix-signature"]
|
12
|
-
msgTimestamp = headers["svix-timestamp"]
|
13
|
-
if !msgSignature || !msgId || !msgTimestamp
|
14
|
-
raise WebhookVerificationError, "Missing required headers"
|
15
|
-
end
|
16
|
-
|
17
|
-
toSign = "#{msgId}.#{msgTimestamp}.#{payload}"
|
18
|
-
signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'), @secret, toSign)).strip()
|
19
|
-
|
20
|
-
passedSignatures = msgSignature.split(" ")
|
21
|
-
passedSignatures.each do |versionedSignature|
|
22
|
-
version, expectedSignature = versionedSignature.split(',', 2)
|
23
|
-
if version != "v1"
|
24
|
-
next
|
25
|
-
end
|
26
|
-
if Svix.secure_compare(signature, expectedSignature)
|
27
|
-
return JSON.parse(payload, symbolize_names: true)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
raise WebhookVerificationError, "No matching signature found"
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|