neon_email 0.1.2 → 0.1.7

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: 89a438887ec723f38ce45670094bd5a6b0f82c91cff68a5c32225974d1d8939d
4
- data.tar.gz: 9ed2bf07e591f1d995cc39ae0a42238519ae28997b89b6d71c435701d6d6ff65
3
+ metadata.gz: da39a31a4fe68a74959b0409fc82992cddf2cc06761c44634d5155838cb69938
4
+ data.tar.gz: a6d11db1ad7536f5c49088721a103f3419ddfb8faa978fac3ebe829f6138a53b
5
5
  SHA512:
6
- metadata.gz: 547bec39ca5c44eb842bda76fac2a9e3d06a90ef9e1a7ba6b7d6adc2451e36fcf709338a6b50ea982f8d23ca65d89113858f481b9dc217468339fa0e2b47e1ca
7
- data.tar.gz: 83639e6778b6cf49cf40adf8d7f4283ed19029589ec2287f5084ec038d18ee176aa1c112ad14770747e88c7203ac899f0ae351c6b830a19f96b176067cf51f88
6
+ metadata.gz: 10df62f0f374ec465b90d19d67e4187daabbe2da9b59d76ebbe10ff92cd925613b279ac9007c8aa91a7436a7c94061ce0929c9fd6f3780a085c42fdeff088c5e
7
+ data.tar.gz: f09193f0ce3565a816304a1f10643cdd828e9cfc76bcebf513abd86fe18b6a1a6c023c6048bd6d8ba7862231483eb6b1fc8aef115b738117090223d87a64f02a
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 "rake", "~> 12.0"
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,45 +1,95 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- neon_email (0.1.1)
4
+ neon_email (0.1.7)
5
5
  functions_framework (= 0.9.0)
6
- neon_schemas (= 0.1.1)
6
+ neon_operations (= 0.0.6)
7
+ neon_schemas (= 0.1.13)
8
+ neon_secrets (= 0.0.1)
9
+ sendgrid-ruby (= 6.4)
7
10
 
8
11
  GEM
9
12
  remote: https://rubygems.org/
10
13
  specs:
11
- addressable (2.7.0)
14
+ addressable (2.8.0)
12
15
  public_suffix (>= 2.0.2, < 5.0)
13
16
  ast (2.4.2)
14
17
  avro (1.10.2)
15
18
  multi_json (~> 1)
16
- cloud_events (0.4.0)
19
+ cloud_events (0.5.1)
17
20
  coderay (1.1.3)
18
- concurrent-ruby (1.1.8)
21
+ concurrent-ruby (1.1.9)
19
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)
20
62
  faker (2.17.0)
21
63
  i18n (>= 1.6, < 2)
22
- faraday (1.4.1)
64
+ faraday (1.5.0)
65
+ faraday-em_http (~> 1.0)
66
+ faraday-em_synchrony (~> 1.0)
23
67
  faraday-excon (~> 1.1)
68
+ faraday-httpclient (~> 1.0.1)
24
69
  faraday-net_http (~> 1.0)
25
70
  faraday-net_http_persistent (~> 1.1)
71
+ faraday-patron (~> 1.0)
26
72
  multipart-post (>= 1.2, < 3)
27
73
  ruby2_keywords (>= 0.0.4)
74
+ faraday-em_http (1.0.0)
75
+ faraday-em_synchrony (1.0.0)
28
76
  faraday-excon (1.1.0)
77
+ faraday-httpclient (1.0.1)
29
78
  faraday-net_http (1.0.1)
30
79
  faraday-net_http_persistent (1.1.0)
31
- fixture_dependencies (1.10.0)
32
- functions-framework-ruby (9001.0)
80
+ faraday-patron (1.0.0)
81
+ ffi (1.15.3)
82
+ formatador (0.3.0)
33
83
  functions_framework (0.9.0)
34
84
  cloud_events (~> 0.1)
35
85
  puma (~> 4.3)
36
86
  rack (~> 2.1)
37
- gapic-common (0.4.1)
87
+ gapic-common (0.5.0)
38
88
  faraday (~> 1.3)
39
- google-protobuf (~> 3.15, >= 3.15.2)
40
- googleapis-common-protos (>= 1.3.11, < 2.0)
41
- googleapis-common-protos-types (>= 1.0.6, < 2.0)
42
- googleauth (~> 0.15, >= 0.15.1)
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)
43
93
  grpc (~> 1.36)
44
94
  google-cloud-core (1.6.0)
45
95
  google-cloud-env (~> 1.0)
@@ -47,15 +97,19 @@ GEM
47
97
  google-cloud-env (1.5.0)
48
98
  faraday (>= 0.17.3, < 2.0)
49
99
  google-cloud-errors (1.1.0)
50
- google-cloud-pubsub (2.6.1)
51
- concurrent-ruby (~> 1.1)
52
- google-cloud-core (~> 1.5)
53
- google-cloud-pubsub-v1 (~> 0.0)
54
- google-cloud-pubsub-v1 (0.4.0)
55
- gapic-common (~> 0.3)
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)
106
+ google-cloud-errors (~> 1.0)
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)
56
110
  google-cloud-errors (~> 1.0)
