lib/onix/product.rb in onix-0.7.4 vs lib/onix/product.rb in onix-0.7.5
- old
+ new
@@ -22,10 +22,16 @@
xml_accessor :text, :from => "OtherText", :as => [ONIX::OtherText]
xml_accessor :media_files, :from => "MediaFile", :as => [ONIX::MediaFile]
xml_accessor :imprints, :from => "Imprint", :as => [ONIX::Imprint]
xml_accessor :publishers, :from => "Publisher", :as => [ONIX::Publisher]
xml_accessor :publishing_status, :from => "PublishingStatus", :as => Fixnum, :to_xml => ONIX::Formatters.two_digit
- xml_accessor :publication_date, :from => "PublicationDate", :as => Date, :to_xml => ONIX::Formatters.yyyymmdd
+ xml_accessor(:publication_date, :from => "PublicationDate", :to_xml => ONIX::Formatters.yyyymmdd) do |val|
+ begin
+ Date.parse(val)
+ rescue
+ nil
+ end
+ end
xml_accessor :year_first_published, :from => "YearFirstPublished", :as => Fixnum
xml_accessor :sales_restrictions, :from => "SalesRestriction", :as => [ONIX::SalesRestriction]
xml_accessor :measurements, :from => "Measure", :as => [ONIX::Measure]
xml_accessor :supply_details, :from => "SupplyDetail", :as => [ONIX::SupplyDetail]
xml_accessor :market_representations, :from => "MarketRepresentation", :as => [ONIX::MarketRepresentation]