neon_email 0.1.5 → 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: cb3f35cf3264d0b746bb69f06cf725c57e8dd4fd35b3a177a88d1fb3ab0902f4
4
- data.tar.gz: 42ba2f0e1e14e0c510aa383b9a08cbaf80d9ac40747bcc7fd13e75cb4b455b62
3
+ metadata.gz: 6d8636648cfe831ff6cb2adcf1bdb8d2efd047546dda72907e9565570ed09d1c
4
+ data.tar.gz: d2bd55c9dc5c086d4b633028ba21aec81717373b1672b7bb13fe319ee65301bc
5
5
  SHA512:
6
- metadata.gz: 3ffdb88d7f5b1ec5970918be95d02a95beaafcadb2b96b1b84ccb5aed63d800d51e7f44928fb4118b03b77f5f0388ae720ff6b378ea97266ef0e6f9bc82b94ff
7
- data.tar.gz: b189186688a0dee4fa06707d1b57f1ce9d509eae367c9ff9730674a84aa670fdf534dd17e60d24dc4efa2c2813b7b0ba7cc90337dbfcc405a5476bc8f5235a8d
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,46 +1,91 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- neon_email (0.1.4)
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)
7
8
  neon_secrets (= 0.0.1)
9
+ sendgrid-ruby (= 6.4)
8
10
 
9
11
  GEM
10
12
  remote: https://rubygems.org/
11
13
  specs:
12
- addressable (2.7.0)
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.4.0)
19
+ cloud_events (0.5.1)
18
20
  coderay (1.1.3)
19
- concurrent-ruby (1.1.8)
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.4.1)
64
+ faraday (1.4.3)
65
+ faraday-em_http (~> 1.0)
66
+ faraday-em_synchrony (~> 1.0)
24
67
  faraday-excon (~> 1.1)
25
68
  faraday-net_http (~> 1.0)
26
69
  faraday-net_http_persistent (~> 1.1)
27
70
  multipart-post (>= 1.2, < 3)
28
71
  ruby2_keywords (>= 0.0.4)
72
+ faraday-em_http (1.0.0)
73
+ faraday-em_synchrony (1.0.0)
29
74
  faraday-excon (1.1.0)
30
75
  faraday-net_http (1.0.1)
31
76
  faraday-net_http_persistent (1.1.0)
32
- fixture_dependencies (1.10.0)
33
- functions-framework-ruby (9001.0)
77
+ ffi (1.15.3)
78
+ formatador (0.3.0)
34
79
  functions_framework (0.9.0)
35
80
  cloud_events (~> 0.1)
36
81
  puma (~> 4.3)
37
82
  rack (~> 2.1)
38
- gapic-common (0.4.1)
83
+ gapic-common (0.5.0)
39
84
  faraday (~> 1.3)
40
- google-protobuf (~> 3.15, >= 3.15.2)
41
- googleapis-common-protos (>= 1.3.11, < 2.0)
42
- googleapis-common-protos-types (>= 1.0.6, < 2.0)
43
- 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)
44
89
  grpc (~> 1.36)
45
90
  google-cloud-core (1.6.0)
46
91
  google-cloud-env (~> 1.0)
@@ -48,27 +93,19 @@ GEM
48
93
  google-cloud-env (1.5.0)
49
94
  faraday (>= 0.17.3, < 2.0)
50
95
  google-cloud-errors (1.1.0)
51
- google-cloud-pubsub (2.6.1)
52
- concurrent-ruby (~> 1.1)
53
- google-cloud-core (~> 1.5)
54
- google-cloud-pubsub-v1 (~> 0.0)
55
- google-cloud-pubsub-v1 (0.4.0)
56
- gapic-common (~> 0.3)
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)
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)
65
102
  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)
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)
69
106
  google-cloud-errors (~> 1.0)
70
- grpc-google-iam-v1 (>= 0.6.10, < 2.0)
71
- google-protobuf (3.17.0)
107
+ grpc-google-iam-v1 (>= 0.6.10, < 2.a)
108
+ google-protobuf (3.17.3)
72
109
  googleapis-common-protos (1.3.11)
73
110
  google-protobuf (~> 3.14)
74
111
  googleapis-common-protos-types (>= 1.0.6, < 2.0)
@@ -82,30 +119,55 @@ GEM
82
119
  multi_json (~> 1.11)
83
120
  os (>= 0.9, < 2.0)
84
121
  signet (~> 0.14)
85
- grpc (1.37.1)
122
+ grpc (1.38.0)
86
123
  google-protobuf (~> 3.15)
