Class: JSON::LD::API::RemoteDocument
- Inherits:
-
Object
- Object
- JSON::LD::API::RemoteDocument
- Defined in:
- lib/json/ld/api.rb
Overview
A RemoteDocument is returned from a documentLoader.
Instance Attribute Summary collapse
-
#contentType ⇒ String
readonly
The Content-Type of the loaded document, exclusive of any optional parameters.
-
#contextUrl ⇒ String
The URL of a remote context as specified by an HTTP Link header with rel=‘www.w3.org/ns/json-ld#context`.
-
#document ⇒ Array<Hash>, Hash
The parsed retrieved document.
-
#documentUrl ⇒ String
The final URL of the loaded document.
-
#profile ⇒ String
The value of any profile parameter retrieved as part of the original contentType.
Instance Method Summary collapse
-
#initialize(document, documentUrl: nil, contentType: nil, contextUrl: nil, profile: nil, **options) ⇒ RemoteDocument
constructor
A new instance of RemoteDocument.
Constructor Details
#initialize(document, documentUrl: nil, contentType: nil, contextUrl: nil, profile: nil, **options) ⇒ RemoteDocument
Returns a new instance of RemoteDocument.
817 818 819 820 821 822 823 |
# File 'lib/json/ld/api.rb', line 817 def initialize(document, documentUrl: nil, contentType: nil, contextUrl: nil, profile: nil, **) @document = document @documentUrl = documentUrl || [:base_uri] @contentType = contentType || [:content_type] @contextUrl = contextUrl @profile = profile end |
Instance Attribute Details
#contentType ⇒ String (readonly)
The Content-Type of the loaded document, exclusive of any optional parameters.
793 794 795 |
# File 'lib/json/ld/api.rb', line 793 def contentType @contentType end |
#contextUrl ⇒ String
Returns The URL of a remote context as specified by an HTTP Link header with rel=‘www.w3.org/ns/json-ld#context`.
797 798 799 |
# File 'lib/json/ld/api.rb', line 797 def contextUrl @contextUrl end |
#document ⇒ Array<Hash>, Hash
The parsed retrieved document.
801 802 803 |
# File 'lib/json/ld/api.rb', line 801 def document @document end |
#documentUrl ⇒ String
The final URL of the loaded document. This is important to handle HTTP redirects properly.
789 790 791 |
# File 'lib/json/ld/api.rb', line 789 def documentUrl @documentUrl end |
#profile ⇒ String
The value of any profile parameter retrieved as part of the original contentType.
805 806 807 |
# File 'lib/json/ld/api.rb', line 805 def profile @profile end |