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.



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

#codeObject (readonly)

Returns the value of attribute code.



126
127
128
# File 'lib/voucherify/client.rb', line 126

def code
  @code
end

#detailsObject (readonly)

Returns the value of attribute details.



127
128
129
# File 'lib/voucherify/client.rb', line 127

def details
  @details
end

#keyObject (readonly)

Returns the value of attribute key.



128
129
130
# File 'lib/voucherify/client.rb', line 128

def key
  @key
end

#responseObject (readonly)

Returns the value of attribute response.



125
126
127
# File 'lib/voucherify/client.rb', line 125

def response
  @response
end