57
- grpc-google-iam-v1 (>= 0.6.10, < 2.0)
58
- google-protobuf (3.17.0)
111
+ grpc-google-iam-v1 (>= 0.6.10, < 2.a)
112
+ google-protobuf (3.17.3)
59
113
  googleapis-common-protos (1.3.11)
60
114
  google-protobuf (~> 3.14)
61
115
  googleapis-common-protos-types (>= 1.0.6, < 2.0)
@@ -69,28 +123,55 @@ GEM
69
123
  multi_json (~> 1.11)
70
124
  os (>= 0.9, < 2.0)
71
125
  signet (~> 0.14)
72
- grpc (1.37.1)
126
+ grpc (1.38.0)
73
127
  google-protobuf (~> 3.15)
74
128
  googleapis-common-protos-types (~> 1.0)
75
129
  grpc-google-iam-v1 (0.6.11)
76
130
  google-protobuf (~> 3.14)
77
131
  googleapis-common-protos (>= 1.3.11, < 2.0)
78
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)
79
147
  i18n (1.8.10)
80
148
  concurrent-ruby (~> 1.0)
81
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)
82
154
  memoist (0.16.2)
83
155
  method_source (1.0.0)
84
156
  multi_json (1.15.0)
85
157
  multipart-post (2.1.1)
86
- neon_schemas (0.1.1)
158
+ nenv (0.3.0)
159
+ neon_operations (0.0.6)
160
+ dry-monads (~> 1.3)
161
+ neon_schemas (0.1.13)
87
162
  avro (~> 1.10)
163
+ dry-validation (= 1.6)
164
+ neon_operations (= 0.0.6)
165
+ neon_secrets (0.0.1)
166
+ google-cloud-secret_manager (~> 1.1)
88
167
  nio4r (2.5.7)
168
+ notiffany (0.1.3)
169
+ nenv (~> 0.1)
170
+ shellany (~> 0.0)
89
171
  os (1.1.1)
90
172
  parallel (1.20.1)
91
- parser (3.0.1.0)
173
+ parser (3.0.1.1)
92
174
  ast (~> 2.4.1)
93
- pg (1.2.3)
94
175
  pry (0.14.1)
95
176
  coderay (~> 1.1)
96
177
  method_source (~> 1.0)
@@ -100,21 +181,23 @@ GEM
100
181
  rack (2.2.3)
101
182
  rainbow (3.0.0)
102
183
  rake (12.3.3)
184
+ rb-fsevent (0.11.0)
185
+ rb-inotify (0.10.1)
186
+ ffi (~> 1.0)
103
187
  regexp_parser (2.1.1)
104
188
  rexml (3.2.5)
105
- rspec (3.10.0)
106
- rspec-core (~> 3.10.0)
107
- rspec-expectations (~> 3.10.0)
108
- rspec-mocks (~> 3.10.0)
109
- rspec-core (3.10.1)
110
- rspec-support (~> 3.10.0)
111
- rspec-expectations (3.10.1)
112
- diff-lcs (>= 1.2.0, < 2.0)
113
- rspec-support (~> 3.10.0)
114
- 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)
115
196
  diff-lcs (>= 1.2.0, < 2.0)
116
- rspec-support (~> 3.10.0)
117
- rspec-support (3.10.2)
197
+ rspec-support (~> 3.0.0)
198
+ rspec-mocks (3.0.4)
199
+ rspec-support (~> 3.0.0)
200
+ rspec-support (3.0.4)
118
201
  rubocop (1.12.1)
119
202
  parallel (~> 1.10)
120
203
  parser (>= 3.0.0.0)
@@ -124,8 +207,8 @@ GEM
124
207
  rubocop-ast (>= 1.2.0, < 2.0)
125
208
  ruby-progressbar (~> 1.7)
126
209
  unicode-display_width (>= 1.4.0, < 3.0)
127
- rubocop-ast (1.4.1)
128
- parser (>= 2.7.1.5)
210
+ rubocop-ast (1.7.0)
211
+ parser (>= 3.0.1.1)
129
212
  rubocop-performance (1.10.1)
130
213
  rubocop (>= 0.90.0, < 2.0)
131
214
  rubocop-ast (>= 0.4.0)
@@ -134,33 +217,38 @@ GEM
134
217
  ruby_http_client (3.5.2)
135
218
  sendgrid-ruby (6.4.0)
136
219
  ruby_http_client (~> 3.4)
137
- sequel (5.43.0)
220
+ shellany (0.0.1)
138
221
  signet (0.15.0)
139
222
  addressable (~> 2.3)
140
223
  faraday (>= 0.17.3, < 2.0)
141
224
  jwt (>= 1.5, < 3.0)
142
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)
143
232
  standard (1.0.5)
144
233
  rubocop (= 1.12.1)
145
234
  rubocop-performance (= 1.10.1)
235
+ thor (1.1.0)
146
236
  unicode-display_width (2.0.0)
147
237
 
148
238
  PLATFORMS
149
239
  ruby
150
240
 
151
241
  DEPENDENCIES
