Coder Social home page Coder Social logo

perl-webservice-whistle-pet-tracker-api's Introduction

NAME

WebService::Whistle::Pet::Tracker::API - Perl interface to access the Whistle Pet Tracker Web Service

SYNOPSIS

use WebService::Whistle::Pet::Tracker::API;
my $ws   = WebService::Whistle::Pet::Tracker::API->new(email=>$email, password=>$password);
my $pets = $ws->pets; #isa ARRAY of HASHes
foreach my $pet (@$pets) {
  print JSON::XS->new->pretty->encode($pet);
}

DESCRIPTION

Perl interface to access the Whistle Pet Tracker Web Service. All methods return JSON payloads that are converted to Perl data structures. Methods that require authentication will request a token and cache it for the duration of the object.

CONSTRUCTORS

new

my $ws = WebService::Whistle::Pet::Tracker::API->new(email=>$email, password=>$password);

PROPERTIES

email

Sets and returns the registered Whistle account email

password

Sets and returns the registered Whistle account password

METHODS

pets

Returns a list of pets as an array reference

my $pets = $ws->pets;

device

Returns device data for the given device id as a hash reference

my $device        = $ws->device('WXX-ABC123');
my $battery_level = $device->{'battery_level'}; #0-100 charge level

pet_dailies

Returns a list of dailies for the given pet id as an array reference

my $pet_dailies = $ws->pet_dailies($pet_id);

pet_daily_items

Returns a list of the daily items for the given pet id and day number as an array reference

my $day_number      = int(time/24/60/60) - 1; #yesterday
my $pet_daily_items = $ws->pet_daily_items($pet_id, $day_number);

pet_stats

Returns pet stats for the given pet id as a hash reference

my $pet_stats = $ws->pet_stats(123456789);

places

Returns registered places as an array reference

my $places = $ws->places;

METHODS (API)

api

Returns the decoded JSON data from the given web service end point

my $data = $ws->api('/end_point');

login

Calls the login service, caches, and returns the response as a hash reference.

auth_token

Retrieves the authentication JWT token from the login end point

ACCESSORS

ua

Returns an HTTP::Tiny web client user agent

SEE ALSO

AUTHOR

Michael R. Davis

COPYRIGHT AND LICENSE

MIT License

Copyright (c) 2023 Michael R. Davis

perl-webservice-whistle-pet-tracker-api's People

Contributors

mrdvt92 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.