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.
118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/voucherify/client.rb', line 118 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.
114 115 116 |
# File 'lib/voucherify/client.rb', line 114 def code @code end |
#details ⇒ Object (readonly)
Returns the value of attribute details.
115 116 117 |
# File 'lib/voucherify/client.rb', line 115 def details @details end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
116 117 118 |
# File 'lib/voucherify/client.rb', line 116 def key @key end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
113 114 115 |
# File 'lib/voucherify/client.rb', line 113 def response @response end |