152
- faker (~> 2.17)
153
- fixture_dependencies (~> 1.10)
154
- functions-framework-ruby (~> 9001.0)
155
- google-cloud-pubsub (~> 2.6)
242
+ dry-monads (~> 1.3)
243
+ faker (= 2.17)
244
+ guard (= 2.17.0)
245
+ guard-rspec (= 4.7.3)
156
246
  neon_email!
157
- pg (~> 1.2)
158
- pry (~> 0.14.1)
159
- rake (~> 12.0)
160
- rspec (~> 3.0)
161
- sendgrid-ruby (~> 6.4)
162
- sequel (~> 5.43)
163
- 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)
164
252
 
165
253
  BUNDLED WITH
166
254
  2.1.4
data/Guardfile ADDED
@@ -0,0 +1,7 @@
1
+ directories %w[lib/neon_email spec] \
2
+ .select { |d| Dir.exist?(d) ? d : UI.warning("Directory #{d} does not exist") }
3
+
4
+ guard :rspec, cmd: "rspec" do
5
+ watch(%r{^spec/.+_spec\.rb})
6
+ watch(%r{^lib/neon_email/(.+)\.rb}) { |m| "spec/#{m[1]}_spec.rb" }
7
+ end
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Neon Email
2
2
 
3
- This gem is used to listen to email messages to Kafka and then interact with the
3
+ This gem is used to listen to email Pubsub messages and then interact with the
4
4
  Sendgrid API.
5
5
 
6
6
  ## Doppler Setup
data/app.rb CHANGED
@@ -1,17 +1,10 @@
1
1
  require "functions_framework"
2
2
  require "neon_email"
3
- require "logger"
4
- require "base64"
5
- require "json"
3
+ require "neon_operations"
6
4
 
7
- logger = Logger.new($stdout)
8
-
9
- WELCOME_EMAIL_TOPIC = "com.neon_law.outbound_email.welcome_email".freeze
10
-
11
- FunctionsFramework.cloud_event WELCOME_EMAIL_TOPIC do |event|
12
- data = JSON.parse(
13
- Base64.strict_decode64(event.data.fetch(:message).fetch(:data))
5
+ FunctionsFramework.cloud_event "outbound_emails.welcome_email" do |event|
6
+ NeonOperations::GCPFunctionsManager.invoke_operation(
7
+ NeonEmail::Operations::GreetingMailer,
8
+ event
14
9
  )
15
-
16
- logger.info(data)
17
10
  end
data/lib/neon_email.rb CHANGED
@@ -1,5 +1,7 @@
1
+ require "neon_schemas"
2
+ require "neon_operations"
1
3
  require "neon_email/version"
4
+ Dir["#{__dir__}/neon_email/operations/**/*.rb"].sort.each { |f| require f }
2
5
 
3
6
  module NeonEmail
4
- class Error < StandardError; end
5
7
  end
@@ -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,50 @@
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(secret_name: "sendgrid_api_key")
46
+ ).client
47
+ end
48
+ end
49
+ end
50
+ end
@@ -1,3 +1,3 @@
1
1
  module NeonEmail
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.7"
3
3
  end
data/neon_email.gemspec CHANGED
@@ -17,11 +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("..", __FILE__)) do
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.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.1"
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"
27
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.2
4
+ version: 0.1.7
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-15 00:00:00.000000000 Z
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.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.1
26
+ version: 0.1.13
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: functions_framework
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -38,6 +38,160 @@ 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
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
41
195
  description: A gem to handle outbound_email messages in Neon Law software space.
42
196
  email:
43
197
  - support@neonlaw.com
@@ -51,11 +205,13 @@ files:
51
205
  - ".ruby-version"
52
206
  - Gemfile
53
207
  - Gemfile.lock
208
+ - Guardfile
54
209
  - README.md
55
210
  - Rakefile
56
211
  - app.rb
57
212
  - lib/neon_email.rb
58
- - lib/neon_email/greeting_mailer.rb
213
+ - lib/neon_email/operations/greeting_mailer.rb
214
+ - lib/neon_email/operations/sendgrid_mailer.rb
59
215
  - lib/neon_email/version.rb
60
216
  - neon_email.gemspec
61
217
  homepage: https://github.com/neonlaw/codebase
@@ -1,34 +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(message:)
9
- new(message: message).deliver
10
- end
11
-
12
- def initialize(message:)
13
- @message = message
14
- end
15
-
16
- def deliver
17
- from = SendGrid::Email.new(email: "test@example.com")
18
- to = SendGrid::Email.new(email: "test@example.com")
19
- subject = "Sending with Twilio SendGrid is Fun"
20
- content = SendGrid::Content.new(type: "text/plain", value: message)
21
- mail = SendGrid::Mail.new(from, subject, to, content)
22
-
23
- sg = SendGrid::API.new(api_key: ENV["SENDGRID_API_KEY"])
24
- # sg = SendGrid::API.new(api_key: NeonSecrets::Getter.get(secret_name: "sendgrid_api_key"))
25
- response = sg.client.mail._("send").post(request_body: mail.to_json)
26
-
27
- puts response
28
- end
29
-
30
- private
31
-
32
- attr_reader :message
33
- end
34
- end