Class: MAuth::Faraday::MAuthClientUserAgent
- Inherits:
-
Object
- Object
- MAuth::Faraday::MAuthClientUserAgent
- Defined in:
- lib/mauth/faraday.rb
Overview
add MAuth-Client’s user-agent to a request
Instance Method Summary collapse
- #call(request_env) ⇒ Object
-
#initialize(app, agent_base = "Mauth-Client") ⇒ MAuthClientUserAgent
constructor
A new instance of MAuthClientUserAgent.
Constructor Details
#initialize(app, agent_base = "Mauth-Client") ⇒ MAuthClientUserAgent
Returns a new instance of MAuthClientUserAgent.
89 90 91 92 |
# File 'lib/mauth/faraday.rb', line 89 def initialize(app, agent_base = "Mauth-Client") @app = app @agent_base = agent_base end |
Instance Method Details
#call(request_env) ⇒ Object
94 95 96 97 98 |
# File 'lib/mauth/faraday.rb', line 94 def call(request_env) agent = "#{@agent_base} (MAuth-Client: #{MAuth::VERSION}; Ruby: #{RUBY_VERSION}; platform: #{RUBY_PLATFORM})" request_env[:request_headers]['User-Agent'] ||= agent @app.call(request_env) end |