neon_email 0.1.5 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -19
- data/Gemfile.lock +137 -64
- data/Guardfile +7 -0
- data/app.rb +4 -14
- data/lib/neon_email.rb +3 -2
- data/lib/neon_email/operations/greeting_mailer.rb +34 -0
- data/lib/neon_email/operations/sendgrid_mailer.rb +53 -0
- data/lib/neon_email/version.rb +1 -1
- data/neon_email.gemspec +14 -3
- metadata +149 -7
- data/lib/neon_email/greeting_mailer.rb +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75684a3703ec4cef12c59239dd8ccb941d2fcd8320d56224106ea96ce8f10dfb
|
4
|
+
data.tar.gz: 474c505691f0708a21c3baca97ba452aaf075c6bbfc6b6759492d36905464052
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71853e2d2ff5384b82d758adc7cfe3e0b9b1e47581ea8c7a1f629aa061b70416ee9f2a50f9e209beac6244f64e681b3e91e9ddaad900d175d521c90f8ce2dbc3
|
7
|
+
data.tar.gz: a6867440a6cdc5ea4350922762c1e05647bfb89f6d3a17c2dbee327a87347a5f1afb2ebfb12266f81558c65eb34435c64b21c22b2922d15e2007bdb728170511
|
data/Gemfile
CHANGED
@@ -1,22 +1,4 @@
|
|
1
1
|
source "https://rubygems.org"
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in neon_postgres.gemspec
|
4
2
|
gemspec
|
5
3
|
|
6
|
-
gem "
|
7
|
-
gem "rspec", "~> 3.0"
|
8
|
-
gem "standard"
|
9
|
-
|
10
|
-
gem "sequel", "~> 5.43"
|
11
|
-
gem "fixture_dependencies", "~> 1.10"
|
12
|
-
gem "pg", "~> 1.2"
|
13
|
-
|
14
|
-
gem "pry", "~> 0.14.1"
|
15
|
-
|
16
|
-
gem "faker", "~> 2.17"
|
17
|
-
|
18
|
-
gem "sendgrid-ruby", "~> 6.4"
|
19
|
-
|
20
|
-
gem "google-cloud-pubsub", "~> 2.6"
|
21
|
-
|
22
|
-
gem "functions-framework-ruby", "~> 9001.0"
|
4
|
+
gem "dry-monads", "~> 1.3"
|
data/Gemfile.lock
CHANGED
@@ -1,46 +1,95 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
neon_email (0.1.
|
4
|
+
neon_email (0.1.10)
|
5
5
|
functions_framework (= 0.9.0)
|
6
|
-
|
7
|
-
|
6
|
+
neon_operations (= 0.0.6)
|
7
|
+
neon_schemas (= 0.1.13)
|
8
|
+
neon_secrets (= 0.0.3)
|
9
|
+
sendgrid-ruby (= 6.4)
|
8
10
|
|
9
11
|
GEM
|
10
12
|
remote: https://rubygems.org/
|
11
13
|
specs:
|
12
|
-
addressable (2.
|
14
|
+
addressable (2.8.0)
|
13
15
|
public_suffix (>= 2.0.2, < 5.0)
|
14
16
|
ast (2.4.2)
|
15
17
|
avro (1.10.2)
|
16
18
|
multi_json (~> 1)
|
17
|
-
cloud_events (0.
|
19
|
+
cloud_events (0.5.1)
|
18
20
|
coderay (1.1.3)
|
19
|
-
concurrent-ruby (1.1.
|
21
|
+
concurrent-ruby (1.1.9)
|
20
22
|
diff-lcs (1.4.4)
|
23
|
+
docile (1.4.0)
|
24
|
+
dry-configurable (0.12.1)
|
25
|
+
concurrent-ruby (~> 1.0)
|
26
|
+
dry-core (~> 0.5, >= 0.5.0)
|
27
|
+
dry-container (0.8.0)
|
28
|
+
concurrent-ruby (~> 1.0)
|
29
|
+
dry-configurable (~> 0.1, >= 0.1.3)
|
30
|
+
dry-core (0.6.0)
|
31
|
+
concurrent-ruby (~> 1.0)
|
32
|
+
dry-equalizer (0.3.0)
|
33
|
+
dry-inflector (0.2.1)
|
34
|
+
dry-initializer (3.0.4)
|
35
|
+
dry-logic (1.2.0)
|
36
|
+
concurrent-ruby (~> 1.0)
|
37
|
+
dry-core (~> 0.5, >= 0.5)
|
38
|
+
dry-monads (1.3.5)
|
39
|
+
concurrent-ruby (~> 1.0)
|
40
|
+
dry-core (~> 0.4, >= 0.4.4)
|
41
|
+
dry-equalizer
|
42
|
+
dry-schema (1.7.0)
|
43
|
+
concurrent-ruby (~> 1.0)
|
44
|
+
dry-configurable (~> 0.8, >= 0.8.3)
|
45
|
+
dry-core (~> 0.5, >= 0.5)
|
46
|
+
dry-initializer (~> 3.0)
|
47
|
+
dry-logic (~> 1.0)
|
48
|
+
dry-types (~> 1.5)
|
49
|
+
dry-types (1.5.1)
|
50
|
+
concurrent-ruby (~> 1.0)
|
51
|
+
dry-container (~> 0.3)
|
52
|
+
dry-core (~> 0.5, >= 0.5)
|
53
|
+
dry-inflector (~> 0.1, >= 0.1.2)
|
54
|
+
dry-logic (~> 1.0, >= 1.0.2)
|
55
|
+
dry-validation (1.6.0)
|
56
|
+
concurrent-ruby (~> 1.0)
|
57
|
+
dry-container (~> 0.7, >= 0.7.1)
|
58
|
+
dry-core (~> 0.4)
|
59
|
+
dry-equalizer (~> 0.2)
|
60
|
+
dry-initializer (~> 3.0)
|
61
|
+
dry-schema (~> 1.5, >= 1.5.2)
|
21
62
|
faker (2.17.0)
|
22
63
|
i18n (>= 1.6, < 2)
|
23
|
-
faraday (1.
|
64
|
+
faraday (1.5.0)
|
65
|
+
faraday-em_http (~> 1.0)
|
66
|
+
faraday-em_synchrony (~> 1.0)
|
24
67
|
faraday-excon (~> 1.1)
|
68
|
+
faraday-httpclient (~> 1.0.1)
|
25
69
|
faraday-net_http (~> 1.0)
|
26
70
|
faraday-net_http_persistent (~> 1.1)
|
71
|
+
faraday-patron (~> 1.0)
|
27
72
|
multipart-post (>= 1.2, < 3)
|
28
73
|
ruby2_keywords (>= 0.0.4)
|
74
|
+
faraday-em_http (1.0.0)
|
75
|
+
faraday-em_synchrony (1.0.0)
|
29
76
|
faraday-excon (1.1.0)
|
77
|
+
faraday-httpclient (1.0.1)
|
30
78
|
faraday-net_http (1.0.1)
|
31
79
|
faraday-net_http_persistent (1.1.0)
|
32
|
-
|
33
|
-
|
80
|
+
faraday-patron (1.0.0)
|
81
|
+
ffi (1.15.3)
|
82
|
+
formatador (0.3.0)
|
34
83
|
functions_framework (0.9.0)
|
35
84
|
cloud_events (~> 0.1)
|
36
85
|
puma (~> 4.3)
|
37
86
|
rack (~> 2.1)
|
38
|
-
gapic-common (0.
|
87
|
+
gapic-common (0.5.0)
|
39
88
|
faraday (~> 1.3)
|
40
|
-
google-protobuf (~> 3.
|
41
|
-
googleapis-common-protos (>= 1.3.11, < 2.
|
42
|
-
googleapis-common-protos-types (>= 1.0.6, < 2.
|
43
|
-
googleauth (
|
89
|
+
google-protobuf (~> 3.14)
|
90
|
+
googleapis-common-protos (>= 1.3.11, < 2.a)
|
91
|
+
googleapis-common-protos-types (>= 1.0.6, < 2.a)
|
92
|
+
googleauth (>= 0.16.2, < 2.a)
|
44
93
|
grpc (~> 1.36)
|
45
94
|
google-cloud-core (1.6.0)
|
46
95
|
google-cloud-env (~> 1.0)
|
@@ -48,27 +97,19 @@ GEM
|
|
48
97
|
google-cloud-env (1.5.0)
|
49
98
|
faraday (>= 0.17.3, < 2.0)
|
50
99
|
google-cloud-errors (1.1.0)
|
51
|
-
google-cloud-
|
52
|
-
|
53
|
-
google-cloud-
|
54
|
-
google-cloud-
|
55
|
-
google-cloud-
|
56
|
-
gapic-common (
|
57
|
-
google-cloud-errors (~> 1.0)
|
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)
|
100
|
+
google-cloud-secret_manager (1.1.1)
|
101
|
+
google-cloud-core (~> 1.6)
|
102
|
+
google-cloud-secret_manager-v1 (>= 0.1, < 2.a)
|
103
|
+
google-cloud-secret_manager-v1beta1 (>= 0.3, < 2.a)
|
104
|
+
google-cloud-secret_manager-v1 (0.10.1)
|
105
|
+
gapic-common (>= 0.5, < 2.a)
|
65
106
|
google-cloud-errors (~> 1.0)
|
66
|
-
grpc-google-iam-v1 (>= 0.6.10, < 2.
|
67
|
-
google-cloud-secret_manager-v1beta1 (0.8.
|
68
|
-
gapic-common (
|
107
|
+
grpc-google-iam-v1 (>= 0.6.10, < 2.a)
|
108
|
+
google-cloud-secret_manager-v1beta1 (0.8.1)
|
109
|
+
gapic-common (>= 0.5, < 2.a)
|
69
110
|
google-cloud-errors (~> 1.0)
|
70
|
-
grpc-google-iam-v1 (>= 0.6.10, < 2.
|
71
|
-
google-protobuf (3.17.
|
111
|
+
grpc-google-iam-v1 (>= 0.6.10, < 2.a)
|
112
|
+
google-protobuf (3.17.3)
|
72
113
|
googleapis-common-protos (1.3.11)
|
73
114
|
google-protobuf (~> 3.14)
|
74
115
|
googleapis-common-protos-types (>= 1.0.6, < 2.0)
|
@@ -82,30 +123,55 @@ GEM
|
|
82
123
|
multi_json (~> 1.11)
|
83
124
|
os (>= 0.9, < 2.0)
|
84
125
|
signet (~> 0.14)
|
85
|
-
grpc (1.
|
126
|
+
grpc (1.38.0)
|
86
127
|
google-protobuf (~> 3.15)
|
87
128
|
googleapis-common-protos-types (~> 1.0)
|
88
129
|
grpc-google-iam-v1 (0.6.11)
|
89
130
|
google-protobuf (~> 3.14)
|
90
131
|
googleapis-common-protos (>= 1.3.11, < 2.0)
|
91
132
|
grpc (~> 1.27)
|
133
|
+
guard (2.17.0)
|
134
|
+
formatador (>= 0.2.4)
|
135
|
+
listen (>= 2.7, < 4.0)
|
136
|
+
lumberjack (>= 1.0.12, < 2.0)
|
137
|
+
nenv (~> 0.1)
|
138
|
+
notiffany (~> 0.0)
|
139
|
+
pry (>= 0.9.12)
|
140
|
+
shellany (~> 0.0)
|
141
|
+
thor (>= 0.18.1)
|
142
|
+
guard-compat (1.2.1)
|
143
|
+
guard-rspec (4.7.3)
|
144
|
+
guard (~> 2.1)
|
145
|
+
guard-compat (~> 1.1)
|
146
|
+
rspec (>= 2.99.0, < 4.0)
|
92
147
|
i18n (1.8.10)
|
93
148
|
concurrent-ruby (~> 1.0)
|
94
149
|
jwt (2.2.3)
|
150
|
+
listen (3.5.1)
|
151
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
152
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
153
|
+
lumberjack (1.2.8)
|
95
154
|
memoist (0.16.2)
|
96
155
|
method_source (1.0.0)
|
97
156
|
multi_json (1.15.0)
|
98
157
|
multipart-post (2.1.1)
|
99
|
-
|
158
|
+
nenv (0.3.0)
|
159
|
+
neon_operations (0.0.6)
|
160
|
+
dry-monads (~> 1.3)
|
161
|
+
neon_schemas (0.1.13)
|
100
162
|
avro (~> 1.10)
|
101
|
-
|
163
|
+
dry-validation (= 1.6)
|
164
|
+
neon_operations (= 0.0.6)
|
165
|
+
neon_secrets (0.0.3)
|
102
166
|
google-cloud-secret_manager (~> 1.1)
|
103
167
|
nio4r (2.5.7)
|
168
|
+
notiffany (0.1.3)
|
169
|
+
nenv (~> 0.1)
|
170
|
+
shellany (~> 0.0)
|
104
171
|
os (1.1.1)
|
105
172
|
parallel (1.20.1)
|
106
|
-
parser (3.0.1.
|
173
|
+
parser (3.0.1.1)
|
107
174
|
ast (~> 2.4.1)
|
108
|
-
pg (1.2.3)
|
109
175
|
pry (0.14.1)
|
110
176
|
coderay (~> 1.1)
|
111
177
|
method_source (~> 1.0)
|
@@ -115,21 +181,23 @@ GEM
|
|
115
181
|
rack (2.2.3)
|
116
182
|
rainbow (3.0.0)
|
117
183
|
rake (12.3.3)
|
184
|
+
rb-fsevent (0.11.0)
|
185
|
+
rb-inotify (0.10.1)
|
186
|
+
ffi (~> 1.0)
|
118
187
|
regexp_parser (2.1.1)
|
119
188
|
rexml (3.2.5)
|
120
|
-
rspec (3.
|
121
|
-
rspec-core (~> 3.
|
122
|
-
rspec-expectations (~> 3.
|
123
|
-
rspec-mocks (~> 3.
|
124
|
-
rspec-core (3.
|
125
|
-
rspec-support (~> 3.
|
126
|
-
rspec-expectations (3.
|
127
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
128
|
-
rspec-support (~> 3.10.0)
|
129
|
-
rspec-mocks (3.10.2)
|
189
|
+
rspec (3.0.0)
|
190
|
+
rspec-core (~> 3.0.0)
|
191
|
+
rspec-expectations (~> 3.0.0)
|
192
|
+
rspec-mocks (~> 3.0.0)
|
193
|
+
rspec-core (3.0.4)
|
194
|
+
rspec-support (~> 3.0.0)
|
195
|
+
rspec-expectations (3.0.4)
|
130
196
|
diff-lcs (>= 1.2.0, < 2.0)
|
131
|
-
rspec-support (~> 3.
|
132
|
-
rspec-
|
197
|
+
rspec-support (~> 3.0.0)
|
198
|
+
rspec-mocks (3.0.4)
|
199
|
+
rspec-support (~> 3.0.0)
|
200
|
+
rspec-support (3.0.4)
|
133
201
|
rubocop (1.12.1)
|
134
202
|
parallel (~> 1.10)
|
135
203
|
parser (>= 3.0.0.0)
|
@@ -139,8 +207,8 @@ GEM
|
|
139
207
|
rubocop-ast (>= 1.2.0, < 2.0)
|
140
208
|
ruby-progressbar (~> 1.7)
|
141
209
|
unicode-display_width (>= 1.4.0, < 3.0)
|
142
|
-
rubocop-ast (1.
|
143
|
-
parser (>=
|
210
|
+
rubocop-ast (1.7.0)
|
211
|
+
parser (>= 3.0.1.1)
|
144
212
|
rubocop-performance (1.10.1)
|
145
213
|
rubocop (>= 0.90.0, < 2.0)
|
146
214
|
rubocop-ast (>= 0.4.0)
|
@@ -149,33 +217,38 @@ GEM
|
|
149
217
|
ruby_http_client (3.5.2)
|
150
218
|
sendgrid-ruby (6.4.0)
|
151
219
|
ruby_http_client (~> 3.4)
|
152
|
-
|
220
|
+
shellany (0.0.1)
|
153
221
|
signet (0.15.0)
|
154
222
|
addressable (~> 2.3)
|
155
223
|
faraday (>= 0.17.3, < 2.0)
|
156
224
|
jwt (>= 1.5, < 3.0)
|
157
225
|
multi_json (~> 1.10)
|
226
|
+
simplecov (0.21.2)
|
227
|
+
docile (~> 1.1)
|
228
|
+
simplecov-html (~> 0.11)
|
229
|
+
simplecov_json_formatter (~> 0.1)
|
230
|
+
simplecov-html (0.12.3)
|
231
|
+
simplecov_json_formatter (0.1.3)
|
158
232
|
standard (1.0.5)
|
159
233
|
rubocop (= 1.12.1)
|
160
234
|
rubocop-performance (= 1.10.1)
|
235
|
+
thor (1.1.0)
|
161
236
|
unicode-display_width (2.0.0)
|
162
237
|
|
163
238
|
PLATFORMS
|
164
239
|
ruby
|
165
240
|
|
166
241
|
DEPENDENCIES
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
242
|
+
dry-monads (~> 1.3)
|
243
|
+
faker (= 2.17)
|
244
|
+
guard (= 2.17.0)
|
245
|
+
guard-rspec (= 4.7.3)
|
171
246
|
neon_email!
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
sequel (~> 5.43)
|
178
|
-
standard
|
247
|
+
pry (= 0.14.1)
|
248
|
+
rake (= 12.3.3)
|
249
|
+
rspec (= 3.0)
|
250
|
+
simplecov (= 0.21.2)
|
251
|
+
standard (= 1.0.5)
|
179
252
|
|
180
253
|
BUNDLED WITH
|
181
254
|
2.1.4
|
data/Guardfile
ADDED
data/app.rb
CHANGED
@@ -1,20 +1,10 @@
|
|
1
1
|
require "functions_framework"
|
2
2
|
require "neon_email"
|
3
|
-
require "
|
4
|
-
require "base64"
|
5
|
-
require "json"
|
6
|
-
|
7
|
-
logger = Logger.new($stdout)
|
3
|
+
require "neon_operations"
|
8
4
|
|
9
5
|
FunctionsFramework.cloud_event "outbound_emails.welcome_email" do |event|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
Base64.strict_decode64(event.data.fetch("message").fetch("data"))
|
6
|
+
NeonOperations::GCPFunctionsManager.invoke_operation(
|
7
|
+
NeonEmail::Operations::GreetingMailer,
|
8
|
+
event
|
14
9
|
)
|
15
|
-
to_email = data.fetch("to")
|
16
|
-
|
17
|
-
NeonEmail::GreetingMailer.deliver(to_email: to_email)
|
18
|
-
|
19
|
-
logger.info(data)
|
20
10
|
end
|
data/lib/neon_email.rb
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
require_relative "./sendgrid_mailer"
|
2
|
+
|
3
|
+
module NeonEmail
|
4
|
+
module Operations
|
5
|
+
class GreetingMailer < NeonOperations::Operation
|
6
|
+
def initialize(
|
7
|
+
input:,
|
8
|
+
schema_contract: NeonSchemas::Contracts::OutboundEmails::WelcomeEmailContract,
|
9
|
+
mailer_operation: NeonEmail::Operations::SendgridMailer
|
10
|
+
)
|
11
|
+
@input = input
|
12
|
+
@schema_contract = schema_contract
|
13
|
+
@mailer_operation = mailer_operation
|
14
|
+
end
|
15
|
+
|
16
|
+
def call
|
17
|
+
validate_input.bind do |validated_input|
|
18
|
+
mailer_operation.call(
|
19
|
+
input: {
|
20
|
+
from: "support@neonlaw.com",
|
21
|
+
to: validated_input[:email],
|
22
|
+
subject: "Welcome to Neon Law!",
|
23
|
+
content: "Welcome, please email us if you have any questions."
|
24
|
+
}
|
25
|
+
)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
attr_reader :mailer_operation
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require "sendgrid-ruby"
|
2
|
+
require "neon_secrets"
|
3
|
+
|
4
|
+
module NeonEmail
|
5
|
+
module Operations
|
6
|
+
class SendgridMailer < NeonOperations::Operation
|
7
|
+
def initialize(
|
8
|
+
input:,
|
9
|
+
schema_contract: NeonSchemas::Contracts::OutboundEmails::SendgridMailContract
|
10
|
+
)
|
11
|
+
@input = input
|
12
|
+
@schema_contract = schema_contract
|
13
|
+
end
|
14
|
+
|
15
|
+
def call
|
16
|
+
validate_input.bind do |validated_input|
|
17
|
+
mail = SendGrid::Mail.new
|
18
|
+
mail.from = SendGrid::Email.new(email: "support@neonlaw.com", name: "Neon Law")
|
19
|
+
mail.add_content(
|
20
|
+
SendGrid::Content.new(
|
21
|
+
type: "text/plain",
|
22
|
+
value: validated_input[:content]
|
23
|
+
)
|
24
|
+
)
|
25
|
+
mail.subject = validated_input[:subject]
|
26
|
+
personalization = SendGrid::Personalization.new
|
27
|
+
personalization.add_to(SendGrid::Email.new(email: validated_input[:to]))
|
28
|
+
|
29
|
+
mail.add_personalization(personalization)
|
30
|
+
|
31
|
+
request = sendgrid_client.mail._("send").post(request_body: mail.to_json)
|
32
|
+
|
33
|
+
if request.status_code.to_i == 202
|
34
|
+
Success(request)
|
35
|
+
else
|
36
|
+
Failure(request)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def sendgrid_client
|
44
|
+
@_sendgrid_client ||= SendGrid::API.new(
|
45
|
+
api_key: NeonSecrets::Getter.get(
|
46
|
+
secret_name: "sendgrid_api_key",
|
47
|
+
gcp_secret_name: "emails"
|
48
|
+
)
|
49
|
+
).client
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/lib/neon_email/version.rb
CHANGED
data/neon_email.gemspec
CHANGED
@@ -17,12 +17,23 @@ Gem::Specification.new do |spec|
|
|
17
17
|
|
18
18
|
# Specify which files should be added to the gem when it is released.
|
19
19
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
20
|
-
spec.files = Dir.chdir(File.expand_path(
|
20
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
21
21
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
22
|
end
|
23
23
|
spec.require_paths = ["lib"]
|
24
24
|
|
25
|
-
spec.add_runtime_dependency "neon_schemas", "0.1.
|
25
|
+
spec.add_runtime_dependency "neon_schemas", "0.1.13"
|
26
26
|
spec.add_runtime_dependency "functions_framework", "0.9.0"
|
27
|
-
spec.add_runtime_dependency "neon_secrets", "0.0.
|
27
|
+
spec.add_runtime_dependency "neon_secrets", "0.0.3"
|
28
|
+
spec.add_runtime_dependency "sendgrid-ruby", "6.4"
|
29
|
+
spec.add_runtime_dependency "neon_operations", "0.0.6"
|
30
|
+
|
31
|
+
spec.add_development_dependency "rake", "12.3.3"
|
32
|
+
spec.add_development_dependency "rspec", "3.0"
|
33
|
+
spec.add_development_dependency "standard", "1.0.5"
|
34
|
+
spec.add_development_dependency "pry", "0.14.1"
|
35
|
+
spec.add_development_dependency "faker", "2.17"
|
36
|
+
spec.add_development_dependency "guard", "2.17.0"
|
37
|
+
spec.add_development_dependency "guard-rspec", "4.7.3"
|
38
|
+
spec.add_development_dependency "simplecov", "0.21.2"
|
28
39
|
end
|
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.1.
|
4
|
+
version: 0.1.10
|
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-
|
11
|
+
date: 2021-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: neon_schemas
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.1.
|
19
|
+
version: 0.1.13
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.1.
|
26
|
+
version: 0.1.13
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: functions_framework
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +44,154 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.0.
|
47
|
+
version: 0.0.3
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.0.
|
54
|
+
version: 0.0.3
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: sendgrid-ruby
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '6.4'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '6.4'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: neon_operations
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.0.6
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.0.6
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 12.3.3
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 12.3.3
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '3.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '3.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: standard
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.0.5
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 1.0.5
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: pry
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 0.14.1
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 0.14.1
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: faker
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - '='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '2.17'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - '='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '2.17'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: guard
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - '='
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 2.17.0
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - '='
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 2.17.0
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: guard-rspec
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - '='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 4.7.3
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - '='
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: 4.7.3
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: simplecov
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - '='
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: 0.21.2
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - '='
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: 0.21.2
|
55
195
|
description: A gem to handle outbound_email messages in Neon Law software space.
|
56
196
|
email:
|
57
197
|
- support@neonlaw.com
|
@@ -65,11 +205,13 @@ files:
|
|
65
205
|
- ".ruby-version"
|
66
206
|
- Gemfile
|
67
207
|
- Gemfile.lock
|
208
|
+
- Guardfile
|
68
209
|
- README.md
|
69
210
|
- Rakefile
|
70
211
|
- app.rb
|
71
212
|
- lib/neon_email.rb
|
72
|
-
- lib/neon_email/greeting_mailer.rb
|
213
|
+
- lib/neon_email/operations/greeting_mailer.rb
|
214
|
+
- lib/neon_email/operations/sendgrid_mailer.rb
|
73
215
|
- lib/neon_email/version.rb
|
74
216
|
- neon_email.gemspec
|
75
217
|
homepage: https://github.com/neonlaw/codebase
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require "sendgrid-ruby"
|
2
|
-
require "neon_secrets"
|
3
|
-
|
4
|
-
module NeonEmail
|
5
|
-
class GreetingMailer
|
6
|
-
include SendGrid
|
7
|
-
|
8
|
-
def self.deliver(to_email:)
|
9
|
-
new(to_email: to_email).deliver
|
10
|
-
end
|
11
|
-
|
12
|
-
def initialize(to_email:)
|
13
|
-
@to_email = to_email
|
14
|
-
end
|
15
|
-
|
16
|
-
def deliver
|
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
|
-
mail = SendGrid::Mail.new(from, subject, to, content)
|
22
|
-
|
23
|
-
sg = SendGrid::API.new(
|
24
|
-
api_key: NeonSecrets::Getter.get(secret_name: "sendgrid_api_key")
|
25
|
-
)
|
26
|
-
response = sg.client.mail._("send").post(request_body: mail.to_json)
|
27
|
-
|
28
|
-
puts response
|
29
|
-
end
|
30
|
-
|
31
|
-
private
|
32
|
-
|
33
|
-
attr_reader :to_email
|
34
|
-
end
|
35
|
-
end
|