Method: OpenGraphReader::Fetcher#initialize
- Defined in:
- lib/open_graph_reader/fetcher.rb
#initialize(uri) ⇒ Fetcher
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create a new fetcher.
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/open_graph_reader/fetcher.rb', line 26 def initialize uri raise ArgumentError, "url needs to be an instance of URI" unless uri.is_a? URI @uri = uri @fetch_failed = false @connection = Faraday.default_connection.dup @connection.headers.replace(HEADERS) @head_response = nil @get_response = nil prepend_middleware Faraday::CookieJar if defined? Faraday::CookieJar prepend_middleware Faraday::FollowRedirects::Middleware if defined? Faraday::FollowRedirects end |