neon_slack 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 57ab787de9e4a7d580a03cd8fe6bb27db87141bf94681774baf7962d597e4bc3
4
+ data.tar.gz: e71f2154038a0c266b8c5c380674f161cbcf83c4424b31c2f4572837316aaba4
5
+ SHA512:
6
+ metadata.gz: d82f61c2d5909c52810412f273a36c6a586deeb65589fd156d8322b8f7e388b0fba9bafc29417c1e88814ee57af61d2c6d3228c3b9d396480f5ba7716d41b3d9
7
+ data.tar.gz: 6b533aea25e514bc2caa4dc265a83893af7a850b4587377deb693cba0cdffca3c9ba0707a75f0f345c948b16f0975d9b32b446528345401c22338dcf38e7153c
data/.gcloudignore ADDED
@@ -0,0 +1,17 @@
1
+ # This file specifies files that are *not* uploaded to Google Cloud Platform
2
+ # using gcloud. It follows the same syntax as .gitignore, with the addition of
3
+ # "#!include" directives (which insert the entries of the given .gitignore-style
4
+ # file at that point).
5
+ #
6
+ # For more information, run:
7
+ # $ gcloud topic gcloudignore
8
+ #
9
+ .gcloudignore
10
+ # If you would like to upload your .git directory, .gitignore file or files
11
+ # from your .gitignore file, remove the corresponding line
12
+ # below:
13
+ .git
14
+ .gitignore
15
+
16
+ node_modules
17
+ #!include:.gitignore
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ *.gem
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.7
data/Gemfile ADDED
@@ -0,0 +1,22 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in neon_postgres.gemspec
4
+ gemspec
5
+
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"
data/Gemfile.lock ADDED
@@ -0,0 +1,181 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ neon_slack (0.1.0)
5
+ functions_framework (= 0.9.0)
6
+ neon_schemas (= 0.1.1)
7
+ neon_secrets (= 0.0.1)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ addressable (2.7.0)
13
+ public_suffix (>= 2.0.2, < 5.0)
14
+ ast (2.4.2)
15
+ avro (1.10.2)
16
+ multi_json (~> 1)
17
+ cloud_events (0.4.0)
18
+ coderay (1.1.3)
19
+ concurrent-ruby (1.1.8)
20
+ diff-lcs (1.4.4)
21
+ faker (2.17.0)
22
+ i18n (>= 1.6, < 2)
23
+ faraday (1.4.1)
24
+ faraday-excon (~> 1.1)
25
+ faraday-net_http (~> 1.0)
26
+ faraday-net_http_persistent (~> 1.1)
27
+ multipart-post (>= 1.2, < 3)
28
+ ruby2_keywords (>= 0.0.4)
29
+ faraday-excon (1.1.0)
30
+ faraday-net_http (1.0.1)
31
+ faraday-net_http_persistent (1.1.0)
32
+ fixture_dependencies (1.10.0)
33
+ functions-framework-ruby (9001.0)
34
+ functions_framework (0.9.0)
35
+ cloud_events (~> 0.1)
36
+ puma (~> 4.3)
37
+ rack (~> 2.1)
38
+ gapic-common (0.4.1)
39
+ 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)
44
+ grpc (~> 1.36)
45
+ google-cloud-core (1.6.0)
46
+ google-cloud-env (~> 1.0)
47
+ google-cloud-errors (~> 1.0)
48
+ google-cloud-env (1.5.0)
49
+ faraday (>= 0.17.3, < 2.0)
50
+ 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)
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)
71
+ google-protobuf (3.17.0)
72
+ googleapis-common-protos (1.3.11)
73
+ google-protobuf (~> 3.14)
74
+ googleapis-common-protos-types (>= 1.0.6, < 2.0)
75
+ grpc (~> 1.27)
76
+ googleapis-common-protos-types (1.0.6)
77
+ google-protobuf (~> 3.14)
78
+ googleauth (0.16.2)
79
+ faraday (>= 0.17.3, < 2.0)
80
+ jwt (>= 1.4, < 3.0)
81
+ memoist (~> 0.16)
82
+ multi_json (~> 1.11)
83
+ os (>= 0.9, < 2.0)
84
+ signet (~> 0.14)
85
+ grpc (1.37.1)
86
+ google-protobuf (~> 3.15)
87
+ googleapis-common-protos-types (~> 1.0)
88
+ grpc-google-iam-v1 (0.6.11)
89
+ google-protobuf (~> 3.14)
90
+ googleapis-common-protos (>= 1.3.11, < 2.0)
91
+ grpc (~> 1.27)
92
+ i18n (1.8.10)
93
+ concurrent-ruby (~> 1.0)
94
+ jwt (2.2.3)
95
+ memoist (0.16.2)
96
+ method_source (1.0.0)
97
+ multi_json (1.15.0)
98
+ multipart-post (2.1.1)
99
+ neon_schemas (0.1.1)
100
+ avro (~> 1.10)
101
+ neon_secrets (0.0.1)
102
+ google-cloud-secret_manager (~> 1.1)
103
+ nio4r (2.5.7)
104
+ os (1.1.1)
105
+ parallel (1.20.1)
106
+ parser (3.0.1.0)
107
+ ast (~> 2.4.1)
108
+ pg (1.2.3)
109
+ pry (0.14.1)
110
+ coderay (~> 1.1)
111
+ method_source (~> 1.0)
112
+ public_suffix (4.0.6)
113
+ puma (4.3.8)
114
+ nio4r (~> 2.0)
115
+ rack (2.2.3)
116
+ rainbow (3.0.0)
117
+ rake (12.3.3)
118
+ regexp_parser (2.1.1)
119
+ 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)
130
+ diff-lcs (>= 1.2.0, < 2.0)
131
+ rspec-support (~> 3.10.0)
132
+ rspec-support (3.10.2)
133
+ rubocop (1.12.1)
134
+ parallel (~> 1.10)
135
+ parser (>= 3.0.0.0)
136
+ rainbow (>= 2.2.2, < 4.0)
137
+ regexp_parser (>= 1.8, < 3.0)
138
+ rexml
139
+ rubocop-ast (>= 1.2.0, < 2.0)
140
+ ruby-progressbar (~> 1.7)
141
+ unicode-display_width (>= 1.4.0, < 3.0)
142
+ rubocop-ast (1.4.1)
143
+ parser (>= 2.7.1.5)
144
+ rubocop-performance (1.10.1)
145
+ rubocop (>= 0.90.0, < 2.0)
146
+ rubocop-ast (>= 0.4.0)
147
+ ruby-progressbar (1.11.0)
148
+ ruby2_keywords (0.0.4)
149
+ ruby_http_client (3.5.2)
150
+ sendgrid-ruby (6.4.0)
151
+ ruby_http_client (~> 3.4)
152
+ sequel (5.43.0)
153
+ signet (0.15.0)
154
+ addressable (~> 2.3)
155
+ faraday (>= 0.17.3, < 2.0)
156
+ jwt (>= 1.5, < 3.0)
157
+ multi_json (~> 1.10)
158
+ standard (1.0.5)
159
+ rubocop (= 1.12.1)
160
+ rubocop-performance (= 1.10.1)
161
+ unicode-display_width (2.0.0)
162
+
163
+ PLATFORMS
164
+ ruby
165
+
166
+ DEPENDENCIES
167
+ faker (~> 2.17)
168
+ fixture_dependencies (~> 1.10)
169
+ functions-framework-ruby (~> 9001.0)
170
+ google-cloud-pubsub (~> 2.6)
171
+ neon_slack!
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
179
+
180
+ BUNDLED WITH
181
+ 2.1.4
data/README.md ADDED
@@ -0,0 +1,22 @@
1
+ # Neon Slack
2
+
3
+ This gem is used to listen to slack messages from Pubsub then interact with the
4
+ Slack API.
5
+
6
+ ## Doppler Setup
7
+
8
+ You can use the `slack` project in Doppler and access the `dev` environment when
9
+ developing locally. The `stg` and `prd` environments are used for staging and
10
+ production respectively.
11
+
12
+ Local development requires you to start the GCP Pub/Sub locally if you want to
13
+ test the gem end-to-end, _however_ you will most likely __not__ need to start the
14
+ GCP server because we can depend on the arity defined in the `neon_schemas` gem
15
+ as a contract that this is how objects in this gem will be initialized and have
16
+ their methods invoked. You should be able to develop the functionality needed
17
+ here fully using POROs and necessary email APIs like Sendgrid.
18
+
19
+ ## Contributing
20
+
21
+ Bug reports and pull requests are welcome on GitHub at
22
+ https://github.com/neonlaw/codebase.
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
data/app.rb ADDED
@@ -0,0 +1,15 @@
1
+ require "functions_framework"
2
+ require "neon_slac"
3
+ require "logger"
4
+ require "base64"
5
+ require "json"
6
+
7
+ logger = Logger.new($stdout)
8
+
9
+ FunctionsFramework.cloud_event "slack.send_message" do |event|
10
+ data = JSON.parse(
11
+ Base64.strict_decode64(event.data.fetch("message").fetch("data"))
12
+ )
13
+
14
+ logger.info(data)
15
+ end
data/lib/neon_slack.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "neon_slack/version"
2
+
3
+ module NeonSlack
4
+ class Error < StandardError; end
5
+ end
@@ -0,0 +1,22 @@
1
+ require "neon_secrets"
2
+
3
+ module NeonSlack
4
+ class Messenger
5
+ def self.send_message(message:, channel:)
6
+ new(message: message, channel: channel).send_message
7
+ end
8
+
9
+ def initialize(message:, channel:)
10
+ @message = message
11
+ @channel = channel
12
+ end
13
+
14
+ def send_message
15
+ puts response
16
+ end
17
+
18
+ private
19
+
20
+ attr_reader :message, :channel
21
+ end
22
+ end
@@ -0,0 +1,3 @@
1
+ module NeonSlack
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,28 @@
1
+ require_relative "lib/neon_slack/version"
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "neon_slack"
5
+ spec.version = NeonSlack::VERSION
6
+ spec.authors = ["Neon Law"]
7
+ spec.email = ["support@neonlaw.com"]
8
+
9
+ spec.summary = "A gem to handle outbound_email messages in Neon Law software space."
10
+ spec.description = spec.summary
11
+ spec.homepage = "https://github.com/neonlaw/codebase"
12
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
13
+
14
+ spec.metadata["homepage_uri"] = spec.homepage
15
+ spec.metadata["source_code_uri"] = spec.homepage
16
+ spec.metadata["changelog_uri"] = spec.homepage
17
+
18
+ # Specify which files should be added to the gem when it is released.
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
21
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ end
23
+ spec.require_paths = ["lib"]
24
+
25
+ spec.add_runtime_dependency "neon_schemas", "0.1.1"
26
+ spec.add_runtime_dependency "functions_framework", "0.9.0"
27
+ spec.add_runtime_dependency "neon_secrets", "0.0.1"
28
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: neon_slack
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Neon Law
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-06-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: neon_schemas
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.1.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.1.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: functions_framework
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 0.9.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
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
+ description: A gem to handle outbound_email messages in Neon Law software space.
56
+ email:
57
+ - support@neonlaw.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gcloudignore"
63
+ - ".gitignore"
64
+ - ".rspec"
65
+ - ".ruby-version"
66
+ - Gemfile
67
+ - Gemfile.lock
68
+ - README.md
69
+ - Rakefile
70
+ - app.rb
71
+ - lib/neon_slack.rb
72
+ - lib/neon_slack/messenger.rb
73
+ - lib/neon_slack/version.rb
74
+ - neon_slack.gemspec
75
+ homepage: https://github.com/neonlaw/codebase
76
+ licenses: []
77
+ metadata:
78
+ homepage_uri: https://github.com/neonlaw/codebase
79
+ source_code_uri: https://github.com/neonlaw/codebase
80
+ changelog_uri: https://github.com/neonlaw/codebase
81
+ post_install_message:
82
+ rdoc_options: []
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: 2.3.0
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ requirements: []
96
+ rubygems_version: 3.2.15
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: A gem to handle outbound_email messages in Neon Law software space.
100
+ test_files: []