Exception: RequestError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/one_doc.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method, url, response) ⇒ RequestError

Returns a new instance of RequestError.



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/one_doc.rb', line 9

def initialize(method, url, response)
  @status_code = response.status
  @method = method
  @url = url
  begin
    @data = response.parse
  rescue
    @data = nil
  end
  @response = response

  super("received #{status_code} from #{method} #{url} with #{message}")
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



7
8
9
# File 'lib/one_doc.rb', line 7

def data
  @data
end

#methodObject (readonly)

Returns the value of attribute method.



7
8
9
# File 'lib/one_doc.rb', line 7

def method
  @method
end

#responseObject (readonly)

Returns the value of attribute response.



7
8
9
# File 'lib/one_doc.rb', line 7

def response
  @response
end

#status_codeObject (readonly)

Returns the value of attribute status_code.



7
8
9
# File 'lib/one_doc.rb', line 7

def status_code
  @status_code
end

#urlObject (readonly)

Returns the value of attribute url.



7
8
9
# File 'lib/one_doc.rb', line 7

def url
  @url
end