multiple contacts
This commit is contained in:
parent
efff98eb32
commit
b11d2813cd
|
@ -24,5 +24,9 @@ module AVM
|
||||||
def to_creator_list_element
|
def to_creator_list_element
|
||||||
%{<rdf:li>#{self.name}</rdf:li>}
|
%{<rdf:li>#{self.name}</rdf:li>}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def primary?
|
||||||
|
@primary
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -85,12 +85,14 @@ module AVM
|
||||||
|
|
||||||
IPTC_CORE_FIELDS_AND_NAMES.each do |key, element_name|
|
IPTC_CORE_FIELDS_AND_NAMES.each do |key, element_name|
|
||||||
if node = refs[:iptc].at_xpath("//Iptc4xmpCore:#{element_name}")
|
if node = refs[:iptc].at_xpath("//Iptc4xmpCore:#{element_name}")
|
||||||
contacts.first[key] = node.text.strip
|
contacts.each { |contact| contact[key] = node.text.strip }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@contacts = contacts.collect { |contact| Contact.new(contact) }
|
if !(@contacts = contacts.collect { |contact| Contact.new(contact) }).empty?
|
||||||
|
@contacts.first.primary = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def primary_contact
|
def primary_contact
|
||||||
|
|
|
@ -108,8 +108,16 @@ describe AVM::Creator do
|
||||||
|
|
||||||
its('creator.length') { should == 1 }
|
its('creator.length') { should == 1 }
|
||||||
|
|
||||||
context 'creator one' do
|
def self.field_checks
|
||||||
subject { image.creator[0] }
|
its(:name) { should == name }
|
||||||
|
its(:address) { should == address }
|
||||||
|
its(:city) { should == city }
|
||||||
|
its(:state) { should == state }
|
||||||
|
its(:zip) { should == zip }
|
||||||
|
its(:country) { should == country }
|
||||||
|
its(:email) { should == email }
|
||||||
|
its(:telephone) { should == telephone }
|
||||||
|
end
|
||||||
|
|
||||||
let(:name) { 'John Bintz' }
|
let(:name) { 'John Bintz' }
|
||||||
let(:email) { 'bintz@stsci.edu' }
|
let(:email) { 'bintz@stsci.edu' }
|
||||||
|
@ -120,19 +128,44 @@ describe AVM::Creator do
|
||||||
let(:zip) { '21218' }
|
let(:zip) { '21218' }
|
||||||
let(:country) { 'USA' }
|
let(:country) { 'USA' }
|
||||||
|
|
||||||
its(:name) { should == name }
|
context 'creator one' do
|
||||||
its(:address) { should == address }
|
subject { image.creator[0] }
|
||||||
its(:city) { should == city }
|
|
||||||
its(:state) { should == state }
|
field_checks
|
||||||
its(:zip) { should == zip }
|
|
||||||
its(:country) { should == country }
|
it { should be_primary }
|
||||||
its(:email) { should == email }
|
|
||||||
its(:telephone) { should == telephone }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'two creators' do
|
context 'two creators' do
|
||||||
let(:file_path) { 'spec/sample_files/creator/two_creators.xmp' }
|
let(:file_path) { 'spec/sample_files/creator/two_creators.xmp' }
|
||||||
|
|
||||||
|
its('creator.length') { should == 2 }
|
||||||
|
|
||||||
|
context 'first creator' do
|
||||||
|
subject { image.creator[0] }
|
||||||
|
|
||||||
|
field_checks
|
||||||
|
|
||||||
|
it { should be_primary }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'second creator' do
|
||||||
|
subject { image.creator[1] }
|
||||||
|
|
||||||
|
field_checks
|
||||||
|
|
||||||
|
it { should_not be_primary }
|
||||||
|
|
||||||
|
let(:name) { 'Aohn Bintz' }
|
||||||
|
let(:email) { 'aohn@stsci.edu' }
|
||||||
|
let(:telephone) { '800-555-2345' }
|
||||||
|
let(:address) { '3700 San Martin Drive' }
|
||||||
|
let(:city) { 'Baltimore' }
|
||||||
|
let(:state) { 'Maryland' }
|
||||||
|
let(:zip) { '21218' }
|
||||||
|
let(:country) { 'USA' }
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -21,5 +21,3 @@
|
||||||
</rdf:Description>
|
</rdf:Description>
|
||||||
</rdf:RDF>
|
</rdf:RDF>
|
||||||
</x:xmpmeta>
|
</x:xmpmeta>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 4.2.2-c063 53.352624, 2008/07/30-18:05:41 ">
|
||||||
|
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
||||||
|
<rdf:Description rdf:about=""
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/">
|
||||||
|
<dc:creator>
|
||||||
|
<rdf:Seq>
|
||||||
|
<rdf:li>John Bintz</rdf:li>
|
||||||
|
<rdf:li>Aohn Bintz</rdf:li>
|
||||||
|
</rdf:Seq>
|
||||||
|
</dc:creator>
|
||||||
|
</rdf:Description>
|
||||||
|
<rdf:Description rdf:about=""
|
||||||
|
xmlns:Iptc4xmpCore="http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/">
|
||||||
|
<Iptc4xmpCore:CreatorContactInfo rdf:parseType="Resource">
|
||||||
|
<Iptc4xmpCore:CiAdrExtadr>3700 San Martin Drive</Iptc4xmpCore:CiAdrExtadr>
|
||||||
|
<Iptc4xmpCore:CiAdrCity>Baltimore</Iptc4xmpCore:CiAdrCity>
|
||||||
|
<Iptc4xmpCore:CiAdrRegion>Maryland</Iptc4xmpCore:CiAdrRegion>
|
||||||
|
<Iptc4xmpCore:CiAdrPcode>21218</Iptc4xmpCore:CiAdrPcode>
|
||||||
|
<Iptc4xmpCore:CiAdrCtry>USA</Iptc4xmpCore:CiAdrCtry>
|
||||||
|
<Iptc4xmpCore:CiTelWork>800-555-1234,800-555-2345</Iptc4xmpCore:CiTelWork>
|
||||||
|
<Iptc4xmpCore:CiEmailWork>bintz@stsci.edu,aohn@stsci.edu</Iptc4xmpCore:CiEmailWork>
|
||||||
|
<Iptc4xmpCore:CiUrlWork>http://hubblesite.org</Iptc4xmpCore:CiUrlWork>
|
||||||
|
</Iptc4xmpCore:CreatorContactInfo>
|
||||||
|
</rdf:Description>
|
||||||
|
</rdf:RDF>
|
||||||
|
</x:xmpmeta>
|
Loading…
Reference in New Issue