Coder Social home page Coder Social logo

www-cachet's Introduction

WWW::Cachet

A simple (enough) Perl module to interface with Cachet (https://docs.cachethq.io)

INSTALLATION

To install this module type the following:

perl Makefile.PL
make
make test
make install

DOCUMENTATATION

I've tried for the most part to document public methods in the WWW::Cachet module using POD. Check perldoc WWW::Cachet once installed, or perldoc lib/WWW/Cachet.pm from this directory.

It may also be advantageous for you to take a look at the Cachet API Documentation.

EXAMPLE

Okay so you don't wanna read the perldoc for whatever reason then that's fine too, here's a starter for ya. Godspeed.

use WWW::Cachet;
# Import some constants to use later
use WWW::Cachet::Const qw/ :all :component_status :incident_status :calc_type /;

my $cachet = WWW::Cachet->new(
  api_url   => "http://cachet.example.com/api/v1",
  api_token => "rRpHYVhsNnG12X3N4ufr",
  # Optional basic HTTP authentication
  basic_auth => {
    user     => "cachet",
    password => "test"
  }
);

# Retrieve all components
my $components = $cachet->getComponents();
print $_->name, "\n" for (@{$components});

# Retrieve all components with status STATUS_MAJOR_OUTAGE
my $components = $cachet->getComponents({ status => STATUS_MAJOR_OUTAGE });
print $_->name, "\n" for (@{$components});

# Retrieve a single component
my $component = $cachet->getComponent(1);
die $cachet->error unless($component);

# Create a component
my $new_component = $cachet->addComponent({
  name => "New Component",
  status => STATUS_OPERATIONAL
});

# Update an existing component
$new_component->status(STATUS_PARTIAL_OUTAGE);
my $updated_component = $cachet->updateComponent($new_component);
# OR
my $id = 3;
my %update = ( status => STATUS_PARTIAL_OUTAGE );
my $updated_component = $cachet->updateComponent($id, \%update);

DEPENDENCIES

This module requires other modules and libraries:

  • The sole source of truth lies within Makefile.PL

CONTRIBUTORS

COPYRIGHT AND LICENCE

Copyright 2016 Jarrod Linahan [email protected]

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.20.2 or, at your option, any later version of Perl 5 you may have available.

Viva la open sauce

www-cachet's People

Stargazers

 avatar

Watchers

 avatar

Forkers

saur2000

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.