foo
gc = GoogleContacts::Wrapper.new
gc.batch do
john = gc.contacts.find_by_email!('[email protected]')
# Set this email as primary, overwriting other addresses
john.email = '[email protected]'
# return primary email address (string)
puts john.email
# Add email to the list
john.emails << '[email protected]'
john.emails.push('[email protected]', attrs)
john.emails['[email protected]'] = attrs
# this removes any existing label
john.emails['[email protected]'].rel = 'blaat'
# this removes any existing rel
john.emails['[email protected]'].label = 'personal use'
# access new email address. this can be used as a factory
# method to add new addresses
john.emails['[email protected]'].primary!
john.emails.delete('[email protected]')
[:rel] = 'foo'
# Set the last one as primary
john.emails.primary('[email protected]')
end
@wrapper.batch do 1000.times do |i| c = @wrapper.contacts.build c.name = "John %03d" % i c.email = "foo%[email protected]" % i c.save end end