class ONIX::ProductPart
product part use full Product
to provide file protection and file size
Attributes
part_of[RW]
this ProductPart
is part of Product
product[RW]
full Product
if referenced in ONIXMessage
@return [Product]
Public Instance Methods
file_format()
click to toggle source
digital file format string (Epub,Pdf,AmazonKindle) @return [String]
# File lib/onix/product_part.rb, line 43 def file_format file_formats.first.human if file_formats.first end
file_formats()
click to toggle source
# File lib/onix/product_part.rb, line 23 def file_formats @product_form_details.select { |fd| fd.code =~ /^E1.*/ } end
file_mimetype()
click to toggle source
digital file format mimetype @return [String]
# File lib/onix/product_part.rb, line 49 def file_mimetype if file_formats.first file_formats.first.mimetype end end
filesize()
click to toggle source
digital file filesize in bytes @return [Integer]
# File lib/onix/product_part.rb, line 96 def filesize if product product.filesize end end
product_form_description()
click to toggle source
@return [ProductFormDescription]
# File lib/onix/product_part.rb, line 28 def product_form_description product_form_descriptions.first end
protection_type()
click to toggle source
Protection type string (None, Watermarking, DRM, AdobeDRM) @return [String]
# File lib/onix/product_part.rb, line 72 def protection_type if product product.protection_type else if part_of part_of.protection_type end end end
protections()
click to toggle source
List of protections type string (None, Watermarking, DRM, AdobeDRM) @return [Array<String>]
# File lib/onix/product_part.rb, line 84 def protections if product product.protections else if part_of part_of.protections end end end
raw_file_description()
click to toggle source
raw part file description string without HTML @return [String]
# File lib/onix/product_part.rb, line 64 def raw_file_description if product_form_description Helper.strip_html(product_form_description).gsub(/\s+/, " ").strip end end
reflowable?()
click to toggle source
is digital file reflowable ? @return [Boolean]
# File lib/onix/product_part.rb, line 57 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