Class: Oare::Connection
- Inherits:
-
ActiveResource::Connection
- Object
- ActiveResource::Connection
- Oare::Connection
- Defined in:
- lib/active_resource_override/connection.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
Instance Method Summary collapse
- #get_without_decoding(path, headers = {}) ⇒ Object
- #handle_response(response) ⇒ Object
-
#initialize(token, format = ActiveResource::Formats::XmlFormat) ⇒ Connection
constructor
A new instance of Connection.
Constructor Details
#initialize(token, format = ActiveResource::Formats::XmlFormat) ⇒ Connection
Returns a new instance of Connection.
6 7 8 9 10 11 12 |
# File 'lib/active_resource_override/connection.rb', line 6 def initialize(token, format = ActiveResource::Formats::XmlFormat) @access_token = token @user = @password = nil @uri_parser = URI.const_defined?(:Parser) ? URI::Parser.new : URI self.site = access_token.consumer.site self.format = format end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
4 5 6 |
# File 'lib/active_resource_override/connection.rb', line 4 def access_token @access_token end |
Instance Method Details
#get_without_decoding(path, headers = {}) ⇒ Object
14 15 16 |
# File 'lib/active_resource_override/connection.rb', line 14 def get_without_decoding(path, headers = {}) request(:get, path, build_request_headers(headers, :get)) end |
#handle_response(response) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/active_resource_override/connection.rb', line 18 def handle_response(response) return super(response) rescue ActiveResource::ClientError => exc begin = "#{format.decode response.body}" if not .nil? or == "" exc.response.instance_eval do || @message = end end ensure raise exc end end |