Class: Mashape::AuthenticationUtils

Inherits:
Object
  • Object
show all
Defined in:
lib/authentication/authentication_utils.rb

Class Method Summary collapse

Class Method Details

.generateBasicAuthHeader(username, password) ⇒ Object



12
13
14
15
16
17
# File 'lib/authentication/authentication_utils.rb', line 12

def AuthenticationUtils.generateBasicAuthHeader(username, password)
  unless username.empty? || password.empty?
    auth = {"Authorization" => "Basic " + Base64.encode64(username + ":" + password).chomp.gsub(/\n/,'')}
  end
  return auth
end

.generateMashapeAuthHeader(mashape_key) ⇒ Object



8
9
10
# File 'lib/authentication/authentication_utils.rb', line 8

def AuthenticationUtils.generateMashapeAuthHeader(mashape_key)
  return {"X-Mashape-Authorization" => mashape_key}
end