Module: Wayback::Default
- Defined in:
- lib/wayback/default.rb
Constant Summary collapse
- ENDPOINT =
'http://web.archive.org'
- ENDPOINT_PATH =
'/web'
- JSON_ENDPOINT =
'http://archive.org'
- JSON_ENDPOINT_PATH =
'/wayback'
- 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 closest available JSON result builder.use Wayback::Response::ParseAvailablity # 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
- .json_endpoint ⇒ Object
- .json_endpoint_path ⇒ Object
- .middleware ⇒ Faraday::Builder
- .options ⇒ Hash
Class Method Details
.connection_options ⇒ Object
68 69 70 |
# File 'lib/wayback/default.rb', line 68 def CONNECTION_OPTIONS end |
.endpoint ⇒ String
Note:
This is configurable in case you want to use a Wayback Machine-compatible endpoint.
52 53 54 |
# File 'lib/wayback/default.rb', line 52 def endpoint ENDPOINT end |
.endpoint_path ⇒ Object
56 57 58 |
# File 'lib/wayback/default.rb', line 56 def endpoint_path ENDPOINT_PATH end |
.identity_map ⇒ Object
72 73 74 |
# File 'lib/wayback/default.rb', line 72 def identity_map IDENTITY_MAP end |
.json_endpoint ⇒ Object
60 61 62 |
# File 'lib/wayback/default.rb', line 60 def json_endpoint JSON_ENDPOINT end |
.json_endpoint_path ⇒ Object
64 65 66 |
# File 'lib/wayback/default.rb', line 64 def json_endpoint_path JSON_ENDPOINT_PATH 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.
80 81 82 |
# File 'lib/wayback/default.rb', line 80 def middleware MIDDLEWARE end |
.options ⇒ Hash
46 47 48 |
# File 'lib/wayback/default.rb', line 46 def Hash[Wayback::Configurable.keys.map{|key| [key, send(key)]}] end |