class RDF::Util::File::HttpAdapter
@abstract Subclass and override {.open_url} to implement a custom adapter @since 1.2
Public Class Methods
default_accept_header()
click to toggle source
@return [String] the value for an Accept header
# 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()
click to toggle source
@return [String] the default User-Agent used when fetching resources.
# File lib/rdf/util/file.rb, line 47 def self.default_user_agent "Ruby RDF.rb/#{RDF::VERSION}" end
headers(headers: {})
click to toggle source
@param [Array, String] headers
HTTP Request headers
@return [Hash] A hash of HTTP request headers
# 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)
click to toggle source
@abstract @param [String] base_uri to open @param [String] proxy
HTTP Proxy to use for requests.
@param [Array, String] headers ({})
HTTP Request headers Defaults `Accept` header based on available reader content types to allow for content negotiation based on available readers. Defaults `User-Agent` header, unless one is specified.
@param [Boolean] verify_none (false)
Don't verify SSL certificates
@param [Hash{Symbol => Object}] options
options are ignored in this implementation. Applications are encouraged to override this implementation to provide more control over HTTP headers and redirect following.
@return [RemoteDocument, Object] A {RemoteDocument}. If a block is given, the result of evaluating the block is returned. @raise [IOError] if not found
# File lib/rdf/util/file.rb, line 70 def self.open_url(base_uri, proxy: nil, headers: {}, verify_none: false, **options) raise NoMethodError.new("#{self.inspect} does not implement required method `open_url` for ", "open_url") end