Module: ActiveResource::Extend::AuthWithApiKey::ClassMethods

Defined in:
lib/ares/add_api_key.rb

Instance Method Summary collapse

Instance Method Details

#api_clientObject



28
29
30
31
32
33
34
35
# File 'lib/ares/add_api_key.rb', line 28

def api_client
  # Not using superclass_delegating_reader. See +site+ for explanation
  if defined?(@api_client)
    @api_client
  elsif superclass != Object && superclass.api_client
    superclass.api_client.dup.freeze
  end
end

#api_client=(api_client) ⇒ Object



37
38
39
# File 'lib/ares/add_api_key.rb', line 37

def api_client=(api_client)
  @api_client = api_client
end

#api_keyObject



15
16
17
18
19
20
21
22
# File 'lib/ares/add_api_key.rb', line 15

def api_key
  # Not using superclass_delegating_reader. See +site+ for explanation
  if defined?(@api_key)
    @api_key
  elsif superclass != Object && superclass.api_key
    superclass.api_key.dup.freeze
  end
end

#api_key=(api_key) ⇒ Object



24
25
26
# File 'lib/ares/add_api_key.rb', line 24

def api_key=(api_key)
  @api_key = api_key
end

#headers_with_authObject



41
42
43
44
45
46
47
# File 'lib/ares/add_api_key.rb', line 41

def headers_with_auth
  if (api_key.nil? || api_client.nil?)
    headers_without_auth
  else
    headers_without_auth.merge({"Ft-Api-Key" => self.api_key, "Ft-Client" => self.api_client})
  end
end