Sha256: d568b7049987dba1a9b686401acde5fcccfd178e3c4224799505de093475013b
Contents?: true
Size: 1.35 KB
Versions: 2
Compression:
Stored size: 1.35 KB
Contents
# coding: utf-8 module ONIX class Series include ROXML xml_name "Series" xml_accessor :series_identifiers, :from => "SeriesIdentifier", :as => [ONIX::SeriesIdentifier] xml_accessor :title_of_series, :from => "TitleOfSeries" def initialize self.series_identifiers = [] end # retrieve the proprietary series ID def proprietary_series_id series_identifier(1).try(:id_value) end # set a new proprietary series ID def proprietary_series_id=(id) series_identifier_set(1, id) end # retrieve the issn def issn series_identifier(2).try(:id_value) end # set a new issn def issn=(id) series_identifier_set(2, id) end # retrieve the value of a particular ID def series_identifier(type) identifier = series_identifiers.find { |id| id.series_id_type == type } end # set the value of a particular ID def series_identifier_set(type, value) series_indentifier_id = series_identifiers.find { |id| id.series_id_type == type } # create a new series identifier record if we need to if series_indentifier_id.nil? series_indentifier_id = ONIX::SeriesIdentifier.new end series_indentifier_id.series_id_type = type series_indentifier_id.id_value = value series_identifiers << series_indentifier_id end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
milkfarm-onix-0.8.13 | lib/onix/series.rb |
milkfarm-onix-0.8.12 | lib/onix/series.rb |