Exception: Sendeez::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/sendeez/errors.rb

Overview

Raised for any non-2xx response from the Sendeez API.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status, error, retry_after: nil) ⇒ Error

Returns a new instance of Error.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/sendeez/errors.rb', line 8

def initialize(status, error, retry_after: nil)
  @status = status
  @type = error["type"] || "api_error"
  @code = error["code"] || "unknown_error"
  @param = error["param"]
  @request_id = error["request_id"]
  @details = error["details"]
  @action = error["action"]
  @retry_after = retry_after
  super(error["message"] || "Sendeez request failed with HTTP #{status}")
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



6
7
8
# File 'lib/sendeez/errors.rb', line 6

def action
  @action
end

#codeObject (readonly)

Returns the value of attribute code.



6
7
8
# File 'lib/sendeez/errors.rb', line 6

def code
  @code
end

#detailsObject (readonly)

Returns the value of attribute details.



6
7
8
# File 'lib/sendeez/errors.rb', line 6

def details
  @details
end

#paramObject (readonly)

Returns the value of attribute param.



6
7
8
# File 'lib/sendeez/errors.rb', line 6

def param
  @param
end

#request_idObject (readonly)

Returns the value of attribute request_id.



6
7
8
# File 'lib/sendeez/errors.rb', line 6

def request_id
  @request_id
end

#retry_afterObject (readonly)

Returns the value of attribute retry_after.



6
7
8
# File 'lib/sendeez/errors.rb', line 6

def retry_after
  @retry_after
end

#statusObject (readonly)

Returns the value of attribute status.



6
7
8
# File 'lib/sendeez/errors.rb', line 6

def status
  @status
end

#typeObject (readonly)

Returns the value of attribute type.



6
7
8
# File 'lib/sendeez/errors.rb', line 6

def type
  @type
end