Permalink
Browse files

Create SLProduct class.

  • Loading branch information...
tim
tim committed Oct 1, 2009
1 parent a1d1027 commit f25b03907fe46d0a773913ec871d1786508e3b5b
View
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<AudienceRange>
+ <AudienceRangeQualifier>11</AudienceRangeQualifier>
+ <AudienceRangePrecision>03</AudienceRangePrecision>
+ <AudienceRangePrecision>04</AudienceRangePrecision>
+ <AudienceRangeValue>3</AudienceRangeValue>
+ <AudienceRangeValue>5</AudienceRangeValue>
+</AudienceRange>
+
View
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Language>
+ <LanguageRole>01</LanguageRole>
+ <LanguageCode>eng</LanguageCode>
+ <CountryCode>US</CountryCode>
+</Language>
+
View
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Series>
+ <TitleOfSeries>Citizens and Their Governments</TitleOfSeries>
+</Series>
+
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<SeriesIdentifier>
+ <SeriesIDType>01</SeriesIDType>
+ <IDValue>10001</IDValue>
+</SeriesIdentifier>
+
View
@@ -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>sales@cherrylakepublishing.com</EmailAddress>
+ <SupplyToCountry>US</SupplyToCountry>
+ <ProductAvailability>10</ProductAvailability>
+ <Price>
+ <PriceTypeCode>01</PriceTypeCode>
+ <PriceAmount>232.65</PriceAmount>
+ </Price>
+ </SupplyDetail>
+</Product>
View
@@ -70,6 +70,10 @@ def self.two_digit
# core files
# - ordering is important, classes need to be defined before any
# other class can use them
+require File.join(File.dirname(__FILE__), "onix", "language") # milkfarm
+require File.join(File.dirname(__FILE__), "onix", "series_identifier") # milkfarm
+require File.join(File.dirname(__FILE__), "onix", "series") # milkfarm
+require File.join(File.dirname(__FILE__), "onix", "audience_range") # milkfarm
require File.join(File.dirname(__FILE__), "onix", "sender_identifier")
require File.join(File.dirname(__FILE__), "onix", "addressee_identifier")
require File.join(File.dirname(__FILE__), "onix", "header")
@@ -95,10 +99,16 @@ 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") # milkfarm
+require File.join(File.dirname(__FILE__), "onix", "lists", "language_code") # milkfarm
+require File.join(File.dirname(__FILE__), "onix", "lists", "language_role") # milkfarm
+require File.join(File.dirname(__FILE__), "onix", "lists", "notification_type") # milkfarm
+require File.join(File.dirname(__FILE__), "onix", "lists", "product_form_detail") # milkfarm
# product wrappers
require File.join(File.dirname(__FILE__), "onix", "simple_product")
require File.join(File.dirname(__FILE__), "onix", "apa_product")
+require File.join(File.dirname(__FILE__), "onix", "sl_product") # milkfarm
# misc
require File.join(File.dirname(__FILE__), "onix", "normaliser")
View
@@ -0,0 +1,19 @@
+# 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]
+
+ def initialize
+ self.audience_range_precisions = []
+ self.audience_range_values = []
+ end
+ end
+end
View
@@ -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
Oops, something went wrong.

0 comments on commit f25b039

Please sign in to comment.