Exception: MingleEvents::HttpError

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response, requested_location, additional_context = nil) ⇒ HttpError

Returns a new instance of HttpError.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/mingle_events/http_error.rb', line 7

def initialize(response, requested_location, additional_context = nil)
  super(%{
    Unable to retrieve 200 response from URI: <#{requested_location}>!
    HTTP Code: #{response && response.code}
    Body: #{response && response.body}
    #{additional_context.nil? ? "" : additional_context}
  })
  @response = response
  @requested_location = requested_location
  @additional_context = additional_context
end

Instance Attribute Details

#additional_contextObject (readonly)

Returns the value of attribute additional_context.



5
6
7
# File 'lib/mingle_events/http_error.rb', line 5

def additional_context
  @additional_context
end

#requested_locationObject (readonly)

Returns the value of attribute requested_location.



5
6
7
# File 'lib/mingle_events/http_error.rb', line 5

def requested_location
  @requested_location
end

#responseObject (readonly)

Returns the value of attribute response.



5
6
7
# File 'lib/mingle_events/http_error.rb', line 5

def response
  @response
end

Instance Method Details

#not_found?Boolean

Returns:

  • (Boolean)


19
20
21
22
# File 'lib/mingle_events/http_error.rb', line 19

def not_found?
  # has to be a better way to do this!!
  response.class == Net::HTTPNotFound
end