neon_webhooks 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/Dockerfile +9 -0
- data/Gemfile +15 -0
- data/Gemfile.lock +70 -0
- data/README.md +3 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/config.ru +3 -0
- data/lib/neon_webhooks.rb +45 -0
- data/lib/neon_webhooks/version.rb +3 -0
- data/neon_webhooks.gemspec +27 -0
- metadata +58 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4067f67803e5a62f3d7ce10282400e238e89bc02871c1f5ba4682b5f11afffd1
|
4
|
+
data.tar.gz: 46b24b5850df1c8e027e51263c203d36574f29aaee20f9beb4460628f5e9947e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cb62277fc1051d4e362dc7e6d460e1c27c4fef5b66b609b7b1481ade9314e495b26b03719f008665cec7cd06c1cda1eed304b9748b24ade5ec8980d3afd093cb
|
7
|
+
data.tar.gz: e53cba19a52bbf859e90e85365d535ac9fd804d746bbbd12c1538b66171aee68c9ea9f92015fb9953fcd85ef2fd56fed0ee016454b3e4904bdd9e23aab500b59
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Dockerfile
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in webhooks.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
gem "rake", "~> 12.0"
|
7
|
+
gem "rspec", "~> 3.0"
|
8
|
+
|
9
|
+
gem "roda", "~> 3.44"
|
10
|
+
|
11
|
+
gem "rack", "~> 2.2"
|
12
|
+
|
13
|
+
gem "webrick", "~> 1.7"
|
14
|
+
|
15
|
+
gem "standardrb", "~> 1.0"
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
neon_webhooks (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
ast (2.4.2)
|
10
|
+
diff-lcs (1.4.4)
|
11
|
+
parallel (1.20.1)
|
12
|
+
parser (3.0.1.1)
|
13
|
+
ast (~> 2.4.1)
|
14
|
+
rack (2.2.3)
|
15
|
+
rainbow (3.0.0)
|
16
|
+
rake (12.3.3)
|
17
|
+
regexp_parser (2.1.1)
|
18
|
+
rexml (3.2.5)
|
19
|
+
roda (3.44.0)
|
20
|
+
rack
|
21
|
+
rspec (3.10.0)
|
22
|
+
rspec-core (~> 3.10.0)
|
23
|
+
rspec-expectations (~> 3.10.0)
|
24
|
+
rspec-mocks (~> 3.10.0)
|
25
|
+
rspec-core (3.10.1)
|
26
|
+
rspec-support (~> 3.10.0)
|
27
|
+
rspec-expectations (3.10.1)
|
28
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
29
|
+
rspec-support (~> 3.10.0)
|
30
|
+
rspec-mocks (3.10.2)
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
+
rspec-support (~> 3.10.0)
|
33
|
+
rspec-support (3.10.2)
|
34
|
+
rubocop (1.14.0)
|
35
|
+
parallel (~> 1.10)
|
36
|
+
parser (>= 3.0.0.0)
|
37
|
+
rainbow (>= 2.2.2, < 4.0)
|
38
|
+
regexp_parser (>= 1.8, < 3.0)
|
39
|
+
rexml
|
40
|
+
rubocop-ast (>= 1.5.0, < 2.0)
|
41
|
+
ruby-progressbar (~> 1.7)
|
42
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
43
|
+
rubocop-ast (1.7.0)
|
44
|
+
parser (>= 3.0.1.1)
|
45
|
+
rubocop-performance (1.11.2)
|
46
|
+
rubocop (>= 1.7.0, < 2.0)
|
47
|
+
rubocop-ast (>= 0.4.0)
|
48
|
+
ruby-progressbar (1.11.0)
|
49
|
+
standard (1.1.1)
|
50
|
+
rubocop (= 1.14.0)
|
51
|
+
rubocop-performance (= 1.11.2)
|
52
|
+
standardrb (1.0.0)
|
53
|
+
standard
|
54
|
+
unicode-display_width (2.0.0)
|
55
|
+
webrick (1.7.0)
|
56
|
+
|
57
|
+
PLATFORMS
|
58
|
+
ruby
|
59
|
+
|
60
|
+
DEPENDENCIES
|
61
|
+
neon_webhooks!
|
62
|
+
rack (~> 2.2)
|
63
|
+
rake (~> 12.0)
|
64
|
+
roda (~> 3.44)
|
65
|
+
rspec (~> 3.0)
|
66
|
+
standardrb (~> 1.0)
|
67
|
+
webrick (~> 1.7)
|
68
|
+
|
69
|
+
BUNDLED WITH
|
70
|
+
2.1.4
|
data/README.md
ADDED
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "webhooks"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/config.ru
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require "roda"
|
2
|
+
require "neon_webhooks/version"
|
3
|
+
|
4
|
+
module NeonWebhooks
|
5
|
+
class Error < StandardError; end
|
6
|
+
|
7
|
+
class App < Roda
|
8
|
+
plugin :indifferent_params
|
9
|
+
plugin :request_headers
|
10
|
+
|
11
|
+
route do |r|
|
12
|
+
r.root do
|
13
|
+
"ok"
|
14
|
+
end
|
15
|
+
|
16
|
+
r.on "/successful-token-exchange" do
|
17
|
+
r.post do
|
18
|
+
fail unless r.headers.fetch("AUTH0_TOKEN") == ENV.fetch("AUTH0_TOKEN")
|
19
|
+
|
20
|
+
Google::Cloud::PubSub.configure do |config|
|
21
|
+
config.project_id = ENV.fetch("GCP_PROJECT_ID")
|
22
|
+
config.credentials = JSON.parse(ENV.fetch("GCP_CREDENTIALS"))
|
23
|
+
end
|
24
|
+
pubsub = Google::Cloud::PubSub.new
|
25
|
+
|
26
|
+
topic = pubsub.topic "authentication/successful_login"
|
27
|
+
|
28
|
+
record = {
|
29
|
+
email: params.fetch("email"),
|
30
|
+
sub: params.fetch("sub")
|
31
|
+
}
|
32
|
+
|
33
|
+
encoded_message = NeonSchemas::Avro.encode(
|
34
|
+
record: record,
|
35
|
+
schema_name: "authentication/successful_login"
|
36
|
+
)
|
37
|
+
|
38
|
+
topic.publish encoded_message
|
39
|
+
|
40
|
+
return "successful login message enqueued"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require_relative "lib/neon_webhooks/version"
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "neon_webhooks"
|
5
|
+
spec.version = NeonWebhooks::VERSION
|
6
|
+
spec.authors = ["Neon Law"]
|
7
|
+
spec.email = ["nick@neonlaw.com"]
|
8
|
+
|
9
|
+
spec.summary = "A webhook server that enqueues Pub/Sub messages"
|
10
|
+
spec.description = spec.summary
|
11
|
+
|
12
|
+
spec.homepage = "https://github.com/neonlaw/codebase"
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
14
|
+
|
15
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
16
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
17
|
+
spec.metadata["changelog_uri"] = spec.homepage
|
18
|
+
|
19
|
+
# Specify which files should be added to the gem when it is released.
|
20
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
21
|
+
spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
|
22
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
23
|
+
end
|
24
|
+
spec.bindir = "exe"
|
25
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
26
|
+
spec.require_paths = ["lib"]
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: neon_webhooks
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Neon Law
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-06-12 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A webhook server that enqueues Pub/Sub messages
|
14
|
+
email:
|
15
|
+
- nick@neonlaw.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- ".gitignore"
|
21
|
+
- ".rspec"
|
22
|
+
- Dockerfile
|
23
|
+
- Gemfile
|
24
|
+
- Gemfile.lock
|
25
|
+
- README.md
|
26
|
+
- Rakefile
|
27
|
+
- bin/console
|
28
|
+
- bin/setup
|
29
|
+
- config.ru
|
30
|
+
- lib/neon_webhooks.rb
|
31
|
+
- lib/neon_webhooks/version.rb
|
32
|
+
- neon_webhooks.gemspec
|
33
|
+
homepage: https://github.com/neonlaw/codebase
|
34
|
+
licenses: []
|
35
|
+
metadata:
|
36
|
+
homepage_uri: https://github.com/neonlaw/codebase
|
37
|
+
source_code_uri: https://github.com/neonlaw/codebase
|
38
|
+
changelog_uri: https://github.com/neonlaw/codebase
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options: []
|
41
|
+
require_paths:
|
42
|
+
- lib
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.3.0
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
requirements: []
|
54
|
+
rubygems_version: 3.2.15
|
55
|
+
signing_key:
|
56
|
+
specification_version: 4
|
57
|
+
summary: A webhook server that enqueues Pub/Sub messages
|
58
|
+
test_files: []
|