cloudenvoy 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/lint_rubocop.yml +20 -0
  3. data/.github/workflows/{test.yml → test_ruby_2.5_2.6.yml} +8 -13
  4. data/.github/workflows/test_ruby_2.7.yml +36 -0
  5. data/.github/workflows/test_ruby_3.x.yml +35 -0
  6. data/.gitignore +3 -0
  7. data/.rubocop.yml +5 -0
  8. data/Appraisals +24 -4
  9. data/CHANGELOG.md +16 -0
  10. data/README.md +7 -4
  11. data/app/controllers/cloudenvoy/subscriber_controller.rb +5 -2
  12. data/cloudenvoy.gemspec +0 -4
  13. data/examples/rails/.ruby-version +1 -1
  14. data/examples/rails/Gemfile +4 -1
  15. data/examples/rails/Gemfile.lock +139 -113
  16. data/examples/rails/README.md +1 -1
  17. data/examples/sinatra/Gemfile +18 -0
  18. data/examples/sinatra/Gemfile.lock +139 -0
  19. data/examples/sinatra/Procfile +1 -0
  20. data/examples/sinatra/README.md +41 -0
  21. data/examples/sinatra/app/publishers/hello_publisher.rb +34 -0
  22. data/examples/sinatra/app/subscribers/hello_subscriber.rb +16 -0
  23. data/examples/sinatra/app.rb +40 -0
  24. data/examples/sinatra/bin/console +8 -0
  25. data/examples/sinatra/config/initializers/cloudenvoy.rb +30 -0
  26. data/gemfiles/.bundle/config +2 -0
  27. data/gemfiles/rails_5.2.gemfile +1 -0
  28. data/gemfiles/rails_5.2.gemfile.lock +117 -92
  29. data/gemfiles/rails_6.0.gemfile +1 -0
  30. data/gemfiles/rails_6.0.gemfile.lock +118 -93
  31. data/gemfiles/rails_6.1.gemfile +8 -0
  32. data/gemfiles/rails_7.0.gemfile +8 -0
  33. data/gemfiles/semantic_logger_3.4.gemfile +1 -0
  34. data/gemfiles/semantic_logger_3.4.gemfile.lock +95 -189
  35. data/gemfiles/semantic_logger_4.6.gemfile +1 -0
  36. data/gemfiles/semantic_logger_4.6.gemfile.lock +95 -189
  37. data/gemfiles/semantic_logger_4.7.0.gemfile +1 -0
  38. data/gemfiles/semantic_logger_4.7.0.gemfile.lock +95 -189
  39. data/gemfiles/semantic_logger_4.7.2.gemfile +1 -0
  40. data/gemfiles/semantic_logger_4.7.2.gemfile.lock +95 -189
  41. data/lib/cloudenvoy/backend/google_pub_sub.rb +2 -2
  42. data/lib/cloudenvoy/message.rb +2 -2
  43. data/lib/cloudenvoy/subscriber.rb +1 -1
  44. data/lib/cloudenvoy/version.rb +1 -1
  45. data/lib/cloudenvoy.rb +1 -0
  46. data/lib/generators/cloudenvoy/publisher_generator.rb +46 -0
  47. data/lib/generators/cloudenvoy/subscriber_generator.rb +46 -0
  48. data/lib/generators/cloudenvoy/templates/publisher.rb.erb +11 -0
  49. data/lib/generators/cloudenvoy/templates/publisher_spec.rb.erb +6 -0
  50. data/lib/generators/cloudenvoy/templates/subscriber.rb.erb +11 -0
  51. data/lib/generators/cloudenvoy/templates/subscriber_spec.rb.erb +6 -0
  52. metadata +28 -51
  53. data/Gemfile.lock +0 -267
  54. data/app/controllers/cloudenvoy/application_controller.rb +0 -8
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- cloudenvoy (0.4.1)
4
+ cloudenvoy (0.5.0)
5
5
  activesupport
6
6
  google-cloud-pubsub (~> 2.0)
7
7
  jwt
