diff --git a/bin/onix_extract_codelists b/bin/onix_extract_codelists new file mode 100755 index 0000000..00088dc --- /dev/null +++ b/bin/onix_extract_codelists @@ -0,0 +1,16 @@ +#!/usr/bin/ruby +# coding: utf-8 + +USAGE = "./onix_extract_codelists ONIX_BookProduct_CodeLists.xsd some_dir" + +require 'rubygems' +$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib') +require "onix" + +unless ARGV.size == 2 + puts USAGE + exit(1) +end + +extractor = ONIX::CodeListExtractor.new(ARGV.shift) +extractor.run(ARGV.shift) diff --git a/lib/onix.rb b/lib/onix.rb index 6279e25..c0274a5 100644 --- a/lib/onix.rb +++ b/lib/onix.rb @@ -2,6 +2,7 @@ require 'bigdecimal' require 'cgi' +require 'singleton' require 'roxml' require 'andand' @@ -82,18 +83,11 @@ def self.two_digit require File.join(File.dirname(__FILE__), "onix", "reader") require File.join(File.dirname(__FILE__), "onix", "writer") -# lists -require File.join(File.dirname(__FILE__), "onix", "lists", "product_form") -require File.join(File.dirname(__FILE__), "onix", "lists", "product_availability") -require File.join(File.dirname(__FILE__), "onix", "lists", "country_code") -require File.join(File.dirname(__FILE__), "onix", "lists", "language_code") -require File.join(File.dirname(__FILE__), "onix", "lists", "language_role") -require File.join(File.dirname(__FILE__), "onix", "lists", "notification_type") -require File.join(File.dirname(__FILE__), "onix", "lists", "product_form_detail") - # product wrappers require File.join(File.dirname(__FILE__), "onix", "simple_product") require File.join(File.dirname(__FILE__), "onix", "apa_product") # misc +require File.join(File.dirname(__FILE__), "onix", "lists") require File.join(File.dirname(__FILE__), "onix", "normaliser") +require File.join(File.dirname(__FILE__), "onix", "code_list_extractor") diff --git a/lib/onix/code_list_extractor.rb b/lib/onix/code_list_extractor.rb new file mode 100644 index 0000000..4faa041 --- /dev/null +++ b/lib/onix/code_list_extractor.rb @@ -0,0 +1,69 @@ +# coding: utf-8 + +module ONIX + + # A utility class that processes the code list XSD from the ONIX spec and + # creates a set of TSV files. The generated files are used by this library + # to make hashes of the code lists available to users. + # + class CodeListExtractor + + # Creates a new extractor. Expects the path to a copy of the code lists + # file from the spec (called ONIX_BookProduct_CodeLists.xsd on my system). + # + def initialize(filename) + raise ArgumentError, "#{filename} not found" unless File.file?(filename) + + @filename = filename + end + + # generate a set of TSV files in the given directory. Creates the directory + # if it doesn't exist and will overwrite existing files. + # + def run(dir) + FileUtils.mkdir_p(dir) unless File.directory?(dir) + + each_list do |number, data| + #puts number + file = number.to_s.rjust(3, "0") + ".tsv" + path = File.join(dir, file) + File.open(path, "w") { |f| f.write data} + end + end + + private + + def data + @data ||= File.open(@filename) { |f| f.read } + end + + def document + @document ||= Nokogiri::XML(data) + @document.remove_namespaces! if @document.namespaces.size > 0 + @document + end + + def each_list(&block) + document.xpath("//simpleType").each do |node| + list_name = node.xpath("./@name").first.value + list_number = list_name[/List(\d+)/,1].to_i + if list_number > 0 + yield list_number, list_data(list_number) + end + end + end + + def list_data(num) + str = "" + nodes = document.xpath("//simpleType[@name='List#{num}']/restriction/enumeration") + nodes.each do |node| + code = node.xpath("./@value").first.value + desc = node.xpath("./annotation/documentation").first.text + ldesc = node.xpath("./annotation/documentation").last.text + str += "#{code}\t#{desc}\t#{ldesc}\n" + end + str + end + + end +end diff --git a/lib/onix/lists.rb b/lib/onix/lists.rb new file mode 100644 index 0000000..82f1f0a --- /dev/null +++ b/lib/onix/lists.rb @@ -0,0 +1,122 @@ +# coding: utf-8 + +module ONIX + + class Lists + include Singleton + + # retrieve a hash with the specified code list + # + # ONIX::Lists.list(7) + # => { "BB" => "Hardback", ... } + # + def self.list(number) + self.instance.list(number) + end + + # Shortcut to retrieve a common code list + # + def self.audience_code + self.instance.list(28) + end + + # Shortcut to retrieve a common code list + # + def self.contributor_role + self.instance.list(17) + end + + # Shortcut to retrieve a common code list + # + def self.country_code + self.instance.list(91) + end + + # Shortcut to retrieve a common code list + # + def self.language_code + self.instance.list(74) + end + + # Shortcut to retrieve a common code list + # + def self.language_role + self.instance.list(22) + end + + # Shortcut to retrieve a common code list + # + def self.notification_type + self.instance.list(1) + end + + # Shortcut to retrieve a common code list + # + def self.product_availability + self.instance.list(65) + end + + # Shortcut to retrieve a common code list + # + def self.product_form + self.instance.list(7) + end + + # Shortcut to retrieve a common code list + # + def self.product_form_detail + self.instance.list(78) + end + + # return a hash with the data for a single code list. + # + # number should be a fixnum specifying the list to retrieve + # + # ONIX::Lists.instance.list(7) + # => { "BB" => "Hardback", ... } + # + def list(number) + cache[number] ||= build_hash(number) + end + + private + + def build_hash(number) + val = {} + data(number).each_line do |line| + code, desc, ldesc = *line.split("\t") + code = code.to_i if code.to_s.match(/\d+/) + val[code] = desc + end + val + end + + def cache + @cache ||= {} + end + + def path(number) + code_dir = File.dirname(__FILE__) + "/../../data/codes" + filename = number.to_s.rjust(3, "0") + ".tsv" + File.join(code_dir, filename) + end + + def data(number) + File.open(path(number)) { |f| f.read } + end + + public + + # These are here for backwards compatability with the onix gem <= 0.8.3 + AUDIENCE_CODE = ONIX::Lists.audience_code + CONTRIBUTOR_ROLE = ONIX::Lists.contributor_role + COUNTRY_CODE = ONIX::Lists.country_code + LANGUAGE_CODE = ONIX::Lists.language_code + LANGUAGE_ROLE = ONIX::Lists.language_role + NOTIFICATION_TYPE = ONIX::Lists.notification_type + PRODUCT_AVAILABILITY = ONIX::Lists.product_availability + PRODUCT_FORM = ONIX::Lists.product_form + PRODUCT_FORM_DETAIL = ONIX::Lists.product_form_detail + + end +end diff --git a/lib/onix/lists/audience_code.rb b/lib/onix/lists/audience_code.rb deleted file mode 100644 index da7de1b..0000000 --- a/lib/onix/lists/audience_code.rb +++ /dev/null @@ -1,17 +0,0 @@ -# coding: utf-8 - -module ONIX - module Lists - # Code list 91 - COUNTRY_CODE = { - 1 => "General/trade", - 2 => "Children/juvenile", - 3 => "Young adult", - 4 => "Primary & secondary/elementary & high school", - 5 => "College/higher education", - 6 => "Professional and scholarly", - 7 => "ELT/ESL", - 8 => "Adult education", - } - end -end diff --git a/lib/onix/lists/contributor_role.rb b/lib/onix/lists/contributor_role.rb deleted file mode 100644 index b23309b..0000000 --- a/lib/onix/lists/contributor_role.rb +++ /dev/null @@ -1,99 +0,0 @@ -# coding: utf-8 - -module ONIX - module Lists - # Code list 17 - CONTRIBUTOR_ROLE = { - "A01" => "By (author)", - "A02" => "With", - "A03" => "Screenplay by", - "A04" => "Libretto by", - "A05" => "Lyrics by", - "A06" => "By (composer)", - "A07" => "By (artist)", - "A08" => "By (photographer)", - "A09" => "Created by", - "A10" => "From an idea by", - "A11" => "Designed by", - "A12" => "Illustrated by", - "A13" => "Photographs by", - "A14" => "Text by", - "A15" => "Preface by", - "A16" => "Prologue by", - "A17" => "Summary by", - "A18" => "Supplement by", - "A19" => "Afterword by", - "A20" => "Notes by", - "A21" => "Commentaries by", - "A22" => "Epilogue by", - "A23" => "Foreword by", - "A24" => "Introduction by", - "A25" => "Footnotes by", - "A26" => "Memoir by", - "A27" => "Experiments by", - "A29" => "Introduction and notes by", - "A30" => "Software written by", - "A31" => "Book and lyrics by", - "A32" => "Contributions by", - "A33" => "Appendix by", - "A34" => "Index by", - "A35" => "Drawings by", - "A36" => "Cover design or artwork by", - "A37" => "Preliminary work by", - "A38" => "Original author", - "A39" => "Maps by", - "A40" => "Inked or colored by", - "A41" => "Pop-ups by", - "A42" => "Continued by", - "A43" => "Interviewer", - "A44" => "Interviewee", - "A99" => "Other primary creator", - "B01" => "Edited by", - "B02" => "Revised by", - "B03" => "Retold by", - "B04" => "Abridged by", - "B05" => "Adapted by", - "B06" => "Translated by", - "B07" => "As told by", - "B08" => "Translated with commentary by", - "B09" => "Series edited by", - "B10" => "Edited and translated by", - "B11" => "Editor-in-chief", - "B12" => "Guest editor", - "B13" => "Volume editor", - "B14" => "Editorial board member", - "B15" => "Editorial coordination by", - "B16" => "Managing editor", - "B17" => "Founded by", - "B18" => "Prepared for publication by", - "B19" => "Associate editor", - "B20" => "Consultant editor", - "B21" => "General editor", - "B22" => "Dramatized by", - "B23" => "General rapporteur", - "B24" => "Literary editor", - "B25" => "Arranged by (music)", - "B99" => "Other adaptation by", - "C01" => "Compiled by", - "C02" => "Selected by", - "C99" => "Other compilation by", - "D01" => "Producer", - "D02" => "Director", - "D03" => "Conductor", - "D99" => "Other direction by", - "E01" => "Actor", - "E02" => "Dancer", - "E03" => "Narrator", - "E04" => "Commentator", - "E05" => "Vocal soloist", - "E06" => "Instrumental soloist", - "E07" => 'Read by', - "E08" => "Performed by (orchestra, band, ensemble)", - "E99" => "Performed by", - "F01" => "Filmed/photographed by", - "F99" => "Other recording by", - "Z01" => "Assisted by", - "Z99" => "Other", - } - end -end diff --git a/lib/onix/lists/country_code.rb b/lib/onix/lists/country_code.rb deleted file mode 100644 index a2351b8..0000000 --- a/lib/onix/lists/country_code.rb +++ /dev/null @@ -1,257 +0,0 @@ -# coding: utf-8 - -module ONIX - module Lists - # Code list 91 - COUNTRY_CODE = { - "AD" => "Andorra", - "AE" => "United Arab Emirates", - "AF" => "Afghanistan", - "AG" => "Antigua and Barbuda", - "AI" => "Anguilla", - "AL" => "Albania", - "AM" => "Armenia", - "AN" => "Netherlands Antilles", - "AO" => "Angola", - "AQ" => "Antarctica", - "AR" => "Argentina", - "AS" => "American Samoa", - "AT" => "Austria", - "AU" => "Australia", - "AW" => "Aruba", - "AX" => "Aland Islands", - "AZ" => "Azerbaijan", - "BA" => "Bosnia and Herzegovina", - "BB" => "Barbados", - "BD" => "Bangladesh", - "BE" => "Belgium", - "BF" => "Burkina Faso", - "BG" => "Bulgaria", - "BH" => "Bahrain", - "BI" => "Burundi", - "BJ" => "Benin", - "BL" => "Saint Barthelemy", - "BM" => "Bermuda", - "BN" => "Brunei Darussalam", - "BO" => "Bolivia", - "BR" => "Brazil", - "BS" => "Bahamas", - "BT" => "Bhutan", - "BV" => "Bouvet Island", - "BW" => "Botswana", - "BY" => "Belarus", - "BZ" => "Belize", - "CA" => "Canada", - "CC" => "Cocos (Keeling) Islands", - "CD" => "Congo, Democratic Republic of the", - "CF" => "Central African Republic", - "CG" => "Congo", - "CH" => "Switzerland", - "CI" => "Cote D'Ivoire", - "CK" => "Cook Islands", - "CL" => "Chile", - "CM" => "Cameroon", - "CN" => "China", - "CO" => "Colombia", - "CR" => "Costa Rica", - "CS" => "Serbia and Montenegro", - "CU" => "Cuba", - "CV" => "Cape Verde", - "CX" => "Christmas Island", - "CY" => "Cyprus", - "CZ" => "Czech Republic", - "DE" => "Germany", - "DJ" => "Djibouti", - "DK" => "Denmark", - "DM" => "Dominica", - "DO" => "Dominican Republic", - "DZ" => "Algeria", - "EC" => "Ecuador", - "EE" => "Estonia", - "EG" => "Egypt", - "EH" => "Western Sahara", - "ER" => "Eritrea", - "ES" => "Spain", - "ET" => "Ethiopia", - "FI" => "Finland", - "FJ" => "Fiji", - "FK" => "Falkland Islands (Malvinas)", - "FM" => "Micronesia, Federated States of", - "FO" => "Faroe Islands", - "FR" => "France", - "GA" => "Gabon", - "GB" => "United Kingdom", - "GD" => "Grenada", - "GE" => "Georgia", - "GF" => "French Guiana", - "GG" => "Guernsey", - "GH" => "Ghana", - "GI" => "Gibraltar", - "GL" => "Greenland", - "GM" => "Gambia", - "GN" => "Guinea", - "GP" => "Guadeloupe", - "GQ" => "Equatorial Guinea", - "GR" => "Greece", - "GS" => "South Georgia and the South Sandwich Islands", - "GT" => "Guatemala", - "GU" => "Guam", - "GW" => "Guinea-Bissau", - "GY" => "Guyana", - "HK" => "Hong Kong", - "HM" => "Heard Island and McDonald Islands", - "HN" => "Honduras", - "HR" => "Croatia", - "HT" => "Haiti", - "HU" => "Hungary", - "ID" => "Indonesia", - "IE" => "Ireland", - "IL" => "Israel", - "IM" => "Isle of Man", - "IN" => "India", - "IO" => "British Indian Ocean Territory", - "IQ" => "Iraq", - "IR" => "Iran, Islamic Republic of", - "IS" => "Iceland", - "IT" => "Italy", - "JE" => "Jersey", - "JM" => "Jamaica", - "JO" => "Jordan", - "JP" => "Japan", - "KE" => "Kenya", - "KG" => "Kyrgyzstan", - "KH" => "Cambodia", - "KI" => "Kiribati", - "KM" => "Comoros", - "KN" => "Saint Kitts and Nevis", - "KP" => "Korea, Democratic People's Republic of", - "KR" => "Korea, Republic of", - "KW" => "Kuwait", - "KY" => "Cayman Islands", - "KZ" => "Kazakhstan", - "LA" => "Lao People's Democratic Republic", - "LB" => "Lebanon", - "LC" => "Saint Lucia", - "LI" => "Liechtenstein", - "LK" => "Sri Lanka", - "LR" => "Liberia", - "LS" => "Lesotho", - "LT" => "Lithuania", - "LU" => "Luxembourg", - "LV" => "Latvia", - "LY" => "Libyan Arab Jamahiriya", - "MA" => "Morocco", - "MC" => "Monaco", - "MD" => "Moldova, Republic of", - "ME" => "Montenegro", - "MF" => "Saint Martin, French part", - "MG" => "Madagascar", - "MH" => "Marshall Islands", - "MK" => "Macedonia, the former Yugoslav Republic of", - "ML" => "Mali", - "MM" => "Myanmar", - "MN" => "Mongolia", - "MO" => "Macao", - "MP" => "Northern Mariana Islands", - "MQ" => "Martinique", - "MR" => "Mauritania", - "MS" => "Montserrat", - "MT" => "Malta", - "MU" => "Mauritius", - "MV" => "Maldives", - "MW" => "Malawi", - "MX" => "Mexico", - "MY" => "Malaysia", - "MZ" => "Mozambique", - "NA" => "Namibia", - "NC" => "New Caledonia", - "NE" => "Niger", - "NF" => "Norfolk Island", - "NG" => "Nigeria", - "NI" => "Nicaragua", - "NL" => "Netherlands", - "NO" => "Norway", - "NP" => "Nepal", - "NR" => "Nauru", - "NU" => "Niue", - "NZ" => "New Zealand", - "OM" => "Oman", - "PA" => "Panama", - "PE" => "Peru", - "PF" => "French Polynesia", - "PG" => "Papua New Guinea", - "PH" => "Philippines", - "PK" => "Pakistan", - "PL" => "Poland", - "PM" => "Saint Pierre and Miquelon", - "PN" => "Pitcairn", - "PR" => "Puerto Rico", - "PS" => "Palestinian Territory, Occupied", - "PT" => "Portugal", - "PW" => "Palau", - "PY" => "Paraguay", - "QA" => "Qatar", - "RE" => "Reunion", - "RO" => "Romania", - "RS" => "Serbia", - "RU" => "Russian Federation", - "RW" => "Rwanda", - "SA" => "Saudi Arabia", - "SB" => "Solomon Islands", - "SC" => "Seychelles", - "SD" => "Sudan", - "SE" => "Sweden", - "SG" => "Singapore", - "SH" => "Saint Helena", - "SI" => "Slovenia", - "SJ" => "Svalbard and Jan Mayen", - "SK" => "Slovakia", - "SL" => "Sierra Leone", - "SM" => "San Marino", - "SN" => "Senegal", - "SO" => "Somalia", - "SR" => "Suriname", - "ST" => "Sao Tome and Principe", - "SV" => "El Salvador", - "SY" => "Syrian Arab Republic", - "SZ" => "Swaziland", - "TC" => "Turks and Caicos Islands", - "TD" => "Chad", - "TF" => "French Southern Territories", - "TG" => "Togo", - "TH" => "Thailand", - "TJ" => "Tajikistan", - "TK" => "Tokelau", - "TL" => "Timor-Leste", - "TM" => "Turkmenistan", - "TN" => "Tunisia", - "TO" => "Tonga", - "TR" => "Turkey", - "TT" => "Trinidad and Tobago", - "TV" => "Tuvalu", - "TW" => "Taiwan, Province of China", - "TZ" => "Tanzania, United Republic of", - "UA" => "Ukraine", - "UG" => "Uganda", - "UM" => "United States Minor Outlying Islands", - "US" => "United States", - "UY" => "Uruguay", - "UZ" => "Uzbekistan", - "VA" => "Holy See (Vatican City State)", - "VC" => "Saint Vincent and the Grenadines", - "VE" => "Venezuela, Bolivarian Republic of", - "VG" => "Virgin Islands, British", - "VI" => "Virgin Islands, US", - "VN" => "Viet Nam", - "VU" => "Vanuatu", - "WF" => "Wallis and Futuna", - "WS" => "Samoa", - "YE" => "Yemen", - "YT" => "Mayotte", - "YU" => "Yugoslavia", - "ZA" => "South Africa", - "ZM" => "Zambia", - "ZW" => "Zimbabwe", - } - end -end diff --git a/lib/onix/lists/language_code.rb b/lib/onix/lists/language_code.rb deleted file mode 100644 index 2ce2962..0000000 --- a/lib/onix/lists/language_code.rb +++ /dev/null @@ -1,498 +0,0 @@ -# coding: utf-8 - -module ONIX - module Lists - # Code list 74 - LANGUAGE_CODE = { - "aar" => "Afar", - "abk" => "Abkhaz", - "ace" => "Achinese", - "ach" => "Acoli", - "ada" => "Adangme", - "ady" => "Adygei", - "afa" => "Afroasiatic languages", - "afh" => "Afrihili (Artificial language)", - "afr" => "Afrikaans", - "ain" => "Ainu", - "aka" => "Akan", - "akk" => "Akkadian", - "alb" => "Albanian", - "ale" => "Aleut", - "alg" => "Algonquian languages", - "alt" => "Southern Altai", - "amh" => "Amharic", - "ang" => "English, Old (ca. 450-1100)", - "anp" => "Angika", - "apa" => "Apache languages", - "ara" => "Arabic", - "arc" => "Official Aramaic; Imperial Aramaic (700-300 BCE)", - "arg" => "Aragonese Spanish", - "arm" => "Armenian", - "arn" => "Mapudungun; Mapuche", - "arp" => "Arapaho", - "art" => "Artificial languages", - "arw" => "Arawak", - "asm" => "Assamese", - "ast" => "Asturian; Bable; Leonese; Asturleonese", - "ath" => "Athapascan languages", - "aus" => "Australian languages", - "ava" => "Avaric", - "ave" => "Avestan", - "awa" => "Awadhi", - "aym" => "Aymara", - "aze" => "Azerbaijani", - "bad" => "Banda languages", - "bai" => "Bamileke languages", - "bak" => "Bashkir", - "bal" => "Baluchi", - "bam" => "Bambara", - "ban" => "Balinese", - "baq" => "Basque", - "bas" => "Basa", - "bat" => "Baltic languages", - "bej" => "Beja; Bedawiyet", - "bel" => "Belarusian", - "bem" => "Bemba", - "ben" => "Bengali", - "ber" => "Berber languages", - "bho" => "Bhojpuri", - "bih" => "Bihari", - "bik" => "Bikol", - "bin" => "Bini; Edo", - "bis" => "Bislama", - "bla" => "Siksika", - "bnt" => "Bantu languages", - "bos" => "Bosnian", - "bra" => "Braj", - "bre" => "Breton", - "btk" => "Batak languages", - "bua" => "Buriat", - "bug" => "Bugis", - "bul" => "Bulgarian", - "bur" => "Burmese", - "byn" => "Blin; Bilin", - "cad" => "Caddo", - "cai" => "Central American Indian languages", - "car" => "Galibi Carib", - "cat" => "Catalan", - "cau" => "Caucasian languages", - "ceb" => "Cebuano", - "cel" => "Celtic languages", - "cha" => "Chamorro", - "chb" => "Chibcha", - "che" => "Chechen", - "chg" => "Chagatai", - "chi" => "Chinese", - "chk" => "Truk", - "chm" => "Mari", - "chn" => "Chinook jargon", - "cho" => "Choctaw", - "chp" => "Chipewyan; Dene Suline", - "chr" => "Cherokee", - "chu" => "Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic", - "chv" => "Chuvash", - "chy" => "Cheyenne", - "cmc" => "Chamic languages", - "cop" => "Coptic", - "cor" => "Cornish", - "cos" => "Corsican", - "cpe" => "Creoles and pidgins, English-based", - "cpf" => "Creoles and pidgins, French-based", - "cpp" => "Creoles and pidgins, Portuguese-based", - "cre" => "Cree", - "crh" => "Crimean Turkish; Crimean Tatar", - "crp" => "Creoles and pidgins", - "csb" => "Kashubian", - "cus" => "Cushitic languages", - "cze" => "Czech", - "dak" => "Dakota", - "dan" => "Danish", - "dar" => "Dargwa", - "day" => "Land Dayak languages", - "del" => "Delaware", - "den" => "Slave", - "dgr" => "Dogrib", - "din" => "Dinka", - "div" => "Divehi; Dhivehi; Maldivian", - "doi" => "Dogri", - "dra" => "Dravidian languages", - "dsb" => "Lower Sorbian", - "dua" => "Duala", - "dum" => "Dutch, Middle (ca. 1050-1350)", - "dut" => "Dutch; Flemish", - "dyu" => "Dyula", - "dzo" => "Dzongkha", - "efi" => "Efik", - "egy" => "Egyptian", - "eka" => "Ekajuk", - "elx" => "Elamite", - "eng" => "English", - "enm" => "English, Middle (1100-1500)", - "epo" => "Esperanto", - "est" => "Estonian", - "ewe" => "Ewe", - "ewo" => "Ewondo", - "fan" => "Fang", - "fao" => "Faroese", - "fat" => "Fanti", - "fij" => "Fijian", - "fil" => "Filipino; Pilipino", - "fin" => "Finnish", - "fiu" => "Finno-Ugrian languages", - "fon" => "Fon", - "fre" => "French", - "frm" => "French, Middle (ca. 1400-1600)", - "fro" => "French, Old (ca. 842-1400)", - "frr" => "Northern Frisian", - "frs" => "Eastern Frisian", - "fry" => "Western Frisian", - "ful" => "Fula", - "fur" => "Friulian", - "gaa" => "Gã", - "gay" => "Gayo", - "gba" => "Gbaya", - "gem" => "Germanic languages", - "geo" => "Georgian", - "ger" => "German", - "gez" => "Ethiopic", - "gil" => "Gilbertese", - "gla" => "Scottish Gaelic", - "gle" => "Irish", - "glg" => "Galician", - "glv" => "Manx", - "gmh" => "German, Middle High (ca. 1050-1500)", - "goh" => "German, Old High (ca. 750-1050)", - "gon" => "Gondi", - "gor" => "Gorontalo", - "got" => "Gothic", - "grb" => "Grebo", - "grc" => "Greek, Ancient (to 1453)", - "gre" => "Greek, Modern (1453-)", - "grn" => "Guarani", - "gsw" => "Swiss German; Alemannic", - "guj" => "Gujarati", - "gwi" => "Gwich'in", - "hai" => "Haida", - "hat" => "Haitian French Creole", - "hau" => "Hausa", - "haw" => "Hawaiian", - "heb" => "Hebrew", - "her" => "Herero", - "hil" => "Hiligaynon", - "him" => "Himachali", - "hin" => "Hindi", - "hit" => "Hittite", - "hmn" => "Hmong", - "hmo" => "Hiri Motu", - "hrv" => "Croatian", - "hsb" => "Upper Sorbian", - "hun" => "Hungarian", - "hup" => "Hupa", - "iba" => "Iban", - "ibo" => "Igbo", - "ice" => "Icelandic", - "ido" => "Ido", - "iii" => "Sichuan Yi; Nuosu", - "ijo" => "Ijo languages", - "iku" => "Inuktitut", - "ile" => "Interlingue; Occidental", - "ilo" => "Iloko", - "ina" => "Interlingua (International Auxiliary Language Association)", - "inc" => "Indic languages", - "ind" => "Indonesian", - "ine" => "Indo-European languages", - "inh" => "Ingush", - "ipk" => "Inupiaq", - "ira" => "Iranian languages", - "iro" => "Iroquoian languages", - "ita" => "Italian", - "jav" => "Javanese", - "jbo" => "Lojban", - "jpn" => "Japanese", - "jpr" => "Judeo-Persian", - "jrb" => "Judeo-Arabic", - "kaa" => "Kara-Kalpak", - "kab" => "Kabyle", - "kac" => "Kachin; Jingpho", - "kal" => "Kalâtdlisut", - "kam" => "Kamba", - "kan" => "Kannada", - "kar" => "Karen languages", - "kas" => "Kashmiri", - "kau" => "Kanuri", - "kaw" => "Kawi", - "kaz" => "Kazakh", - "kbd" => "Kabardian", - "kha" => "Khasi", - "khi" => "Khoisan languages", - "khm" => "Central Khmer", - "kho" => "Khotanese; Sakan", - "kik" => "Kikuyu; Gikuyu", - "kin" => "Kinyarwanda", - "kir" => "Kirghiz; Kyrgyz", - "kmb" => "Kimbundu", - "kok" => "Konkani", - "kom" => "Komi", - "kon" => "Kongo", - "kor" => "Korean", - "kos" => "Kusaie", - "kpe" => "Kpelle", - "krc" => "Karachay-Balkar", - "krl" => "Karelian", - "kro" => "Kru languages", - "kru" => "Kurukh", - "kua" => "Kuanyama", - "kum" => "Kumyk", - "kur" => "Kurdish", - "kut" => "Kutenai", - "lad" => "Ladino", - "lah" => "Lahnda", - "lam" => "Lamba", - "lao" => "Lao", - "lat" => "Latin", - "lav" => "Latvian", - "lez" => "Lezgian", - "lim" => "Limburgish", - "lin" => "Lingala", - "lit" => "Lithuanian", - "lol" => "Mongo-Nkundu", - "loz" => "Lozi", - "ltz" => "Luxembourgish; Letzeburgesch", - "lua" => "Luba-Lulua", - "lub" => "Luba-Katanga", - "lug" => "Ganda", - "lui" => "Luiseño", - "lun" => "Lunda", - "luo" => "Luo (Kenya and Tanzania)", - "lus" => "Lushai", - "mac" => "Macedonian", - "mad" => "Madurese", - "mag" => "Magahi", - "mah" => "Marshall", - "mai" => "Maithili", - "mak" => "Makasar", - "mal" => "Malayalam", - "man" => "Mandingo", - "mao" => "Maori", - "map" => "Austronesian languages", - "mar" => "Marathi", - "mas" => "Masai", - "may" => "Malay", - "mdf" => "Moksha", - "mdr" => "Mandar", - "men" => "Mende", - "mga" => "Irish, Middle (ca. 1100-1550)", - "mic" => "Mi'kmaq; Micmac", - "min" => "Minangkabau", - "mis" => "Uncoded languages", - "mkh" => "Mon-Khmer languages", - "mlg" => "Malagasy", - "mlt" => "Maltese", - "mnc" => "Manchu", - "mni" => "Manipuri", - "mno" => "Manobo languages", - "moh" => "Mohawk", - "mol" => "Moldavian; Moldovan", - "mon" => "Mongolian", - "mos" => "Mooré", - "mul" => "Multiple languages", - "mun" => "Munda languages", - "mus" => "Creek", - "mwl" => "Mirandese", - "mwr" => "Marwari", - "myn" => "Mayan languages", - "myv" => "Erzya", - "nah" => "Nahuatl languages", - "nai" => "North American Indian languages", - "nap" => "Neapolitan", - "nau" => "Nauru", - "nav" => "Navajo", - "nbl" => "Ndebele, South", - "nde" => "Ndebele, North", - "ndo" => "Ndonga", - "nds" => "Low German; Low Saxon", - "nep" => "Nepali", - "new" => "Newari", - "nia" => "Nias", - "nic" => "Niger-Kordofanian languages", - "niu" => "Niuean", - "nno" => "Norwegian Nynorsk", - "nob" => "Norwegian Bokmål", - "nog" => "Nogai", - "non" => "Old Norse", - "nor" => "Norwegian", - "nqo" => "N'Ko", - "nso" => "Pedi; Sepedi; Northern Sotho", - "nub" => "Nubian languages", - "nwc" => "Classical Newari; Old Newari; Classical Nepal Bhasa", - "nya" => "Chichewa; Chewa; Nyanja", - "nym" => "Nyamwezi", - "nyn" => "Nyankole", - "nyo" => "Nyoro", - "nzi" => "Nzima", - "oci" => "Occitan (post 1500)", - "oji" => "Ojibwa", - "ori" => "Oriya", - "orm" => "Oromo", - "osa" => "Osage", - "oss" => "Ossetian; Ossetic", - "ota" => "Turkish, Ottoman", - "oto" => "Otomian languages", - "paa" => "Papuan languages", - "pag" => "Pangasinan", - "pal" => "Pahlavi", - "pam" => "Pampanga; Kapampangan", - "pan" => "Panjabi", - "pap" => "Papiamento", - "pau" => "Palauan", - "peo" => "Old Persian (ca. 600-400 B.C.)", - "per" => "Persian", - "phi" => "Philippine languages", - "phn" => "Phoenician", - "pli" => "Pali", - "pol" => "Polish", - "pon" => "Ponape", - "por" => "Portuguese", - "pra" => "Prakrit languages", - "pro" => "Provençal (to 1500);Occitan, Old (to 1500)", - "pus" => "Pushto; Pashto", - "qar" => "Aranés", - "qav" => "Valencian", - "que" => "Quechua", - "raj" => "Rajasthani", - "rap" => "Rapanui", - "rar" => "Rarotongan; Cook Islands Maori", - "roa" => "Romance languages", - "roh" => "Romansh", - "rom" => "Romany", - "rum" => "Romanian", - "run" => "Rundi", - "rup" => "Aromanian; Arumanian; Macedo-Romanian", - "rus" => "Russian", - "sad" => "Sandawe", - "sag" => "Sango", - "sah" => "Yakut", - "sai" => "South American Indian languages", - "sal" => "Salishan languages", - "sam" => "Samaritan Aramaic", - "san" => "Sanskrit", - "sas" => "Sasak", - "sat" => "Santali", - "scc" => "Serbian", - "scn" => "Sicilian", - "sco" => "Scots", - "scr" => "Croatian", - "sel" => "Selkup", - "sem" => "Semitic languages", - "sga" => "Irish, Old (to 1100)", - "sgn" => "Sign languages", - "shn" => "Shan", - "sid" => "Sidamo", - "sin" => "Sinhala; Sinhalese", - "sio" => "Siouan languages", - "sit" => "Sino-Tibetan languages", - "sla" => "Slavic languages", - "slo" => "Slovak", - "slv" => "Slovenian", - "sma" => "Southern Sami", - "sme" => "Northern Sami", - "smi" => "Sami languages", - "smj" => "Lule Sami", - "smn" => "Inari Sami", - "smo" => "Samoan", - "sms" => "Skolt Sami", - "sna" => "Shona", - "snd" => "Sindhi", - "snk" => "Soninke", - "sog" => "Sogdian", - "som" => "Somali", - "son" => "Songhai languages", - "sot" => "Sotho", - "spa" => "Spanish", - "srd" => "Sardinian", - "srn" => "Sranan Tongo", - "srp" => "Serbian", - "srr" => "Serer", - "ssa" => "Nilo-Saharan languages", - "ssw" => "Swazi", - "suk" => "Sukuma", - "sun" => "Sundanese", - "sus" => "Susu", - "sux" => "Sumerian", - "swa" => "Swahili", - "swe" => "Swedish", - "syc" => "Classical Syriac", - "syr" => "Syriac", - "tah" => "Tahitian", - "tai" => "Tai languages", - "tam" => "Tamil", - "tat" => "Tatar", - "tel" => "Telugu", - "tem" => "Temne", - "ter" => "Terena", - "tet" => "Tetum", - "tgk" => "Tajik", - "tgl" => "Tagalog", - "tha" => "Thai", - "tib" => "Tibetan", - "tig" => "Tigré", - "tir" => "Tigrinya", - "tiv" => "Tiv", - "tkl" => "Tokelauan", - "tlh" => "Klingon; tlhIngan-Hol", - "tli" => "Tlingit", - "tmh" => "Tamashek", - "tog" => "Tonga (Nyasa)", - "ton" => "Tongan", - "tpi" => "Tok Pisin", - "tsi" => "Tsimshian", - "tsn" => "Tswana", - "tso" => "Tsonga", - "tuk" => "Turkmen", - "tum" => "Tumbuka", - "tup" => "Tupi languages", - "tur" => "Turkish", - "tut" => "Altaic languages", - "tvl" => "Tuvaluan", - "twi" => "Twi", - "tyv" => "Tuvinian", - "udm" => "Udmurt", - "uga" => "Ugaritic", - "uig" => "Uighur; Uyghur", - "ukr" => "Ukrainian", - "umb" => "Umbundu", - "und" => "Undetermined", - "urd" => "Urdu", - "uzb" => "Uzbek", - "vai" => "Vai", - "ven" => "Venda", - "vie" => "Vietnamese", - "vol" => "Volapük", - "vot" => "Votic", - "wak" => "Wakashan languages", - "wal" => "Wolaitta; Wolaytta", - "war" => "Waray", - "was" => "Washo", - "wel" => "Welsh", - "wen" => "Sorbian languages", - "wln" => "Walloon", - "wol" => "Wolof", - "xal" => "Kalmyk", - "xho" => "Xhosa", - "yao" => "Yao", - "yap" => "Yapese", - "yid" => "Yiddish", - "yor" => "Yoruba", - "ypk" => "Yupik languages", - "zap" => "Zapotec", - "zbl" => "Blissymbols; Blissymbolics; Bliss", - "zen" => "Zenaga", - "zha" => "Zhuang; Chuang", - "znd" => "Zande languages", - "zul" => "Zulu", - "zun" => "Zuni", - "zxx" => "No linguistic content", - "zza" => "Zaza; Dimili; Dimli; Kirdki; Kirmanjki; Zazaki", - } - end -end diff --git a/lib/onix/lists/language_role.rb b/lib/onix/lists/language_role.rb deleted file mode 100644 index 88841d8..0000000 --- a/lib/onix/lists/language_role.rb +++ /dev/null @@ -1,18 +0,0 @@ -# coding: utf-8 - -module ONIX - module Lists - # Code list 22 - LANGUAGE_ROLE = { - "01" => "Language of text", - "02" => "Original language of a translated text", - "03" => "Language of abstracts", - "04" => "Rights language", - "05" => "Rights-excluded language", - "06" => "Original language in a multilingual edition", - "07" => "Translated language in a multilingual edition", - "08" => "Language of audio track", - "09" => "Language of subtitles", - } - end -end diff --git a/lib/onix/lists/notification_type.rb b/lib/onix/lists/notification_type.rb deleted file mode 100644 index 15ffb30..0000000 --- a/lib/onix/lists/notification_type.rb +++ /dev/null @@ -1,19 +0,0 @@ -# coding: utf-8 - -module ONIX - module Lists - # Code list 1 - NOTIFICATION_TYPE = { - 1 => "Early notification", - 2 => "Advance notification (confirmed)", - 3 => "Notification confirmed from book-in-hand", - 4 => "Update (partial)", - 5 => "Delete", - 8 => "Notice of sale", - 9 => "Notice of acquisition", - 12 => "Update - SupplyDetail only", - 13 => "Update - MarketRepresentation only", - 14 => "Update - SupplyDetail and MarketRepresentation", - } - end -end diff --git a/lib/onix/lists/product_availability.rb b/lib/onix/lists/product_availability.rb deleted file mode 100644 index 27ea050..0000000 --- a/lib/onix/lists/product_availability.rb +++ /dev/null @@ -1,32 +0,0 @@ -# coding: utf-8 - -module ONIX - module Lists - # Code list 65 - PRODUCT_AVAILABILITY = { - 1 => "Cancelled", - 10 => "Not Yet Available", - 11 => "Awaiting Stock", - 12 => "Not Yet Available, will be POD", - 20 => "Available", - 21 => "In Stock", - 22 => "To Order", - 23 => "Manufactured on Demand", - 30 => "Temporarily Unavailable", - 31 => "Out Of Stock", - 32 => "Reprinting", - 33 => "Awaiting Reissue", - 40 => "Not Available", - 41 => "Replaced By New Product", - 42 => "Other Format Available", - 43 => "No Longer Supplier By Us", - 44 => "Apply Direct", - 45 => "Not Sold Seperately", - 46 => "Withdrawn From Sale", - 47 => "Remaindered", - 48 => "Out Of Print, Replaced By POD with Diff ISBN", - 99 => "Uncertain" - } - end -end - diff --git a/lib/onix/lists/product_form.rb b/lib/onix/lists/product_form.rb deleted file mode 100644 index 761465e..0000000 --- a/lib/onix/lists/product_form.rb +++ /dev/null @@ -1,99 +0,0 @@ -# coding: utf-8 - -module ONIX - module Lists - # code list 7 - PRODUCT_FORM = { - "00" => "Undefined", - "AA" => "Audio", - "AB" => "Audio - Cassette", - "AC" => "Audio - CD", - "AD" => "Audio - DAT", - "AE" => "Audio - Disk", - "AF" => "Audio - Tape", - "AZ" => "Audio - Other", - "BA" => "Book", - "BB" => "Book - Hardback", - "BC" => "Book - Paperback", - "BD" => "Book - Loose-leaf", - "BE" => "Book - Spiral Bound", - "BF" => "Book - Pamphlet", - "BG" => "Book - Leather / Fine Binding", - "BH" => "Book - Board", - "BI" => "Book - Rag", - "BJ" => "Book - Bath", - "BZ" => "Book - Other", - "CA" => "Cartographic - Sheet Map", - "CB" => "Cartographic - Sheet Map Folded", - "CC" => "Cartographic - Sheet Map Flat", - "CD" => "Cartographic - Sheet Map Rolled", - "CE" => "Cartographic - Globe", - "CZ" => "Cartographic - Other", - "DA" => "Digital", - "DB" => "Digital - CDROM", - "DC" => "Digital - CD-Interactive", - "DD" => "Digital - DVD", - "DE" => "Digital - Game Cartridge", - "DF" => "Digital - Diskette", - "DG" => "Digital - Electronic Book Text", - "DH" => "Digital - Online File", - "DZ" => "Digital - Other", - "FA" => "Film or Transparency", - "FB" => "Film", - "FC" => "Film - Slides", - "FD" => "Film - OHP Transparencies", - "FZ" => "Film - Other ", - "MA" => "Microform", - "MB" => "Microform - Microfiche", - "MC" => "Microform - Microfilm", - "MZ" => "Microform - Other", - "PA" => "Print - Misc", - "PB" => "Print - Address Book", - "PC" => "Print - Calendar", - "PD" => "Print - Cards", - "PE" => "Print - Copymasters", - "PF" => "Print - Diary", - "PG" => "Print - Frieze", - "PH" => "Print - Kit", - "PI" => "Print - Sheet Music", - "PJ" => "Print - Postcard Book or Pack", - "PK" => "Print - Poster", - "PL" => "Print - Record Book", - "PM" => "Print - Wallet", - "PN" => "Print - Pictures or Photographs", - "PO" => "Print - Wallchart", - "PZ" => "Print - Other", - "VA" => "Video", - "VB" => "Video - VHS PAL", - "VC" => "Video - VHS NTSC", - "VD" => "Video - Betamax PAL", - "VE" => "Video - Betamax NTSC", - "VF" => "Video - disk", - "VG" => "Video - VHS SECAM", - "VH" => "Video - Betamax SECAM", - "VZ" => "Video - Other Format", - "WW" => "Multiple - Mixed Media Product", - "WX" => "Misc - Quantity Pack", - "XA" => "Misc - Trade-only Material", - "XB" => "Misc - Dumpbim - Empty", - "XC" => "Misc - Dumpbin - Filled", - "XD" => "Misc - Counterpack - Empty", - "XE" => "Misc - Counterpack - Filled", - "XF" => "Misc - Poster", - "XG" => "Misc - Shelf Strip", - "XH" => "Misc - Window Piece", - "XI" => "Misc - Streamer", - "XJ" => "Misc - Spinner", - "XK" => "Misc - Large Book Display", - "XL" => "Misc - Shrink Wrapped Pack", - "XZ" => "Misc - Other Point of Sale", - "ZA" => "General Merchandise", - "ZB" => "Misc - Doll", - "ZC" => "Misc - Soft Toy", - "ZD" => "Misc - Toy", - "ZE" => "Misc - Game", - "ZF" => "Misc - T-shirt", - "ZZ" => "Misc - Other Merchandise" - } - end -end diff --git a/lib/onix/lists/product_form_detail.rb b/lib/onix/lists/product_form_detail.rb deleted file mode 100644 index 7cef0d9..0000000 --- a/lib/onix/lists/product_form_detail.rb +++ /dev/null @@ -1,157 +0,0 @@ -# coding: utf-8 - -module ONIX - module Lists - # Code list 78 - PRODUCT_FORM_DETAIL = { - "A101" => "CD standard audio format", - "A102" => "SACD super audio format", - "A103" => "MP3 format", - "A104" => "WAV format", - "A105" => "Real Audio format", - "A106" => "WMA", - "A107" => "AAC", - "A108" => "Ogg/Vorbis", - "A109" => "Audible", - "A110" => "FLAC", - "A111" => "AIFF", - "A112" => "ALAC", - "A201" => "DAISY 2: full audio with title only (no navigation)", - "A202" => "DAISY 2: full audio with navigation", - "A203" => "DAISY 2: full audio with navigation and partial text", - "A204" => "DAISY 2: full audio and full text", - "A205" => "DAISY 2: full text and some audio", - "A206" => "DAISY 2: full text and no audio", - "A207" => "DAISY 3: full audio with title only (no navigation)", - "A208" => "DAISY 3: full audio with navigation", - "A209" => "DAISY 3: full audio with navigation and partial text", - "A210" => "DAISY 3: full audio and full text", - "A211" => "DAISY 3: full text and some audio", - "A212" => "DAISY 3: full text and no audio", - "B101" => "Mass market (rack) paperback", - "B102" => "Trade paperback (US)", - "B103" => "Digest format paperback", - "B104" => "A-format paperback", - "B105" => "B-format paperback", - "B106" => "Trade paperback (UK)", - "B107" => "Tall rack paperback (US)", - "B108" => "A5: Tankobon", - "B109" => "B5: Tankobon", - "B110" => "B6: Tankobon", - "B111" => "A6: Bunko", - "B112" => "B40-dori: Shinsho", - "B113" => "Pocket (Sweden)", - "B114" => "Storpocket (Sweden)", - "B115" => "Kartonnage (Sweden)", - "B116" => "Flexband (Sweden)", - "B201" => "Coloring / join-the-dot book", - "B202" => "Lift-the-flap book", - "B203" => "Fuzzy book", - "B204" => "Miniature book", - "B205" => "Moving picture / flicker book", - "B206" => "Pop-up book", - "B207" => "Scented / 'smelly' book", - "B208" => "Sound story / 'noisy' book", - "B209" => "Sticker book", - "B210" => "Touch-and-feel book", - "B211" => "Toy / die-cut book", - "B212" => "Die-cut book", - "B213" => "Book-as-toy", - "B214" => "Soft-to-touch book", - "B215" => "Fuzzy-felt book", - "B221" => "Picture book", - "B301" => "Loose leaf - sheets & binder", - "B302" => "Loose leaf - binder only", - "B303" => "Loose leaf - sheets only", - "B304" => "Sewn", - "B305" => "Unsewn / adhesive bound", - "B306" => "Library binding", - "B307" => "Reinforced binding", - "B308" => "Half bound", - "B309" => "Quarter bound", - "B310" => "Saddle-sewn", - "B311" => "Comb bound", - "B312" => "Wire-O", - "B313" => "Concealed wire", - "B401" => "Cloth over boards", - "B402" => "Paper over boards", - "B403" => "Leather, real", - "B404" => "Leather, imitation", - "B405" => "Leather, bonded", - "B406" => "Vellum", - "B407" => "Plastic", - "B408" => "Vinyl", - "B409" => "Cloth", - "B410" => "Imitation cloth", - "B411" => "Velvet", - "B412" => "Flexible plastic/vinyl cover", - "B413" => "Plastic-covered", - "B414" => "Vinyl-covered", - "B415" => "Laminated cover", - "B501" => "With dust jacket", - "B502" => "With printed dust jacket", - "B503" => "With translucent dust cover", - "B504" => "With flaps", - "B505" => "With thumb index", - "B506" => "With ribbon marker(s)", - "B507" => "With zip fastener", - "B508" => "With button snap fastener", - "B509" => "With leather edge lining", - "B601" => "Turn-around book", - "B602" => "Unflipped manga format", - "B701" => "UK Braille Grade 1", - "B702" => "UK Braille Grade 2", - "B703" => "US Braille", - "D101" => "Real Video format", - "D102" => "Quicktime format", - "D103" => "AVI format", - "D104" => "Windows Media Video format", - "D105" => "MPEG-4", - "D201" => "MS-DOS", - "D202" => "Windows", - "D203" => "Macintosh", - "D204" => "UNIX / LINUX", - "D205" => "Other operating system(s)", - "D206" => "Palm OS", - "D207" => "Windows Mobile", - "D301" => "Microsoft XBox", - "D302" => "Nintendo Gameboy Color", - "D303" => "Nintendo Gameboy Advanced", - "D304" => "Nintendo Gameboy", - "D305" => "Nintendo Gamecube", - "D306" => "Nintendo 64", - "D307" => "Sega Dreamcast", - "D308" => "Sega Genesis/Megadrive", - "D309" => "Sega Saturn", - "D310" => "Sony PlayStation 1", - "D311" => "Sony PlayStation 2", - "D312" => "Nintendo Dual Screen", - "D313" => "Sony PlayStation 3", - "D314" => "Xbox 360", - "D315" => "Nintendo Wii", - "D316" => "Sony PlayStation Portable (PSP)", - "L101" => "Laminated", - "P101" => "Desk calendar", - "P102" => "Mini calendar", - "P103" => "Engagement calendar", - "P104" => "Day by day calendar", - "P105" => "Poster calendar", - "P106" => "Wall calendar", - "P107" => "Perpetual calendar", - "P108" => "Advent calendar", - "P109" => "Bookmark calendar", - "P110" => "Student calendar", - "P111" => "Project calendar", - "P112" => "Almanac calendar", - "P113" => "Other calendar", - "P114" => "Other calendar or organiser product", - "P201" => "Hardback (stationery)", - "P202" => "Paperback / softback (stationery)", - "P203" => "Spiral bound (stationery)", - "P204" => "Leather / fine binding (stationery)", - "V201" => "PAL", - "V202" => "NTSC", - "V203" => "SECAM", - } - end -end diff --git a/spec/lists_spec.rb b/spec/lists_spec.rb new file mode 100644 index 0000000..279a6ef --- /dev/null +++ b/spec/lists_spec.rb @@ -0,0 +1,33 @@ +# coding: utf-8 + +require File.dirname(__FILE__) + '/spec_helper.rb' + +context ONIX::Lists, "list method" do + + it "should return a hash containing the ProductForm code list" do + forms = ONIX::Lists.list(7) + forms.should be_a(Hash) + forms["BB"].should eql("Hardback") + end + +end + +context ONIX::Lists, "product_form shortcut method" do + + it "should return a hash containing the ProductForm code list" do + forms = ONIX::Lists.product_form + forms.should be_a(Hash) + forms["BB"].should eql("Hardback") + end + +end + +context ONIX::Lists, "PRODUCT_FORM shortcut constant" do + + it "should return a hash containing the ProductForm code list" do + forms = ONIX::Lists::PRODUCT_FORM + forms.should be_a(Hash) + forms["BB"].should eql("Hardback") + end + +end