I'm successfully using the vpim/vcard gem to import from a vcard file
except for one part... the physical address fields.
the docs are pretty sketchy and there isnt much when you google for
info, so I'm wondering if anybody can help.
my prob is that when I'm trying to process the addresses, I must be
looking at the wrong part of the data, 'cause it comes up blank (when
the cobbled together data I'm using for dev definitely has data
I currently have the following code:
card.addresses.each do |a|
addrs = ""
addrs += a.pobox.to_s + '\n' unless a.pobox.to_s.blank?
addrs += a.street.to_s + '\n' unless a.street.to_s.blank?
addrs += a.locality.to_s + ', ' unless a.locality.to_s.blank?
addrs += a.region.to_s + ' ' unless a.region.to_s.blank?
addrs += a.postalcode.to_s unless a.postalcode.to_s.blank?
addrs += '\n' + a.country.to_s unless a.country.to_s.blank?
location = a.location.to_s
if location == 'home' || location == '' || a.location.blank?
options[:home_addrs] = addrs
elsif location == 'work'
options[:work_addrs] = addrs
I thought these attributes were all Strings, but it's not seeming that
way. I tried it initially without the .to_s and then threw that in
'cause I found it to be necessary on the a.location piece you see near
the end. Didnt make a difference.
Does anybody know the proper way to pull this data out?