@@ -10,200 +10,119 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- actioncable (6.0.3.3)
14
- actionpack (= 6.0.3.3)
15
- nio4r (~> 2.0)
16
- websocket-driver (>= 0.6.1)
17
- actionmailbox (6.0.3.3)
18
- actionpack (= 6.0.3.3)
19
- activejob (= 6.0.3.3)
20
- activerecord (= 6.0.3.3)
21
- activestorage (= 6.0.3.3)
22
- activesupport (= 6.0.3.3)
23
- mail (>= 2.7.1)
24
- actionmailer (6.0.3.3)
25
- actionpack (= 6.0.3.3)
26
- actionview (= 6.0.3.3)
27
- activejob (= 6.0.3.3)
28
- mail (~> 2.5, >= 2.5.4)
29
- rails-dom-testing (~> 2.0)
30
- actionpack (6.0.3.3)
31
- actionview (= 6.0.3.3)
32
- activesupport (= 6.0.3.3)
33
- rack (~> 2.0, >= 2.0.8)
34
- rack-test (>= 0.6.3)
35
- rails-dom-testing (~> 2.0)
36
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
37
- actiontext (6.0.3.3)
38
- actionpack (= 6.0.3.3)
39
- activerecord (= 6.0.3.3)
40
- activestorage (= 6.0.3.3)
41
- activesupport (= 6.0.3.3)
42
- nokogiri (>= 1.8.5)
43
- actionview (6.0.3.3)
44
- activesupport (= 6.0.3.3)
45
- builder (~> 3.1)
46
- erubi (~> 1.4)
47
- rails-dom-testing (~> 2.0)
48
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
49
- activejob (6.0.3.3)
50
- activesupport (= 6.0.3.3)
51
- globalid (>= 0.3.6)
52
- activemodel (6.0.3.3)
53
- activesupport (= 6.0.3.3)
54
- activerecord (6.0.3.3)
55
- activemodel (= 6.0.3.3)
56
- activesupport (= 6.0.3.3)
57
- activestorage (6.0.3.3)
58
- actionpack (= 6.0.3.3)
59
- activejob (= 6.0.3.3)
60
- activerecord (= 6.0.3.3)
61
- marcel (~> 0.3.1)
62
- activesupport (6.0.3.3)
13
+ activesupport (6.1.0)
63
14
  concurrent-ruby (~> 1.0, >= 1.0.2)
64
- i18n (>= 0.7, < 2)
65
- minitest (~> 5.1)
66
- tzinfo (~> 1.1)
67
- zeitwerk (~> 2.2, >= 2.2.2)
68
- addressable (2.7.0)
15
+ i18n (>= 1.6, < 2)
16
+ minitest (>= 5.1)
17
+ tzinfo (~> 2.0)
18
+ zeitwerk (~> 2.3)
19
+ addressable (2.8.0)
69
20
  public_suffix (>= 2.0.2, < 5.0)
70
- appraisal (2.3.0)
21
+ appraisal (2.4.1)
71
22
  bundler
72
23
  rake
73
24
  thor (>= 0.14.0)
74
- ast (2.4.1)
75
- builder (3.2.4)
76
- concurrent-ruby (1.1.7)
77
- crack (0.4.4)
78
- crass (1.0.6)
79
- diff-lcs (1.4.4)
80
- erubi (1.9.0)
81
- faraday (1.0.1)
25
+ ast (2.4.2)
26
+ concurrent-ruby (1.1.9)
27
+ crack (0.4.5)
28
+ rexml
29
+ diff-lcs (1.5.0)
30
+ faraday (1.10.0)
31
+ faraday-em_http (~> 1.0)
32
+ faraday-em_synchrony (~> 1.0)
33
+ faraday-excon (~> 1.1)
34
+ faraday-httpclient (~> 1.0)
35
+ faraday-multipart (~> 1.0)
36
+ faraday-net_http (~> 1.0)
37
+ faraday-net_http_persistent (~> 1.0)
38
+ faraday-patron (~> 1.0)
39
+ faraday-rack (~> 1.0)
40
+ faraday-retry (~> 1.0)
41
+ ruby2_keywords (>= 0.0.4)
42
+ faraday-em_http (1.0.0)
43
+ faraday-em_synchrony (1.0.0)
44
+ faraday-excon (1.1.0)
45
+ faraday-httpclient (1.0.1)
46
+ faraday-multipart (1.0.3)
82
47
  multipart-post (>= 1.2, < 3)
