NAME
App::MonM::Notifier::Client - monotifier client
VERSION
Version 1.00
SYNOPSIS
use App::MonM::Notifier::Client;
my $client = new App::MonM::Notifier::Client(
url => "http://localhost/monotifier"
);
my $client = new App::MonM::Notifier::Client(
uri => $uri,
debug => 1,
verbose => 1,
timeout => 180, # default: 180
);
my $status = $client->check;
if ($status) {
debug("OK $url: ".$client->code);
debug(Dumper($client->res));
} else {
debug("ERROR $url: ".$client->code);
debug($client->error);
}
DESCRIPTION
Client for interaction with MToken server. This module provides client methods
The module based on MToken::Client.
METHODS
- new
-
my $client = new App::MonM::Notifier::Client( url => "http://localhost/monotifier", user => $user, # optional password => $password, # optional timeout => $timeout, # default: 180 );
Returns client
- check
-
my $status = $client->check; my $status = $client->check( "GET" ); # Default: HEAD
Returns check-status of server. 0 - Error; 1 - Ok
See README file for details of data format
- code
-
my $code = $client->code;
Returns HTTP code of the response
- credentials
-
$client->credentials("username", "password", "realm")
Set credentials for User Agent by Realm (name of basic authentication)
- error
-
print $client->error;
Returns error string
- info
-
my %rec = $client->info( $token, $id );
Returns record by ID
- req
-
my $request = $client->req;
Returns request hash
- request
-
my $json = $client->request("METHOD", "PATH", "DATA");
Send request
- res
-
my $response = $client->res;
Returns response hash
- status
-
my $status = $client->status;
Returns object status value. 0 - Error; 1 - Ok
- send
-
my $id = $client->send( token => $params{token}, ident => $params{ident}, level => $params{level}, to => $params{to}, from => $params{from}, subject => $params{subject}, message => $params{message}, pubdate => $params{pubdate}, expires => $params{expires}, );
Send message and returns ID or false
- remove
-
my $status = $client->remove( $token, $id );
Removes message by ID and returns status. 0 - Error; 1 - Ok
- update
-
my $status = $client->send( id => $params{id}, token => $params{token}, ident => $params{ident}, level => $params{level}, to => $params{to}, from => $params{from}, subject => $params{subject}, message => $params{message}, pubdate => $params{pubdate}, expires => $params{expires}, );
Update message and returns status
- trace
-
my $trace_array = $client->trace; $client->trace("New trace record");
Gets trace stack or pushes new trace record to trace stack
- cleanuptrace
-
$client->cleanuptrace;
Cleanup trace and returns client object
HISTORY
See CHANGES
file
DEPENDENCIES
TO DO
See TODO
file
BUGS
* none noted
SEE ALSO
App::MonM::Notifier, MToken::Client
AUTHOR
Sergey Lepenkov (Serz Minus) http://www.serzik.com <abalama@cpan.org>
COPYRIGHT
Copyright (C) 1998-2017 D&D Corporation. All Rights Reserved
LICENSE
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
See LICENSE
file