Revision: 22349
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 10, 2010 13:27 by webonomic
Initial Code
require 'vpim/vcard'
card = Vpim::Vcard::Maker.make2 do |maker|
maker.add_name do |name|
name.prefix = 'Dr.'
name.given = 'Jimmy'
name.family = 'Death'
end
maker.add_addr do |addr|
addr.preferred = true
addr.location = 'work'
addr.street = '12 Last Row, 13th Section'
addr.locality = 'City of Lost Children'
addr.country = 'Cinema'
end
maker.add_addr do |addr|
addr.location = [ 'home', 'zoo' ]
addr.delivery = [ 'snail', 'stork', 'camel' ]
addr.street = '12 Last Row, 13th Section'
addr.locality = 'City of Lost Children'
addr.country = 'Cinema'
end
maker.nickname = "The Good Doctor"
maker.birthday = Date.today
maker.add_photo do |photo|
photo.link = 'http://example.com/image.png'
end
maker.add_photo do |photo|
photo.image = "File.open('drdeath.jpg').read # a fake string, real data is too large :-)"
photo.type = 'jpeg'
end
maker.add_tel('416 123 1111')
maker.add_tel('416 123 2222') { |t| t.location = 'home'; t.preferred = true }
maker.add_impp('joe') do |impp|
impp.preferred = 'yes'
impp.location = 'mobile'
end
maker.add_x_aim('example') do |xaim|
xaim.location = 'row12'
end
maker.add_tel('416-123-3333') do |tel|
tel.location = 'work'
tel.capability = 'fax'
end
maker.add_email('[email protected]') { |e| e.location = 'work' }
maker.add_email('[email protected]') { |e| e.preferred = 'yes' }
end
puts card
Initial URL
http://vpim.rubyforge.org/
Initial Description
Requires vPim package.
Initial Title
Ruby vcard maker
Initial Tags
Initial Language
Ruby