Module: TwitterTweetBot::API::HTTP::Headers

Included in:
TwitterTweetBot::API::HTTP
Defined in:
lib/twitter_tweet_bot/api/http/headers.rb

Constant Summary collapse

BASIC_AUTHORIZATION =
'Basic %<credentials>s'.freeze
BEARER_AUTHORIZATION =
'Bearer %<credentials>s'.freeze

Instance Method Summary collapse

Instance Method Details

#basic_authorization_header(user, password) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/twitter_tweet_bot/api/http/headers.rb', line 12

def basic_authorization_header(user, password)
  {
    authorization: format(
      BASIC_AUTHORIZATION,
      credentials: authorization_credentials(user, password)
    )
  }
end

#bearer_authorization_header(credentials) ⇒ Object



21
22
23
# File 'lib/twitter_tweet_bot/api/http/headers.rb', line 21

def bearer_authorization_header(credentials)
  { authorization: format(BEARER_AUTHORIZATION, credentials: credentials) }
end