83
- gapic-common (0.3.4)
84
- google-protobuf (~> 3.12, >= 3.12.2)
85
- googleapis-common-protos (>= 1.3.9, < 2.0)
86
- googleapis-common-protos-types (>= 1.0.4, < 2.0)
87
- googleauth (~> 0.9)
88
- grpc (~> 1.25)
89
- globalid (0.4.2)
90
- activesupport (>= 4.2.0)
91
- google-cloud-core (1.5.0)
48
+ faraday-net_http (1.0.1)
49
+ faraday-net_http_persistent (1.2.0)
50
+ faraday-patron (1.0.0)
51
+ faraday-rack (1.0.0)
52
+ faraday-retry (1.0.3)
53
+ gapic-common (0.8.0)
54
+ faraday (~> 1.3)
55
+ google-protobuf (~> 3.14)
56
+ googleapis-common-protos (>= 1.3.11, < 2.a)
57
+ googleapis-common-protos-types (>= 1.0.6, < 2.a)
58
+ googleauth (>= 0.17.0, < 2.a)
59
+ grpc (~> 1.36)
60
+ google-cloud-core (1.6.0)
92
61
  google-cloud-env (~> 1.0)
93
62
  google-cloud-errors (~> 1.0)
94
- google-cloud-env (1.3.3)
63
+ google-cloud-env (1.5.0)
95
64
  faraday (>= 0.17.3, < 2.0)
96
- google-cloud-errors (1.0.1)
97
- google-cloud-pubsub (2.1.0)
65
+ google-cloud-errors (1.2.0)
66
+ google-cloud-pubsub (2.9.1)
98
67
  concurrent-ruby (~> 1.1)
99
68
  google-cloud-core (~> 1.5)
100
69
  google-cloud-pubsub-v1 (~> 0.0)
101
- google-cloud-pubsub-v1 (0.1.2)
102
- gapic-common (~> 0.3)
70
+ google-cloud-pubsub-v1 (0.7.1)
71
+ gapic-common (>= 0.7, < 2.a)
103
72
  google-cloud-errors (~> 1.0)
104
- grpc-google-iam-v1 (>= 0.6.10, < 2.0)
105
- google-protobuf (3.13.0-universal-darwin)
106
- googleapis-common-protos (1.3.10)
107
- google-protobuf (~> 3.11)
108
- googleapis-common-protos-types (>= 1.0.5, < 2.0)
73
+ grpc-google-iam-v1 (>= 0.6.10, < 2.a)
74
+ google-protobuf (3.19.4-x86_64-darwin)
75
+ googleapis-common-protos (1.3.12)
76
+ google-protobuf (~> 3.14)
77
+ googleapis-common-protos-types (~> 1.2)
109
78
  grpc (~> 1.27)
110
- googleapis-common-protos-types (1.0.5)
111
- google-protobuf (~> 3.11)
112
- googleauth (0.13.1)
113
- faraday (>= 0.17.3, < 2.0)
79
+ googleapis-common-protos-types (1.3.0)
80
+ google-protobuf (~> 3.14)
81
+ googleauth (1.1.2)
82
+ faraday (>= 0.17.3, < 3.a)
114
83
  jwt (>= 1.4, < 3.0)
115
84
  memoist (~> 0.16)
116
85
  multi_json (~> 1.11)
117
86
  os (>= 0.9, < 2.0)
118
- signet (~> 0.14)
119
- grpc (1.32.0-universal-darwin)
120
- google-protobuf (~> 3.13)
87
+ signet (>= 0.16, < 2.a)
88
+ grpc (1.43.1-universal-darwin)
89
+ google-protobuf (~> 3.18)
121
90
  googleapis-common-protos-types (~> 1.0)
122
- grpc-google-iam-v1 (0.6.10)
123
- google-protobuf (~> 3.11)
124
- googleapis-common-protos (>= 1.3.10, < 2.0)
91
+ grpc-google-iam-v1 (1.0.0)
92
+ google-protobuf (~> 3.14)
93
+ googleapis-common-protos (>= 1.3.12, < 2.0)
125
94
  grpc (~> 1.27)
126
95
  hashdiff (1.0.1)
127
- i18n (1.8.5)
96
+ i18n (1.8.11)
128
97
  concurrent-ruby (~> 1.0)
129
98
  jaro_winkler (1.5.4)
130
- jwt (2.2.2)
131
- loofah (2.7.0)
132
- crass (~> 1.0.2)
133
- nokogiri (>= 1.5.9)
134
- mail (2.7.1)
135
- mini_mime (>= 0.1.1)
136
- marcel (0.3.3)
137
- mimemagic (~> 0.3.2)
99
+ jwt (2.3.0)
138
100
  memoist (0.16.2)
