alexrothenberg / motion-addressbook

MIT License
89 stars 30 forks source link

ABPersonCreateVCardRepresentationWithPeople #34

Closed VGraupera closed 11 years ago

VGraupera commented 11 years ago

I didnt find a wrapper for ABPersonCreateVCardRepresentationWithPeople. Can it be added? Thanks.

alexrothenberg commented 11 years ago

This sounds like a great idea.

Were you imagining the API to be something like this?

people = AddressBook::Person.all
AddressBook::Person.vcards_for(people)
# returns an array of vcards

and

alex = AddressBook::Person.find_by_email('alex@example.com')
alex.to_vcard
# returns one vcard
jmay commented 11 years ago

ABPersonCreateVCardRepresentationWithPeople returns a NSConcreteData object. But RubyMotion seems to stringify those correctly, so I don't know if it's necessary to explicitly call to_s on the value.

The VCardRepresentation is just a single giant string, not an array of strings, regardless of whether you give it a single Person record or multiple. There's no "VCard object". So perhaps we should just imitate the iOS naming convention: AddressBook::Person.vcard_representation_for(people)?

alexrothenberg commented 11 years ago

Added with commit 1ee2f31. Any reactions?

VGraupera commented 11 years ago

Wow, very nicely done. And that was fast. Really appreciate this. I will try it out.