Sha256: d78353f17422bec7f1288ad7f00e3679abc31b78990818b4508817218e5da64e

Contents?: true

Size: 721 Bytes

Versions: 11

Compression:

Stored size: 721 Bytes

Contents

require 'emaildirect'
require 'json'

module EmailDirect
  # Represents a relay send receipt and associated functionality
  class RelaySend::Receipt
    attr_reader :receipt_id

    def initialize(receipt_id)
      @receipt_id = receipt_id
    end

    def details
      response = get
      Hashie::Mash.new(response)
    end

    def message
      response = get 'Message'
      Hashie::Mash.new(response)
    end

    def clicks
      response = get 'Clicks'
      Hashie::Mash.new(response)
    end

    private

    def get(action = nil)
      EmailDirect.get uri_for(action)
    end

    def uri_for(action)
      action = "/#{action}" if action
      "/RelaySends/Receipt/#{receipt_id}#{action}"
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
emaildirect-2.0.0 lib/emaildirect/relay_send/receipt.rb
emaildirect-1.3.4 lib/emaildirect/relay_send/receipt.rb
emaildirect-1.3.3 lib/emaildirect/relay_send/receipt.rb
emaildirect-1.3.2 lib/emaildirect/relay_send/receipt.rb
emaildirect-1.3.1 lib/emaildirect/relay_send/receipt.rb
emaildirect-1.3.0 lib/emaildirect/relay_send/receipt.rb
emaildirect-1.2.1 lib/emaildirect/relay_send/receipt.rb
emaildirect-1.2.0 lib/emaildirect/relay_send/receipt.rb
emaildirect-1.1.0 lib/emaildirect/relay_send/receipt.rb
emaildirect-1.0.1 lib/emaildirect/relay_send/receipt.rb
emaildirect-1.0.0 lib/emaildirect/relay_send/receipt.rb