Class: Soup::Agent
- Inherits:
-
Object
- Object
- Soup::Agent
- Extended by:
- Forwardable
- Defined in:
- lib/soup-client/agent.rb
Instance Method Summary collapse
- #faraday(domain) ⇒ Object
-
#initialize(domain = 'https://www.soup.io/') ⇒ Agent
constructor
A new instance of Agent.
Constructor Details
#initialize(domain = 'https://www.soup.io/') ⇒ Agent
Returns a new instance of Agent.
8 9 10 |
# File 'lib/soup-client/agent.rb', line 8 def initialize(domain = 'https://www.soup.io/') @agent ||= faraday(domain) end |
Instance Method Details
#faraday(domain) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/soup-client/agent.rb', line 14 def faraday(domain) Faraday.new(url: domain) do |builder| builder.use Faraday::Request::UrlEncoded builder.use Faraday::Response::Logger builder.use Faraday::Adapter::NetHttp end end |