139
- method_source (1.0.0)
140
- mimemagic (0.3.5)
141
- mini_mime (1.0.2)
142
- mini_portile2 (2.4.0)
143
- minitest (5.14.2)
101
+ minitest (5.15.0)
144
102
  multi_json (1.15.0)
145
103
  multipart-post (2.1.1)
146
- nio4r (2.5.4)
147
- nokogiri (1.10.10)
148
- mini_portile2 (~> 2.4.0)
149
- os (1.1.1)
150
- parallel (1.19.2)
151
- parser (2.7.1.5)
104
+ os (1.1.4)
105
+ parallel (1.21.0)
106
+ parser (3.1.0.0)
152
107
  ast (~> 2.4.1)
153
108
  public_suffix (4.0.6)
154
- rack (2.2.3)
155
- rack-test (1.1.0)
156
- rack (>= 1.0, < 3)
157
- rails (6.0.3.3)
158
- actioncable (= 6.0.3.3)
159
- actionmailbox (= 6.0.3.3)
160
- actionmailer (= 6.0.3.3)
161
- actionpack (= 6.0.3.3)
162
- actiontext (= 6.0.3.3)
163
- actionview (= 6.0.3.3)
164
- activejob (= 6.0.3.3)
165
- activemodel (= 6.0.3.3)
166
- activerecord (= 6.0.3.3)
167
- activestorage (= 6.0.3.3)
168
- activesupport (= 6.0.3.3)
169
- bundler (>= 1.3.0)
170
- railties (= 6.0.3.3)
171
- sprockets-rails (>= 2.0.0)
172
- rails-dom-testing (2.0.3)
173
- activesupport (>= 4.2.0)
174
- nokogiri (>= 1.6)
175
- rails-html-sanitizer (1.3.0)
176
- loofah (~> 2.3)
177
- railties (6.0.3.3)
178
- actionpack (= 6.0.3.3)
179
- activesupport (= 6.0.3.3)
180
- method_source
181
- rake (>= 0.8.7)
182
- thor (>= 0.20.3, < 2.0)
183
109
  rainbow (3.0.0)
184
- rake (13.0.1)
110
+ rake (13.0.6)
185
111
  retriable (3.1.2)
186
- rspec (3.9.0)
187
- rspec-core (~> 3.9.0)
188
- rspec-expectations (~> 3.9.0)
189
- rspec-mocks (~> 3.9.0)
190
- rspec-core (3.9.3)
191
- rspec-support (~> 3.9.3)
192
- rspec-expectations (3.9.2)
112
+ rexml (3.2.5)
113
+ rspec (3.10.0)
114
+ rspec-core (~> 3.10.0)
115
+ rspec-expectations (~> 3.10.0)
116
+ rspec-mocks (~> 3.10.0)
117
+ rspec-core (3.10.1)
118
+ rspec-support (~> 3.10.0)
119
+ rspec-expectations (3.10.1)
193
120
  diff-lcs (>= 1.2.0, < 2.0)
194
- rspec-support (~> 3.9.0)
195
- rspec-mocks (3.9.1)
121
+ rspec-support (~> 3.10.0)
122
+ rspec-mocks (3.10.2)
196
123
  diff-lcs (>= 1.2.0, < 2.0)
197
- rspec-support (~> 3.9.0)
198
- rspec-rails (4.0.1)
199
- actionpack (>= 4.2)
200
- activesupport (>= 4.2)
201
- railties (>= 4.2)
202
- rspec-core (~> 3.9)
203
- rspec-expectations (~> 3.9)
204
- rspec-mocks (~> 3.9)
205
- rspec-support (~> 3.9)
206
- rspec-support (3.9.3)
124
+ rspec-support (~> 3.10.0)
125
+ rspec-support (3.10.3)
207
126
  rubocop (0.76.0)
208
127
  jaro_winkler (~> 1.5.1)
209
128
  parallel (~> 1.10)
@@ -213,53 +132,40 @@ GEM
213
132
  unicode-display_width (>= 1.4.0, < 1.7)
214
133
  rubocop-rspec (1.37.0)
215
134
  rubocop (>= 0.68.1)
