Module: EndPointBlank::AuthorizationMethods::ClassMethods

Defined in:
lib/end_point_blank/authorization.rb

Instance Method Summary collapse

Instance Method Details

#configurationObject



8
9
10
# File 'lib/end_point_blank/authorization.rb', line 8

def configuration
  EndPointBlank::Configuration.instance
end

#header(hostname = nil) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/end_point_blank/authorization.rb', line 12

def header(hostname = nil)
  token = nil
  token = EndPointBlank::AccessTokens.token(hostname) if hostname

  if token
    "Bearer " + token
  else
    "Basic " + Base64.encode64(configuration.client_id + ":" + configuration.client_secret).gsub("\n", "")
  end
end