We can access a local phone book of our device and stored contacts to Rhom via the Ruby class RhoContact
. We can perform basic CRUD i.e. Create, Read, Update, and Destroy operations on the phone contacts. The following methods are available in the RhoContact class:
Create
We can create a new contact in the phonebook with the following command:
Rho::RhoContact.create!(@params['contact'])
We can set the properties of the contact passed as parameter hash, and save the created phonebook records (create):
We can get all the device contacts using the following command:
Rho::RhoContact.find(:all)
It will return hash of hashes of all contacts stored in the phonebook.
If we want to get only one specific contact, we may use the following command:
Rho::RhoContact.find(@params['id'])
It will return hash of all the properties of the contact identified by the provided ID.
Update
We can update a device contact by using the following command:
Rho::RhoContact.update_attributes(@params['contact'])
It...