aws-sdk-rails 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 628e3876864cc9c7662c6098eaca8ffd766a667d
4
+ data.tar.gz: 517102c3250c1638b6956c6fbe04851bfaab3550
5
+ SHA512:
6
+ metadata.gz: 538c2468758d7b54cd6ded4fdd826220f71c3bcb236e9368e6f5ca7a16f7fba9f4497bbcceccd32a0b26e1b90634356dba49a6f01d26306e7c15877c922c8c14
7
+ data.tar.gz: f22408e0c06a5e15783d89ea8db97cc163ed06a0063e9e73406744a6c49a2559e11484764bd5f8860b0c2ba439b6660a91467d09504b4a18331fa3c60c2453b0
@@ -0,0 +1,39 @@
1
+ require 'aws-sdk-resources'
2
+
3
+ module Aws
4
+ module Rails
5
+
6
+ autoload :Mailer, 'aws/rails/mailer'
7
+
8
+ # @api private
9
+ class Railtie < ::Rails::Railtie
10
+ initializer "aws-sdk-rails.initialize" do |app|
11
+ # Initialization Actions
12
+ Aws::Rails.add_action_mailer_delivery_method
13
+ Aws::Rails.log_to_rails_logger
14
+ end
15
+ end
16
+
17
+ # This is called automatically from the SDK's Railtie, but if you want to
18
+ # manually specify options for building the Aws::SES::Client object, you
19
+ # can manually call this method.
20
+ #
21
+ # @param [Symbol] name The name of the ActionMailer delivery method to
22
+ # register.
23
+ # @param [Hash] options The options you wish to pass on to the
24
+ # Aws::SES::Client initialization method.
25
+ def self.add_action_mailer_delivery_method(name = :aws_sdk, options = {})
26
+ ActiveSupport.on_load(:action_mailer) do
27
+ self.add_delivery_method(name, Aws::Rails::Mailer, options)
28
+ end
29
+ end
30
+
31
+ # Configures the AWS SDK for Ruby's logger to use the Rails logger.
32
+ def self.log_to_rails_logger
33
+ Aws.config[:logger] = ::Rails.logger
34
+ nil
35
+ end
36
+
37
+ end
38
+ end
39
+
@@ -0,0 +1,45 @@
1
+ module Aws
2
+ module Rails
3
+
4
+ # Provides a delivery method for ActionMailer that uses Amazon Simple Email
5
+ # Service.
6
+ #
7
+ # Once you have an SES delivery method you can configure Rails to
8
+ # use this for ActionMailer in your environment configuration
9
+ # (e.g. RAILS_ROOT/config/environments/production.rb)
10
+ #
11
+ # config.action_mailer.delivery_method = :aws_sdk
12
+ #
13
+ # Uses the AWS SDK for Ruby V2's credential provider chain when creating an
14
+ # SES client instance.
15
+ class Mailer
16
+
17
+ # @param [Hash] options Passes along initialization options to
18
+ # [Aws::SES::Client.new](http://docs.aws.amazon.com/sdkforruby/api/Aws/SES/Client.html#initialize-instance_method).
19
+ def initialize(options = {})
20
+ @client = SES::Client.new(options)
21
+ end
22
+
23
+ # Rails expects this method to exist, and to handle a Mail::Message object
24
+ # correctly. Called during mail delivery.
25
+ def deliver!(message)
26
+ send_opts = {}
27
+ send_opts[:raw_message] = {}
28
+ send_opts[:raw_message][:data] = message.to_s
29
+
30
+ if message.respond_to?(:destinations)
31
+ send_opts[:destinations] = message.destinations
32
+ end
33
+
34
+ @client.send_raw_email(send_opts)
35
+
36
+ end
37
+
38
+ # ActionMailer expects this method to be present and to return a hash.
39
+ def settings
40
+ {}
41
+ end
42
+
43
+ end
44
+ end
45
+ end
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: aws-sdk-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Amazon Web Services
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-03-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: aws-sdk-resources
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '3'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '3'
41
+ description: Provides helpers to integrate the AWS SDK for Ruby with Ruby on Rails.
42
+ email:
43
+ - alexwood@amazon.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - lib/aws-sdk-rails.rb
49
+ - lib/aws/rails/mailer.rb
50
+ homepage: http://github.com/awslabs/aws-sdk-rails
51
+ licenses:
52
+ - Apache 2.0
53
+ metadata: {}
54
+ post_install_message:
55
+ rdoc_options: []
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ requirements: []
69
+ rubyforge_project:
70
+ rubygems_version: 2.2.2
71
+ signing_key:
72
+ specification_version: 4
73
+ summary: AWS SDK for Ruby Rails Plugin
74
+ test_files: []
75
+ has_rdoc: