Class: Fedora::Datastream

Inherits:
BaseObject show all
Defined in:
lib/fedora/datastream.rb

Instance Attribute Summary

Attributes inherited from BaseObject

#attributes, #blob, #errors, #new_object

Instance Method Summary collapse

Methods inherited from BaseObject

#[], #new_object?

Constructor Details

#initialize(attrs = nil) ⇒ Datastream

Returns a new instance of Datastream.



5
6
7
8
# File 'lib/fedora/datastream.rb', line 5

def initialize(attrs = nil)
  super
  self.control_group='M' if @attributes[:mimeType]
end

Instance Method Details

#control_groupObject



14
15
16
# File 'lib/fedora/datastream.rb', line 14

def control_group
  @attributes[:controlGroup]
end

#control_group=(cg) ⇒ Object



17
18
19
# File 'lib/fedora/datastream.rb', line 17

def control_group=(cg)
  @attributes[:controlGroup]=cg
end

#dsidObject



21
22
23
24
25
26
27
# File 'lib/fedora/datastream.rb', line 21

def dsid
  if attributes.has_key?(:dsid) 
    attributes[:dsid]
  else
    attributes[:dsID]
  end
end

#labelObject



29
30
31
# File 'lib/fedora/datastream.rb', line 29

def label
  @attributes[:dsLabel]
end

#label=(new_label) ⇒ Object



33
34
35
# File 'lib/fedora/datastream.rb', line 33

def label=(new_label)
  @attributes[:dsLabel] = new_label
end

#pidObject



10
11
12
# File 'lib/fedora/datastream.rb', line 10

def pid
  attributes[:pid]
end

#uriObject



38
39
40
# File 'lib/fedora/datastream.rb', line 38

def uri
  "fedora:info/#{pid}/datastreams/#{dsid}"
end

#urlObject



43
44
45
# File 'lib/fedora/datastream.rb', line 43

def url
  return "#{Fedora::Repository.instance.base_url}/objects/#{pid}/datastreams/#{dsid}"
end