Exception: Voucherify::VoucherifyError
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- Voucherify::VoucherifyError
- Defined in:
- lib/voucherify/client.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#details ⇒ Object
readonly
Returns the value of attribute details.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(restClientError) ⇒ VoucherifyError
constructor
A new instance of VoucherifyError.
Constructor Details
#initialize(restClientError) ⇒ VoucherifyError
Returns a new instance of VoucherifyError.
130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/voucherify/client.rb', line 130 def initialize (restClientError) if restClientError.is_a? RestClient::Exceptions::Timeout @response = restClientError @details = restClientError super(restClientError) else @response = restClientError.response parsedResponse = JSON.parse(@response) @code = parsedResponse['code'] @details = parsedResponse['details'] @key = parsedResponse['key'] super(parsedResponse['message']) end end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
126 127 128 |
# File 'lib/voucherify/client.rb', line 126 def code @code end |
#details ⇒ Object (readonly)
Returns the value of attribute details.
127 128 129 |
# File 'lib/voucherify/client.rb', line 127 def details @details end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
128 129 130 |
# File 'lib/voucherify/client.rb', line 128 def key @key end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
125 126 127 |
# File 'lib/voucherify/client.rb', line 125 def response @response end |