Class: Postmark::Bounce
- Inherits:
-
Object
- Object
- Postmark::Bounce
- Defined in:
- lib/postmark/bounce.rb
Instance Attribute Summary collapse
-
#bounced_at ⇒ Object
readonly
Returns the value of attribute bounced_at.
-
#details ⇒ Object
readonly
Returns the value of attribute details.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#server_id ⇒ Object
readonly
Returns the value of attribute server_id.
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
- #activate ⇒ Object
- #can_activate? ⇒ Boolean
- #dump ⇒ Object
- #dump_available? ⇒ Boolean
- #inactive? ⇒ Boolean
-
#initialize(values = {}) ⇒ Bounce
constructor
A new instance of Bounce.
Constructor Details
#initialize(values = {}) ⇒ Bounce
Returns a new instance of Bounce.
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/postmark/bounce.rb', line 6 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"] end |
Instance Attribute Details
#bounced_at ⇒ Object (readonly)
Returns the value of attribute bounced_at.
4 5 6 |
# File 'lib/postmark/bounce.rb', line 4 def bounced_at @bounced_at end |
#details ⇒ Object (readonly)
Returns the value of attribute details.
4 5 6 |
# File 'lib/postmark/bounce.rb', line 4 def details @details end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
4 5 6 |
# File 'lib/postmark/bounce.rb', line 4 def email @email end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/postmark/bounce.rb', line 4 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/postmark/bounce.rb', line 4 def name @name end |
#server_id ⇒ Object (readonly)
Returns the value of attribute server_id.
4 5 6 |
# File 'lib/postmark/bounce.rb', line 4 def server_id @server_id end |
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
4 5 6 |
# File 'lib/postmark/bounce.rb', line 4 def tag @tag end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/postmark/bounce.rb', line 4 def type @type end |
Class Method Details
.all(options = {}) ⇒ Object
44 45 46 47 48 |
# File 'lib/postmark/bounce.rb', line 44 def all( = {}) [:count] ||= 30 [:offset] ||= 0 Postmark::HttpClient.get("bounces", ).map { |bounce_json| Bounce.new(bounce_json) } end |
.find(id) ⇒ Object
40 41 42 |
# File 'lib/postmark/bounce.rb', line 40 def find(id) Bounce.new(Postmark::HttpClient.get("bounces/#{id}")) end |
.tags ⇒ Object
50 51 52 |
# File 'lib/postmark/bounce.rb', line 50 def Postmark::HttpClient.get("bounces/tags") end |
Instance Method Details
#activate ⇒ Object
31 32 33 |
# File 'lib/postmark/bounce.rb', line 31 def activate Bounce.new(Postmark::HttpClient.put("bounces/#{id}/activate")["Bounce"]) end |
#can_activate? ⇒ Boolean
23 24 25 |
# File 'lib/postmark/bounce.rb', line 23 def can_activate? !!@can_activate end |
#dump ⇒ Object
27 28 29 |
# File 'lib/postmark/bounce.rb', line 27 def dump Postmark::HttpClient.get("bounces/#{id}/dump")["Body"] end |
#dump_available? ⇒ Boolean
35 36 37 |
# File 'lib/postmark/bounce.rb', line 35 def dump_available? !!@dump_available end |
#inactive? ⇒ Boolean
19 20 21 |
# File 'lib/postmark/bounce.rb', line 19 def inactive? !!@inactive end |