Class: Postmark::Bounce

Inherits:
Object
  • Object
show all
Defined in:
lib/postmark/bounce.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(values = {}) ⇒ Bounce

Returns a new instance of Bounce.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/postmark/bounce.rb', line 9

def initialize(values = {})
  values = Postmark::HashHelper.to_ruby(values)
  @id = values[:id]
  @email = values[:email]
  @bounced_at = Time.parse(values[:bounced_at])
  @type = values[:type]
  @name = values[:name]
  @description = values[:description]
  @details = values[:details]
  @tag = values[:tag]
  @dump_available = values[:dump_available]
  @inactive = values[:inactive]
  @can_activate = values[:can_activate]
  @message_id = values[:message_id]
  @subject = values[:subject]
  @server_id = values[:server_id]
  @message_stream = values[:message_stream]
  @content = values[:content]
end

Instance Attribute Details

#bounced_atObject (readonly)

Returns the value of attribute bounced_at.



6
7
8
# File 'lib/postmark/bounce.rb', line 6

def bounced_at
  @bounced_at
end

#contentObject (readonly)

Returns the value of attribute content.



6
7
8
# File 'lib/postmark/bounce.rb', line 6

def content
  @content
end

#descriptionObject (readonly)

Returns the value of attribute description.



6
7
8
# File 'lib/postmark/bounce.rb', line 6

def description
  @description
end

#detailsObject (readonly)

Returns the value of attribute details.



6
7
8
# File 'lib/postmark/bounce.rb', line 6

def details
  @details
end

#emailObject (readonly)

Returns the value of attribute email.



6
7
8
# File 'lib/postmark/bounce.rb', line 6

def email
  @email
end

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/postmark/bounce.rb', line 6

def id
  @id
end

#message_idObject (readonly)

Returns the value of attribute message_id.



6
7
8
# File 'lib/postmark/bounce.rb', line 6

def message_id
  @message_id
end

#message_streamObject (readonly)

Returns the value of attribute message_stream.



6
7
8
# File 'lib/postmark/bounce.rb', line 6

def message_stream
  @message_stream
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/postmark/bounce.rb', line 6

def name
  @name
end

#server_idObject (readonly)

Returns the value of attribute server_id.



6
7
8
# File 'lib/postmark/bounce.rb', line 6

def server_id
  @server_id
end

#subjectObject (readonly)

Returns the value of attribute subject.



6
7
8
# File 'lib/postmark/bounce.rb', line 6

def subject
  @subject
end

#tagObject (readonly)

Returns the value of attribute tag.



6
7
8
# File 'lib/postmark/bounce.rb', line 6

def tag
  @tag
end

#typeObject (readonly)

Returns the value of attribute type.



6
7
8
# File 'lib/postmark/bounce.rb', line 6

def type
  @type
end

Class Method Details

.all(options = {}) ⇒ Object



54
55
56
57
58
59
60
# File 'lib/postmark/bounce.rb', line 54

def all(options = {})
  options[:count]  ||= 30
  options[:offset] ||= 0
  Postmark.api_client.get_bounces(options).map do |bounce_json|
    Bounce.new(bounce_json)
  end
end

.find(id) ⇒ Object



50
51
52
# File 'lib/postmark/bounce.rb', line 50

def find(id)
  Bounce.new(Postmark.api_client.get_bounce(id))
end

Instance Method Details

#activateObject



41
42
43
# File 'lib/postmark/bounce.rb', line 41

def activate
  Bounce.new(Postmark.api_client.activate_bounce(id))
end

#can_activate?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/postmark/bounce.rb', line 33

def can_activate?
  !!@can_activate
end

#dumpObject



37
38
39
# File 'lib/postmark/bounce.rb', line 37

def dump
  Postmark.api_client.dump_bounce(id)[:body]
end

#dump_available?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/postmark/bounce.rb', line 45

def dump_available?
  !!@dump_available
end

#inactive?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/postmark/bounce.rb', line 29

def inactive?
  !!@inactive
end