Class: ONIX::CollateralDetail

Inherits:
SubsetDSL show all
Defined in:
lib/onix/collateral_detail.rb

Instance Attribute Summary

Attributes included from Attributes

#attributes

High level collapse

Low level 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

Constructor Details

This class inherits a constructor from ONIX::SubsetDSL

Instance Method Details

#cited_contentsArray<CitedContent>

Returns:



9
# File 'lib/onix/collateral_detail.rb', line 9

elements "CitedContent", :subset, :cardinality => 0..n

#descriptionString

product description string including HTML

Returns:

  • (String)


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_updatedDate

Epub sample last updated

Returns:

  • (Date)


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_mimetypeString

Epub sample mimetype

Returns:

  • (String)


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_resourceObject



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_urlString

Epub sample URL

Returns:

  • (String)


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_updatedObject

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_mimetypeObject

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_resourceObject



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_urlString

product larger front cover URL string

Returns:

  • (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

#prizesArray<Prize>

Returns:



11
# File 'lib/onix/collateral_detail.rb', line 11

elements "Prize", :subset, :cardinality => 0..n

#supporting_resourcesArray<SupportingResource>

Returns:



10
# File 'lib/onix/collateral_detail.rb', line 10

elements "SupportingResource", :subset, :cardinality => 0..n

#text_contentsArray<TextContent>

Returns:



8
# File 'lib/onix/collateral_detail.rb', line 8

elements "TextContent", :subset, :cardinality => 0..n