aws-sdk-rails 4.1.0 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +256 -0
  3. data/LICENSE.txt +12 -0
  4. data/VERSION +1 -1
  5. data/lib/aws/rails/middleware/elastic_beanstalk_sqsd.rb +141 -0
  6. data/lib/aws/rails/notifications.rb +5 -7
  7. data/lib/aws/rails/railtie.rb +38 -77
  8. data/lib/aws-sdk-rails.rb +1 -9
  9. metadata +14 -197
  10. data/app/controllers/action_mailbox/ingresses/ses/inbound_emails_controller.rb +0 -79
  11. data/bin/aws_sqs_active_job +0 -6
  12. data/config/routes.rb +0 -8
  13. data/lib/action_dispatch/session/dynamodb_store.rb +0 -38
  14. data/lib/active_job/queue_adapters/sqs_adapter/params.rb +0 -78
  15. data/lib/active_job/queue_adapters/sqs_adapter.rb +0 -58
  16. data/lib/active_job/queue_adapters/sqs_async_adapter.rb +0 -39
  17. data/lib/aws/rails/action_mailbox/engine.rb +0 -21
  18. data/lib/aws/rails/action_mailbox/rspec/email.rb +0 -50
  19. data/lib/aws/rails/action_mailbox/rspec/subscription_confirmation.rb +0 -37
  20. data/lib/aws/rails/action_mailbox/rspec.rb +0 -69
  21. data/lib/aws/rails/action_mailbox/s3_client.rb +0 -28
  22. data/lib/aws/rails/action_mailbox/sns_message_verifier.rb +0 -18
  23. data/lib/aws/rails/action_mailbox/sns_notification.rb +0 -99
  24. data/lib/aws/rails/middleware/ebs_sqs_active_job_middleware.rb +0 -118
  25. data/lib/aws/rails/ses_mailer.rb +0 -49
  26. data/lib/aws/rails/sesv2_mailer.rb +0 -60
  27. data/lib/aws/rails/sqs_active_job/configuration.rb +0 -184
  28. data/lib/aws/rails/sqs_active_job/deduplication.rb +0 -21
  29. data/lib/aws/rails/sqs_active_job/executor.rb +0 -77
  30. data/lib/aws/rails/sqs_active_job/job_runner.rb +0 -27
  31. data/lib/aws/rails/sqs_active_job/lambda_handler.rb +0 -63
  32. data/lib/aws/rails/sqs_active_job/poller.rb +0 -160
  33. data/lib/aws/rails/sqs_active_job.rb +0 -33
  34. data/lib/generators/aws_record/base.rb +0 -213
  35. data/lib/generators/aws_record/generated_attribute.rb +0 -138
  36. data/lib/generators/aws_record/model/USAGE +0 -24
  37. data/lib/generators/aws_record/model/model_generator.rb +0 -25
  38. data/lib/generators/aws_record/model/templates/model.erb +0 -48
  39. data/lib/generators/aws_record/model/templates/table_config.erb +0 -18
  40. data/lib/generators/aws_record/secondary_index.rb +0 -66
  41. data/lib/generators/dynamo_db/session_store_migration/USAGE +0 -13
  42. data/lib/generators/dynamo_db/session_store_migration/session_store_migration_generator.rb +0 -48
  43. data/lib/generators/dynamo_db/session_store_migration/templates/dynamo_db_session_store.yml +0 -70
  44. data/lib/generators/dynamo_db/session_store_migration/templates/session_store_migration.erb +0 -9
  45. data/lib/tasks/aws_record/migrate.rake +0 -14
  46. data/lib/tasks/dynamo_db/session_store.rake +0 -10
