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

Inherits:
Object
  • Object
show all
Defined in:
vendor/bundler/ruby/2.6.0/bundler/gems/json-ld-94ee7791d19f/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:

Options Hash (**options):



806
807
808
809
810
811
812
# File 'vendor/bundler/ruby/2.6.0/bundler/gems/json-ld-94ee7791d19f/lib/json/ld/api.rb', line 806

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:



790
791
792
# File 'vendor/bundler/ruby/2.6.0/bundler/gems/json-ld-94ee7791d19f/lib/json/ld/api.rb', line 790

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



794
795
796
# File 'vendor/bundler/ruby/2.6.0/bundler/gems/json-ld-94ee7791d19f/lib/json/ld/api.rb', line 794

def contextUrl
  @contextUrl
end

#documentArray<Hash>, Hash

The parsed retrieved document.

Returns:



798
799
800
# File 'vendor/bundler/ruby/2.6.0/bundler/gems/json-ld-94ee7791d19f/lib/json/ld/api.rb', line 798

def document
  @document
end

#documentUrlString

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

Returns:



786
787
788
# File 'vendor/bundler/ruby/2.6.0/bundler/gems/json-ld-94ee7791d19f/lib/json/ld/api.rb', line 786

def documentUrl
  @documentUrl
end

#profileString

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

Returns:



802
803
804
# File 'vendor/bundler/ruby/2.6.0/bundler/gems/json-ld-94ee7791d19f/lib/json/ld/api.rb', line 802

def profile
  @profile
end