/Gnip-Rules

REST Client managing rules for Gnip API

Primary LanguagePerl

NAME

Gnip::Rules - REST client managing rules for Gnip API

SYNOPSIS

use Gnip::Rules;
use Try::Tiny;

my $client = Gnip::Rules->new(
    user => 'user',
    password => 'password',
    base_url => 'base_url',
    spore_spec => 'spore-spec/gnip.json',
    account => 'Account',
    publisher => 'twitter',
);

# get rules
try {
    my $rules = $client->get_rules;
} catch {
    die $_->raw_body."\n";
};

# set rules
try {
    my $rules = $client->set_rules({
        rules => [
            { value => "rule" },
            { value => "rule_with_tag", tag => "tag" },
        ]
    });
} catch {
    die $_->raw_body."\n";
};

# delete rules
try {
    my $rules = $client->delete_rules({
        rules => [
            { value => "rule" },
            { value => "rule_with_tag", tag => "tag" },
        ]
    });
} catch {
    die $_->raw_body."\n";
};

DESCRIPTION

Gnip::Rules is an REST client managing rules for Gnip API, available at http://docs.gnip.com/w/page/23733233/Rules%20Methods%20Documentation

METHODS

my $client = Gnip::Rules->new( %args );

user, password

Credentials for authentification.

base_url

Base URL for the API, including your gnipboxname.

spore_spec

Path to Net::HTTP::Spore specification file (see spore-spec/gnip.json in the package).

account publisher

Gnip acccount and publisher.

get_rules( %opt )

set_rules( \%rules )

delete_rules( \%rules )

update_rules( \%rules, %opt )

NOTES

The API uses the HTTPS protocol. For this, you need to install the Net::SSLeay module.

AUTHOR

Stéphane Raux <stephane.raux@linkfluence.net>

LICENSE

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

SEE ALSO

AnyEvent::Gnip::Stream Net::HTTP::Spore