Sha256: 862e8242ec71680892371e30b885951287b88bd40b39a47cf4f1995fe3162ce4

Contents?: true

Size: 649 Bytes

Versions: 1

Compression:

Stored size: 649 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 }
      
      response = self.class.post('/email', headers: self.class.headers.merge(api_key), body: mail.to_postmark.to_json)
      raise ::SimplePostmark::APIError.new(response) unless response.success?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple_postmark-0.4.2 lib/simple_postmark/delivery_method.rb