The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WWW::Giraffi::API::Axion - Giraffi API Axion Method Axion Module

VERSION

0.2_04

SYNOPSIS

  use strict;
  use warnings;
  use WWW::Giraffi::API;
  
  my $apikey = "ilovenirvana_ilovekurtcobain";
  my $g = WWW::Giraffi::API->new(apikey => $apikey);
  # get all axion data
  my $arrayref = $g->axion->all;
  foreach $ref(@{$arrayref}) {
      ## anything to do...
  }

DESCRIPTION

WWW::Giraffi::API::Axion is Giraffi API Axion Method Access Module

METHOD

all

Get All Axion Setting

Example:

  $ create axion object
  my $axion = $g->axion;
  my $arrayref = $axion->all;

Return Array Reference:

  [
    {
      'axion' => {
           'options' => {},
           'name' => 'Aborted Alert',
           'axiontype' => 'messaging',
           'user_id' => 16,
           'id' => 2
       }
    }
  ]

Get Axion Setting

Example:

  my $conditions = { 'name' => 'Aborted Alert' };
  my $arrayref = $axion->search($conditions);

Return Array Reference:

  # only conditions match
  [
    {
      'axion' => {
           'options' => {},
           'name' => 'Aborted Alert',
           'axiontype' => 'messaging',
           'user_id' => 16,
           'id' => 2
       }
    }
  ]

find

Get One Axion Setting

Example:

  my $axion_id = 1;
  my $ref = $axion->find($axion_id);

Return Reference:

  {
    'axion' => {
         'options' => {},
         'name' => 'Aborted Alert',
         'axiontype' => 'messaging',
         'user_id' => 16,
         'id' => 1 
     }
  }

Example:

  my $axion_id = 1;
  my $arrayref = $axion->find_media($axion_id);

Return Array Reference:

  # media by add_media_by_id
  [
    {
      medium => {
             options => {
                  'address' => 'me@domain'
              },
              mediumtype => 'email',
              name => 'Alert Email',
              user_id => 16,
              id => 5
      }
    }
  ]

create

Post Axion Setting

Example:

  # axiontype is "messaging"
  my $conditions = {
        axiontype => "messaging",
        name => 'Aborted alert',
     };
  
  # axiontype is "http_request"
  my $conditions = {
        axiontype => "http_request",
        name => 'Aborted alert post request',
        options => {
          header => {
            "content-type" => "application/x-www-form-urlencoded",
            Authorization => "Basic ****"
          },
          uri => "https://convore.com/api/topics/19099/messages/create.json",
          method => "post",
          body => {
            message => "Aborted alert post message by API"
          }
        }
     };
  $axion->create($conditions);

exec

Execute Axion. add_media_by_id method is executed in advance

Example:

  my $axion_id = 1;
  $axion->exec($axion_id);

update

Update Axion Setting

Example:

  my $axion_id = 1;
  my $conditions = { name => 'Emergency Axion' };
  $axion->update($axion_id, $conditions);

destroy

Delete Axion Setting

Example:

  my $axion_id = 1;
  $axion->delete($axion_id);

add_media

Adds the specified media using the media id parameter to an axion, specified by an axion id parameter

Example:

  my $media_id = 100;
  my $axion_id = 2;
  $axion->add_media($axion_id, $media_id);

remove_media

Deletes the specified medium using the medium id parameter from an axion, specified by an axion id parameter

Example:

  my $media_id = 100;
  my $axion_id = 2;
  $axion->remove_media($axion_id, $media_id);

AUTHOR

Akira Horimoto <emperor@gmail.com>

LICENSE

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