Class: RDF::Util::File::HttpAdapter Abstract

Inherits:
Object
  • Object
show all
Defined in:
vendor/bundler/ruby/2.5.0/bundler/gems/rdf-1b20f426c35b/lib/rdf/util/file.rb

Overview

This class is abstract.

Subclass and override HttpAdapter.open_url to implement a custom adapter

Since:

  • 1.2

Direct Known Subclasses

FaradayAdapter, NetHttpAdapter, RestClientAdapter

Class Method Summary collapse

Class Method Details

.default_accept_headerString

Returns the value for an Accept header

Returns:

  • (String)

    the value for an Accept header

Since:

  • 1.2



40
41
42
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-1b20f426c35b/lib/rdf/util/file.rb', line 40

def self.default_accept_header
  (RDF::Format.accept_types + %w(*/*;q=0.1)).join(", ")
end

.headers(headers: {}) ⇒ Hash

Returns A hash of HTTP request headers

Parameters:

Returns:

  • (Hash)

    A hash of HTTP request headers

Since:

  • 1.2



33
34
35
36
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-1b20f426c35b/lib/rdf/util/file.rb', line 33

def self.headers headers: {}
  headers['Accept'] ||= default_accept_header
  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.

Parameters:

  • base_uri (String)

    to open

  • proxy (String)

    HTTP Proxy to use for requests.

  • headers (Array, String)

    ({}) HTTP Request headers

  • verify_none (Boolean)

    (false) Don't verify SSL certificates

  • options (Hash{Symbol => Object})

    options are ignored in this implementation. Applications are encouraged to override this implementation to provide more control over HTTP headers and redirect following.

Returns:

Raises:

  • (IOError)

    if not found

Since:

  • 1.2



59
60
61
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-1b20f426c35b/lib/rdf/util/file.rb', line 59

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