Exception: Postmark::InactiveRecipientError

Inherits:
ApiInputError show all
Defined in:
lib/postmark/error.rb

Constant Summary collapse

PATTERNS =
[
  /Found inactive addresses: (.+?)\. Inactive/,
  /these inactive addresses: (.+?)\.?$/
].freeze

Constants inherited from ApiInputError

ApiInputError::INACTIVE_RECIPIENT, ApiInputError::INVALID_EMAIL_REQUEST

Instance Attribute Summary collapse

Attributes inherited from ApiInputError

#error_code

Attributes inherited from HttpServerError

#body, #parsed_body, #status_code

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiInputError

build, #retry?

Methods inherited from HttpServerError

build, #retry?

Constructor Details

#initialize(*args) ⇒ InactiveRecipientError

Returns a new instance of InactiveRecipientError.



95
96
97
98
# File 'lib/postmark/error.rb', line 95

def initialize(*args)
  super
  @recipients = parse_recipients || []
end

Instance Attribute Details

#recipientsObject (readonly)

Returns the value of attribute recipients.



78
79
80
# File 'lib/postmark/error.rb', line 78

def recipients
  @recipients
end

Class Method Details

.parse_recipients(message) ⇒ Object



85
86
87
88
89
90
91
92
93
# File 'lib/postmark/error.rb', line 85

def self.parse_recipients(message)
  PATTERNS.each do |p|
    _, recipients = p.match(message).to_a
    next unless recipients
    return recipients.split(', ')
  end

  []
end