Class: ONIX::CollateralDetail
- Defined in:
- lib/onix/collateral_detail.rb
Instance Attribute Summary
Attributes included from Attributes
High level collapse
-
#description ⇒ String
product description string including HTML.
-
#epub_sample_last_updated ⇒ Date
Epub sample last updated.
-
#epub_sample_mimetype ⇒ String
Epub sample mimetype.
- #epub_sample_resource ⇒ Object
-
#epub_sample_url ⇒ String
Epub sample URL.
-
#frontcover_last_updated ⇒ Object
product larger front cover last updated date.
-
#frontcover_mimetype ⇒ Object
product larger front cover mimetype.
- #frontcover_resource ⇒ Object
-
#frontcover_url ⇒ String
product larger front cover URL string.
Low level collapse
- #cited_contents ⇒ Array<CitedContent>
- #prizes ⇒ Array<Prize>
- #supporting_resources ⇒ Array<SupportingResource>
- #text_contents ⇒ Array<TextContent>
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
Constructor Details
This class inherits a constructor from ONIX::SubsetDSL
Instance Method Details
#cited_contents ⇒ Array<CitedContent>
9 |
# File 'lib/onix/collateral_detail.rb', line 9 elements "CitedContent", :subset, :cardinality => 0..n |
#description ⇒ String
product description string including HTML
17 18 19 20 21 22 |
# File 'lib/onix/collateral_detail.rb', line 17 def description desc_contents = @text_contents.description + @text_contents.short_description if desc_contents.length > 0 desc_contents.first.text end end |
#epub_sample_last_updated ⇒ Date
Epub sample last updated
81 82 83 84 85 |
# File 'lib/onix/collateral_detail.rb', line 81 def epub_sample_last_updated if self.epub_sample_resource self.epub_sample_resource.last_updated end end |
#epub_sample_mimetype ⇒ String
Epub sample mimetype
89 90 91 92 93 |
# File 'lib/onix/collateral_detail.rb', line 89 def epub_sample_mimetype if self.epub_sample_resource self.epub_sample_resource.file_mimetype end end |
#epub_sample_resource ⇒ Object
64 65 66 67 68 69 |
# File 'lib/onix/collateral_detail.rb', line 64 def epub_sample_resource es = @supporting_resources.sample_content.select { |sr| sr.versions.last and sr.versions.last.file_format == "Epub" }.first if es es.versions.last end end |
#epub_sample_url ⇒ String
Epub sample URL
73 74 75 76 77 |
# File 'lib/onix/collateral_detail.rb', line 73 def epub_sample_url if self.epub_sample_resource self.epub_sample_resource.links.first.strip end end |
#frontcover_last_updated ⇒ Object
product larger front cover last updated date
51 52 53 54 55 |
# File 'lib/onix/collateral_detail.rb', line 51 def frontcover_last_updated if self.frontcover_resource self.frontcover_resource.last_updated end end |
#frontcover_mimetype ⇒ Object
product larger front cover mimetype
58 59 60 61 62 |
# File 'lib/onix/collateral_detail.rb', line 58 def frontcover_mimetype if self.frontcover_resource self.frontcover_resource.file_mimetype end end |
#frontcover_resource ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/onix/collateral_detail.rb', line 24 def frontcover_resource fc = @supporting_resources.front_cover if fc.length > 0 if fc.length > 1 best_found = fc.select { |c| c.versions.last and c.versions.last.image_width }.sort { |c1, c2| c2.versions.last.image_width <=> c1.versions.last.image_width }.first if best_found # we take larger one best_found.versions.last else # we try first that is not gif fc.select { |sr| not sr.versions.last.file_format == "Gif" }.first.versions.last end else fc.first.versions.last end end end |
#frontcover_url ⇒ String
product larger front cover URL string
44 45 46 47 48 |
# File 'lib/onix/collateral_detail.rb', line 44 def frontcover_url if self.frontcover_resource self.frontcover_resource.links.first.strip end end |
#prizes ⇒ Array<Prize>
11 |
# File 'lib/onix/collateral_detail.rb', line 11 elements "Prize", :subset, :cardinality => 0..n |
#supporting_resources ⇒ Array<SupportingResource>
10 |
# File 'lib/onix/collateral_detail.rb', line 10 elements "SupportingResource", :subset, :cardinality => 0..n |
#text_contents ⇒ Array<TextContent>
8 |
# File 'lib/onix/collateral_detail.rb', line 8 elements "TextContent", :subset, :cardinality => 0..n |