Skip to content

Commit

Permalink
Merge branch 'master' into roxml3
Browse files Browse the repository at this point in the history
  • Loading branch information
yob committed Oct 19, 2009
2 parents 996ed10 + 6e2971d commit c113ca3
Show file tree
Hide file tree
Showing 21 changed files with 1,327 additions and 5 deletions.
9 changes: 9 additions & 0 deletions data/audience_range.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<AudienceRange>
<AudienceRangeQualifier>11</AudienceRangeQualifier>
<AudienceRangePrecision>03</AudienceRangePrecision>
<AudienceRangeValue>3</AudienceRangeValue>
<AudienceRangePrecision>04</AudienceRangePrecision>
<AudienceRangeValue>5</AudienceRangeValue>
</AudienceRange>

7 changes: 7 additions & 0 deletions data/language.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Language>
<LanguageRole>01</LanguageRole>
<LanguageCode>eng</LanguageCode>
<CountryCode>US</CountryCode>
</Language>

5 changes: 5 additions & 0 deletions data/series.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Series>
<TitleOfSeries>Citizens and Their Governments</TitleOfSeries>
</Series>

6 changes: 6 additions & 0 deletions data/series_identifier.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<SeriesIdentifier>
<SeriesIDType>01</SeriesIDType>
<IDValue>10001</IDValue>
</SeriesIdentifier>

81 changes: 81 additions & 0 deletions data/sl_product.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE ONIXMessage SYSTEM "http://www.editeur.org/onix/2.1/03/reference/onix-international.dtd">
<Product>
<RecordReference>10001</RecordReference>
<NotificationType>02</NotificationType>
<ProductIdentifier>
<ProductIDType>01</ProductIDType>
<IDValue>10001</IDValue>
</ProductIdentifier>
<ProductIdentifier>
<ProductIDType>02</ProductIDType>
<IDValue>1602791082</IDValue>
</ProductIdentifier>
<ProductIdentifier>
<ProductIDType>15</ProductIDType>
<IDValue>9781602791084</IDValue>
</ProductIdentifier>
<Title>
<TitleType>01</TitleType>
<TitleText>Citizens and Their Governments</TitleText>
</Title>
<CopyrightYear>2008</CopyrightYear>
<AudienceRange>
<AudienceRangeQualifier>11</AudienceRangeQualifier>
<AudienceRangePrecision>03</AudienceRangePrecision>
<AudienceRangePrecision>04</AudienceRangePrecision>
<AudienceRangeValue>3</AudienceRangeValue>
<AudienceRangeValue>5</AudienceRangeValue>
</AudienceRange>
<Language>
<LanguageRole>01</LanguageRole>
<LanguageCode>eng</LanguageCode>
</Language>
<Website>
<WebsiteRole>12</WebsiteRole>
<WebsiteLink>http://www.cherrylakepublishing.com/shop/show/10001</WebsiteLink>
</Website>
<NumberOfPages>32</NumberOfPages>
<OtherText>
<TextTypeCode>01</TextTypeCode>
<Text>This series focuses on teaching civic literacy from a global perspective. Why is voting important? How do elections differ around the world? What is the impact of immigration? How does the government work?</Text>
</OtherText>
<MediaFile>
<MediaFileTypeCode>04</MediaFileTypeCode>
<MediaFileLinkTypeCode>01</MediaFileLinkTypeCode>
<MediaFileLink>http://www.cherrylakepublishing.com/images/covers/l/9781602791084</MediaFileLink>
</MediaFile>
<MediaFile>
<MediaFileTypeCode>07</MediaFileTypeCode>
<MediaFileLinkTypeCode>01</MediaFileLinkTypeCode>
<MediaFileLink>http://www.cherrylakepublishing.com/images/covers/m/9781602791084</MediaFileLink>
</MediaFile>
<Publisher>
<PublishingRole>01</PublishingRole>
<PublisherName>Cherry Lake</PublisherName>
</Publisher>
<PublishingStatus>02</PublishingStatus>
<PublicationDate>20091201</PublicationDate>
<Measure>
<MeasureTypeCode>01</MeasureTypeCode>
<Measurement>9.5</Measurement>
<MeasureUnitCode>in</MeasureUnitCode>
</Measure>
<Measure>
<MeasureTypeCode>02</MeasureTypeCode>
<Measurement>7.5</Measurement>
<MeasureUnitCode>in</MeasureUnitCode>
</Measure>
<SupplyDetail>
<SupplierName>Cherry Lake Publishing</SupplierName>
<TelephoneNumber>1-866-918-3956</TelephoneNumber>
<FaxNumber>1-866-489-6490</FaxNumber>
<EmailAddress>[email protected]</EmailAddress>
<SupplyToCountry>US</SupplyToCountry>
<ProductAvailability>10</ProductAvailability>
<Price>
<PriceTypeCode>01</PriceTypeCode>
<PriceAmount>232.65</PriceAmount>
</Price>
</SupplyDetail>
</Product>
15 changes: 12 additions & 3 deletions lib/onix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module ONIX
module Version #:nodoc:
Major = 0
Minor = 7
Tiny = 7
Tiny = 8

