We will now create a source adapter for our employee-server application that we created in the last section.
For creating a source adapter, we will use the RhoSync command utility. The following command will generate the employee source adapter:
rhosync source employee
Generating with source generator:
[ADDED] sources/employee.rb
[ADDED] spec/sources/employee_spec.rb
We can see that two files are created by running the above mentioned command. The file employee.rb
is the source adapter and the other file, employee_spec.rb
, is a unit test file that we will discuss in detail in Chapter 8.
The above command will also edit settings/settings.yml
and add the product adapter to the sources section with some default options:
:sources: Employee: :poll_interval: 300
This code means that Employee
is our source adapter and its poll_interval
is 300. Poll interval
is the total seconds in which the corresponding source will synchronize with the device...