Class: RDF::Util::File::HttpAdapter Abstract
- Inherits:
-
Object
- Object
- RDF::Util::File::HttpAdapter
- Defined in:
- lib/rdf/util/file.rb
Overview
This class is abstract.
Subclass and override HttpAdapter.open_url to implement a custom adapter
Direct Known Subclasses
Class Method Summary collapse
-
.default_accept_header ⇒ String
The value for an Accept header.
-
.default_user_agent ⇒ String
The default User-Agent used when fetching resources.
-
.headers(headers: {}) ⇒ Hash
A hash of HTTP request headers.
- .open_url(base_uri, proxy: nil, headers: {}, verify_none: false, **options) ⇒ RemoteDocument, Object abstract
Class Method Details
.default_accept_header ⇒ String
Returns the value for an Accept header.
41 42 43 |
# File 'lib/rdf/util/file.rb', line 41 def self.default_accept_header (RDF::Format.accept_types + %w(*/*;q=0.1)).join(", ") end |
.default_user_agent ⇒ String
Returns the default User-Agent used when fetching resources.
47 48 49 |
# File 'lib/rdf/util/file.rb', line 47 def self.default_user_agent "Ruby RDF.rb/#{RDF::VERSION}" end |
.headers(headers: {}) ⇒ Hash
Returns A hash of HTTP request headers.
33 34 35 36 37 |
# File 'lib/rdf/util/file.rb', line 33 def self.headers headers: {} headers['Accept'] ||= default_accept_header headers['User-Agent'] ||= default_user_agent headers end |
.open_url(base_uri, proxy: nil, headers: {}, verify_none: false, **options) ⇒ RemoteDocument, Object
This method is abstract.
Returns A RemoteDocument. If a block is given, the result of evaluating the block is returned.
70 71 72 |
# File 'lib/rdf/util/file.rb', line 70 def self.open_url(base_uri, proxy: nil, headers: {}, verify_none: false, **) raise NoMethodError.new("#{self.inspect} does not implement required method `open_url` for ", "open_url") end |