Class: SimpleConnect::BearerHeaders
- Inherits:
-
Object
- Object
- SimpleConnect::BearerHeaders
- Defined in:
- lib/simple_connect/bearer_headers.rb
Overview
Builds Bearer-auth request headers (Content-Type + User-Agent + Authorization) for the account Message API. Same #build_for(body) interface as Headers, so Request can use either interchangeably — but this one performs no body signing. One instance per MessagesClient; holds the api_key so callers never see it.
Instance Method Summary collapse
- #build_for(_body) ⇒ Object
-
#initialize(api_key:, user_agent: nil) ⇒ BearerHeaders
constructor
A new instance of BearerHeaders.
Constructor Details
#initialize(api_key:, user_agent: nil) ⇒ BearerHeaders
Returns a new instance of BearerHeaders.
10 11 12 13 |
# File 'lib/simple_connect/bearer_headers.rb', line 10 def initialize(api_key:, user_agent: nil) @api_key = api_key.to_s @user_agent = (user_agent || Headers.default_user_agent).to_s end |
Instance Method Details
#build_for(_body) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/simple_connect/bearer_headers.rb', line 15 def build_for(_body) { "Content-Type" => "application/json", "User-Agent" => @user_agent, "Authorization" => "Bearer #{@api_key}" } end |