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

Defined in:
lib/ares/add_api_key.rb

Instance Method Summary collapse

Instance Method Details

#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



28
29
30
# File 'lib/ares/add_api_key.rb', line 28

def headers_with_auth
  api_key.nil? ? headers_without_auth : headers_without_auth.merge({"Ft-Api-Key" => self.api_key})
end