class Cacofonix::Lists
Builds hashes for all code lists in the ONIX spec.
Use like so:
Cacofonix::Lists.list(7) => { "BB" => "Hardback", ... }
There are also some constants for commonly used lists:
Cacofonix::Lists::PRODUCT_FORM => { "BB" => "Hardback", ... }
Constants
- AUDIENCE_CODE
These are here for backwards compatability with the onix gem <= 0.8.3
- CONTRIBUTOR_ROLE
- COUNTRY_CODE
- LANGUAGE_CODE
- LANGUAGE_ROLE
- NOTIFICATION_TYPE
- PRODUCT_AVAILABILITY
- PRODUCT_FORM
- PRODUCT_FORM_DETAIL
Public Class Methods
audience_code()
click to toggle source
Shortcut to retrieve a common code list
# File lib/cacofonix/core/lists.rb, line 44 def self.audience_code self.instance.list(28) end
contributor_role()
click to toggle source
Shortcut to retrieve a common code list
# File lib/cacofonix/core/lists.rb, line 50 def self.contributor_role self.instance.list(17) end
country_code()
click to toggle source
Shortcut to retrieve a common code list
# File lib/cacofonix/core/lists.rb, line 56 def self.country_code self.instance.list(91) end
language_code()
click to toggle source
Shortcut to retrieve a common code list
# File lib/cacofonix/core/lists.rb, line 62 def self.language_code self.instance.list(74) end
language_role()
click to toggle source
Shortcut to retrieve a common code list
# File lib/cacofonix/core/lists.rb, line 68 def self.language_role self.instance.list(22) end
list(number)
click to toggle source
retrieve a hash with the specified code list
Cacofonix::Lists.list(7) => { "BB" => "Hardback", ... }
# File lib/cacofonix/core/lists.rb, line 25 def self.list(number) self.instance.list(number) end
notification_type()
click to toggle source
Shortcut to retrieve a common code list
# File lib/cacofonix/core/lists.rb, line 74 def self.notification_type self.instance.list(1) end
product_availability()
click to toggle source
Shortcut to retrieve a common code list
# File lib/cacofonix/core/lists.rb, line 80 def self.product_availability self.instance.list(65) end
product_form()
click to toggle source
Shortcut to retrieve a common code list
# File lib/cacofonix/core/lists.rb, line 86 def self.product_form self.instance.list(7) end
product_form_detail()
click to toggle source
Shortcut to retrieve a common code list
# File lib/cacofonix/core/lists.rb, line 92 def self.product_form_detail self.instance.list(78) end
Public Instance Methods
list(number)
click to toggle source
Return a hash with the data for a single code list.
Number should be a fixnum specifying the list to retrieve:
Cacofonix::Lists.instance.list(7) => { "BB" => "Hardback", ... }
# File lib/cacofonix/core/lists.rb, line 36 def list(number) raise "Invalid list number: #{number}" unless number.to_s.match(/^\d+$/) require File.join("cacofonix", "codelists", number.to_s.rjust(3, "0")) eval("Cacofonix::CodeLists::LIST_#{number}") end