NAME

WebService::Pixela::Pixel - It's Pixela Webhook API client

SYNOPSIS

use strict;
use warnings;

use WebService::Pixela;

my $pixela = WebService::Pixela->new(token => $ENV{TOKEN}, username => $ENV{USERNAME});

# set graph id
$pixela->graph->id('anatofuz-test');

$pixela->pixel->get(date => '20180915');
$pixela->pixel->update(date => '20180915', quantity => 50);

$pixela->pixel->increment(date => '20180915');
$pixela->pixel->decrement(date => '20180915');

$pixela->pixel->get(date => '20180915');
$pixela->pixel->delete(date => '20180915');

DESCRIPTION

WebService::Pixela::Pixel is user API client about Pixe.la webservice.

INTERFACE

instance methods

This instance method require WebService::Pixela instance. So, Usually use these methods from the WebService::Pixela instance.

$pixela->pixel->post(%opts)

It records the quantity of the specified date as a "Pixel".

%opts might be:

([required]) id : Str

Specify the target graph as an ID. If the graph id is set for an instance, it will be automatically used. (You do not need to enter it as an argument)

[required] date : [yyyyMMdd]

The date on which the quantity is to be recorded. It is specified in yyyyMMdd format.

[required] quantity : String

Specify the quantity to be registered on the specified date. Validation rule: int^-?[0-9]+ float^-?[0-9]+.[0-9]+

optional_data : json_string

Additional information other than quantity. It is specified as JSON string. The amount of this data must be less than 10 KB.

See also

https://docs.pixe.la/#/post-pixel

$pixela->pixel->get(%opts)

Get registered quantity as "Pixel".

%opts might be:

([required]) id : Str

Specify the target graph as an ID. If the graph id is set for an instance, it will be automatically used. (You do not need to enter it as an argument)

[required] date : [yyyyMMdd]

The date on which the quantity is to be recorded. It is specified in yyyyMMdd format.

See also

https://docs.pixe.la/#/get-pixel

$pixela->pixel->update(%opts)

Update the quantity already registered as a "Pixel". If target "Pixel" not exist, create a new "Pixel" and set quantity.

%opts might be:

([required]) id : Str

Specify the target graph as an ID. If the graph id is set for an instance, it will be automatically used. (You do not need to enter it as an argument)

[required] date : [yyyyMMdd]

The date on which the quantity is to be recorded. It is specified in yyyyMMdd format.

quantity : String

Specify the quantity to be registered on the specified date. Validation rule: int^-?[0-9]+ float^-?[0-9]+.[0-9]+

optional_data : json_string

Additional information other than quantity. It is specified as JSON string. The amount of this data must be less than 10 KB.

See also

https://docs.pixe.la/#/put-pixel

$pixela->pixel->increment(%opts)

Increment quantity "Pixel" of the day (it is used "timezone" setting if Graph's "timezone" is specified, if not specified, calculates it in "UTC"). If the graph type is int then 1 added, and for float then 0.01 added.

%opts might be:

([required]) id : Str

Specify the target graph as an ID. If the graph id is set for an instance, it will be automatically used. (You do not need to enter it as an argument)

[required] date : [yyyyMMdd]

The date on which the quantity is to be recorded. It is specified in yyyyMMdd format.

length : Int (default 0)

Since the request body is not specifield, specify the Content-Length header. (Default 0)

See also

https://docs.pixe.la/#/increment-pixel

$pixela->pixel->decrement(%opts)

Decrement quantity "Pixel" of the day (it is used "timezone" setting if Graph's "timezone" is specified, if not specified, calculates it in "UTC"). If the graph type is int then -1 added, and for float then -0.01 added.

%opts might be:

([required]) id : Str

Specify the target graph as an ID. If the graph id is set for an instance, it will be automatically used. (You do not need to enter it as an argument)

[required] date : [yyyyMMdd]

The date on which the quantity is to be recorded. It is specified in yyyyMMdd format.

length : Int (default 0)

Since the request body is not specifield, specify the Content-Length header. (Default 0)

See also

https://docs.pixe.la/#/decrement-pixel

$pixela->pixel->delete(%opts)

Delete the registered "Pixel".

%opts might be:

([required]) id : Str

Specify the target graph as an ID. If the graph id is set for an instance, it will be automatically used. (You do not need to enter it as an argument)

[required] date : [yyyyMMdd]

The date on which the quantity is to be recorded. It is specified in yyyyMMdd format.

See also

https://docs.pixe.la/#/delete-pixel

LICENSE

Copyright (C) Takahiro SHIMIZU.

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

AUTHOR

Takahiro SHIMIZU <anatofuz@gmail.com>