Sha256: c15e871bbd4343018f4186ecb0cf757c6701822408c98d44bdf30410543c2244

Contents?: true

Size: 560 Bytes

Versions: 3

Compression:

Stored size: 560 Bytes

Contents

module Mail
  class SimplePostmark
    include HTTParty

    def initialize(values)
      self.settings = { api_key: '********-****-****-****-************' }.merge(values)
    end

    attr_accessor :settings
    base_uri 'http://api.postmarkapp.com'
    headers 'Accept' => 'application/json', 'ContentType' => 'application/json'

    def deliver!(mail)
      api_key = { 'X-Postmark-Server-Token' => settings[:api_key].to_s }
      
      self.class.post('/email', headers: self.class.headers.merge(api_key), body: mail.to_postmark.to_json)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
simple_postmark-0.4.1 lib/simple_postmark/delivery_method.rb
simple_postmark-0.4.0 lib/simple_postmark/delivery_method.rb
simple_postmark-0.3.5 lib/simple_postmark/delivery_method.rb