class ROBundle::Proxy

A class to represent an ORE Proxy for an Aggregate as per the specification

of the

{JSON structure}[https://researchobject.github.io/specifications/bundle/#json-structure]
of the manifest.

Public Class Methods

new click to toggle source
new(folder)
new(folder, filename)

Create a new ORE Proxy. If folder is not supplied then “/” is assumed.

Calls superclass method ROBundle::ManifestEntry::new
   # File lib/ro-bundle/ro/proxy.rb
24 def initialize(object = "", filename = nil)
25   super()
26 
27   if object.instance_of?(Hash)
28     @structure = object
29     init_provenance_defaults(@structure)
30   else
31     @structure = {}
32     @structure[:uri] = UUID.generate(:urn)
33     @structure[:folder] = folder_slashes(object)
34     @structure[:filename] = filename
35   end
36 end

Public Instance Methods

filename click to toggle source

Return the filename field of this Proxy.

   # File lib/ro-bundle/ro/proxy.rb
50 def filename
51   @structure[:filename]
52 end
folder click to toggle source

Return the folder field of this Proxy.

   # File lib/ro-bundle/ro/proxy.rb
42 def folder
43   @structure[:folder]
44 end
to_json(options = nil) → String click to toggle source

Write this Proxy out as a json string. Takes the same options as JSON#generate.

   # File lib/ro-bundle/ro/proxy.rb
67 def to_json(*a)
68   JSON.generate(Util.clean_json(@structure),*a)
69 end
uri → String in the form of a urn:uuid URI. click to toggle source

Return the annotation id of this Annotation.

   # File lib/ro-bundle/ro/proxy.rb
58 def uri
59   @structure[:uri]
60 end

Private Instance Methods

folder_slashes(folder) click to toggle source
   # File lib/ro-bundle/ro/proxy.rb
73 def folder_slashes(folder)
74   folder = "/#{folder}" unless folder.start_with?('/')
75   folder = "#{folder}/" unless folder.end_with?('/')
76   folder
77 end