Class: ShippingEasy::Http::FaradayAdapter::CustomUserAgent

Inherits:
Faraday::Middleware
  • Object
show all
Defined in:
lib/shipping_easy/http/faraday_adapter.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, agent_string) ⇒ CustomUserAgent

Returns a new instance of CustomUserAgent.



41
42
43
44
# File 'lib/shipping_easy/http/faraday_adapter.rb', line 41

def initialize(app, agent_string)
  super(app)
  @agent_string = agent_string
end

Instance Method Details

#call(env) ⇒ Object



46
47
48
49
# File 'lib/shipping_easy/http/faraday_adapter.rb', line 46

def call(env)
  env[:request_headers]['User-Agent'] = @agent_string
  @app.call(env)
end