Class: ONIX::ResourceVersion
Instance Attribute Summary
Attributes included from Attributes
#attributes
Instance Method Summary
collapse
Methods inherited from SubsetDSL
element, elements, #get_class, get_class, inherited, #initialize, n, #parse, ref_to_short, register_elements, register_scopes, #register_subset_array, registered_elements, #registered_elements, registered_scopes, scope, short_to_ref
Methods inherited from Subset
parse, #parse, #tag_match, #unsupported
Methods included from Attributes
attribute_class, #parse_attributes, #serialized_attributes
Instance Method Details
#content_dates ⇒ Array<ContentDate>
8
|
# File 'lib/onix/resource_version.rb', line 8
elements "ContentDate", :subset, :cardinality => 0..n
|
6
|
# File 'lib/onix/resource_version.rb', line 6
elements "ResourceVersionFeature", :subset, :shortcut => :features, :cardinality => 0..n
|
23
24
25
26
27
28
29
|
# File 'lib/onix/resource_version.rb', line 23
def file_format
if ["DownloadableFile", "LinkableResource"].include?(@resource_form.human)
if file_format_feature
file_format_feature.value.human
end
end
end
|
18
19
20
|
# File 'lib/onix/resource_version.rb', line 18
def file_format_feature
@resource_version_features.select { |f| f.type.human == "FileFormat" }.first
end
|
#file_mimetype ⇒ Object
31
32
33
34
35
36
37
|
# File 'lib/onix/resource_version.rb', line 31
def file_mimetype
if ["DownloadableFile", "LinkableResource"].include?(@resource_form.human)
if file_format_feature
file_format_feature.value.mimetype
end
end
end
|
#filename ⇒ String
11
12
13
14
15
|
# File 'lib/onix/resource_version.rb', line 11
def filename
if @resource_form.human == "DownloadableFile"
resource_links.first
end
end
|
5
|
# File 'lib/onix/resource_version.rb', line 5
element "ResourceForm", :subset, :shortcut => :form, :cardinality => 1
|
#image_height ⇒ Object
57
58
59
60
61
|
# File 'lib/onix/resource_version.rb', line 57
def image_height
if self.image_height_feature
self.image_height_feature.value.to_i
end
end
|
#image_height_feature ⇒ Object
43
44
45
|
# File 'lib/onix/resource_version.rb', line 43
def image_height_feature
@resource_version_features.image_pixels_height.first
end
|
#image_width ⇒ Object
51
52
53
54
55
|
# File 'lib/onix/resource_version.rb', line 51
def image_width
if self.image_width_feature
self.image_width_feature.value.to_i
end
end
|
#image_width_feature ⇒ Object
39
40
41
|
# File 'lib/onix/resource_version.rb', line 39
def image_width_feature
@resource_version_features.image_pixels_width.first
end
|
#last_updated ⇒ Object
73
74
75
76
77
|
# File 'lib/onix/resource_version.rb', line 73
def last_updated
if self.last_updated_content_date
self.last_updated_content_date.date
end
end
|
#last_updated_content_date ⇒ Object
69
70
71
|
# File 'lib/onix/resource_version.rb', line 69
def last_updated_content_date
@content_dates.last_updated.first
end
|
#last_updated_utc ⇒ Object
79
80
81
82
83
|
# File 'lib/onix/resource_version.rb', line 79
def last_updated_utc
if self.last_updated_content_date and self.last_updated_content_date.date
self.last_updated_content_date.date.to_time.utc.strftime('%Y%m%dT%H%M%S%z')
end
end
|
#links ⇒ Array<String>
7
|
# File 'lib/onix/resource_version.rb', line 7
elements "ResourceLink", :text, :shortcut => :links, :cardinality => 1..n
|
#md5_hash ⇒ Object
63
64
65
66
67
|
# File 'lib/onix/resource_version.rb', line 63
def md5_hash
if self.md5_hash_feature
self.md5_hash_feature.value
end
end
|
#md5_hash_feature ⇒ Object
47
48
49
|
# File 'lib/onix/resource_version.rb', line 47
def md5_hash_feature
@resource_version_features.md5_hash.first
end
|
5
|
# File 'lib/onix/resource_version.rb', line 5
element "ResourceForm", :subset, :shortcut => :form, :cardinality => 1
|
#resource_links ⇒ Array<String>
7
|
# File 'lib/onix/resource_version.rb', line 7
elements "ResourceLink", :text, :shortcut => :links, :cardinality => 1..n
|
6
|
# File 'lib/onix/resource_version.rb', line 6
elements "ResourceVersionFeature", :subset, :shortcut => :features, :cardinality => 0..n
|