Module: FedoraLens

Extended by:
ActiveSupport::Autoload, ActiveSupport::Concern
Included in:
TestClass
Defined in:
lib/fedora_lens.rb,
lib/fedora_lens/core.rb,
lib/fedora_lens/lens.rb,
lib/fedora_lens/errors.rb,
lib/fedora_lens/lenses.rb,
lib/fedora_lens/version.rb,
lib/fedora_lens/lens_tests.rb,
lib/fedora_lens/attribute_methods.rb,
lib/fedora_lens/attribute_methods/read.rb,
lib/fedora_lens/attribute_methods/write.rb,
lib/fedora_lens/attribute_methods/declarations.rb

Defined Under Namespace

Modules: AttributeMethods, Core, LensTests, Lenses Classes: AttributeNotSupportedError, FedoraLensError, Lens, RecordNotSaved

Constant Summary collapse

HOST =
"http://localhost:8983/fedora/rest"
VERSION =
'0.0.12'

Class Method Summary collapse

Class Method Details

.base_pathObject



35
36
37
# File 'lib/fedora_lens/core.rb', line 35

def base_path
  @@base_path ||= ''
end

.base_path=(path) ⇒ Object

Set a base path if you want to put all your objects below a certain path example:

FedoraLens.base_path = '/text


42
43
44
# File 'lib/fedora_lens/core.rb', line 42

def base_path= path
  @@base_path =  path
end

.connectionObject



27
28
29
# File 'lib/fedora_lens/core.rb', line 27

def connection
  @@connection ||= Ldp::Client.new(host)
end

.hostObject



31
32
33
# File 'lib/fedora_lens/core.rb', line 31

def host
  HOST
end

.id_to_uri(id) ⇒ Object



46
47
48
49
50
# File 'lib/fedora_lens/core.rb', line 46

def id_to_uri(id)
  id = "/#{id}" unless id.start_with? '/'
  id = FedoraLens.base_path + id unless id.start_with? "#{FedoraLens.base_path}/"
  FedoraLens.host + id
end

.uri_to_id(uri) ⇒ Object



52
53
54
# File 'lib/fedora_lens/core.rb', line 52

def uri_to_id(uri)
  uri.to_s.sub(FedoraLens.host + FedoraLens.base_path, '')
end