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

NAME

Yandex::Audience - a simple API for Yandex.Audience

It contains very few number of API-calls now.

VERSION

version 0.01

SYNOPSYS

  use Yandex::Audience;

  my $Token = 'AgAAAAAAELGSBIXHdBAPDm-6sJ7Sbao7J-pmaU7'; #Auth token
  my $YaAudience= Yandex::Audience->new( -token => $Token);

  #Get list of existing segments
  my $Segments = $YaAudience->getListOfSegments();

  #Upload a content of String in CSV-fromat
  my $Segment = $YaAudience->uploadCSV($CSV);

  #Upload CSV-file
  my $Segment = $YaAudience->uploadCSV('real1500_md5.csv');

  #Save the uploaded content as a segment
  my $SegmentStatus = $YaAudience->saveSegment( segment => $Segment->{id},
                                                name => 'Litres'.$Segment->{id},
                                                hashed => 1,
                                               ) if exists $Segment->{id};

  #Delete a segment
  my $Result = $YaAudience->deleteSegment(9243581);

METHODS

getListOfSegments()

Returns a list of existing segments available to the user.

  my $Segments = $YaAudience->get_list_of_segments();

uploadCSV()

Upload a CSV-file with data and create a segment. Returns Hash with Id of segment(s) and it's statuses.

  my $Segment = $YaAudience->uploadCSV('real1500_md5.csv');

saveSegment()

Saves a segment generated from a file with user data.

  my $SegmentStatus = $YaAudience->saveSegment( -segment => $Segment->{id},          #Id of a segment
                                                 -name   => 'Litres'.$Segment->{id}, #A name of a segment
                                                 -hashed => 1,                       #1 if data contains hashed fields
                                               ) if exists $Segment->{id};

deleteSegment()

Deletes the specified segment (or segments) Returns arrayref to scalars: 1 if success, 0 otherwise.

  my $Result = $YaAudience->deleteSegment($SegmentID); #$SegmentID - can be scalar or arrayref to scalars, or arrayref to hashes with id of segment(s).
or
  my $Result = $YaAudience->deleteSegment( [9254200, 9254215] );

_deleteSegment()

The internal method. Deletes a segment. Returns scalar: 1 if success, 0 otherwise.

  my $Result = $YaAudience->_deleteSegment($SegmentID); #$SegmentID - scalar, contains id of segment.
  

_prepareJSON()

The internal method. Returns hash with values of type JSON::Boolean changed to Scalars (1 and 0).

AUTHOR

Dmitry Marin, <mcorvax at cpan.org>

BUGS

Please report any bugs or feature requests to bug-yandex-audience at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Yandex-Audience. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Yandex::Audience

You can also look for information at:

LICENSE AND COPYRIGHT

This software is Copyright (c) 2019 by Dmitry Marin.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)