Exception: RubyPayler::UnexpectedResponseError

Inherits:
Error
  • Object
show all
Defined in:
lib/ruby_payler/errors.rb

Overview

Unexpected response

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ UnexpectedResponseError

Returns a new instance of UnexpectedResponseError.



40
41
42
# File 'lib/ruby_payler/errors.rb', line 40

def initialize(response)
  @response = response
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



38
39
40
# File 'lib/ruby_payler/errors.rb', line 38

def response
  @response
end

Instance Method Details

#bodyObject



48
49
50
# File 'lib/ruby_payler/errors.rb', line 48

def body
  @body ||= response.body
end

#codeObject



44
45
46
# File 'lib/ruby_payler/errors.rb', line 44

def code
  @code ||= response.status
end

#messageObject



52
53
54
# File 'lib/ruby_payler/errors.rb', line 52

def message
  "Unexpected response: code - #{code}, body - #{body}"
end

#to_sObject



56
57
58
# File 'lib/ruby_payler/errors.rb', line 56

def to_s
  message
end