cacofonix 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/.rvmrc +1 -0
- data/.travis.yml +10 -0
- data/CHANGELOG.md +205 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +22 -0
- data/README.md +76 -0
- data/Rakefile +6 -0
- data/TODO +14 -0
- data/bin/onix_extract_codelists +41 -0
- data/cacofonix.gemspec +39 -0
- data/data/9780194351898.xml +74 -0
- data/data/Ashgate Other.xml +382679 -0
- data/data/Bookwise_July_2008.xml +21611 -0
- data/data/Peribo Onix 0408.xml +17051 -0
- data/data/aau.xml +96 -0
- data/data/audience_range.xml +9 -0
- data/data/contributor.xml +6 -0
- data/data/control_chars.xml +74 -0
- data/data/entities.xml +78 -0
- data/data/extra_entities.xml +65 -0
- data/data/header.xml +21 -0
- data/data/header_invalid_sentdate.xml +21 -0
- data/data/hlasep08.xml +24519 -0
- data/data/imprint.xml +5 -0
- data/data/iso_8859_1.xml +58 -0
- data/data/jul.xml +24783 -0
- data/data/language.xml +7 -0
- data/data/market_representation.xml +11 -0
- data/data/measure.xml +6 -0
- data/data/media_file.xml +6 -0
- data/data/no_encoding.xml +78 -0
- data/data/no_xml_declaration.xml +95 -0
- data/data/other_text.xml +5 -0
- data/data/price.xml +5 -0
- data/data/product.xml +79 -0
- data/data/product_identifier.xml +5 -0
- data/data/product_invalid_pubdate.xml +42 -0
- data/data/publisher.xml +5 -0
- data/data/rba_FANT.xml +23 -0
- data/data/reference_with_release_attrib.xml +74 -0
- data/data/sales_restriction.xml +4 -0
- data/data/sales_rights.xml +35 -0
- data/data/sender_identifier.xml +5 -0
- data/data/series.xml +5 -0
- data/data/series_identifier.xml +6 -0
- data/data/short_tags.xml +191 -0
- data/data/short_tags_ivp.xml +231 -0
- data/data/sl_product.xml +81 -0
- data/data/stock.xml +5 -0
- data/data/subject.xml +6 -0
- data/data/supply_detail.xml +18 -0
- data/data/title.xml +6 -0
- data/data/two_products.xml +114 -0
- data/data/usd.xml +175 -0
- data/data/utf_16.xml +0 -0
- data/data/website.xml +6 -0
- data/examples/reader.rb +25 -0
- data/examples/reader_apa.rb +22 -0
- data/examples/writer.rb +13 -0
- data/examples/writer_apa.rb +38 -0
- data/lib/cacofonix.rb +151 -0
- data/lib/cacofonix/codelists/001.rb +16 -0
- data/lib/cacofonix/codelists/002.rb +11 -0
- data/lib/cacofonix/codelists/003.rb +13 -0
- data/lib/cacofonix/codelists/005.rb +20 -0
- data/lib/cacofonix/codelists/006.rb +82 -0
- data/lib/cacofonix/codelists/007.rb +129 -0
- data/lib/cacofonix/codelists/008.rb +13 -0
- data/lib/cacofonix/codelists/009.rb +13 -0
- data/lib/cacofonix/codelists/010.rb +52 -0
- data/lib/cacofonix/codelists/011.rb +17 -0
- data/lib/cacofonix/codelists/012.rb +17 -0
- data/lib/cacofonix/codelists/013.rb +13 -0
- data/lib/cacofonix/codelists/014.rb +10 -0
- data/lib/cacofonix/codelists/015.rb +19 -0
- data/lib/cacofonix/codelists/016.rb +12 -0
- data/lib/cacofonix/codelists/017.rb +96 -0
- data/lib/cacofonix/codelists/018.rb +11 -0
- data/lib/cacofonix/codelists/019.rb +13 -0
- data/lib/cacofonix/codelists/020.rb +7 -0
- data/lib/cacofonix/codelists/021.rb +39 -0
- data/lib/cacofonix/codelists/022.rb +15 -0
- data/lib/cacofonix/codelists/023.rb +19 -0
- data/lib/cacofonix/codelists/024.rb +17 -0
- data/lib/cacofonix/codelists/025.rb +35 -0
- data/lib/cacofonix/codelists/026.rb +86 -0
- data/lib/cacofonix/codelists/027.rb +90 -0
- data/lib/cacofonix/codelists/028.rb +14 -0
- data/lib/cacofonix/codelists/029.rb +25 -0
- data/lib/cacofonix/codelists/030.rb +22 -0
- data/lib/cacofonix/codelists/031.rb +9 -0
- data/lib/cacofonix/codelists/032.rb +8 -0
- data/lib/cacofonix/codelists/033.rb +43 -0
- data/lib/cacofonix/codelists/034.rb +21 -0
- data/lib/cacofonix/codelists/035.rb +12 -0
- data/lib/cacofonix/codelists/036.rb +9 -0
- data/lib/cacofonix/codelists/037.rb +12 -0
- data/lib/cacofonix/codelists/038.rb +43 -0
- data/lib/cacofonix/codelists/039.rb +14 -0
- data/lib/cacofonix/codelists/040.rb +12 -0
- data/lib/cacofonix/codelists/041.rb +12 -0
- data/lib/cacofonix/codelists/042.rb +22 -0
- data/lib/cacofonix/codelists/043.rb +12 -0
- data/lib/cacofonix/codelists/044.rb +22 -0
- data/lib/cacofonix/codelists/045.rb +19 -0
- data/lib/cacofonix/codelists/046.rb +15 -0
- data/lib/cacofonix/codelists/047.rb +10 -0
- data/lib/cacofonix/codelists/048.rb +17 -0
- data/lib/cacofonix/codelists/049.rb +91 -0
- data/lib/cacofonix/codelists/050.rb +14 -0
- data/lib/cacofonix/codelists/051.rb +36 -0
- data/lib/cacofonix/codelists/052.rb +7 -0
- data/lib/cacofonix/codelists/053.rb +10 -0
- data/lib/cacofonix/codelists/054.rb +29 -0
- data/lib/cacofonix/codelists/055.rb +23 -0
- data/lib/cacofonix/codelists/056.rb +8 -0
- data/lib/cacofonix/codelists/057.rb +11 -0
- data/lib/cacofonix/codelists/058.rb +29 -0
- data/lib/cacofonix/codelists/059.rb +13 -0
- data/lib/cacofonix/codelists/060.rb +8 -0
- data/lib/cacofonix/codelists/061.rb +9 -0
- data/lib/cacofonix/codelists/062.rb +11 -0
- data/lib/cacofonix/codelists/063.rb +7 -0
- data/lib/cacofonix/codelists/064.rb +19 -0
- data/lib/cacofonix/codelists/065.rb +34 -0
- data/lib/cacofonix/codelists/066.rb +10 -0
- data/lib/cacofonix/codelists/067.rb +8 -0
- data/lib/cacofonix/codelists/068.rb +22 -0
- data/lib/cacofonix/codelists/069.rb +10 -0
- data/lib/cacofonix/codelists/070.rb +8 -0
- data/lib/cacofonix/codelists/071.rb +16 -0
- data/lib/cacofonix/codelists/072.rb +13 -0
- data/lib/cacofonix/codelists/073.rb +42 -0
- data/lib/cacofonix/codelists/074.rb +495 -0
- data/lib/cacofonix/codelists/075.rb +8 -0
- data/lib/cacofonix/codelists/076.rb +18 -0
- data/lib/cacofonix/codelists/077.rb +25 -0
- data/lib/cacofonix/codelists/078.rb +173 -0
- data/lib/cacofonix/codelists/079.rb +25 -0
- data/lib/cacofonix/codelists/080.rb +26 -0
- data/lib/cacofonix/codelists/081.rb +45 -0
- data/lib/cacofonix/codelists/082.rb +23 -0
- data/lib/cacofonix/codelists/083.rb +74 -0
- data/lib/cacofonix/codelists/084.rb +16 -0
- data/lib/cacofonix/codelists/085.rb +29 -0
- data/lib/cacofonix/codelists/086.rb +11 -0
- data/lib/cacofonix/codelists/087.rb +12 -0
- data/lib/cacofonix/codelists/088.rb +7 -0
- data/lib/cacofonix/codelists/089.rb +7 -0
- data/lib/cacofonix/codelists/090.rb +17 -0
- data/lib/cacofonix/codelists/091.rb +257 -0
- data/lib/cacofonix/codelists/092.rb +14 -0
- data/lib/cacofonix/codelists/093.rb +19 -0
- data/lib/cacofonix/codelists/094.rb +9 -0
- data/lib/cacofonix/codelists/095.rb +9 -0
- data/lib/cacofonix/codelists/096.rb +191 -0
- data/lib/cacofonix/codelists/097.rb +7 -0
- data/lib/cacofonix/codelists/098.rb +27 -0
- data/lib/cacofonix/codelists/099.rb +30 -0
- data/lib/cacofonix/codelists/100.rb +12 -0
- data/lib/cacofonix/codelists/101.rb +8 -0
- data/lib/cacofonix/codelists/102.rb +9 -0
- data/lib/cacofonix/codelists/121.rb +164 -0
- data/lib/cacofonix/codelists/138.rb +12 -0
- data/lib/cacofonix/codelists/139.rb +76 -0
- data/lib/cacofonix/codelists/140.rb +13 -0
- data/lib/cacofonix/codelists/141.rb +16 -0
- data/lib/cacofonix/codelists/142.rb +18 -0
- data/lib/cacofonix/codelists/143.rb +13 -0
- data/lib/cacofonix/codelists/144.rb +12 -0
- data/lib/cacofonix/codelists/145.rb +13 -0
- data/lib/cacofonix/codelists/146.rb +9 -0
- data/lib/cacofonix/codelists/147.rb +16 -0
- data/lib/cacofonix/codelists/148.rb +9 -0
- data/lib/cacofonix/codelists/149.rb +10 -0
- data/lib/cacofonix/codelists/150.rb +130 -0
- data/lib/cacofonix/codelists/151.rb +13 -0
- data/lib/cacofonix/codelists/152.rb +8 -0
- data/lib/cacofonix/codelists/153.rb +20 -0
- data/lib/cacofonix/codelists/154.rb +15 -0
- data/lib/cacofonix/codelists/155.rb +11 -0
- data/lib/cacofonix/codelists/156.rb +10 -0
- data/lib/cacofonix/codelists/157.rb +10 -0
- data/lib/cacofonix/codelists/158.rb +32 -0
- data/lib/cacofonix/codelists/159.rb +12 -0
- data/lib/cacofonix/codelists/160.rb +10 -0
- data/lib/cacofonix/codelists/161.rb +9 -0
- data/lib/cacofonix/codelists/162.rb +12 -0
- data/lib/cacofonix/codelists/163.rb +17 -0
- data/lib/cacofonix/codelists/164.rb +11 -0
- data/lib/cacofonix/codelists/165.rb +9 -0
- data/lib/cacofonix/codelists/166.rb +9 -0
- data/lib/cacofonix/codelists/167.rb +9 -0
- data/lib/cacofonix/codelists/168.rb +8 -0
- data/lib/cacofonix/codelists/169.rb +9 -0
- data/lib/cacofonix/codelists/170.rb +7 -0
- data/lib/cacofonix/codelists/171.rb +8 -0
- data/lib/cacofonix/codelists/172.rb +7 -0
- data/lib/cacofonix/codelists/173.rb +8 -0
- data/lib/cacofonix/codelists/174.rb +8 -0
- data/lib/cacofonix/codelists/175.rb +206 -0
- data/lib/cacofonix/codelists/176.rb +20 -0
- data/lib/cacofonix/codelists/177.rb +8 -0
- data/lib/cacofonix/codelists/178.rb +24 -0
- data/lib/cacofonix/codelists/179.rb +7 -0
- data/lib/cacofonix/codelists/184.rb +11 -0
- data/lib/cacofonix/core/code.rb +106 -0
- data/lib/cacofonix/core/element.rb +275 -0
- data/lib/cacofonix/core/header.rb +45 -0
- data/lib/cacofonix/core/lists.rb +108 -0
- data/lib/cacofonix/core/reader.rb +166 -0
- data/lib/cacofonix/core/writer.rb +123 -0
- data/lib/cacofonix/elements/addressee_identifier.rb +6 -0
- data/lib/cacofonix/elements/agent_identifier.rb +6 -0
- data/lib/cacofonix/elements/audience.rb +8 -0
- data/lib/cacofonix/elements/audience_range.rb +15 -0
- data/lib/cacofonix/elements/batch_bonus.rb +7 -0
- data/lib/cacofonix/elements/bible.rb +12 -0
- data/lib/cacofonix/elements/complexity.rb +7 -0
- data/lib/cacofonix/elements/conference.rb +14 -0
- data/lib/cacofonix/elements/conference_sponsor.rb +8 -0
- data/lib/cacofonix/elements/conference_sponsor_identifier.rb +6 -0
- data/lib/cacofonix/elements/contained_item.rb +6 -0
- data/lib/cacofonix/elements/content_item.rb +21 -0
- data/lib/cacofonix/elements/contributor.rb +19 -0
- data/lib/cacofonix/elements/copyright_owner.rb +8 -0
- data/lib/cacofonix/elements/copyright_owner_identifier.rb +6 -0
- data/lib/cacofonix/elements/copyright_statement.rb +7 -0
- data/lib/cacofonix/elements/discount_coded.rb +8 -0
- data/lib/cacofonix/elements/extent.rb +8 -0
- data/lib/cacofonix/elements/identifier.rb +7 -0
- data/lib/cacofonix/elements/illustrations.rb +8 -0
- data/lib/cacofonix/elements/imprint.rb +9 -0
- data/lib/cacofonix/elements/language.rb +8 -0
- data/lib/cacofonix/elements/location_identifier.rb +8 -0
- data/lib/cacofonix/elements/main_subject.rb +9 -0
- data/lib/cacofonix/elements/market_date.rb +8 -0
- data/lib/cacofonix/elements/market_representation.rb +18 -0
- data/lib/cacofonix/elements/measure.rb +8 -0
- data/lib/cacofonix/elements/media_file.rb +16 -0
- data/lib/cacofonix/elements/name.rb +6 -0
- data/lib/cacofonix/elements/name_base.rb +17 -0
- data/lib/cacofonix/elements/new_supplier.rb +12 -0
- data/lib/cacofonix/elements/not_for_sale.rb +13 -0
- data/lib/cacofonix/elements/on_order_detail.rb +7 -0
- data/lib/cacofonix/elements/other_text.rb +17 -0
- data/lib/cacofonix/elements/page_run.rb +7 -0
- data/lib/cacofonix/elements/person_date.rb +8 -0
- data/lib/cacofonix/elements/person_name_identifier.rb +6 -0
- data/lib/cacofonix/elements/price.rb +46 -0
- data/lib/cacofonix/elements/prize.rb +10 -0
- data/lib/cacofonix/elements/product.rb +155 -0
- data/lib/cacofonix/elements/product_base.rb +61 -0
- data/lib/cacofonix/elements/product_classification.rb +8 -0
- data/lib/cacofonix/elements/product_form_feature.rb +8 -0
- data/lib/cacofonix/elements/product_identifier.rb +6 -0
- data/lib/cacofonix/elements/professional_affiliation.rb +7 -0
- data/lib/cacofonix/elements/publisher.rb +11 -0
- data/lib/cacofonix/elements/reissue.rb +9 -0
- data/lib/cacofonix/elements/related_product.rb +6 -0
- data/lib/cacofonix/elements/religious_text.rb +8 -0
- data/lib/cacofonix/elements/religious_text_feature.rb +8 -0
- data/lib/cacofonix/elements/sales_outlet.rb +7 -0
- data/lib/cacofonix/elements/sales_outlet_identifier.rb +6 -0
- data/lib/cacofonix/elements/sales_restriction.rb +7 -0
- data/lib/cacofonix/elements/sales_rights.rb +13 -0
- data/lib/cacofonix/elements/sender_identifier.rb +6 -0
- data/lib/cacofonix/elements/series.rb +11 -0
- data/lib/cacofonix/elements/series_identifier.rb +6 -0
- data/lib/cacofonix/elements/set.rb +13 -0
- data/lib/cacofonix/elements/stock.rb +16 -0
- data/lib/cacofonix/elements/stock_quantity_coded.rb +8 -0
- data/lib/cacofonix/elements/subject.rb +13 -0
- data/lib/cacofonix/elements/supplier_identifier.rb +6 -0
- data/lib/cacofonix/elements/supply_detail.rb +37 -0
- data/lib/cacofonix/elements/text_item.rb +11 -0
- data/lib/cacofonix/elements/text_item_identifier.rb +6 -0
- data/lib/cacofonix/elements/title.rb +11 -0
- data/lib/cacofonix/elements/website.rb +8 -0
- data/lib/cacofonix/elements/work_identifier.rb +6 -0
- data/lib/cacofonix/utils/code_list_extractor.rb +112 -0
- data/lib/cacofonix/utils/normaliser.rb +125 -0
- data/lib/cacofonix/version.rb +5 -0
- data/lib/cacofonix/wrappers/apa_product.rb +748 -0
- data/lib/cacofonix/wrappers/simple_product.rb +49 -0
- data/support/entities.txt +1499 -0
- data/support/extract.rb +25 -0
- data/support/switch-onix-2.1-short-to-reference.xsl +24 -0
- data/support/switch-onix-tagnames-1.1.xsl +25 -0
- data/support/switch-onix-tagnames-2.0.xsl +37 -0
- metadata +438 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
class Cacofonix::Prize < Cacofonix::Element
|
|
4
|
+
xml_name "Prize"
|
|
5
|
+
xml_accessor :prize_name, :from => "PrizeName"
|
|
6
|
+
xml_accessor :prize_year, :from => "PrizeYear"
|
|
7
|
+
onix_code_from_list :prize_country, "PrizeCountry", :list => 91
|
|
8
|
+
onix_code_from_list :prize_code, "PrizeCode", :list => 41
|
|
9
|
+
xml_accessor :prize_jury, :from => "PrizeJury"
|
|
10
|
+
end
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
class Cacofonix::Product < Cacofonix::ProductBase
|
|
4
|
+
xml_name "Product"
|
|
5
|
+
|
|
6
|
+
# PR.1 Record reference number, type and source
|
|
7
|
+
xml_accessor :record_reference, :from => "RecordReference"
|
|
8
|
+
onix_code_from_list :notification_type, "NotificationType", :list => 1
|
|
9
|
+
onix_code_from_list :deletion_code, "DeletionCode", :list => 2
|
|
10
|
+
xml_accessor :deletion_text, :from => "DeletionText"
|
|
11
|
+
onix_code_from_list :record_source_type, "RecordSourceType", :list => 3
|
|
12
|
+
onix_code_from_list :record_source_identifier_type, "RecordSourceIdentifierType", :list => 44
|
|
13
|
+
xml_accessor :record_source_identifier, :from => "RecordSourceIdentifier"
|
|
14
|
+
xml_accessor :record_source_name, :from => "RecordSourceName"
|
|
15
|
+
|
|
16
|
+
# PR.2 Product numbers
|
|
17
|
+
onix_codes_from_list :barcodes, "Barcode", :list => 6
|
|
18
|
+
|
|
19
|
+
# PR.3 Product Form
|
|
20
|
+
# (See also ProductBase)
|
|
21
|
+
onix_composite :contained_items, Cacofonix::ContainedItem
|
|
22
|
+
onix_composite :product_classifications, Cacofonix::ProductClassification
|
|
23
|
+
|
|
24
|
+
# PR.4 Epublication
|
|
25
|
+
# (See also ProductBase)
|
|
26
|
+
onix_code_from_list :epub_source, "EpubSource", :list => 11
|
|
27
|
+
xml_accessor :epub_source_version, "EpubSourceVersion"
|
|
28
|
+
xml_accessor :epub_source_description, "EpubSourceDescription"
|
|
29
|
+
|
|
30
|
+
onix_composite :series, Cacofonix::Series
|
|
31
|
+
onix_boolean_flag(:no_series, "NoSeries")
|
|
32
|
+
|
|
33
|
+
# PR.6 Set
|
|
34
|
+
onix_composite :sets, Cacofonix::Set
|
|
35
|
+
|
|
36
|
+
# PR.7 Title
|
|
37
|
+
onix_composite :titles, Cacofonix::Title
|
|
38
|
+
onix_composite :work_identifiers, Cacofonix::WorkIdentifier
|
|
39
|
+
onix_code_from_list :thesis_type, "ThesisType", :list => 72
|
|
40
|
+
xml_accessor :thesis_presented_to, :from => "ThesisPresentedTo"
|
|
41
|
+
xml_accessor :year_of_thesis, :from => "YearOfThesis", :as => Integer
|
|
42
|
+
|
|
43
|
+
# PR.8 Authorship
|
|
44
|
+
onix_composite :contributors, Cacofonix::Contributor
|
|
45
|
+
xml_accessor :contributor_statement, :from => "ContributorStatement"
|
|
46
|
+
onix_boolean_flag(:no_contributor, "NoContributor")
|
|
47
|
+
|
|
48
|
+
# PR.9 Conference
|
|
49
|
+
onix_composite :conferences, Cacofonix::Conference
|
|
50
|
+
|
|
51
|
+
# PR.10 Edition
|
|
52
|
+
onix_code_from_list :edition_type_code, "EditionTypeCode", :list => 21
|
|
53
|
+
xml_accessor :edition_number, :from => "EditionNumber", :as => Integer
|
|
54
|
+
xml_accessor :edition_version_number, :from => "EditionVersionNumber"
|
|
55
|
+
xml_accessor :edition_statement, :from => "EditionStatement"
|
|
56
|
+
onix_boolean_flag(:no_edition, "NoEdition")
|
|
57
|
+
onix_composite :religious_text, Cacofonix::ReligiousText, :singular => true
|
|
58
|
+
|
|
59
|
+
# PR.11 Language
|
|
60
|
+
onix_composite :languages, Cacofonix::Language
|
|
61
|
+
|
|
62
|
+
# PR.12 Extents and other content
|
|
63
|
+
xml_accessor :number_of_pages, :from => "NumberOfPages", :as => Integer
|
|
64
|
+
xml_accessor :pages_roman, :from => "PagesRoman"
|
|
65
|
+
xml_accessor :pages_arabic, :from => "PagesArabic", :as => Integer
|
|
66
|
+
onix_composite :extents, Cacofonix::Extent
|
|
67
|
+
xml_accessor :number_of_illustrations, :from => "NumberOfIllustrations", :as => Integer
|
|
68
|
+
xml_accessor :illustrations_note, :from => "IllustrationsNote"
|
|
69
|
+
onix_composite :illustrations, Cacofonix::Illustrations
|
|
70
|
+
xml_accessor :map_scale, :from => "MapScale", :as => [Integer]
|
|
71
|
+
|
|
72
|
+
# PR.13 Subject
|
|
73
|
+
xml_accessor :basic_main_subject, :from => "BASICMainSubject"
|
|
74
|
+
xml_accessor :basic_version, :from => "BASICVersion"
|
|
75
|
+
xml_accessor :bic_main_subject, :from => "BICMainSubject"
|
|
76
|
+
xml_accessor :bic_version, :from => "BICVersion"
|
|
77
|
+
onix_composite :main_subjects, Cacofonix::MainSubject
|
|
78
|
+
onix_composite :subjects, Cacofonix::Subject
|
|
79
|
+
onix_composite :person_as_subjects, Cacofonix::Contributor, :from => "PersonAsSubject"
|
|
80
|
+
xml_accessor :corporate_body_as_subject, :from => "CorporateBodyAsSubject", :as => []
|
|
81
|
+
xml_accessor :place_as_subject, :from => "PlaceAsSubject", :as => []
|
|
82
|
+
|
|
83
|
+
# PR.14 Audience
|
|
84
|
+
onix_codes_from_list :audience_codes, "AudienceCode", :list => 28
|
|
85
|
+
onix_composite :audiences, Cacofonix::Audience
|
|
86
|
+
onix_composite :audience_ranges, Cacofonix::AudienceRange
|
|
87
|
+
xml_accessor :audience_description, :from => "AudienceDescription"
|
|
88
|
+
onix_composite :complexities, Cacofonix::Complexity
|
|
89
|
+
|
|
90
|
+
# PR.15 Descriptions and supporting texts
|
|
91
|
+
onix_composite :other_texts, Cacofonix::OtherText
|
|
92
|
+
# NB: alias included for backwards compatibility
|
|
93
|
+
alias_accessor :text, :other_texts
|
|
94
|
+
|
|
95
|
+
# PR.16 Links to image/audio/video files
|
|
96
|
+
onix_composite :media_files, Cacofonix::MediaFile
|
|
97
|
+
onix_composite :product_websites, Cacofonix::Website, :from => "ProductWebsite"
|
|
98
|
+
|
|
99
|
+
# PR.17 Prizes
|
|
100
|
+
onix_composite :prizes, Cacofonix::Prize
|
|
101
|
+
|
|
102
|
+
# PR.18 Content items
|
|
103
|
+
onix_composite :content_items, Cacofonix::ContentItem
|
|
104
|
+
|
|
105
|
+
# PR.19 Publisher
|
|
106
|
+
onix_composite :imprints, Cacofonix::Imprint
|
|
107
|
+
onix_composite :publishers, Cacofonix::Publisher
|
|
108
|
+
xml_accessor :cities_of_publication, :from => "CityOfPublication", :as => []
|
|
109
|
+
onix_code_from_list :country_of_publication, "CountryOfPublication", :list => 91
|
|
110
|
+
|
|
111
|
+
# PR.20 Publishing status and dates, and copyright
|
|
112
|
+
onix_code_from_list :publishing_status, "PublishingStatus", :list => 64
|
|
113
|
+
xml_accessor :publishing_status_note, :from => "PublishingStatusNote"
|
|
114
|
+
onix_date_accessor :announcement_date, "AnnouncementDate"
|
|
115
|
+
onix_date_accessor :trade_announcement_date, "TradeAnnouncementDate"
|
|
116
|
+
onix_date_accessor :publication_date, "PublicationDate"
|
|
117
|
+
onix_composite :copyright_statements, Cacofonix::CopyrightStatement
|
|
118
|
+
xml_accessor :copyright_year, :from => "CopyrightYear", :as => Integer
|
|
119
|
+
xml_accessor :year_first_published, :from => "YearFirstPublished", :as => Integer
|
|
120
|
+
|
|
121
|
+
# PR.21 Territorial rights and other sales restrictions
|
|
122
|
+
onix_composite :sales_rights, Cacofonix::SalesRights
|
|
123
|
+
onix_composite :not_for_sales, Cacofonix::NotForSale
|
|
124
|
+
onix_composite :sales_restrictions, Cacofonix::SalesRestriction
|
|
125
|
+
|
|
126
|
+
# PR.22 Dimensions
|
|
127
|
+
onix_composite :measures, Cacofonix::Measure
|
|
128
|
+
alias_accessor :measurements, :measures
|
|
129
|
+
# Some deprecated attributes. Read only
|
|
130
|
+
# - See the measurements array for the current way of specifying
|
|
131
|
+
# various measurements of the product
|
|
132
|
+
xml_reader :height, :from => "Height", :as => BigDecimal
|
|
133
|
+
xml_reader :width, :from => "Width", :as => BigDecimal
|
|
134
|
+
xml_reader :thickness, :from => "Thickness", :as => BigDecimal
|
|
135
|
+
xml_reader :weight, :from => "Weight", :as => BigDecimal
|
|
136
|
+
xml_reader :dimensions, :from => "Dimensions"
|
|
137
|
+
|
|
138
|
+
# PR.23 Related products
|
|
139
|
+
onix_composite :related_products, Cacofonix::RelatedProduct
|
|
140
|
+
onix_date_accessor :out_of_print_date, "OutOfPrintDate"
|
|
141
|
+
|
|
142
|
+
# PR.24 Supplier, availability and prices
|
|
143
|
+
onix_composite :supply_details, Cacofonix::SupplyDetail
|
|
144
|
+
|
|
145
|
+
# PR.25 Market representation
|
|
146
|
+
onix_composite :market_representations, Cacofonix::MarketRepresentation
|
|
147
|
+
|
|
148
|
+
# PR.26 Sales promotion
|
|
149
|
+
xml_accessor :promotion_campaign, :from => "PromotionCampaign"
|
|
150
|
+
xml_accessor :promotion_contact_details, :from => "PromotionContactDetails"
|
|
151
|
+
xml_accessor :initial_print_run, :from => "InitialPrintRun"
|
|
152
|
+
xml_accessor :reprint_details, :from => "ReprintDetail", :as => []
|
|
153
|
+
xml_accessor :copies_sold, :from => "CopiesSold"
|
|
154
|
+
xml_accessor :book_club_adoption, :from => "BookClubAdoption"
|
|
155
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
# This is the abstract base class of Product, RelatedProduct
|
|
4
|
+
# and ContainedItem.
|
|
5
|
+
#
|
|
6
|
+
class Cacofonix::ProductBase < Cacofonix::Element
|
|
7
|
+
onix_composite :product_identifiers, Cacofonix::ProductIdentifier
|
|
8
|
+
onix_composite :websites, Cacofonix::Website
|
|
9
|
+
onix_code_from_list :product_form, "ProductForm", :list => 7
|
|
10
|
+
onix_codes_from_list :product_form_details, "ProductFormDetail", :list => 78
|
|
11
|
+
onix_composite :product_form_features, Cacofonix::ProductFormFeature
|
|
12
|
+
onix_code_from_list :product_packaging, "ProductPackaging", :list => 80
|
|
13
|
+
xml_accessor :product_form_description, :from => "ProductFormDescription"
|
|
14
|
+
xml_accessor :number_of_pieces, :from => "NumberOfPieces", :as => Integer
|
|
15
|
+
onix_code_from_list :trade_category, "TradeCategory", :list => 12
|
|
16
|
+
onix_code_from_list :product_content_type, "ProductContentType", :list => 81
|
|
17
|
+
onix_code_from_list :epub_type, "EpubType", :list => 10
|
|
18
|
+
xml_accessor :epub_type_version, "EpubTypeVersion"
|
|
19
|
+
xml_accessor :epub_type_description, "EpubTypeDescription"
|
|
20
|
+
onix_code_from_list :epub_format, "EpubFormat", :list => 11
|
|
21
|
+
xml_accessor :epub_format_version, "EpubFormatVersion"
|
|
22
|
+
xml_accessor :epub_format_description, "EpubFormatDescription"
|
|
23
|
+
xml_accessor :epub_type_note, "EpubTypeNote"
|
|
24
|
+
|
|
25
|
+
# Extend this product instance with a module. Typically these modules
|
|
26
|
+
# make it easier to read or write common values in the Product.
|
|
27
|
+
#
|
|
28
|
+
# The product tracks the modules that have extended it, so that it
|
|
29
|
+
# can easily pass these extensions on to other products
|
|
30
|
+
# (see #interpret_like_me).
|
|
31
|
+
#
|
|
32
|
+
# For convenience, this method returns the product itself.
|
|
33
|
+
#
|
|
34
|
+
def interpret(mods)
|
|
35
|
+
@_extensions ||= []
|
|
36
|
+
[mods].flatten.compact.uniq.each { |mod|
|
|
37
|
+
next if @_extensions.include?(mod)
|
|
38
|
+
@_extensions << mod
|
|
39
|
+
extend(mod)
|
|
40
|
+
}
|
|
41
|
+
self
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Apply all the modules that have extended this product to another product.
|
|
45
|
+
#
|
|
46
|
+
# This is useful when, say, accessing RelatedProduct or ContainedItem
|
|
47
|
+
# composites. Your module might do something like:
|
|
48
|
+
#
|
|
49
|
+
# def print_product
|
|
50
|
+
# prod = related_products.detect { |p| p.relation_code == 13 }
|
|
51
|
+
# prod ? interpret_like_me(prod) : nil
|
|
52
|
+
# end
|
|
53
|
+
#
|
|
54
|
+
# As a result, this related product will have all the extensions applied
|
|
55
|
+
# to this product.
|
|
56
|
+
#
|
|
57
|
+
def interpret_like_me(product)
|
|
58
|
+
product.interpret(@_extensions)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
end
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
class Cacofonix::ProductClassification < Cacofonix::Element
|
|
4
|
+
xml_name "ProductClassification"
|
|
5
|
+
xml_accessor :product_classification_type, "ProductClassificationType"
|
|
6
|
+
onix_code_from_list :product_classification_code, "ProductClassificationCode", :list => 9
|
|
7
|
+
xml_accessor :percent, :from => "Percent", :as => Float
|
|
8
|
+
end
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
class Cacofonix::ProductFormFeature < Cacofonix::Element
|
|
4
|
+
xml_name "ProductFormFeature"
|
|
5
|
+
onix_code_from_list :product_form_feature_type, "ProductFormFeatureType", :list => 79
|
|
6
|
+
xml_accessor :product_form_feature_value, :from => "ProductFormFeatureValue"
|
|
7
|
+
xml_accessor :product_form_feature_description, :from => "ProductFormFeatureDescription"
|
|
8
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
class Cacofonix::Publisher < Cacofonix::Element
|
|
4
|
+
xml_name "Publisher"
|
|
5
|
+
onix_code_from_list :publishing_role, "PublishingRole", :list => 45
|
|
6
|
+
onix_code_from_list :name_code_type, "NameCodeType", :list => 44
|
|
7
|
+
xml_accessor :name_code_type_name, :from => "NameCodeTypeName"
|
|
8
|
+
xml_accessor :name_code_type_value, :from => "NameCodeTypeValue"
|
|
9
|
+
xml_accessor :publisher_name, :from => "PublisherName"
|
|
10
|
+
onix_composite :websites, Cacofonix::Website
|
|
11
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
class Cacofonix::Reissue < Cacofonix::Element
|
|
4
|
+
xml_name "Reissue"
|
|
5
|
+
onix_date_accessor :reissue_date, "ReissueDate"
|
|
6
|
+
xml_accessor :reissue_description, :from => "ReissueDescription"
|
|
7
|
+
onix_composite :prices, Cacofonix::Price
|
|
8
|
+
onix_composite :media_files, Cacofonix::MediaFile
|
|
9
|
+
end
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
class Cacofonix::ReligiousText < Cacofonix::Element
|
|
4
|
+
xml_name "ReligiousText"
|
|
5
|
+
onix_composite :bible, Cacofonix::Bible, :singular => true
|
|
6
|
+
onix_code_from_list :religious_text_identifier, "ReligiousTextIdentifier", :list => 88
|
|
7
|
+
onix_composite :religious_text_feature, Cacofonix::ReligiousTextFeature
|
|
8
|
+
end
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
class Cacofonix::ReligiousTextFeature < Cacofonix::Element
|
|
4
|
+
xml_name "ReligiousTextFeature"
|
|
5
|
+
onix_code_from_list :religious_text_feature_type, "ReligiousTextFeatureType", :list => 89
|
|
6
|
+
onix_code_from_list :religious_text_feature_code, "ReligiousTextFeatureCode", :list => 90
|
|
7
|
+
xml_accessor :religious_text_feature_description, :from => "ReligiousTextFeatureDescription"
|
|
8
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
# See also: NotForSale. It's possible to set not for sale here as well.
|
|
4
|
+
#
|
|
5
|
+
class Cacofonix::SalesRights < Cacofonix::Element
|
|
6
|
+
xml_name "SalesRights"
|
|
7
|
+
onix_code_from_list :sales_rights_type, "SalesRightsType", :list => 46
|
|
8
|
+
onix_spaced_codes_from_list :rights_countries, "RightsCountry", :list => 91
|
|
9
|
+
onix_spaced_codes_from_list :rights_territories, "RightsTerritory", :list => 49
|
|
10
|
+
|
|
11
|
+
# Deprecated accessors
|
|
12
|
+
onix_codes_from_list :rights_region, "RightsRegion", :list => 47
|
|
13
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
class Cacofonix::Series < Cacofonix::Element
|
|
4
|
+
xml_name "Series"
|
|
5
|
+
onix_composite :series_identifiers, Cacofonix::SeriesIdentifier
|
|
6
|
+
xml_accessor :title_of_series, :from => "TitleOfSeries"
|
|
7
|
+
onix_composite :titles, Cacofonix::Title
|
|
8
|
+
onix_composite :contributors, Cacofonix::Contributor
|
|
9
|
+
xml_accessor :number_within_series, :from => "NumberWithinSeries"
|
|
10
|
+
xml_accessor :year_of_annual, :from => "YearOfAnnual"
|
|
11
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
class Cacofonix::Set < Cacofonix::Element
|
|
4
|
+
xml_name "Set"
|
|
5
|
+
onix_composite :product_identifiers, Cacofonix::ProductIdentifier
|
|
6
|
+
xml_accessor :title_of_set, :from => "TitleOfSet"
|
|
7
|
+
onix_composite :titles, Cacofonix::Title
|
|
8
|
+
xml_accessor :set_part_number, :from => "SetPartNumber"
|
|
9
|
+
xml_accessor :set_part_title, :from => "SetPartTitle"
|
|
10
|
+
xml_accessor :number_within_set, :from => "ItemNumberWithinSet"
|
|
11
|
+
xml_accessor :level_sequence_number, :from => "LevelSequenceNumber"
|
|
12
|
+
xml_accessor :set_item_title, :from => "SetItemTitle"
|
|
13
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
class Cacofonix::Stock < Cacofonix::Element
|
|
4
|
+
xml_name "Stock"
|
|
5
|
+
onix_composite :location_identifier, Cacofonix::LocationIdentifier, :singular => true
|
|
6
|
+
xml_accessor :location_name, :from => "LocationName"
|
|
7
|
+
onix_composite :stock_quantity_coded, Cacofonix::StockQuantityCoded, :singular => true
|
|
8
|
+
|
|
9
|
+
# NOTE: these *should* be numeric fields according to the spec,
|
|
10
|
+
# but heaps of ONIX files in the wild use text
|
|
11
|
+
xml_accessor :on_hand, :from => "OnHand"
|
|
12
|
+
xml_accessor :on_order, :from => "OnOrder"
|
|
13
|
+
|
|
14
|
+
xml_accessor :cbo, :from => "CBO"
|
|
15
|
+
onix_composite :on_order_detail, Cacofonix::OnOrderDetail, :singular => true
|
|
16
|
+
end
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
class Cacofonix::StockQuantityCoded < Cacofonix::Element
|
|
4
|
+
xml_name "StockQuantityCoded"
|
|
5
|
+
onix_code_from_list :stock_quantity_code_type, "StockQuantityCodeType", :list => 70
|
|
6
|
+
xml_accessor :stock_quantity_code_type_name, :from => "StockQuantityCodeTypeName"
|
|
7
|
+
xml_accessor :stock_quantity_code
|
|
8
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
class Cacofonix::Subject < Cacofonix::Element
|
|
4
|
+
xml_name "Subject"
|
|
5
|
+
onix_code_from_list :subject_scheme_identifier, "SubjectSchemeIdentifier", :list => 27
|
|
6
|
+
# Aliased for backwards compat
|
|
7
|
+
alias_accessor :subject_scheme_id, :subject_scheme_identifier
|
|
8
|
+
|
|
9
|
+
xml_accessor :subject_scheme_name, :from => "SubjectSchemeName"
|
|
10
|
+
xml_accessor :subject_scheme_version, :from => "SubjectSchemeVersion"
|
|
11
|
+
xml_accessor :subject_code, :from => "SubjectCode"
|
|
12
|
+
xml_accessor :subject_heading_text, :from => "SubjectHeadingText"
|
|
13
|
+
end
|