Pedro Melo

NAME

AnyEvent::WebService::Notifo - AnyEvent-powered client for the notifo.com API

VERSION

version 0.001

SYNOPSIS

    use AnyEvent;
    use AnyEvent::WebService::Notifo;
    
    # Uses the default values obtained from configuration file
    my $awn = AnyEvent::WebService::Notifo->new;
    
    # ... or just pass them in
    my $awn = AnyEvent::WebService::Notifo->new(
        api_key => 'api_key_value',
        user    => 'api_user',
    );
    
    # a coderef as a callback is one possibility...
    $awn->send_notification(msg => 'my nottification text', cb => sub {
      my ($res) = @_;
      # $res is our response 
    });
    
    # ... or a condvar
    my $cv = AE::cv;
    $awn->send_notification(msg => 'my nottification text', cb => $cv);
    $res = $cv->recv;  # $res is our response

DESCRIPTION

A client for the http://notifo.com/ API using the AnyEvent framework.

CONSTRUCTORS

new

Creates a new AnyEvent::WebService::Notifo object. See Protocol::Notifo->new() for a explanation of the parameters and the configuration file used for default values.

METHODS

send_notification

Sends a notification.

It accepts a hash with parameters. We require a cb parameter. This must be a coderef or a condvar, that will be called with the response.

In void context, this method returns nothing. In scalar context, it returns a guard object. If this object goes out of scope, the request is canceled. So you need to keep this guard object alive until your callback is called.

See Protocol::Notifo->send_notification() for list of parameters that this method accepts, and an explanation of the response that the callback receives.

SEE ALSO

Protocol::Notifo, AnyEvent

AUTHOR

Pedro Melo <melo@simplicidade.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2010 by Pedro Melo.

This is free software, licensed under:

  The Artistic License 2.0