Gnip::Rules - REST client managing rules for Gnip API
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";
};
Gnip::Rules is an REST client managing rules for Gnip API, available at http://docs.gnip.com/w/page/23733233/Rules%20Methods%20Documentation
- 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.
The API uses the HTTPS protocol. For this, you need to install the Net::SSLeay module.
Stéphane Raux <stephane.raux@linkfluence.net>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.