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

Inherits:
Object
  • Object
show all
Defined in:
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=‘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):

  • options (Hash{Symbol => Object})


826
827
828
829
830
831
832
# File 'lib/json/ld/api.rb', line 826

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:

  • (String)


802
803
804
# File 'lib/json/ld/api.rb', line 802

def contentType
  @contentType
end

#contextUrlString

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

Returns:



806
807
808
# File 'lib/json/ld/api.rb', line 806

def contextUrl
  @contextUrl
end

#documentArray<Hash>, Hash

The parsed retrieved document.

Returns:



810
811
812
# File 'lib/json/ld/api.rb', line 810

def document
  @document
end

#documentUrlString

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

Returns:

  • (String)


798
799
800
# File 'lib/json/ld/api.rb', line 798

def documentUrl
  @documentUrl
end

#profileString

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

Returns:

  • (String)


814
815
816
# File 'lib/json/ld/api.rb', line 814

def profile
  @profile
end