Exception: CFC::Errors::HTTPError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/cfc/errors/http_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request, response) ⇒ HTTPError

Returns a new instance of HTTPError.



8
9
10
11
12
# File 'lib/cfc/errors/http_error.rb', line 8

def initialize(request, response)
  super "Cloudflare API request returned HTTP #{response.code}"
  @request = request
  @response = response
end

Instance Attribute Details

#requestObject (readonly)

Returns the value of attribute request.



6
7
8
# File 'lib/cfc/errors/http_error.rb', line 6

def request
  @request
end

#responseObject (readonly)

Returns the value of attribute response.



6
7
8
# File 'lib/cfc/errors/http_error.rb', line 6

def response
  @response
end

Instance Method Details

#dataObject



14
15
16
# File 'lib/cfc/errors/http_error.rb', line 14

def data
  JSON.parse(@response.body)
end