NAME

Weenect::API - API interaction

SYNOPSIS

    use Weenect::API;
    my $api = Weenect::API->new;

    # Connect to the server
    $api->login( "me@example.com", "password" );

    # Get the trackers.
    my $trackers = $api->get_trackers;

    # Process tracker data.
    foreach my $tracker ( @$trackers ) {
	printf("Tracker %s [%d%s]\n", $tracker->name, $tracker->id,
	      $tracker->active ? "" : ",inactive" );
    }

METHODS

The Weenect::API class supports the following methods:

login( $user, $pass )

Connects to the Weenect server by loggin in.

Returns a user object, suitable for further operations.

get_trackers

Returns a list of trackers associated with this account, in the form of Weenect::Tracker objects

get_preferences

Returns the current set of preferences in the form of a Weenect::Preferences object.

set_preferences( %prefs )

Sets one or more preferences.

E.g.

language => "nl"
preferred_metric_system => "km"
option => 0
mail_pref => { offers => 0,
               company_news => 0,
               new_features => 0,
               surveys_and_tests => 0 }

Returns the current set of preferences in the form of a Weenect::Preferences object.

get_animals( $imei )

Returns a list of animals associated with a given tracked, identified by its IMEI number (as a string).

The animals info is in the form of a Weenect::Animal object.