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

Inherits:
Object
  • Object
show all
Defined in:
vendor/bundler/ruby/2.4.0/bundler/gems/json-ld-4e9cdb2fc35e/lib/json/ld/api.rb

Overview

A RemoteDocument is returned from a documentLoader.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, document, context_url = nil) ⇒ RemoteDocument

Returns a new instance of RemoteDocument

Parameters:

  • url (String)

    URL of the loaded document, after redirects

  • document (String, Array<Hash>, Hash)

    The retrieved document, either as raw text or parsed JSON

  • context_url (String) (defaults to: nil)

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



587
588
589
590
591
# File 'vendor/bundler/ruby/2.4.0/bundler/gems/json-ld-4e9cdb2fc35e/lib/json/ld/api.rb', line 587

def initialize(url, document, context_url = nil)
  @documentUrl = url
  @document = document
  @contextUrl = context_url
end

Instance Attribute Details

#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



580
581
582
# File 'vendor/bundler/ruby/2.4.0/bundler/gems/json-ld-4e9cdb2fc35e/lib/json/ld/api.rb', line 580

def contextUrl
  @contextUrl
end

#documentString, ... (readonly)

Returns The retrieved document, either as raw text or parsed JSON

Returns:



576
577
578
# File 'vendor/bundler/ruby/2.4.0/bundler/gems/json-ld-4e9cdb2fc35e/lib/json/ld/api.rb', line 576

def document
  @document
end

#documentUrlString (readonly)

Returns URL of the loaded document, after redirects

Returns:

  • (String)

    URL of the loaded document, after redirects



572
573
574
# File 'vendor/bundler/ruby/2.4.0/bundler/gems/json-ld-4e9cdb2fc35e/lib/json/ld/api.rb', line 572

def documentUrl
  @documentUrl
end