Module: ApiAuth::Rails::ActiveResourceExtension::ActiveResourceApiAuth::ClassMethods

Defined in:
lib/api_auth/railtie.rb

Instance Method Summary collapse

Instance Method Details

#connection_with_auth(refresh = false) ⇒ Object


42
43
44
45
46
47
48
49
# File 'lib/api_auth/railtie.rb', line 42

def connection_with_auth(refresh = false)
  c = connection_without_auth(refresh)
  c.hmac_access_id = hmac_access_id
  c.hmac_secret_key = hmac_secret_key
  c.use_hmac = use_hmac
  c.api_auth_options = api_auth_options
  c
end

#with_api_auth(access_id, secret_key, options = {}) ⇒ Object


30
31
32
33
34
35
36
37
38
39
40
# File 'lib/api_auth/railtie.rb', line 30

def with_api_auth(access_id, secret_key, options = {})
  self.hmac_access_id = access_id
  self.hmac_secret_key = secret_key
  self.use_hmac = true
  self.api_auth_options = options

  class << self
    alias_method :connection_without_auth, :connection
    alias_method :connection,              :connection_with_auth
  end
end