String = [Major, Minor, Tiny].join('.')
end
Expand Down Expand Up @@ -66,14 +66,18 @@ def self.two_digit
require File.join(File.dirname(__FILE__), "onix", "addressee_identifier")
require File.join(File.dirname(__FILE__), "onix", "header")
require File.join(File.dirname(__FILE__), "onix", "product_identifier")
require File.join(File.dirname(__FILE__), "onix", "series_identifier")
require File.join(File.dirname(__FILE__), "onix", "series")
require File.join(File.dirname(__FILE__), "onix", "title")
require File.join(File.dirname(__FILE__), "onix", "website")
require File.join(File.dirname(__FILE__), "onix", "contributor")
require File.join(File.dirname(__FILE__), "onix", "language")
require File.join(File.dirname(__FILE__), "onix", "subject")
require File.join(File.dirname(__FILE__), "onix", "other_text")
require File.join(File.dirname(__FILE__), "onix", "media_file")
require File.join(File.dirname(__FILE__), "onix", "audience_range")
require File.join(File.dirname(__FILE__), "onix", "imprint")
require File.join(File.dirname(__FILE__), "onix", "publisher")
require File.join(File.dirname(__FILE__), "onix", "other_text")
require File.join(File.dirname(__FILE__), "onix", "media_file")
require File.join(File.dirname(__FILE__), "onix", "sales_restriction")
require File.join(File.dirname(__FILE__), "onix", "stock")
require File.join(File.dirname(__FILE__), "onix", "price")
Expand All @@ -87,6 +91,11 @@ def self.two_digit
# 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")
Expand Down
26 changes: 26 additions & 0 deletions lib/onix/audience_range.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# coding: utf-8

module ONIX
class AudienceRange
include ROXML
include ONIX::Common

xml_name "AudienceRange"

xml_accessor :audience_range_qualifier, :from => "AudienceRangeQualifier", :as => Fixnum, :to_xml => ONIX::Formatters.two_digit
xml_accessor :audience_range_precisions, :from => "AudienceRangePrecision", :as => [Fixnum], :to_xml => [ONIX::Formatters.two_digit] # TODO: two_digit isn't working on the array items
xml_accessor :audience_range_values, :from => "AudienceRangeValue", :as => [Integer]

# TODO: element AudienceRange: validity error :
# Element AudienceRange content does not follow the DTD, expecting
# (AudienceRangeQualifier , AudienceRangePrecision , AudienceRangeValue ,
# (AudienceRangePrecision , AudienceRangeValue)?),
# got
# (AudienceRangeQualifier AudienceRangePrecision AudienceRangePrecision
# AudienceRangeValue AudienceRangeValue )
def initialize
self.audience_range_precisions = []
self.audience_range_values = []
end
end
end
14 changes: 14 additions & 0 deletions lib/onix/language.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# coding: utf-8

module ONIX
class Language
include ROXML
include ONIX::Common

xml_name "Language"

xml_accessor :language_role, :from => "LanguageRole", :as => Fixnum, :to_xml => ONIX::Formatters.two_digit
xml_accessor :language_code, :from => "LanguageCode"
xml_accessor :country_code, :from => "CountryCode"
end
end
17 changes: 17 additions & 0 deletions lib/onix/lists/audience_code.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 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
Loading

0 comments on commit c113ca3

Please sign in to comment.