Module: Wayback::Default
- Defined in:
- lib/wayback/default.rb
Constant Summary collapse
- ENDPOINT =
'http://web.archive.org'
- ENDPOINT_PATH =
'/web'
- CONNECTION_OPTIONS =
{ :headers => {:user_agent => "Wayback Ruby Gem #{Wayback::Version}"}, :request => {:open_timeout => 5, :timeout => 10}, :ssl => {:verify => false}, }
- IDENTITY_MAP =
false
- MIDDLEWARE =
Faraday::Builder.new do |builder| # Convert request params to "www-form-urlencoded" builder.use Faraday::Request::UrlEncoded # Follow redirects builder.use FaradayMiddleware::FollowRedirects # Handle 4xx server responses builder.use Wayback::Response::RaiseError, Wayback::Error::ClientError # Handle 5xx server responses builder.use Wayback::Response::RaiseError, Wayback::Error::ServerError # Parse memento page builder.use Wayback::Response::ParseMementoPage # Parse link-format with custom memento parser builder.use Wayback::Response::ParseMemento # Set Faraday's HTTP adapter builder.adapter Faraday.default_adapter end
Class Method Summary collapse
- .connection_options ⇒ Object
- .endpoint ⇒ String
- .endpoint_path ⇒ Object
- .identity_map ⇒ Object
- .middleware ⇒ Faraday::Builder
- .options ⇒ Hash
Class Method Details
.connection_options ⇒ Object
55 56 57 |
# File 'lib/wayback/default.rb', line 55 def CONNECTION_OPTIONS end |
.endpoint ⇒ String
Note:
This is configurable in case you want to use a Wayback Machine-compatible endpoint.
47 48 49 |
# File 'lib/wayback/default.rb', line 47 def endpoint ENDPOINT end |
.endpoint_path ⇒ Object
51 52 53 |
# File 'lib/wayback/default.rb', line 51 def endpoint_path ENDPOINT_PATH end |
.identity_map ⇒ Object
59 60 61 |
# File 'lib/wayback/default.rb', line 59 def identity_map IDENTITY_MAP end |
.middleware ⇒ Faraday::Builder
Note:
Faraday's middleware stack implementation is comparable to that of Rack middleware. The order of middleware is important: the first middleware on the list wraps all others, while the last middleware is the innermost one.
67 68 69 |
# File 'lib/wayback/default.rb', line 67 def middleware MIDDLEWARE end |
.options ⇒ Hash
41 42 43 |
# File 'lib/wayback/default.rb', line 41 def Hash[Wayback::Configurable.keys.map{|key| [key, send(key)]}] end |