spectral notes

This commit is contained in:
John Bintz 2011-03-16 10:41:01 -04:00
parent a5498624a2
commit 3e60a0ab7a
5 changed files with 14 additions and 5 deletions

View File

@ -2,11 +2,14 @@ require 'avm/creator'
require 'avm/xmp'
require 'avm/image_type'
require 'avm/image_quality'
require 'avm/observation'
module AVM
class Image
DUBLIN_CORE_FIELDS = [ :title, :description ]
AVM_SINGLE_FIELDS = [ 'Distance.Notes', 'ReferenceURL', 'Credit', 'Date', 'ID', 'Type', 'Image.ProductQuality' ]
AVM_SINGLE_FIELDS = [ 'Distance.Notes', 'Spectral.Notes', 'ReferenceURL', 'Credit', 'Date', 'ID', 'Type', 'Image.ProductQuality' ]
AVM_SINGLE_METHODS = [ :distance_notes, :spectral_notes, :reference_url, :credit, :date, :id, :type, :quality ]
AVM_SINGLES = AVM_SINGLE_FIELDS.zip(AVM_SINGLE_METHODS)
attr_reader :creator, :observations
@ -35,7 +38,7 @@ module AVM
refs[:photoshop].add_child(%{<photoshop:Headline>#{headline}</photoshop:Headline>})
AVM_SINGLE_FIELDS.zip([distance_notes, reference_url, credit, string_date, id, image_type, image_quality]).each do |tag, value|
AVM_SINGLE_FIELDS.zip([distance_notes, spectral_notes, reference_url, credit, string_date, id, image_type, image_quality]).each do |tag, value|
refs[:avm].add_child(%{<avm:#{tag}>#{value.to_s}</avm:#{tag}>}) if value
end
@ -91,7 +94,7 @@ module AVM
end
end
AVM_SINGLE_FIELDS.zip([ :distance_notes, :reference_url, :credit, :date, :id, :type, :quality ]).each do |tag, field|
AVM_SINGLES.each do |tag, field|
if node = refs[:avm].at_xpath("./avm:#{tag}")
options[field] = node.text
end

View File

@ -11,6 +11,7 @@ describe AVM::Image do
let(:headline) { 'Headline' }
let(:description) { 'Description' }
let(:distance_notes) { 'Distance Notes' }
let(:spectral_notes) { 'Spectral Notes' }
let(:reference_url) { 'Reference URL' }
let(:credit) { 'Credit' }
let(:date) { '2010-01-01' }
@ -20,14 +21,13 @@ describe AVM::Image do
let(:redshift) { 'Redshift' }
let(:light_years) { 'Light years' }
it "should have spectral notes"
def self.with_all_options
let(:options) { {
:title => title,
:headline => headline,
:description => description,
:distance_notes => distance_notes,
:spectral_notes => spectral_notes,
:reference_url => reference_url,
:credit => credit,
:date => date,
@ -45,6 +45,7 @@ describe AVM::Image do
its(:headline) { should == headline }
its(:description) { should == description }
its(:distance_notes) { should == distance_notes }
its(:spectral_notes) { should == spectral_notes }
its(:reference_url) { should == reference_url }
its(:credit) { should == credit }
its(:date) { should == Time.parse(date) }
@ -75,6 +76,7 @@ describe AVM::Image do
its(:headline) { should be_nil }
its(:description) { should be_nil }
its(:distance_notes) { should be_nil }
its(:spectral_notes) { should be_nil }
its(:reference_url) { should be_nil }
its(:credit) { should be_nil }
its(:date) { should be_nil }
@ -139,6 +141,7 @@ describe AVM::Image do
dublin_core.at_xpath('./dc:description/rdf:Alt/rdf:li').text.should == description
avm.at_xpath('./avm:Distance.Notes').text.should == distance_notes
avm.at_xpath('./avm:Spectral.Notes').text.should == spectral_notes
avm.at_xpath('./avm:ReferenceURL').text.should == reference_url
avm.at_xpath('./avm:Credit').text.should == credit
avm.at_xpath('./avm:Date').text.should == date

View File

@ -25,6 +25,7 @@
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:avm="http://www.communicatingastronomy.org/avm/1.0/">
<avm:Spectral.Notes>Spectral Notes</avm:Spectral.Notes>
<avm:Distance.Notes>Distance Notes</avm:Distance.Notes>
<avm:ReferenceURL>Reference URL</avm:ReferenceURL>
<avm:Credit>Credit</avm:Credit>

View File

@ -25,6 +25,7 @@
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:avm="http://www.communicatingastronomy.org/avm/1.0/">
<avm:Spectral.Notes>Spectral Notes</avm:Spectral.Notes>
<avm:Distance.Notes>Distance Notes</avm:Distance.Notes>
<avm:ReferenceURL>Reference URL</avm:ReferenceURL>
<avm:Credit>Credit</avm:Credit>

View File

@ -25,6 +25,7 @@
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:avm="http://www.communicatingastronomy.org/avm/1.0/">
<avm:Spectral.Notes>Spectral Notes</avm:Spectral.Notes>
<avm:Distance.Notes>Distance Notes</avm:Distance.Notes>
<avm:ReferenceURL>Reference URL</avm:ReferenceURL>
<avm:Credit>Credit</avm:Credit>