module Songkick::Transport::Authentication
Public Instance Methods
basic_auth_headers(credentials)
click to toggle source
# File lib/songkick/transport/authentication.rb, line 9 def basic_auth_headers(credentials) username = credentials.fetch(:username) password = credentials.fetch(:password) encoded_creds = strict_encode64("#{username}:#{password}") Headers.new({"Authorization" => "Basic #{encoded_creds}"}) end
strict_encode64(str)
click to toggle source
Base64.strict_encode64 is not available on Ruby 1.8.7
# File lib/songkick/transport/authentication.rb, line 17 def strict_encode64(str) if Base64.respond_to?(:strict_encode64) Base64.strict_encode64(str) else Base64.encode64(str).gsub("\n", '') end end