Exception: Voucherify::VoucherifyError

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/voucherify/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#codeObject (readonly)

Returns the value of attribute code.



114
115
116
# File 'lib/voucherify/client.rb', line 114

def code
  @code
end

#detailsObject (readonly)

Returns the value of attribute details.



115
116
117
# File 'lib/voucherify/client.rb', line 115

def details
  @details
end

#keyObject (readonly)

Returns the value of attribute key.



116
117
118
# File 'lib/voucherify/client.rb', line 116

def key
  @key
end

#responseObject (readonly)

Returns the value of attribute response.



113
114
115
# File 'lib/voucherify/client.rb', line 113

def response
  @response
end