class Faraday::Conductivity::UserAgent
Public Class Methods
new(app, options = {})
click to toggle source
Calls superclass method
# File lib/faraday/conductivity/user_agent.rb, line 8 def initialize(app, options = {}) super(app) @name = options.fetch(:app) { "Faraday" } @version = options.fetch(:version) { "0.0" } @environment = options.fetch(:environment) { Environment.new } end
Public Instance Methods
app()
click to toggle source
# File lib/faraday/conductivity/user_agent.rb, line 24 def app "#{@name}/#{@version} (#{@environment.hostname}; #{@environment.login}; #{@environment.pid})" end
call(env)
click to toggle source
# File lib/faraday/conductivity/user_agent.rb, line 15 def call(env) env[:request_headers]['User-Agent'] = user_agent @app.call(env) end
ruby()
click to toggle source
# File lib/faraday/conductivity/user_agent.rb, line 28 def ruby "#{RUBY_ENGINE}/#{RUBY_VERSION} (#{RUBY_PATCHLEVEL}; #{RUBY_PLATFORM})" end
user_agent()
click to toggle source
# File lib/faraday/conductivity/user_agent.rb, line 20 def user_agent [ app, ruby ].join(' ') end