neon_email 0.1.1 → 0.1.6

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: c40d88f4c28b729a5e855912be0741a0ad0eb2526981cfe989ccb2bb17c294a5
4
- data.tar.gz: 2ae8b9ecab535718a411771c3b1c155d76cb9dff3a4bc970d8d2a55e16299855
3
+ metadata.gz: 6d8636648cfe831ff6cb2adcf1bdb8d2efd047546dda72907e9565570ed09d1c
4
+ data.tar.gz: d2bd55c9dc5c086d4b633028ba21aec81717373b1672b7bb13fe319ee65301bc
5
5
  SHA512:
6
- metadata.gz: 54dbf8e7b80e6b20b9956060d20a5efbc032f03ccd0fab57f1dd71d2c54c31ab41b004393c0b62a237e9a8b6814d8954ffd4556ac107b30a6e2ac144f16852a7
7
- data.tar.gz: f8e346a358dc12f7975bd8dbba457fc6bd05c3d57050912ac521ed0e7dff32a56765cf84cc17240b1039fa9616030ef34d96620f274a20d3f5b1b8f8325bdf9d
6
+ metadata.gz: c6420e4bed7faf395f8774a995ab9c266e15a9bc82d14b6f6cd711ba05fa1425e003595df054df739c221774448cb961e90809153062f3a60dbcb7f26770d44c
7
+ data.tar.gz: a4d631b2774fccd610efa7aec538c8c67b66a3189a9d4028914cd6a0754905abd309aacfbd88420479c68d553c3f19cd2ed12448549868cf2a24e10b2c8fea5b
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,91 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- neon_email (0.1.1)
4
+ neon_email (0.1.5)
5
5
  functions_framework (= 0.9.0)
6
- neon_schemas (= 0.1.1)
6
+ neon_operations (= 0.0.6)
7
+ neon_schemas (= 0.1.12)
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.4.3)
65
+ faraday-em_http (~> 1.0)
66
+ faraday-em_synchrony (~> 1.0)
23
67
  faraday-excon (~> 1.1)
24
68
  faraday-net_http (~> 1.0)
25
69
  faraday-net_http_persistent (~> 1.1)
26
70
  multipart-post (>= 1.2, < 3)
27
71
  ruby2_keywords (>= 0.0.4)
72
+ faraday-em_http (1.0.0)
73
+ faraday-em_synchrony (1.0.0)
28
74
  faraday-excon (1.1.0)
29
75
  faraday-net_http (1.0.1)
30
76
  faraday-net_http_persistent (1.1.0)
31
- fixture_dependencies (1.10.0)
32
- functions-framework-ruby (9001.0)
77
+ ffi (1.15.3)
78
+ formatador (0.3.0)
33
79
  functions_framework (0.9.0)
34
80
  cloud_events (~> 0.1)
35
81
  puma (~> 4.3)
36
82
  rack (~> 2.1)
37
- gapic-common (0.4.1)
83
+ gapic-common (0.5.0)
38
84
  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)
85
+ google-protobuf (~> 3.14)
86
+ googleapis-common-protos (>= 1.3.11, < 2.a)
87
+ googleapis-common-protos-types (>= 1.0.6, < 2.a)
88
+ googleauth (>= 0.16.2, < 2.a)
43
89
  grpc (~> 1.36)
44
90
  google-cloud-core (1.6.0)
45
91
  google-cloud-env (~> 1.0)
@@ -47,15 +93,19 @@ GEM
47
93
  google-cloud-env (1.5.0)
48
94
  faraday (>= 0.17.3, < 2.0)
49
95
  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)
96
+ google-cloud-secret_manager (1.1.1)
97
+ google-cloud-core (~> 1.6)
98
+ google-cloud-secret_manager-v1 (>= 0.1, < 2.a)
99
+ google-cloud-secret_manager-v1beta1 (>= 0.3, < 2.a)
100
+ google-cloud-secret_manager-v1 (0.10.1)
101
+ gapic-common (>= 0.5, < 2.a)
102
+ google-cloud-errors (~> 1.0)
103
+ grpc-google-iam-v1 (>= 0.6.10, < 2.a)
104
+ google-cloud-secret_manager-v1beta1 (0.8.1)
105
+ gapic-common (>= 0.5, < 2.a)
56
106
  google-cloud-errors (~> 1.0)
57
- grpc-google-iam-v1 (>= 0.6.10, < 2.0)
58
- google-protobuf (3.17.0)
107
+ grpc-google-iam-v1 (>= 0.6.10, < 2.a)
108
+ google-protobuf (3.17.3)
59
109
  googleapis-common-protos (1.3.11)
60
110
  google-protobuf (~> 3.14)
61
111
  googleapis-common-protos-types (>= 1.0.6, < 2.0)
@@ -69,28 +119,55 @@ GEM
69
119
  multi_json (~> 1.11)
70
120
  os (>= 0.9, < 2.0)
71
121
  signet (~> 0.14)
72
- grpc (1.37.1)
122
+ grpc (1.38.0)
73
123
  google-protobuf (~> 3.15)
74
124
  googleapis-common-protos-types (~> 1.0)
75
125
  grpc-google-iam-v1 (0.6.11)
76
126
  google-protobuf (~> 3.14)
77
127
  googleapis-common-protos (>= 1.3.11, < 2.0)
78
128
  grpc (~> 1.27)
