lib/adiwg/mdtranslator/readers/mdJson/modules/module_series.rb in adiwg-mdtranslator-2.9.2 vs lib/adiwg/mdtranslator/readers/mdJson/modules/module_series.rb in adiwg-mdtranslator-2.10.0
- old
+ new
@@ -1,57 +1,57 @@
# unpack series
# Reader - ADIwg JSON to internal data structure
# History:
+# Stan Smith 2018-02-19 refactored error and warning messaging
# Stan Smith 2016-10-12 original script
module ADIWG
- module Mdtranslator
- module Readers
- module MdJson
+ module Mdtranslator
+ module Readers
+ module MdJson
- module Series
+ module Series
- def self.unpack(hSeries, responseObj)
+ def self.unpack(hSeries, responseObj)
- # return nil object if input is empty
- if hSeries.empty?
- responseObj[:readerExecutionMessages] << 'Series object is empty'
- responseObj[:readerExecutionPass] = false
- return nil
- end
+ # return nil object if input is empty
+ if hSeries.empty?
+ responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: citation series object is empty'
+ return nil
+ end
- # instance classes needed in script
- intMetadataClass = InternalMetadata.new
- intSeries = intMetadataClass.newSeries
+ # instance classes needed in script
+ intMetadataClass = InternalMetadata.new
+ intSeries = intMetadataClass.newSeries
- # series - seriesName
- if hSeries.has_key?('seriesName')
- if hSeries['seriesName'] != ''
- intSeries[:seriesName] = hSeries['seriesName']
- end
- end
+ # series - seriesName
+ if hSeries.has_key?('seriesName')
+ unless hSeries['seriesName'] == ''
+ intSeries[:seriesName] = hSeries['seriesName']
+ end
+ end
- # series - series issue
- if hSeries.has_key?('seriesIssue')
- if hSeries['seriesIssue'] != ''
- intSeries[:seriesIssue] = hSeries['seriesIssue']
- end
- end
+ # series - series issue
+ if hSeries.has_key?('seriesIssue')
+ unless hSeries['seriesIssue'] == ''
+ intSeries[:seriesIssue] = hSeries['seriesIssue']
+ end
+ end
- # series - issue page
- if hSeries.has_key?('issuePage')
- if hSeries['issuePage'] != ''
- intSeries[:issuePage] = hSeries['issuePage']
- end
- end
+ # series - issue page
+ if hSeries.has_key?('issuePage')
+ unless hSeries['issuePage'] == ''
+ intSeries[:issuePage] = hSeries['issuePage']
+ end
+ end
- return intSeries
+ return intSeries
- end
+ end
- end
-
end
- end
- end
+
+ end
+ end
+ end
end