The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

WWW::PushBullet - Module giving easy access to PushBullet API

DESCRIPTION

Module giving easy access to PushBullet API

SYNOPSIS

use WWW::PushBullet;

my $pb = WWW::PushBullet->new({apikey => $apikey});

$pb->push_address({ device_iden => $device_iden, name => $name, 
    address => $address });
    
$pb->push_file({ device_iden => $device_iden, file => $filename);
    
$pb->push_link({ device_iden => $device_iden, title => $title,
    url => $url });
    
$pb->push_list({ device_iden => $device_iden, title => $title, 
    items => \@items });
    
$pb->push_note({ device_iden => $device_iden, title => $title,
    body => $body });

SUBROUTINES/METHODS

new($params)

Creates a new instance of PushBullet API

my $pb = WWW::PushBullet->new({apikey => $apikey});

DEBUG

Prints Debug message when '_debug' is enabled

api_key()

Returns current PushBullet API key

my $apikey = $pb->api_key();

debug_mode

Sets Debug mode

$pb->debug_mode(1);

contacts()

Returns list of contacts

my $contacts = $pb->contacts();

foreach my $c (@{$contacts})
{
    printf "Contact '%s' (%s) => %s\n", $c->{name}, $c->{iden}, $c->{email};
}

devices()

Returns list of devices

my $devices = $pb->devices();

foreach my $d (@{$devices})
{
    printf "Device '%s' (%s)=> id %s\n", 
        $d->{nickname}, $d->{model}, $d->{iden};
}

_ephemerals

Generic ephemerals function (not supposed to be used directly)

_pushes($content)

Generic pushes function (not supposed to be used directly)

_upload_request($file_name, $file_type)

Upload request to AWS (used by push_file)

push_address($params)

Pushes address (with name & address)

$pb->push_address(
    {
        device_iden => $device_iden,
        name        => 'GooglePlex',
        address     => '1600 Amphitheatre Pkwy, Mountain View, CA 94043, Etats-Unis'
    }
    );

push_file($params)

Pushes file

$pb->push_file(
    { 
        device_iden => $device_iden, 
        file_name => '/var/www/index.html',
        body => 'File Description'
    }
    );

push_link($params)

Pushes link (with title & url)

$pb->push_link(
    {
        device_iden => $device_iden,
        title       => 'WWW::PushBullet Perl module on GitHub',
        url         => 'https://github.com/sebthebert/WWW-PushBullet'
    }
    );

push_list($params)

Pushes list (with title & items)

$pb->push_list(
    {
        device_iden => $device_iden,
        title       => 'One list with 3 items',
        items       => [ 'One', 'Two', 'Three' ]
    }
    );

push_note($params)

Pushes note (with title & body)

$pb->push_note(
    {
        device_iden => $device_iden,
        title       => 'Note Title',
        body        => 'Note Body'
    }
    );

push_sms($params)

Push SMS

$pb->push_sms(
    {
        conversation_iden => $mobile,
        message => $sms,
        target_device_iden => $conf->{default_sms_device}
    }
    );

user_info()

Returns PushBullet's user information (name, email, iden...)

my $user_info = $pb->user_info();

version()

Returns WWW::PushBullet module version

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

REPOSITORY

https://github.com/sebthebert/WWW-PushBullet

AUTHOR

Sébastien Thébert <www-pushbullet@onetool.pm>