129
+ guard (2.17.0)
130
+ formatador (>= 0.2.4)
131
+ listen (>= 2.7, < 4.0)
132
+ lumberjack (>= 1.0.12, < 2.0)
133
+ nenv (~> 0.1)
134
+ notiffany (~> 0.0)
135
+ pry (>= 0.9.12)
136
+ shellany (~> 0.0)
137
+ thor (>= 0.18.1)
138
+ guard-compat (1.2.1)
139
+ guard-rspec (4.7.3)
140
+ guard (~> 2.1)
141
+ guard-compat (~> 1.1)
142
+ rspec (>= 2.99.0, < 4.0)
79
143
  i18n (1.8.10)
80
144
  concurrent-ruby (~> 1.0)
81
145
  jwt (2.2.3)
146
+ listen (3.5.1)
147
+ rb-fsevent (~> 0.10, >= 0.10.3)
148
+ rb-inotify (~> 0.9, >= 0.9.10)
149
+ lumberjack (1.2.8)
82
150
  memoist (0.16.2)
83
151
  method_source (1.0.0)
84
152
  multi_json (1.15.0)
85
153
  multipart-post (2.1.1)
86
- neon_schemas (0.1.1)
154
+ nenv (0.3.0)
155
+ neon_operations (0.0.6)
156
+ dry-monads (~> 1.3)
157
+ neon_schemas (0.1.12)
87
158
  avro (~> 1.10)
159
+ dry-validation (= 1.6)
160
+ neon_operations (= 0.0.6)
161
+ neon_secrets (0.0.1)
162
+ google-cloud-secret_manager (~> 1.1)
88
163
  nio4r (2.5.7)
164
+ notiffany (0.1.3)
165
+ nenv (~> 0.1)
166
+ shellany (~> 0.0)
89
167
  os (1.1.1)
90
168
  parallel (1.20.1)
91
169
  parser (3.0.1.0)
92
170
  ast (~> 2.4.1)
93
- pg (1.2.3)
94
171
  pry (0.14.1)
95
172
  coderay (~> 1.1)
96
173
  method_source (~> 1.0)
@@ -100,21 +177,23 @@ GEM
100
177
  rack (2.2.3)
101
178
  rainbow (3.0.0)
102
179
  rake (12.3.3)
180
+ rb-fsevent (0.11.0)
181
+ rb-inotify (0.10.1)
182
+ ffi (~> 1.0)
103
183
  regexp_parser (2.1.1)
104
184
  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)
185
+ rspec (3.0.0)
186
+ rspec-core (~> 3.0.0)
187
+ rspec-expectations (~> 3.0.0)
188
+ rspec-mocks (~> 3.0.0)
189
+ rspec-core (3.0.4)
190
+ rspec-support (~> 3.0.0)
191
+ rspec-expectations (3.0.4)
115
192
  diff-lcs (>= 1.2.0, < 2.0)
116
- rspec-support (~> 3.10.0)
117
- rspec-support (3.10.2)
193
+ rspec-support (~> 3.0.0)
194
+ rspec-mocks (3.0.4)
195
+ rspec-support (~> 3.0.0)
196
+ rspec-support (3.0.4)
118
197
  rubocop (1.12.1)
119
198
  parallel (~> 1.10)
120
199
  parser (>= 3.0.0.0)
@@ -134,33 +213,38 @@ GEM
134
213
  ruby_http_client (3.5.2)
135
214
  sendgrid-ruby (6.4.0)
136
215
  ruby_http_client (~> 3.4)
137
- sequel (5.43.0)
216
+ shellany (0.0.1)
138
217
  signet (0.15.0)
139
218
  addressable (~> 2.3)
140
219
  faraday (>= 0.17.3, < 2.0)
141
220
  jwt (>= 1.5, < 3.0)
142
221
  multi_json (~> 1.10)
222
+ simplecov (0.21.2)
223
+ docile (~> 1.1)
224
+ simplecov-html (~> 0.11)
225
+ simplecov_json_formatter (~> 0.1)
226
+ simplecov-html (0.12.3)
227
+ simplecov_json_formatter (0.1.3)
143
228
  standard (1.0.5)
144
229
  rubocop (= 1.12.1)
145
230
  rubocop-performance (= 1.10.1)
231
+ thor (1.1.0)
146
232
  unicode-display_width (2.0.0)
147
233
 
148
234
  PLATFORMS
149
235
  ruby
150
236
 
151
237
  DEPENDENCIES
152
- faker (~> 2.17)
153
- fixture_dependencies (~> 1.10)
154
- functions-framework-ruby (~> 9001.0)
155
- google-cloud-pubsub (~> 2.6)
238
+ dry-monads (~> 1.3)
239
+ faker (= 2.17)
240
+ guard (= 2.17.0)
241
+ guard-rspec (= 4.7.3)
156
242
  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
243
+ pry (= 0.14.1)
244
+ rake (= 12.3.3)
245
+ rspec (= 3.0)
246
+ simplecov (= 0.21.2)
247
+ standard (= 1.0.5)
164
248
 
165
249
  BUNDLED WITH
166
250
  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,15 +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(Base64.strict_decode64(event.data.fetch(:data)))
13
-
14
- logger.info(data)
5
+ FunctionsFramework.cloud_event "outbound_emails.welcome_email" do |event|
6
+ NeonOperations::GCPFunctionsManager.invoke_operation(
7
+ NeonEmail::Operations::GreetingMailer,
8
+ event
9
+ )
15
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.1"
2
+ VERSION = "0.1.6"
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.12"
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.1
4
+ version: 0.1.6
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.12
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.12
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