Class: ActiveResource::Connection
- Inherits:
-
Object
- Object
- ActiveResource::Connection
- Defined in:
- lib/basecamp/active_resource.rb
Overview
ActiveResource connection patch to let users access the last response object and the headers.
Example:
>> Basecamp::Message.find(:all, params => { :project_id => 1037 })
>> Basecamp::Message.connection.response["status"]
=> "200 OK"
Instance Method Summary collapse
- #handle_response(response) ⇒ Object
- #original_handle_response ⇒ Object
- #response ⇒ Object
- #set_header(key, value) ⇒ Object
Instance Method Details
#handle_response(response) ⇒ Object
11 12 13 14 |
# File 'lib/basecamp/active_resource.rb', line 11 def handle_response(response) Thread.current[:active_resource_connection_headers] = response original_handle_response(response) end |
#original_handle_response ⇒ Object
8 |
# File 'lib/basecamp/active_resource.rb', line 8 alias_method :original_handle_response, :handle_response |
#response ⇒ Object
16 17 18 |
# File 'lib/basecamp/active_resource.rb', line 16 def response Thread.current[:active_resource_connection_headers] end |
#set_header(key, value) ⇒ Object
20 21 22 |
# File 'lib/basecamp/active_resource.rb', line 20 def set_header(key, value) default_header.update(key => value) end |