=head1 NAME
WebService::Zussar - Zussar API wrapper module for perl
=head1 SYNOPSIS
use WebService::Zussar->new( encoding => 'utf8' );
my $zussar = WebService::Zussar;
# Request event
$zussar->fetch( 'event', keyword => 'perl' );
# Print each events title
while ( my $event = $zussar->next ){
print $event->title . "\n";
}
# Request event/user
$zussar->fetch( 'event/user', event_id => '476003' );
while ( my $event = $zussar->next ){
# Print each users of event
foreach my $user( @{$event->users} ){
print $user->nickname . "\n";
}
}
=head1 INSTALLATION
$ git clone git://github.com/mugifly/WebService-Zussar.git
$ cpanm ./WebService-Zussar
=head1 METHODS
=head2 new ( [%params] )
Create an instance of WebService::Zussar.
%params = (optional) LWP::UserAgent options, and encoding (example: encoding => 'utf8').
=head2 fetch ( $api_path [, %params] )
Send request to Zussar API.
Also, this method has supported a fetch like 'Auto-Pager'.
=over 4
=item * $api_path = Path of request to Zussar API. Currently available: "event" or "event/user".
=item * %params = Query parameter.
=back
About the query, please see: http://www.zusaar.com/doc/api.html
=head3 About the fetch like 'AutoPager'
You can fetch all search results, by such as this code:
# Request event
$zussar->fetch( 'event' );
# Print each events title
while ( my $event = $zussar->next ){
print $event->title . "\n";
}
In the case of default, you can fetch max 10 items by single request to Zussar API.
However, this module is able to fetch all results by repeat request, automatically.
Also, you can disable this function, by specifying an option(disable_nextpage_fetch => 1) when call a constructor:
my $zussar = WebService::Zussar->new(disable_nextpage_fetch => 1);
# Request event
$zussar->fetch( 'event' );
# Print each events title
while ( my $event = $zussar->next ){
print $event->title . "\n";
}
In this case, you can fetch max 10 items.
But also, you can fetch more items by causing a 'fetch' method again with 'start' parameter:
# Request the event of the remaining again
$zussar->fetch( 'event', start => 10 ); # Fetch continue after 10th items.
=head2 next
Get a next item, from the fetched items in instance.
=head2 prev
Get a previous item, from the fetched items in instance.
=head2 iter
set or get a position of iterator.
=head1 SEE ALSO
L - Your feedback is highly appreciated.
L
L
L
L - https://github.com/ytnobody/WebService-ATND/
(Maybe you can use this library with an almost similar code.)
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2013, Masanori Ohgita (http://ohgita.info/).
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
I wrote this library with referred to the library that was written by L. Thank you.
Thanks, Perl Mongers & CPAN authors.