87
124
  googleapis-common-protos-types (~> 1.0)
88
125
  grpc-google-iam-v1 (0.6.11)
89
126
  google-protobuf (~> 3.14)
90
127
  googleapis-common-protos (>= 1.3.11, < 2.0)
91
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)
92
143
  i18n (1.8.10)
93
144
  concurrent-ruby (~> 1.0)
94
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)
95
150
  memoist (0.16.2)
96
151
  method_source (1.0.0)
97
152
  multi_json (1.15.0)
98
153
  multipart-post (2.1.1)
99
- 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)
100
158
  avro (~> 1.10)
159
+ dry-validation (= 1.6)
160
+ neon_operations (= 0.0.6)
101
161
  neon_secrets (0.0.1)
102
162
  google-cloud-secret_manager (~> 1.1)
103
163
  nio4r (2.5.7)
164
+ notiffany (0.1.3)
165
+ nenv (~> 0.1)
166
+ shellany (~> 0.0)
104
167
  os (1.1.1)
105
168
  parallel (1.20.1)
106
169
  parser (3.0.1.0)
107
170
  ast (~> 2.4.1)
108
- pg (1.2.3)
109
171
  pry (0.14.1)
110
172
  coderay (~> 1.1)
111
173
  method_source (~> 1.0)
@@ -115,21 +177,23 @@ GEM
115
177
  rack (2.2.3)
116
178
  rainbow (3.0.0)
117
179
  rake (12.3.3)
180
+ rb-fsevent (0.11.0)
181
+ rb-inotify (0.10.1)
182
+ ffi (~> 1.0)
118
183
  regexp_parser (2.1.1)
119
184
  rexml (3.2.5)
120
- rspec (3.10.0)
121
- rspec-core (~> 3.10.0)
122
- rspec-expectations (~> 3.10.0)
123
- rspec-mocks (~> 3.10.0)
124
- rspec-core (3.10.1)
125
- rspec-support (~> 3.10.0)
126
- rspec-expectations (3.10.1)
127
- diff-lcs (>= 1.2.0, < 2.0)
128
- rspec-support (~> 3.10.0)
129
- 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)
130
192
  diff-lcs (>= 1.2.0, < 2.0)
131
- rspec-support (~> 3.10.0)
132
- 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)
133
197
  rubocop (1.12.1)
134
198
  parallel (~> 1.10)
135
199
  parser (>= 3.0.0.0)
@@ -149,33 +213,38 @@ GEM
149
213
  ruby_http_client (3.5.2)
150
214
  sendgrid-ruby (6.4.0)
151
215
  ruby_http_client (~> 3.4)
152
- sequel (5.43.0)
216
+ shellany (0.0.1)
153
217
  signet (0.15.0)
154
218
  addressable (~> 2.3)
155
219
  faraday (>= 0.17.3, < 2.0)
156
220
  jwt (>= 1.5, < 3.0)
157
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)
158
228
  standard (1.0.5)
159
229
  rubocop (= 1.12.1)
160
230
  rubocop-performance (= 1.10.1)
231
+ thor (1.1.0)
161
232
  unicode-display_width (2.0.0)
162
233
 
163
234
  PLATFORMS
164
235
  ruby
165
236
 
166
237
  DEPENDENCIES
167
- faker (~> 2.17)
168
- fixture_dependencies (~> 1.10)
169
- functions-framework-ruby (~> 9001.0)
170
- 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)
171
242
  neon_email!
172
- pg (~> 1.2)
173
- pry (~> 0.14.1)
174
- rake (~> 12.0)
175
- rspec (~> 3.0)
176
- sendgrid-ruby (~> 6.4)
177
- sequel (~> 5.43)
178
- 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)
179
248
 
180
249
  BUNDLED WITH
181
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/app.rb CHANGED
@@ -1,20 +1,10 @@
1
1
  require "functions_framework"
2
2
  require "neon_email"
3
- require "logger"
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
- logger.info "hey you!"
11
-
12
- data = JSON.parse(
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
@@ -1,6 +1,7 @@
1
+ require "neon_schemas"
2
+ require "neon_operations"
1
3
  require "neon_email/version"
2
- require "neon_email/greeting_mailer"
4
+ Dir["#{__dir__}/neon_email/operations/**/*.rb"].sort.each { |f| require f }
3
5
 
4
6
  module NeonEmail
5
- class Error < StandardError; end
6
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.5"
2
+ VERSION = "0.1.6"
3
3
  end
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("..", __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
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"
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.5
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-18 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
@@ -52,6 +52,146 @@ dependencies:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
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
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