class BRL::Auth::Connection

Constants

ACCEPT
CONTENT_TYPE

Public Class Methods

new(request_class: Faraday, base_url: BRL.configuration.auth_base_url) click to toggle source
Calls superclass method
# File lib/brl/auth/connection.rb, line 9
def initialize(request_class: Faraday, base_url: BRL.configuration.auth_base_url)
  super(request_class: request_class, base_url: base_url)
end

Public Instance Methods

default_headers() click to toggle source
# File lib/brl/auth/connection.rb, line 13
def default_headers
  {
    "Accept": "application/json",
    "Authorization": authorization_string,
    "Content-Type": CONTENT_TYPE
  }
end

Protected Instance Methods

authorization_string() click to toggle source
# File lib/brl/auth/connection.rb, line 22
def authorization_string
  handshake = BRL.configuration.handshake.strip
  secret_key = BRL.configuration.secret_key.strip
  auth_string = ::Base64.strict_encode64("#{handshake}:#{secret_key}")

  "basic #{auth_string}"
end