neon_email 0.0.9 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +16 -1
- data/README.md +1 -1
- data/app.rb +12 -3
- data/lib/neon_email.rb +1 -0
- data/lib/neon_email/greeting_mailer.rb +13 -12
- data/lib/neon_email/version.rb +1 -1
- data/neon_email.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb3f35cf3264d0b746bb69f06cf725c57e8dd4fd35b3a177a88d1fb3ab0902f4
|
4
|
+
data.tar.gz: 42ba2f0e1e14e0c510aa383b9a08cbaf80d9ac40747bcc7fd13e75cb4b455b62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ffdb88d7f5b1ec5970918be95d02a95beaafcadb2b96b1b84ccb5aed63d800d51e7f44928fb4118b03b77f5f0388ae720ff6b378ea97266ef0e6f9bc82b94ff
|
7
|
+
data.tar.gz: b189186688a0dee4fa06707d1b57f1ce9d509eae367c9ff9730674a84aa670fdf534dd17e60d24dc4efa2c2813b7b0ba7cc90337dbfcc405a5476bc8f5235a8d
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
neon_email (0.
|
4
|
+
neon_email (0.1.4)
|
5
5
|
functions_framework (= 0.9.0)
|
6
6
|
neon_schemas (= 0.1.1)
|
7
|
+
neon_secrets (= 0.0.1)
|
7
8
|
|
8
9
|
GEM
|
9
10
|
remote: https://rubygems.org/
|
@@ -55,6 +56,18 @@ GEM
|
|
55
56
|
gapic-common (~> 0.3)
|
56
57
|
google-cloud-errors (~> 1.0)
|
57
58
|
grpc-google-iam-v1 (>= 0.6.10, < 2.0)
|
59
|
+
google-cloud-secret_manager (1.1.0)
|
60
|
+
google-cloud-core (~> 1.5)
|
61
|
+
google-cloud-secret_manager-v1 (~> 0.1)
|
62
|
+
google-cloud-secret_manager-v1beta1 (~> 0.3)
|
63
|
+
google-cloud-secret_manager-v1 (0.10.0)
|
64
|
+
gapic-common (~> 0.4)
|
65
|
+
google-cloud-errors (~> 1.0)
|
66
|
+
grpc-google-iam-v1 (>= 0.6.10, < 2.0)
|
67
|
+
google-cloud-secret_manager-v1beta1 (0.8.0)
|
68
|
+
gapic-common (~> 0.3)
|
69
|
+
google-cloud-errors (~> 1.0)
|
70
|
+
grpc-google-iam-v1 (>= 0.6.10, < 2.0)
|
58
71
|
google-protobuf (3.17.0)
|
59
72
|
googleapis-common-protos (1.3.11)
|
60
73
|
google-protobuf (~> 3.14)
|
@@ -85,6 +98,8 @@ GEM
|
|
85
98
|
multipart-post (2.1.1)
|
86
99
|
neon_schemas (0.1.1)
|
87
100
|
avro (~> 1.10)
|
101
|
+
neon_secrets (0.0.1)
|
102
|
+
google-cloud-secret_manager (~> 1.1)
|
88
103
|
nio4r (2.5.7)
|
89
104
|
os (1.1.1)
|
90
105
|
parallel (1.20.1)
|
data/README.md
CHANGED
data/app.rb
CHANGED
@@ -1,11 +1,20 @@
|
|
1
1
|
require "functions_framework"
|
2
2
|
require "neon_email"
|
3
3
|
require "logger"
|
4
|
+
require "base64"
|
5
|
+
require "json"
|
4
6
|
|
5
7
|
logger = Logger.new($stdout)
|
6
8
|
|
7
|
-
|
9
|
+
FunctionsFramework.cloud_event "outbound_emails.welcome_email" do |event|
|
10
|
+
logger.info "hey you!"
|
8
11
|
|
9
|
-
|
10
|
-
|
12
|
+
data = JSON.parse(
|
13
|
+
Base64.strict_decode64(event.data.fetch("message").fetch("data"))
|
14
|
+
)
|
15
|
+
to_email = data.fetch("to")
|
16
|
+
|
17
|
+
NeonEmail::GreetingMailer.deliver(to_email: to_email)
|
18
|
+
|
19
|
+
logger.info(data)
|
11
20
|
end
|
data/lib/neon_email.rb
CHANGED
@@ -1,27 +1,28 @@
|
|
1
1
|
require "sendgrid-ruby"
|
2
|
-
|
2
|
+
require "neon_secrets"
|
3
3
|
|
4
4
|
module NeonEmail
|
5
5
|
class GreetingMailer
|
6
6
|
include SendGrid
|
7
7
|
|
8
|
-
def self.deliver(
|
9
|
-
new(
|
8
|
+
def self.deliver(to_email:)
|
9
|
+
new(to_email: to_email).deliver
|
10
10
|
end
|
11
11
|
|
12
|
-
def initialize(
|
13
|
-
@
|
12
|
+
def initialize(to_email:)
|
13
|
+
@to_email = to_email
|
14
14
|
end
|
15
15
|
|
16
16
|
def deliver
|
17
|
-
from = SendGrid::Email.new(email: "
|
18
|
-
to = SendGrid::Email.new(email:
|
19
|
-
subject = "
|
20
|
-
content = SendGrid::Content.new(type: "text/plain", value:
|
17
|
+
from = SendGrid::Email.new(email: "support@neonlaw.com")
|
18
|
+
to = SendGrid::Email.new(email: to_email)
|
19
|
+
subject = "Welcome to Neon Law!"
|
20
|
+
content = SendGrid::Content.new(type: "text/plain", value: "Welcome")
|
21
21
|
mail = SendGrid::Mail.new(from, subject, to, content)
|
22
22
|
|
23
|
-
sg = SendGrid::API.new(
|
24
|
-
|
23
|
+
sg = SendGrid::API.new(
|
24
|
+
api_key: NeonSecrets::Getter.get(secret_name: "sendgrid_api_key")
|
25
|
+
)
|
25
26
|
response = sg.client.mail._("send").post(request_body: mail.to_json)
|
26
27
|
|
27
28
|
puts response
|
@@ -29,6 +30,6 @@ module NeonEmail
|
|
29
30
|
|
30
31
|
private
|
31
32
|
|
32
|
-
attr_reader :
|
33
|
+
attr_reader :to_email
|
33
34
|
end
|
34
35
|
end
|
data/lib/neon_email/version.rb
CHANGED
data/neon_email.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: neon_email
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Neon Law
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-06-
|
11
|
+
date: 2021-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: neon_schemas
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.9.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: neon_secrets
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.0.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.0.1
|
41
55
|
description: A gem to handle outbound_email messages in Neon Law software space.
|
42
56
|
email:
|
43
57
|
- support@neonlaw.com
|