metadata CHANGED
@@ -1,240 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amazon Web Services
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-27 00:00:00.000000000 Z
11
+ date: 2024-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: aws-record
14
+ name: aws-sdk-core
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2'
19
+ version: '3'
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: '2'
27
- - !ruby/object:Gem::Dependency
28
- name: aws-sessionstore-dynamodb
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '2'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '2'
41
- - !ruby/object:Gem::Dependency
42
- name: aws-sdk-s3
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '1'
48
- - - ">="
49
- - !ruby/object:Gem::Version
50
- version: 1.123.0
51
- type: :runtime
52
- prerelease: false
53
- version_requirements: !ruby/object:Gem::Requirement
54
- requirements:
55
- - - "~>"
56
- - !ruby/object:Gem::Version
57
- version: '1'
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- version: 1.123.0
61
- - !ruby/object:Gem::Dependency
62
- name: aws-sdk-ses
63
- requirement: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - "~>"
66
- - !ruby/object:Gem::Version
67
- version: '1'
68
- - - ">="
69
- - !ruby/object:Gem::Version
70
- version: 1.50.0
71
- type: :runtime
72
- prerelease: false
73
- version_requirements: !ruby/object:Gem::Requirement
74
- requirements:
75
- - - "~>"
76
- - !ruby/object:Gem::Version
77
- version: '1'
78
- - - ">="
79
- - !ruby/object:Gem::Version
80
- version: 1.50.0
81
- - !ruby/object:Gem::Dependency
82
- name: aws-sdk-sesv2
83
- requirement: !ruby/object:Gem::Requirement
84
- requirements:
85
- - - "~>"
86
- - !ruby/object:Gem::Version
87
- version: '1'
88
- - - ">="
89
- - !ruby/object:Gem::Version
90
- version: 1.34.0
91
- type: :runtime
92
- prerelease: false
93
- version_requirements: !ruby/object:Gem::Requirement
94
- requirements:
95
- - - "~>"
96
- - !ruby/object:Gem::Version
97
- version: '1'
98
- - - ">="
99
- - !ruby/object:Gem::Version
100
- version: 1.34.0
101
- - !ruby/object:Gem::Dependency
102
- name: aws-sdk-sns
103
- requirement: !ruby/object:Gem::Requirement
104
- requirements:
105
- - - "~>"
106
- - !ruby/object:Gem::Version
107
- version: '1'
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: 1.61.0
111
- type: :runtime
112
- prerelease: false
113
- version_requirements: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '1'
118
- - - ">="
119
- - !ruby/object:Gem::Version
120
- version: 1.61.0
121
- - !ruby/object:Gem::Dependency
122
- name: aws-sdk-sqs
123
- requirement: !ruby/object:Gem::Requirement
124
- requirements:
125
- - - "~>"
126
- - !ruby/object:Gem::Version
127
- version: '1'
128
- - - ">="
129
- - !ruby/object:Gem::Version
130
- version: 1.56.0
131
- type: :runtime
132
- prerelease: false
133
- version_requirements: !ruby/object:Gem::Requirement
134
- requirements:
135
- - - "~>"
136
- - !ruby/object:Gem::Version
137
- version: '1'
138
- - - ">="
139
- - !ruby/object:Gem::Version
140
- version: 1.56.0
141
- - !ruby/object:Gem::Dependency
142
- name: actionmailbox
143
- requirement: !ruby/object:Gem::Requirement
144
- requirements:
145
- - - ">="
146
- - !ruby/object:Gem::Version
147
- version: 7.0.0
148
- type: :runtime
149
- prerelease: false
150
- version_requirements: !ruby/object:Gem::Requirement
151
- requirements:
152
- - - ">="
153
- - !ruby/object:Gem::Version
154
- version: 7.0.0
155
- - !ruby/object:Gem::Dependency
156
- name: concurrent-ruby
157
- requirement: !ruby/object:Gem::Requirement
158
- requirements:
159
- - - "~>"
160
- - !ruby/object:Gem::Version
161
- version: '1.3'
162
- - - ">="
163
- - !ruby/object:Gem::Version
164
- version: 1.3.1
165
- type: :runtime
166
- prerelease: false
167
- version_requirements: !ruby/object:Gem::Requirement
168
- requirements:
169
- - - "~>"
170
- - !ruby/object:Gem::Version
171
- version: '1.3'
172
- - - ">="
173
- - !ruby/object:Gem::Version
174
- version: 1.3.1
26
+ version: '3'
175
27
  - !ruby/object:Gem::Dependency
176
28
  name: railties
177
29
  requirement: !ruby/object:Gem::Requirement
178
30
  requirements:
179
31
  - - ">="
180
32
  - !ruby/object:Gem::Version
181
- version: 7.0.0
33
+ version: 7.1.0
182
34
  type: :runtime
183
35
  prerelease: false
184
36
  version_requirements: !ruby/object:Gem::Requirement
185
37
  requirements:
186
38
  - - ">="
187
39
  - !ruby/object:Gem::Version