216
- ruby-progressbar (1.10.1)
135
+ ruby-progressbar (1.11.0)
136
+ ruby2_keywords (0.0.5)
217
137
  semantic_logger (4.7.2)
218
138
  concurrent-ruby (~> 1.0)
219
- signet (0.14.0)
220
- addressable (~> 2.3)
221
- faraday (>= 0.17.3, < 2.0)
139
+ signet (0.16.1)
140
+ addressable (~> 2.8)
141
+ faraday (>= 0.17.5, < 3.0)
222
142
  jwt (>= 1.5, < 3.0)
223
143
  multi_json (~> 1.10)
224
- sprockets (4.0.2)
144
+ thor (1.1.0)
145
+ timecop (0.9.4)
146
+ tzinfo (2.0.4)
225
147
  concurrent-ruby (~> 1.0)
226
- rack (> 1, < 3)
227
- sprockets-rails (3.2.2)
228
- actionpack (>= 4.0)
229
- activesupport (>= 4.0)
230
- sprockets (>= 3.0.0)
231
- sqlite3 (1.4.2)
232
- thor (1.0.1)
233
- thread_safe (0.3.6)
234
- timecop (0.9.1)
235
- tzinfo (1.2.7)
236
- thread_safe (~> 0.1)
237
148
  unicode-display_width (1.6.1)
238
- webmock (3.9.1)
239
- addressable (>= 2.3.6)
149
+ webmock (3.14.0)
150
+ addressable (>= 2.8.0)
240
151
  crack (>= 0.3.2)
241
152
  hashdiff (>= 0.4.0, < 2.0.0)
242
- websocket-driver (0.7.3)
243
- websocket-extensions (>= 0.1.0)
244
- websocket-extensions (0.1.5)
245
- zeitwerk (2.4.0)
153
+ zeitwerk (2.5.3)
246
154
 
247
155
  PLATFORMS
248
156
  ruby
249
157
 
250
158
  DEPENDENCIES
159
+ activesupport (= 6.1)
251
160
  appraisal
252
161
  cloudenvoy!
253
- rails
254
162
  rake (>= 12.3.3)
255
163
  rspec (~> 3.0)
256
- rspec-rails
257
164
  rubocop (= 0.76.0)
258
165
  rubocop-rspec (= 1.37.0)
259
166
  semantic_logger (= 4.7.2)
260
- sqlite3
261
167
  timecop
262
168
  webmock
263
169
 
264
170
  BUNDLED WITH
265
- 2.1.4
171
+ 2.3.6
@@ -32,7 +32,7 @@ module Cloudenvoy
32
32
  # @return [Google::Cloud::Pub] The low level client instance.
33
33
  #
34
34
  def backend
