Sha256: d14f3733a4992f4070d6dc1f10ada0503d1f67f851b727772b0fb56b2748e772
Contents?: true
Size: 1.43 KB
Versions: 6
Compression:
Stored size: 1.43 KB
Contents
require 'time' module Postmark class Bounce attr_reader :email, :bounced_at, :type, :details, :name, :id, :server_id, :tag, :message_id, :subject def initialize(values = {}) @id = values["ID"] @email = values["Email"] @bounced_at = Time.parse(values["BouncedAt"]) @type = values["Type"] @name = values["Name"] @details = values["Details"] @tag = values["Tag"] @dump_available = values["DumpAvailable"] @inactive = values["Inactive"] @can_activate = values["CanActivate"] @message_id = values["MessageID"] @subject = values["Subject"] end def inactive? !!@inactive end def can_activate? !!@can_activate end def dump Postmark::HttpClient.get("bounces/#{id}/dump")["Body"] end def activate Bounce.new(Postmark::HttpClient.put("bounces/#{id}/activate")["Bounce"]) end def dump_available? !!@dump_available end class << self def find(id) Bounce.new(Postmark::HttpClient.get("bounces/#{id}")) end def all(options = {}) options[:count] ||= 30 options[:offset] ||= 0 Postmark::HttpClient.get("bounces", options)['Bounces'].map { |bounce_json| Bounce.new(bounce_json) } end def tags Postmark::HttpClient.get("bounces/tags") end end end end
Version data entries
6 entries across 6 versions & 1 rubygems