188
- version: 7.0.0
189
- description: Integrates the AWS Ruby SDK with Ruby on Rails
40
+ version: 7.1.0
41
+ description: Integrates the AWS SDK for Ruby with Ruby on Rails
190
42
  email:
191
43
  - aws-dr-rubygems@amazon.com
192
- executables:
193
- - aws_sqs_active_job
44
+ executables: []
194
45
  extensions: []
195
46
  extra_rdoc_files: []
196
47
  files:
48
+ - CHANGELOG.md
49
+ - LICENSE.txt
197
50
  - VERSION
198
- - app/controllers/action_mailbox/ingresses/ses/inbound_emails_controller.rb
199
- - bin/aws_sqs_active_job
200
- - config/routes.rb
201
- - lib/action_dispatch/session/dynamodb_store.rb
202
- - lib/active_job/queue_adapters/sqs_adapter.rb
203
- - lib/active_job/queue_adapters/sqs_adapter/params.rb
204
- - lib/active_job/queue_adapters/sqs_async_adapter.rb
205
51
  - lib/aws-sdk-rails.rb
206
- - lib/aws/rails/action_mailbox/engine.rb
207
- - lib/aws/rails/action_mailbox/rspec.rb
208
- - lib/aws/rails/action_mailbox/rspec/email.rb
209
- - lib/aws/rails/action_mailbox/rspec/subscription_confirmation.rb
210
- - lib/aws/rails/action_mailbox/s3_client.rb
211
- - lib/aws/rails/action_mailbox/sns_message_verifier.rb
212
- - lib/aws/rails/action_mailbox/sns_notification.rb
213
- - lib/aws/rails/middleware/ebs_sqs_active_job_middleware.rb
52
+ - lib/aws/rails/middleware/elastic_beanstalk_sqsd.rb
214
53
  - lib/aws/rails/notifications.rb
215
54
  - lib/aws/rails/railtie.rb
216
- - lib/aws/rails/ses_mailer.rb
217
- - lib/aws/rails/sesv2_mailer.rb
218
- - lib/aws/rails/sqs_active_job.rb
219
- - lib/aws/rails/sqs_active_job/configuration.rb
220
- - lib/aws/rails/sqs_active_job/deduplication.rb
221
- - lib/aws/rails/sqs_active_job/executor.rb
222
- - lib/aws/rails/sqs_active_job/job_runner.rb
223
- - lib/aws/rails/sqs_active_job/lambda_handler.rb
224
- - lib/aws/rails/sqs_active_job/poller.rb
225
- - lib/generators/aws_record/base.rb
226
- - lib/generators/aws_record/generated_attribute.rb
227
- - lib/generators/aws_record/model/USAGE
228
- - lib/generators/aws_record/model/model_generator.rb
229
- - lib/generators/aws_record/model/templates/model.erb
230
- - lib/generators/aws_record/model/templates/table_config.erb
231
- - lib/generators/aws_record/secondary_index.rb
232
- - lib/generators/dynamo_db/session_store_migration/USAGE
233
- - lib/generators/dynamo_db/session_store_migration/session_store_migration_generator.rb
234
- - lib/generators/dynamo_db/session_store_migration/templates/dynamo_db_session_store.yml
235
- - lib/generators/dynamo_db/session_store_migration/templates/session_store_migration.erb
236
- - lib/tasks/aws_record/migrate.rake
237
- - lib/tasks/dynamo_db/session_store.rake
238
55
  homepage: https://github.com/aws/aws-sdk-rails
239
56
  licenses:
240
57
  - Apache-2.0
@@ -254,8 +71,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
254
71
  - !ruby/object:Gem::Version
255
72
  version: '0'
256
73
  requirements: []
257
- rubygems_version: 3.5.9
74
+ rubygems_version: 3.5.11
258
75
  signing_key:
259
76
  specification_version: 4
260
- summary: AWS SDK for Ruby on Rails Plugin
77
+ summary: AWS SDK for Ruby on Rails Railtie
261
78
  test_files: []
