class ONIX::DescriptiveDetail
Public Instance Methods
is digital offer audio ? @return [Boolean]
# File lib/onix/descriptive_detail.rb, line 179 def audio? not audio_formats.empty? end
@return [String]
# File lib/onix/descriptive_detail.rb, line 184 def audio_format self.audio_formats.first.human if self.audio_formats.first end
@return [Array<ProductFormDetail>]
# File lib/onix/descriptive_detail.rb, line 105 def audio_formats @product_form_details.select { |fd| fd.code =~ /^A.*/ } end
BISAC categories @return [Array<Subject>]
# File lib/onix/descriptive_detail.rb, line 111 def bisac_categories @subjects.bisac end
BISAC categories identifiers string array (eg: FIC000000) @return [Array<String>]
# File lib/onix/descriptive_detail.rb, line 253 def bisac_categories_codes self.bisac_categories.map { |c| c.code }.uniq end
is digital offer a bundle ? @return [Boolean]
# File lib/onix/descriptive_detail.rb, line 190 def bundle? @product_composition.human == "MultipleComponentRetailProduct" end
CLIL categories @return [Array<Subject>]
# File lib/onix/descriptive_detail.rb, line 117 def clil_categories @subjects.clil end
CLIL categories identifier string array @return [Array<String>]
# File lib/onix/descriptive_detail.rb, line 259 def clil_categories_codes self.clil_categories.map { |c| c.code }.uniq end
is digital ? @return [Boolean]
# File lib/onix/descriptive_detail.rb, line 157 def digital? if @product_form and @product_form.human =~ /Digital/ true else false end end
digital offer has DRM ? @return [Boolean]
# File lib/onix/descriptive_detail.rb, line 167 def drmized? @protections.any? { |p| p =~ /Drm/ } end
digital file format string (Epub,Pdf,AmazonKindle) @return [String]
# File lib/onix/descriptive_detail.rb, line 196 def file_format file_formats.first.human if file_formats.first end
@return [Array<ProductFormDetail>]
# File lib/onix/descriptive_detail.rb, line 90 def file_formats @product_form_details.select { |fd| fd.code =~ /^E1.*/ } end
digital file format mimetype @return [String]
# File lib/onix/descriptive_detail.rb, line 202 def file_mimetype if file_formats.first file_formats.first.mimetype end end
file size in bytes @return [Integer]
# File lib/onix/descriptive_detail.rb, line 147 def filesize if filesize_extent filesize_extent.bytes else nil end end
@return [Extent]
# File lib/onix/descriptive_detail.rb, line 100 def filesize_extent @extents.filesize.first end
keywords string array @return [Array<String>]
# 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 @return [String]
# File lib/onix/descriptive_detail.rb, line 236 def language_of_text l = @languages.of_text.first if l l.code end end
page count @return [Integer]
# File lib/onix/descriptive_detail.rb, line 139 def pages if pages_extent pages_extent.pages end end
@return [Extent]
# File lib/onix/descriptive_detail.rb, line 80 def pages_extent @extents.page.first end
@return [TitleElement]
# 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 @return [String]
# 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 string array @return [Array<String>]
# File lib/onix/descriptive_detail.rb, line 229 def protections return [] if @epub_technical_protections.length == 0 @epub_technical_protections.map(&:human) end
@return [Collection]
# File lib/onix/descriptive_detail.rb, line 95 def publisher_collection @collections.publisher.first end
publisher collection title @return [String]
# File lib/onix/descriptive_detail.rb, line 245 def publisher_collection_title if self.publisher_collection self.publisher_collection.title end end
is digital file reflowable ? @return [Boolean]
# 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
is digital offer streaming ? @return [Boolean]
# File lib/onix/descriptive_detail.rb, line 173 def streaming? @product_form.code == "EC" end
product subtitle string @return [String]
# File lib/onix/descriptive_detail.rb, line 133 def subtitle product_title_element.subtitle if product_title_element end
product title string @return [String]
# File lib/onix/descriptive_detail.rb, line 127 def title product_title_element.title if product_title_element end