Method: ActiveResource::Base.connection

Defined in:
lib/active_resource/base.rb

.connection(refresh = false) ⇒ Object

An instance of ActiveResource::Connection that is the base \connection to the remote service. The refresh parameter toggles whether or not the \connection is refreshed at every request or not (defaults to false).



637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
# File 'lib/active_resource/base.rb', line 637

def connection(refresh = false)
  if _connection_defined? || superclass == Object
    self._connection = connection_class.new(site, format) if refresh || _connection.nil?
    _connection.proxy = proxy if proxy
    _connection.user = user if user
    _connection.password = password if password
    _connection.auth_type = auth_type if auth_type
    _connection.timeout = timeout if timeout
    _connection.open_timeout = open_timeout if open_timeout
    _connection.read_timeout = read_timeout if read_timeout
    _connection.ssl_options = ssl_options if ssl_options
    _connection
  else
    superclass.connection
  end
end