@@ -1,79 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'aws/rails/action_mailbox/sns_notification'
4
-
5
- module ActionMailbox
6
- module Ingresses
7
- module Ses
8
- # Ingests inbound emails from Amazon SES/SNS and confirms subscriptions.
9
- #
10
- # Subscription requests must provide the following parameters in a JSON body:
11
- # - +Message+: Notification content
12
- # - +MessagId+: Notification unique identifier
13
- # - +Timestamp+: iso8601 timestamp
14
- # - +TopicArn+: Topic identifier
15
- # - +Type+: Type of event ("Subscription")
16
- #
17
- # Inbound email events must provide the following parameters in a JSON body:
18
- # - +Message+: Notification content
19
- # - +MessagId+: Notification unique identifier
20
- # - +Timestamp+: iso8601 timestamp
21
- # - +SubscribeURL+: Topic identifier
22
- # - +TopicArn+: Topic identifier
23
- # - +Type+: Type of event ("SubscriptionConfirmation")
24
- #
25
- # All requests are authenticated by validating the provided AWS signature.
26
- #
27
- # Returns:
28
- #
29
- # - <tt>204 No Content</tt> if a request is successfully processed
30
- # - <tt>401 Unauthorized</tt> if a request does not contain a valid signature
31
- # - <tt>404 Not Found</tt> if the Amazon ingress has not been configured
32
- # - <tt>422 Unprocessable Entity</tt> if a request provides invalid parameters
33
- class InboundEmailsController < ActionMailbox::BaseController
34
- before_action :verify_authenticity, :validate_topic, :confirm_subscription
35
-
36
- def create
37
- head :bad_request unless notification.message_content.present?
38
-
39
- ActionMailbox::InboundEmail.create_and_extract_message_id!(notification.message_content)
40
- head :no_content
41
- end
42
-
43
- private
44
-
45
- def verify_authenticity
46
- head :bad_request unless notification.present?
47
- head :unauthorized unless notification.verified?
48
- end
49
-
50
- def confirm_subscription
51
- return unless notification.type == 'SubscriptionConfirmation'
52
- return head :ok if notification.subscription_confirmed?
53
-
54
- Rails.logger.error('SNS subscription confirmation request rejected.')
55
- head :unprocessable_entity
56
- end
57
-
58
- def validate_topic
59
- return if valid_topic == notification.topic
60
-
61
- Rails.logger.warn("Ignoring unknown topic: #{topic}")
62
- head :unauthorized
63
- end
64
-
65
- def notification
66
- @notification ||= Aws::Rails::ActionMailbox::SnsNotification.new(request.raw_post)
67
- end
68
-
69
- def topic
70
- @topic ||= notification.topic
71
- end
72
-
73
- def valid_topic
74
- ::Rails.configuration.action_mailbox.ses.subscribed_topic
75
- end
76
- end
77
- end
78
- end
79
- end
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require_relative '../lib/aws/rails/sqs_active_job/poller'
5
-
6
- Aws::Rails::SqsActiveJob::Poller.new.run
data/config/routes.rb DELETED
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Rails.application.routes.draw do
4
- scope '/rails/action_mailbox', module: 'action_mailbox/ingresses' do
5
- post '/ses/inbound_emails' => 'ses/inbound_emails#create',
6
- as: :rails_ses_inbound_emails
7
- end
8
- end
@@ -1,38 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'aws-sessionstore-dynamodb'
4
- require 'action_dispatch/middleware/session/abstract_store'
5
-
6
- module ActionDispatch
7
- module Session
8
- # Uses the Dynamo DB Session Store implementation to create a class that
9
- # extends ActionDispatch::Session. Rails will create a :dynamodb_store
10
- # configuration for session_store from this class name.
11
- #
12
- # This class will use the Rails secret_key_base unless otherwise provided.
13
- #
14
- # Configuration can also be provided in YAML files from Rails config, either
15
- # in "config/session_store.yml" or "config/session_store/#\\{Rails.env}.yml".
16
- # Configuration files that are environment-specific will take precedence.
17
- #
18
- # @see https://docs.aws.amazon.com/sdk-for-ruby/aws-sessionstore-dynamodb/api/Aws/SessionStore/DynamoDB/Configuration.html
19
- class DynamodbStore < Aws::SessionStore::DynamoDB::RackMiddleware
20
- include StaleSessionCheck
21
- include SessionObject
22
-
23
- def initialize(app, options = {})
24
- options[:config_file] ||= config_file if File.exist?(config_file)
25
- options[:secret_key] ||= Rails.application.secret_key_base
26
- super
27
- end
28
-
29
- private
30
-
31
- def config_file
32
- file = Rails.root.join("config/dynamo_db_session_store/#{Rails.env}.yml")
33
- file = Rails.root.join('config/dynamo_db_session_store.yml') unless File.exist?(file)
34
- file
35
- end
36
- end
37
- end
38
- end
@@ -1,78 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ActiveJob
4
- module QueueAdapters
5
- class SqsAdapter
6
- # == build request parameter of Aws::SQS::Client
7
- class Params
8
- class << self
9
- def assured_delay_seconds(timestamp)
10
- delay = (timestamp - Time.now.to_f).floor
11
- delay = 0 if delay.negative?
12
- raise ArgumentError, 'Unable to queue a job with a delay great than 15 minutes' if delay > 15.minutes
13
-
14
- delay
15
- end
16
- end
17
-
18
- def initialize(job, body)
19
- @job = job
20
- @body = body || job.serialize
21
- end
22
-
23
- def queue_url
24
- @queue_url ||= Aws::Rails::SqsActiveJob.config.queue_url_for(@job.queue_name)
25
- end
26
-
27
- def entry
28
- if Aws::Rails::SqsActiveJob.fifo?(queue_url)
29
- default_entry.merge(options_for_fifo)
30
- else
31
- default_entry
32
- end
33
- end
34
-
35
- private
36
-
37
- def default_entry
38
- {
39
- message_body: Aws::Json.dump(@body),
40
- message_attributes: message_attributes
41
- }
42
- end
43
-
44
- def message_attributes
45
- {
46
- 'aws_sqs_active_job_class' => {
47
- string_value: @job.class.to_s,
48
- data_type: 'String'
49
- },
50
- 'aws_sqs_active_job_version' => {
51
- string_value: Aws::Rails::VERSION,
52
- data_type: 'String'
53
- }
54
- }
55
- end
56
-
57
- def options_for_fifo
58
- options = {}
59
- options[:message_deduplication_id] =
60
- Digest::SHA256.hexdigest(Aws::Json.dump(deduplication_body))
61
-
62
- message_group_id = @job.message_group_id if @job.respond_to?(:message_group_id)
63
- message_group_id ||= Aws::Rails::SqsActiveJob.config.message_group_id
64
-
65
- options[:message_group_id] = message_group_id
66
- options
67
- end
68
-
69
- def deduplication_body
70
- ex_dedup_keys = @job.excluded_deduplication_keys if @job.respond_to?(:excluded_deduplication_keys)
71
- ex_dedup_keys ||= Aws::Rails::SqsActiveJob.config.excluded_deduplication_keys
72
-
73
- @body.except(*ex_dedup_keys)
74
- end
75
- end
76
- end
77
- end
78
- end
@@ -1,58 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'aws-sdk-sqs'
4
-
5
- module ActiveJob
6
- module QueueAdapters
7
- # Set in rails config via config.active_job.queue_adapter = :sqs to use the SQS adapter
8
- class SqsAdapter
9
- def enqueue_after_transaction_commit?
10
- true
11
- end
12
-
13
- def enqueue(job)
14
- _enqueue(job)
15
- end
16
-
17
- def enqueue_at(job, timestamp)
18
- delay = Params.assured_delay_seconds(timestamp)
19
- _enqueue(job, nil, delay_seconds: delay)
20
- end
21
-
22
- def enqueue_all(jobs)
23
- enqueued_count = 0
24
- jobs.group_by(&:queue_name).each do |queue_name, same_queue_jobs|
25
- queue_url = Aws::Rails::SqsActiveJob.config.queue_url_for(queue_name)
26
- base_send_message_opts = { queue_url: queue_url }
27
-
28
- same_queue_jobs.each_slice(10) do |chunk|
29
- entries = chunk.map do |job|
30
- entry = Params.new(job, nil).entry
31
- entry[:id] = job.job_id
32
- entry[:delay_seconds] = Params.assured_delay_seconds(job.scheduled_at) if job.scheduled_at
33
- entry
34
- end
35
-
36
- send_message_opts = base_send_message_opts.deep_dup
37
- send_message_opts[:entries] = entries
38
-
39
- send_message_batch_result = Aws::Rails::SqsActiveJob.config.client.send_message_batch(send_message_opts)
40
- enqueued_count += send_message_batch_result.successful.count
41
- end
42
- end
43
- enqueued_count
44
- end
45
-
46
- private
47
-
48
- def _enqueue(job, body = nil, send_message_opts = {})
49
- body ||= job.serialize
50
- params = Params.new(job, body)
51
- send_message_opts = send_message_opts.merge(params.entry)
52
- send_message_opts[:queue_url] = params.queue_url
53
-
54
- Aws::Rails::SqsActiveJob.config.client.send_message(send_message_opts)
55
- end
56
- end
57
- end
58
- end
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'aws-sdk-sqs'
4
- require 'concurrent'
5
-
6
- module ActiveJob
7
- module QueueAdapters
8
- # == Async adapter for Amazon SQS ActiveJob
9
- #
10
- # This adapter queues jobs asynchronously (ie non-blocking). Error handler can be configured
11
- # with +Aws::Rails::SqsActiveJob.config.async_queue_error_handler+.
12
- #
13
- # To use this adapter, set up as:
14
- #
15
- # config.active_job.queue_adapter = :sqs_async
16
- class SqsAsyncAdapter < SqsAdapter
17
- private
18
-
19
- def _enqueue(job, body = nil, send_message_opts = {})
20
- # FIFO jobs must be queued in order, so do not queue async
21
- queue_url = Aws::Rails::SqsActiveJob.config.queue_url_for(job.queue_name)
22
- if Aws::Rails::SqsActiveJob.fifo?(queue_url)
23
- super
24
- else
25
- # Serialize is called here because the job’s locale needs to be
26
- # determined in this thread and not in some other thread.
27
- body = job.serialize
28
- Concurrent::Promises
29
- .future { super }
30
- .rescue do |e|
31
- Rails.logger.error "Failed to queue job #{job}. Reason: #{e}"
32
- error_handler = Aws::Rails::SqsActiveJob.config.async_queue_error_handler
33
- error_handler&.call(e, job, send_message_opts)
34
- end
35
- end
36
- end
37
- end
38
- end
39
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- if defined?(ActionMailbox::Engine)
4
- module Aws
5
- module Rails
6
- module ActionMailbox
7
- # @api private
8
- class Engine < ::Rails::Engine
9
- config.action_mailbox.ses = ActiveSupport::OrderedOptions.new
10
- config.action_mailbox.ses.s3_client_options ||= {}
11
-
12
- initializer 'aws-sdk-rails.mount_engine' do |app|
13
- app.routes.append do
14
- mount Engine => '/'
15
- end
16
- end
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,50 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Aws
4
- module Rails
5
- module ActionMailbox
6
- module RSpec
7
- # @api private
8
- class Email
9
- def initialize(authentic: true, topic: 'topic:arn:default', mail: default_mail, message_params: {})
10
- @authentic = authentic
11
- @topic = topic
12
- @mail = mail
13
- @message_params = message_params
14
- end
15
-
16
- def headers
17
- { 'content-type' => 'application/json' }
18
- end
19
-
20
- def url
21
- '/rails/action_mailbox/ses/inbound_emails'
22
- end
23
-
24
- def params
25
- {
26
- 'Type' => 'Notification',
27
- 'TopicArn' => @topic,
28
- 'Message' => message_json
29
- }
30
- end
31
-
32
- def message_json
33
- {
34
- 'notificationType' => 'Received',
35
- 'content' => @mail.encoded
36
- }.merge(@message_params).to_json
37
- end
38
-
39
- def authentic?
40
- @authentic
41
- end
42
-
43
- def default_mail
44
- Mail.new
45
- end
46
- end
47
- end
48
- end
49
- end
50
- end
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Aws
4
- module Rails
5
- module ActionMailbox
6
- module RSpec
7
- # @api private
8
- class SubscriptionConfirmation
9
- def initialize(authentic: true, topic: 'topic:arn:default')
10
- @authentic = authentic
11
- @topic = topic
12
- end
13
-
14
- def url
15
- '/rails/action_mailbox/ses/inbound_emails'
16
- end
17
-
18
- def headers
19
- { 'content-type' => 'application/json' }
20
- end
21
-
22
- def params
23
- {
24
- 'Type' => 'SubscriptionConfirmation',
25
- 'TopicArn' => @topic,
26
- 'SubscribeURL' => 'http://example.com/subscribe'
27
- }
28
- end
29
-
30
- def authentic?
31
- @authentic
32
- end
33
- end
34
- end
35
- end
36
- end
37
- end