Class: ActiveResource::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/active_resource/conditional_get/base.rb

Class Method Summary collapse

Class Method Details

.connection_with_cache(refresh = false) ⇒ Object Also known as: connection



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/active_resource/conditional_get/base.rb', line 10

def connection_with_cache(refresh = false)
  if defined?(@connection) || superclass == Object
    @connection = Connection.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.ssl_options = ssl_options if ssl_options
    @connection.cache = cache if cache
    @connection
  else
    superclass.connection
  end
end