Class: JSON::LD::API::RemoteDocument

Inherits:
Object
  • Object
show all
Defined in:
vendor/bundler/ruby/2.7.0/bundler/gems/json-ld-5c6f8d6f7620/lib/json/ld/api.rb

Overview

A RemoteDocument is returned from a documentLoader.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(document, documentUrl: nil, contentType: nil, contextUrl: nil, profile: nil, **options) ⇒ RemoteDocument

Returns a new instance of RemoteDocument.

Parameters:

  • document (RDF::Util::File::RemoteDocument)
  • documentUrl (String) (defaults to: nil)

    The final URL of the loaded document. This is important to handle HTTP redirects properly.

  • contentType (String) (defaults to: nil)

    The Content-Type of the loaded document, exclusive of any optional parameters.

  • contextUrl (String) (defaults to: nil)

    The URL of a remote context as specified by an HTTP Link header with rel=http://www.w3.org/ns/json-ld#context

  • profile (String) (defaults to: nil)

    The value of any profile parameter retrieved as part of the original contentType.

  • options (Hash)

    a customizable set of options

Options Hash (**options):



816
817
818
819
820
821
822
# File 'vendor/bundler/ruby/2.7.0/bundler/gems/json-ld-5c6f8d6f7620/lib/json/ld/api.rb', line 816

def initialize(document, documentUrl: nil, contentType: nil, contextUrl: nil, profile: nil, **options)
  @document = document
  @documentUrl = documentUrl || options[:base_uri]
  @contentType = contentType || options[:content_type]
  @contextUrl = contextUrl
  @profile = profile
end

Instance Attribute Details

#contentTypeString (readonly)

The Content-Type of the loaded document, exclusive of any optional parameters.

Returns:



792
793
794
# File 'vendor/bundler/ruby/2.7.0/bundler/gems/json-ld-5c6f8d6f7620/lib/json/ld/api.rb', line 792

def contentType
  @contentType
end

#contextUrlString

Returns The URL of a remote context as specified by an HTTP Link header with rel=http://www.w3.org/ns/json-ld#context.

Returns:

  • (String)

    The URL of a remote context as specified by an HTTP Link header with rel=http://www.w3.org/ns/json-ld#context



796
797
798
# File 'vendor/bundler/ruby/2.7.0/bundler/gems/json-ld-5c6f8d6f7620/lib/json/ld/api.rb', line 796

def contextUrl
  @contextUrl
end

#documentArray<Hash>, Hash

The parsed retrieved document.

Returns:



800
801
802
# File 'vendor/bundler/ruby/2.7.0/bundler/gems/json-ld-5c6f8d6f7620/lib/json/ld/api.rb', line 800

def document
  @document
end

#documentUrlString

The final URL of the loaded document. This is important to handle HTTP redirects properly.

Returns:



788
789
790
# File 'vendor/bundler/ruby/2.7.0/bundler/gems/json-ld-5c6f8d6f7620/lib/json/ld/api.rb', line 788

def documentUrl
  @documentUrl
end

#profileString

The value of any profile parameter retrieved as part of the original contentType.

Returns:



804
805
806
# File 'vendor/bundler/ruby/2.7.0/bundler/gems/json-ld-5c6f8d6f7620/lib/json/ld/api.rb', line 804

def profile
  @profile
end