metamailer 1.0.4 → 1.0.5
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.
- data/lib/jangomailm.rb +18 -0
- data/lib/metamailer.rb +4 -2
- data/lib/postageappm.rb +9 -3
- data/lib/sendgridm.rb +17 -0
- metadata +5 -3
- /data/lib/{elasticemail.rb → elasticemailm.rb} +0 -0
- /data/lib/{mailgun.rb → mailgunm.rb} +0 -0
    
        data/lib/jangomailm.rb
    ADDED
    
    | @@ -0,0 +1,18 @@ | |
| 1 | 
            +
            require "net/http"
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            class Jangomail < MetaMailer
         | 
| 4 | 
            +
              attr_accessor :username
         | 
| 5 | 
            +
              attr_accessor :api_key
         | 
| 6 | 
            +
             | 
| 7 | 
            +
              def initialize(username, password)
         | 
| 8 | 
            +
                @username = username
         | 
| 9 | 
            +
                @password = password
         | 
| 10 | 
            +
              end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
              def send(from, to, subject, html, text)
         | 
| 13 | 
            +
                uri = URI("http://api.jangomail.com/api.asmx/SendTransactionalEmail")
         | 
| 14 | 
            +
                from_address = from.split("<")[1].split(">")[0]
         | 
| 15 | 
            +
                from_name = from.split(" <")[0]
         | 
| 16 | 
            +
                p = {:Username => @username, :Password => @password, :FromEmail => from_address, :FromName => from_name, :ToEmailAddress => to, :Subject => subject, :MessagePlain => text, :MessageHTML => html, :Options => ""}
         | 
| 17 | 
            +
              end
         | 
| 18 | 
            +
            end
         | 
    
        data/lib/metamailer.rb
    CHANGED
    
    | @@ -1,4 +1,6 @@ | |
| 1 1 | 
             
            require_relative "core.rb"
         | 
| 2 2 | 
             
            require_relative "postageappm.rb"
         | 
| 3 | 
            -
            require_relative " | 
| 4 | 
            -
            require_relative " | 
| 3 | 
            +
            require_relative "elasticemailm.rb"
         | 
| 4 | 
            +
            require_relative "mailgunm.rb"
         | 
| 5 | 
            +
            require_relative "jangomailm.rb"
         | 
| 6 | 
            +
            require_relative "sendgridm.rb"
         | 
    
        data/lib/postageappm.rb
    CHANGED
    
    | @@ -1,11 +1,17 @@ | |
| 1 1 | 
             
            gem 'postageapp', '=1.0.23'
         | 
| 2 2 | 
             
            require 'postageapp'
         | 
| 3 3 |  | 
| 4 | 
            -
            PostageApp.configure do |config|
         | 
| 5 | 
            -
              config.api_key = ""# api key goes here
         | 
| 6 | 
            -
            end
         | 
| 4 | 
            +
            #PostageApp.configure do |config|
         | 
| 5 | 
            +
            #  config.api_key = ""# api key goes here
         | 
| 6 | 
            +
            #end
         | 
| 7 7 |  | 
| 8 8 | 
             
            class PostageAppMailer < MetaMailer
         | 
| 9 | 
            +
              def initialize(api_key)
         | 
| 10 | 
            +
                PostageApp.configure do |config|
         | 
| 11 | 
            +
                  config.api_key = ""
         | 
| 12 | 
            +
                end
         | 
| 13 | 
            +
              end
         | 
| 14 | 
            +
             | 
| 9 15 | 
             
              def send(from, to, subject, html, text)
         | 
| 10 16 | 
             
                request = PostageApp::Request.new(:send_message, {
         | 
| 11 17 | 
             
                  'headers' => {
         | 
    
        data/lib/sendgridm.rb
    ADDED
    
    | @@ -0,0 +1,17 @@ | |
| 1 | 
            +
            require "sendgrid_toolkit"
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            class Sendgrid < MetaMailer
         | 
| 4 | 
            +
              attr_accessor :api_user
         | 
| 5 | 
            +
              attr_accessor :api_key
         | 
| 6 | 
            +
             | 
| 7 | 
            +
              def initialize(api_user, api_key)
         | 
| 8 | 
            +
                @username = @api_user
         | 
| 9 | 
            +
                @password = @api_key
         | 
| 10 | 
            +
              end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
              def send(from, to, subject, html, text)
         | 
| 13 | 
            +
                from_address = from.split("<")[1].split(">")[0]
         | 
| 14 | 
            +
                from_name = from.split(" <")[0]
         | 
| 15 | 
            +
                SendgridToolkit::Mail.new(@api_user, @api_key).send_mail :to => to, :from => from_address, :subject => subject, :text => text
         | 
| 16 | 
            +
              end
         | 
| 17 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: metamailer
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.0. | 
| 4 | 
            +
              version: 1.0.5
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -20,9 +20,11 @@ extra_rdoc_files: [] | |
| 20 20 | 
             
            files:
         | 
| 21 21 | 
             
            - lib/metamailer.rb
         | 
| 22 22 | 
             
            - lib/core.rb
         | 
| 23 | 
            -
            - lib/ | 
| 24 | 
            -
            - lib/ | 
| 23 | 
            +
            - lib/mailgunm.rb
         | 
| 24 | 
            +
            - lib/elasticemailm.rb
         | 
| 25 25 | 
             
            - lib/postageappm.rb
         | 
| 26 | 
            +
            - lib/jangomailm.rb
         | 
| 27 | 
            +
            - lib/sendgridm.rb
         | 
| 26 28 | 
             
            homepage: http://github.com/brg8/metamailer
         | 
| 27 29 | 
             
            licenses:
         | 
| 28 30 | 
             
            - GNU
         | 
| 
            File without changes
         | 
| 
            File without changes
         |