Giter Site home page Giter Site logo

anyevent-hipchat's Introduction

NAME

AnyEvent::HipChat - Build application to Atlassian Hipchat

SYNOPSIS

my $hp = AnyEvent::HipChat->new(
    webhook_iface => $interface,
    webhook_port  => $port,
    data_storage  => <storage class, optional>,
    descriptor    => <hipchat capabilities descriptor>
);

$hp->on(
   ready => sub {
       my $store = shift;
       my $room_id = $store->room_id;
       my $api = $store->api;
       .... #doing something very useful here
   }
);

$hp->start;

DESCRIPTION

Framework to build application to Atlassian Hipchat platform. It's contain two major parts: AnyEvent::HipChat::Api - api client library, AnyEvent::HipChat - hipchat http callback handler.

USAGE

Basic usage scenario

setup

Provide interface, prort and capabilities descriptor to AnyEvent::HipChat constructor

on->ready

Setup some callbacks with very useful scenario via ready event

setup_callback

Setup some user defined callback handlers (e.g. for room message processing)

start

Make AnyEvent::HipChat framework to listen hipchat callback.

METHODS

new(%args)

Constructor, provide following options:

webhook_iface, required

Listening interface address, required There is no default, and it MUST be real network interface no 0.0.0.0.

webhook_port

AnyEvent::Hipchat port, default 65500

httpd_args

Something that you wand to send to AnyEvent::HTTPD-new(...)>

descriptor

Hipchat capability descriptor goes here. Note that there is reasonable default

{
     name         => ucfirst(lc(Sys::Hostname::hostname)). " hipchat integration",
     description  => 'An integration that make cool stuff',
     key          => Sys::Hostname::hostname,
     links        => { ... },
     capabilities => {
         hipchatApiConsumer => {
             scopes => [
                 qw/send_message/
             ]
         },
         "installable" => { ... },
     }
 };
data_storage

Instanse of class that support AnyEvent::HipChat::DataStore interface

on($event => $sub)

$hp->on(reday => sub { .... })

Setup new event handler, for now only 'ready' event effectively supported

setup_callback($sub)

my $cb_url =
    $hp->setup_callback(sub {
        my ($ok, $data, $err) = @_;
        ...
    });

$api->create_room_webhook(
    url => $cb_url,
    event => 'room_message',
    room_id => $room_id,
    key => $room_hook_key,
    sub {
        my ($ok, $data, $err) = @_;
        ...
 });

Setup user defined callback

start()

Register callbacks and run AnyEvent::HTTPD on configured host/port

scopes()

Get scopes from capabilities descriptor

api, store, event_emitter, httpd, descriptor

Various accessors

AUTHORS

[email protected]

LICENSE

CC0 1.0 Universal

SEE ALSO

examples/, AnyEvent::HipChat::Api, AnyEvent::HipChat::EventEmitter, AnyEvent::HTTPD, AnyEvent::HipChat::DataStore

anyevent-hipchat's People

Contributors

pru-mike avatar

Stargazers

 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.