Class: NRB::BreweryControlSystem::HTTPService::UserAgent

Inherits:
Object
  • Object
show all
Defined in:
lib/brewery_control_system/http_service/user_agent.rb

Constant Summary collapse

NAME =
'BCS Interrogator'.freeze
URL =
'https://github.com/NewRepublicBrewing/BCS-Interrogator'.freeze

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ UserAgent

Returns a new instance of UserAgent.



19
20
21
# File 'lib/brewery_control_system/http_service/user_agent.rb', line 19

def initialize(app)
  @app = app
end

Instance Method Details

#agentObject



8
9
10
# File 'lib/brewery_control_system/http_service/user_agent.rb', line 8

def agent
  @agent ||= "#{name} #{version} (#{url})".freeze
end

#call(env) ⇒ Object



13
14
15
16
# File 'lib/brewery_control_system/http_service/user_agent.rb', line 13

def call(env)
  env[:request_headers]["User-Agent"] = agent
  @app.call(env).on_complete { }
end

#nameObject



24
# File 'lib/brewery_control_system/http_service/user_agent.rb', line 24

def name; NAME; end

#urlObject



27
# File 'lib/brewery_control_system/http_service/user_agent.rb', line 27

def url; URL; end

#versionObject



30
# File 'lib/brewery_control_system/http_service/user_agent.rb', line 30

def version; NRB::BreweryControlSystem.version; end