35
- @backend ||= Google::Cloud::PubSub.new({
35
+ @backend ||= Google::Cloud::PubSub.new(**{
36
36
  project_id: config.gcp_project_id,
37
37
  emulator_host: development? ? Cloudenvoy::Config::EMULATOR_HOST : nil
38
38
  }.compact)
@@ -109,7 +109,7 @@ module Cloudenvoy
109
109
  ps_topic = backend.topic(topic, skip_lookup: true)
110
110
 
111
111
  # Attempt to create the subscription
112
- ps_topic.subscribe(name, sub_config)
112
+ ps_topic.subscribe(name, **sub_config)
113
113
  rescue Google::Cloud::AlreadyExistsError
114
114
  # Update endpoint on subscription
115
115
  # Topic is not updated as it is name-dependent
@@ -75,8 +75,8 @@ module Cloudenvoy
75
75
  def to_h
76
76
  {
77
77
  id: id,
78
- payload: payload,
79
- metadata: metadata,
78
+ payload: payload&.dup,
79
+ metadata: metadata&.dup,
80
80
  topic: topic,
81
81
  sub_uri: sub_uri
82
82
  }.compact
@@ -53,7 +53,7 @@ module Cloudenvoy
53
53
  # @return [Array<String,String>] A tuple [subscriber_name, topic ]
54
54
  #
55
55
  def self.parse_sub_uri(sub_uri)
56
- sub_uri.split('/').last.split('.').last(2)
56
+ sub_uri.split('/').last.split('.', 2).last.split('.', 2)
57
57
  end
58
58
 
59
59
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cloudenvoy
4
- VERSION = '0.4.1'
4
+ VERSION = '0.5.0'
5
5
  end
data/lib/cloudenvoy.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'active_support/core_ext/string/inflections'
4
+ require 'active_support/core_ext/object/try'
4
5
 
5
6
  require 'cloudenvoy/version'
6
7
  require 'cloudenvoy/config'
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails/generators/named_base'
4
+
5
+ module Cloudenvoy
6
+ module Generators # :nodoc:
7
+ class PublisherGenerator < ::Rails::Generators::NamedBase # :nodoc:
8
+ desc 'This generator creates a CloudEnvoy in app/publishers and a corresponding test'
9
+
10
+ check_class_collision suffix: 'Publisher'
11
+
12
+ def self.default_generator_root
13
+ File.dirname(__FILE__)
14
+ end
15
+
16
+ def create_publisher_file
17
+ template 'publisher.rb.erb', File.join('app/publishers', class_path, "#{file_name}_publisher.rb")
18
+ end
19
+
20
+ def create_test_file
21
+ return unless test_framework
22
+
23
+ create_publisher_spec if test_framework == :rspec
24
+ end
25
+
26
+ private
27
+
28
+ def create_publisher_spec
29
+ template_file = File.join(
30
+ 'spec/publishers',
31
+ class_path,
32
+ "#{file_name}_publisher_spec.rb"
33
+ )
34
+ template 'publisher_spec.rb.erb', template_file
35
+ end
36
+
37
+ def file_name
38
+ @file_name ||= super.sub(/_?publisher\z/i, '')
39
+ end
40
+
41
+ def test_framework
42
+ ::Rails.application.config.generators.options[:rails][:test_framework]
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails/generators/named_base'
4
+
5
+ module Cloudenvoy
6
+ module Generators # :nodoc:
7
+ class SubscriberGenerator < ::Rails::Generators::NamedBase # :nodoc:
8
+ desc 'This generator creates a CloudEnvoy in app/subscribers and a corresponding test'
9
+
10
+ check_class_collision suffix: 'Subscriber'
11
+
12
+ def self.default_generator_root
13
+ File.dirname(__FILE__)
14
+ end
15
+
16
+ def create_subscriber_file
17
+ template 'subscriber.rb.erb', File.join('app/subscribers', class_path, "#{file_name}_subscriber.rb")
18
+ end
19
+
20
+ def create_test_file
21
+ return unless test_framework
22
+
23
+ create_subscriber_spec if test_framework == :rspec
24
+ end
25
+
26
+ private
27
+
28
+ def create_subscriber_spec
29
+ template_file = File.join(
30
+ 'spec/subscribers',
31
+ class_path,
32
+ "#{file_name}_subscriber_spec.rb"
33
+ )
34
+ template 'subscriber_spec.rb.erb', template_file
35
+ end
36
+
37
+ def file_name
38
+ @file_name ||= super.sub(/_?subscriber\z/i, '')
39
+ end
40
+
41
+ def test_framework
42
+ ::Rails.application.config.generators.options[:rails][:test_framework]
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,11 @@
1
+ <% module_namespacing do -%>
2
+ class <%= class_name %>Publisher
3
+ include Cloudenvoy::Publisher
4
+
5
+ cloudenvoy_options topic: 'test-msgs'
6
+
7
+ def payload(msg)
8
+ # Format the message payload. The payload can be a hash or a string.
9
+ end
10
+ end
11
+ <% end -%>
@@ -0,0 +1,6 @@
1
+ require 'rails_helper'
2
+ <% module_namespacing do -%>
3
+ RSpec.describe <%= class_name %>Publisher, type: :publisher do
4
+ pending "add some examples to (or delete) #{__FILE__}"
5
+ end
6
+ <% end -%>
@@ -0,0 +1,11 @@
1
+ <% module_namespacing do -%>
2
+ class <%= class_name %>Subscriber
3
+ include Cloudenvoy::Subscriber
4
+
5
+ cloudenvoy_options topic: 'test-msgs'
6
+
7
+ def process(msg)
8
+ # Do something
9
+ end
10
+ end
11
+ <% end -%>
@@ -0,0 +1,6 @@
1
+ require 'rails_helper'
2
+ <% module_namespacing do -%>
3
+ RSpec.describe <%= class_name %>Subscriber, type: :subscriber do
4
+ pending "add some examples to (or delete) #{__FILE__}"
5
+ end
6
+ <% end -%>