Sha256: a227d0a7b5c2f60faa86b9aeef65756ff7964d7d3f0adcb09e3f8308ce560b6d

Contents?: true

Size: 659 Bytes

Versions: 4

Compression:

Stored size: 659 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?
      response
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
simple_postmark-0.5.1 lib/simple_postmark/delivery_method.rb
simple_postmark-0.5.0 lib/simple_postmark/delivery_method.rb
simple_postmark-0.4.4 lib/simple_postmark/delivery_method.rb
simple_postmark-0.4.3 lib/simple_postmark/delivery_method.rb