Class: ONIX::DescriptiveDetail
Instance Attribute Summary
Attributes included from Attributes
#attributes
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
65
|
# File 'lib/onix/descriptive_detail.rb', line 65
elements "AncillaryContent", :subset, :cardinality => 0..n
|
#audience_codes ⇒ Array<AudienceCode>
71
|
# File 'lib/onix/descriptive_detail.rb', line 71
elements "AudienceCode", :subset, :cardinality => 0..n
|
#audience_descriptions ⇒ Array<String>
74
|
# File 'lib/onix/descriptive_detail.rb', line 74
elements "AudienceDescription", :text, :cardinality => 0..n
|
73
|
# File 'lib/onix/descriptive_detail.rb', line 73
elements "AudienceRange", :subset, :cardinality => 0..n
|
#audiences ⇒ Array<Audience>
72
|
# File 'lib/onix/descriptive_detail.rb', line 72
elements "Audience", :subset, :cardinality => 0..n
|
#audio? ⇒ Boolean
179
180
181
|
# File 'lib/onix/descriptive_detail.rb', line 179
def audio?
not audio_formats.empty?
end
|
184
185
186
|
# File 'lib/onix/descriptive_detail.rb', line 184
def audio_format
self.audio_formats.first.human if self.audio_formats.first
end
|
105
106
107
|
# File 'lib/onix/descriptive_detail.rb', line 105
def audio_formats
@product_form_details.select { |fd| fd.code =~ /^A.*/ }
end
|
#bisac_categories ⇒ Array<Subject>
111
112
113
|
# File 'lib/onix/descriptive_detail.rb', line 111
def bisac_categories
@subjects.bisac
end
|
#bisac_categories_codes ⇒ Array<String>
BISAC categories identifiers string array (eg: FIC000000)
253
254
255
|
# File 'lib/onix/descriptive_detail.rb', line 253
def bisac_categories_codes
self.bisac_categories.map { |c| c.code }.uniq
end
|
#bundle? ⇒ Boolean
is digital offer a bundle ?
190
191
192
|
# File 'lib/onix/descriptive_detail.rb', line 190
def bundle?
@product_composition.human == "MultipleComponentRetailProduct"
end
|
#clil_categories ⇒ Array<Subject>
117
118
119
|
# File 'lib/onix/descriptive_detail.rb', line 117
def clil_categories
@subjects.clil
end
|
#clil_categories_codes ⇒ Array<String>
CLIL categories identifier string array
259
260
261
|
# File 'lib/onix/descriptive_detail.rb', line 259
def clil_categories_codes
self.clil_categories.map { |c| c.code }.uniq
end
|
#collections ⇒ Array<Collection>
37
|
# File 'lib/onix/descriptive_detail.rb', line 37
elements "Collection", :subset, :cardinality => 0..n
|
#complexities ⇒ Array<Complexity>
75
|
# File 'lib/onix/descriptive_detail.rb', line 75
elements "Complexity", :subset, :cardinality => 0..n
|
20
|
# File 'lib/onix/descriptive_detail.rb', line 20
element "ProductComposition", :subset, :shortcut => :composition, :cardinality => 1
|
28
|
# File 'lib/onix/descriptive_detail.rb', line 28
elements "ProductContentType", :subset, :shortcut => :content_types, :cardinality => 0..n
|
#contributor_statements ⇒ Array<String>
44
|
# File 'lib/onix/descriptive_detail.rb', line 44
elements "ContributorStatement", :text, :cardinality => 0..n
|
#contributors ⇒ Array<Contributor>
43
|
# File 'lib/onix/descriptive_detail.rb', line 43
elements "Contributor", :subset, :cardinality => 0..n
|
#country_of_manufacture ⇒ CountryOfManufacture
30
|
# File 'lib/onix/descriptive_detail.rb', line 30
element "CountryOfManufacture", :subset, :klass=>"CountryCode", :cardinality => 0..1
|
#digital? ⇒ Boolean
157
158
159
160
161
162
163
|
# File 'lib/onix/descriptive_detail.rb', line 157
def digital?
if @product_form and @product_form.human =~ /Digital/
true
else
false
end
end
|
#drmized? ⇒ Boolean
167
168
169
|
# File 'lib/onix/descriptive_detail.rb', line 167
def drmized?
@protections.any? { |p| p =~ /Drm/ }
end
|
#edition_number ⇒ Integer
52
|
# File 'lib/onix/descriptive_detail.rb', line 52
element "EditionNumber", :integer, :cardinality => 0..1
|
#edition_statements ⇒ Array<String>
54
|
# File 'lib/onix/descriptive_detail.rb', line 54
elements "EditionStatement", :text, :cardinality => 0..n
|
51
|
# File 'lib/onix/descriptive_detail.rb', line 51
element "EditionType", :subset, :cardinality => 0..n
|
#edition_version_number ⇒ String
53
|
# File 'lib/onix/descriptive_detail.rb', line 53
element "EditionVersionNumber", :text, :cardinality => 0..1
|
33
|
# File 'lib/onix/descriptive_detail.rb', line 33
element "EpubLicense", :subset, :cardinality => 0..1
|
31
|
# File 'lib/onix/descriptive_detail.rb', line 31
elements "EpubTechnicalProtection", :subset, :cardinality => 0..n
|
32
|
# File 'lib/onix/descriptive_detail.rb', line 32
elements "EpubUsageConstraint", :subset, :cardinality => 0..n
|
#extents ⇒ Array<Extent>
61
|
# File 'lib/onix/descriptive_detail.rb', line 61
elements "Extent", :subset, :cardinality => 0..n
|
#file_description ⇒ String
25
|
# File 'lib/onix/descriptive_detail.rb', line 25
element "ProductFormDescription", :text, :shortcut => :file_description, :cardinality => 0..n
|
digital file format string (Epub,Pdf,AmazonKindle)
196
197
198
|
# File 'lib/onix/descriptive_detail.rb', line 196
def file_format
file_formats.first.human if file_formats.first
end
|
90
91
92
|
# File 'lib/onix/descriptive_detail.rb', line 90
def file_formats
@product_form_details.select { |fd| fd.code =~ /^E1.*/ }
end
|
#file_mimetype ⇒ String
digital file format mimetype
202
203
204
205
206
|
# File 'lib/onix/descriptive_detail.rb', line 202
def file_mimetype
if file_formats.first
file_formats.first.mimetype
end
end
|
#filesize ⇒ Integer
147
148
149
150
151
152
153
|
# File 'lib/onix/descriptive_detail.rb', line 147
def filesize
if filesize_extent
filesize_extent.bytes
else
nil
end
end
|
#filesize_extent ⇒ Extent
100
101
102
|
# File 'lib/onix/descriptive_detail.rb', line 100
def filesize_extent
@extents.filesize.first
end
|
21
|
# File 'lib/onix/descriptive_detail.rb', line 21
element "ProductForm", :subset, :shortcut => :form, :cardinality => 1
|
22
|
# File 'lib/onix/descriptive_detail.rb', line 22
elements "ProductFormDetail", :subset, :shortcut => :form_details, :cardinality => 0..n
|
23
|
# File 'lib/onix/descriptive_detail.rb', line 23
elements "ProductFormFeature", :subset, :shortcut => :form_features, :cardinality => 0..n
|
62
|
# File 'lib/onix/descriptive_detail.rb', line 62
element "Illustrated", :subset, :cardinality => 0..1
|
#illustrations_notes ⇒ Array<String>
64
|
# File 'lib/onix/descriptive_detail.rb', line 64
elements "IllustrationsNote", :text, :cardinality => 0..n
|
#keywords ⇒ Array<String>
265
266
267
268
269
270
|
# File 'lib/onix/descriptive_detail.rb', line 265
def keywords
kws = @subjects.keyword.map { |kw| kw.heading_text }.compact
kws = kws.flat_map { |kw| kw.split(/;|,|\n/) }.map { |kw| kw.strip }
kws.reject! { |k| k == "" }
kws
end
|
#language_of_text ⇒ String
236
237
238
239
240
241
|
# File 'lib/onix/descriptive_detail.rb', line 236
def language_of_text
l = @languages.of_text.first
if l
l.code
end
end
|
#languages ⇒ Array<Language>
60
|
# File 'lib/onix/descriptive_detail.rb', line 60
elements "Language", :subset, :cardinality => 0..1
|
#map_scales ⇒ Array<Integer>
34
|
# File 'lib/onix/descriptive_detail.rb', line 34
elements "MapScale", :integer, :cardinality => 0..n
|
#measures ⇒ Array<Measure>
29
|
# File 'lib/onix/descriptive_detail.rb', line 29
elements "Measure", :subset, :cardinality => 0..n
|
#no_collection ⇒ Boolean
38
|
# File 'lib/onix/descriptive_detail.rb', line 38
element "NoCollection", :bool, :cardinality => 0..1
|
#no_contributor ⇒ Boolean
45
|
# File 'lib/onix/descriptive_detail.rb', line 45
element "NoContributor", :bool, :cardinality => 0..1
|
#no_edition ⇒ Boolean
55
|
# File 'lib/onix/descriptive_detail.rb', line 55
element "NoEdition", :bool, :cardinality => 0..1
|
#number_of_illustrations ⇒ Integer
63
|
# File 'lib/onix/descriptive_detail.rb', line 63
element "NumberOfIllustrations", :integer, :cardinality => 0..1
|
#pages ⇒ Integer
139
140
141
142
143
|
# File 'lib/onix/descriptive_detail.rb', line 139
def pages
if pages_extent
pages_extent.pages
end
end
|
#pages_extent ⇒ Extent
80
81
82
|
# File 'lib/onix/descriptive_detail.rb', line 80
def pages_extent
@extents.page.first
end
|
36
|
# File 'lib/onix/descriptive_detail.rb', line 36
elements "ProductPart", :subset, :shortcut => :parts, :cardinality => 0..n
|
#primary_content_type ⇒ PrimaryContentType
27
|
# File 'lib/onix/descriptive_detail.rb', line 27
element "PrimaryContentType", :subset, :klass => "ProductContentType"
|
35
|
# File 'lib/onix/descriptive_detail.rb', line 35
elements "ProductClassification", :subset, :cardinality => 0..n
|
20
|
# File 'lib/onix/descriptive_detail.rb', line 20
element "ProductComposition", :subset, :shortcut => :composition, :cardinality => 1
|
28
|
# File 'lib/onix/descriptive_detail.rb', line 28
elements "ProductContentType", :subset, :shortcut => :content_types, :cardinality => 0..n
|
21
|
# File 'lib/onix/descriptive_detail.rb', line 21
element "ProductForm", :subset, :shortcut => :form, :cardinality => 1
|
25
|
# File 'lib/onix/descriptive_detail.rb', line 25
element "ProductFormDescription", :text, :shortcut => :file_description, :cardinality => 0..n
|
22
|
# File 'lib/onix/descriptive_detail.rb', line 22
elements "ProductFormDetail", :subset, :shortcut => :form_details, :cardinality => 0..n
|
23
|
# File 'lib/onix/descriptive_detail.rb', line 23
elements "ProductFormFeature", :subset, :shortcut => :form_features, :cardinality => 0..n
|
24
|
# File 'lib/onix/descriptive_detail.rb', line 24
element "ProductPackaging", :subset, :cardinality => 0..1
|
#product_parts ⇒ Array<ProductPart>
36
|
# File 'lib/onix/descriptive_detail.rb', line 36
elements "ProductPart", :subset, :shortcut => :parts, :cardinality => 0..n
|
#product_title_element ⇒ TitleElement
85
86
87
|
# File 'lib/onix/descriptive_detail.rb', line 85
def product_title_element
@title_details.distinctive_title.first.title_elements.product_level.first if @title_details.distinctive_title.first
end
|
#protection_type ⇒ String
217
218
219
220
221
222
223
224
225
|
# File 'lib/onix/descriptive_detail.rb', line 217
def protection_type
if @epub_technical_protections.length > 0
if @epub_technical_protections.length == 1
@epub_technical_protections.first.human
else
raise ExpectsOneButHasSeveral, @epub_technical_protections.map(&:human)
end
end
end
|
#protections ⇒ Array<String>
229
230
231
232
|
# File 'lib/onix/descriptive_detail.rb', line 229
def protections
return [] if @epub_technical_protections.length == 0
@epub_technical_protections.map(&:human)
end
|
#publisher_collection ⇒ Collection
95
96
97
|
# File 'lib/onix/descriptive_detail.rb', line 95
def publisher_collection
@collections.publisher.first
end
|
#publisher_collection_title ⇒ String
publisher collection title
245
246
247
248
249
|
# File 'lib/onix/descriptive_detail.rb', line 245
def publisher_collection_title
if self.publisher_collection
self.publisher_collection.title
end
end
|
#reflowable? ⇒ Boolean
is digital file reflowable ?
210
211
212
213
|
# File 'lib/onix/descriptive_detail.rb', line 210
def reflowable?
return true if @product_form_details.select { |fd| fd.code == "E200" }.length > 0
return false if @product_form_details.select { |fd| fd.code == "E201" }.length > 0
end
|
#streaming? ⇒ Boolean
is digital offer streaming ?
173
174
175
|
# File 'lib/onix/descriptive_detail.rb', line 173
def streaming?
@product_form.code == "EC"
end
|
#subjects ⇒ Array<Subject>
66
|
# File 'lib/onix/descriptive_detail.rb', line 66
elements "Subject", :subset, :cardinality => 0..n
|
#subtitle ⇒ String
133
134
135
|
# File 'lib/onix/descriptive_detail.rb', line 133
def subtitle
product_title_element.subtitle if product_title_element
end
|
#thesis_presented_to ⇒ String
41
|
# File 'lib/onix/descriptive_detail.rb', line 41
element "ThesisPresentedTo", :text, :cardinality => 0..1
|
40
|
# File 'lib/onix/descriptive_detail.rb', line 40
element "ThesisType", :subset, :cardinality => 0..1
|
#thesis_year ⇒ String
42
|
# File 'lib/onix/descriptive_detail.rb', line 42
element "ThesisYear", :text, :cardinality => 0..1
|
#title ⇒ String
127
128
129
|
# File 'lib/onix/descriptive_detail.rb', line 127
def title
product_title_element.title if product_title_element
end
|
#title_details ⇒ Array<TitleDetail>
39
|
# File 'lib/onix/descriptive_detail.rb', line 39
elements "TitleDetail", :subset, :cardinality => 0..n
|
26
|
# File 'lib/onix/descriptive_detail.rb', line 26
element "TradeCategory", :subset, :cardinality => 0..1
|