Module: Songkick::Transport::Authentication
- Extended by:
- Authentication
- Included in:
- Authentication
- Defined in:
- lib/songkick/transport/authentication.rb
Instance Method Summary collapse
- #basic_auth_headers(credentials) ⇒ Object
-
#strict_encode64(str) ⇒ Object
Base64.strict_encode64 is not available on Ruby 1.8.7.
Instance Method Details
#basic_auth_headers(credentials) ⇒ Object
9 10 11 12 13 14 |
# 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) ⇒ Object
Base64.strict_encode64 is not available on Ruby 1.8.7
17 18 19 20 21 22 23 |
# 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 |