=head1 NAME

WebService::Connpass - connpass API (v1) wrapper module for perl5

=head1 SYNOPSIS

  use WebService::Connpass;
  
  my $connpass = WebService::Connpass->new( encoding => 'utf8' );
  
  # Request event
  $connpass->fetch( 'event', keyword => 'perl' );
  
  # Print each events information
  while ( my $event = $connpass->next ){
    # Title and Event ID
    print $event->title . " (" . $event->event_id . ")";
    # Date (started_at)
    print " - ".$event->started if $event->started;
    print "\n";
  }

=head1 INSTALLATION (from GitHub)

  $ git clone git://github.com/mugifly/p5-WebService-Connpass.git
  $ cpanm ./p5-WebService-Connpass

=head1 METHODS

=head2 new ( [%params] )

Create an instance of WebService::Connpass.

%params = (optional) LWP::UserAgent options, and encoding (example: encoding => 'utf8').

=head2 fetch ( $api_path [, %params] )

Send request to Connpass API.
Also, this method has supported a fetch like 'Auto-Pager'.

=over 4

=item * $api_path = Path of request to Connpass API. Currently available: "event" only.

=item * %params = Query parameter.

=back

About the query, please see: http://connpass.com/about/api/

=head3 About the fetch like 'AutoPager' 

You can fetch all search results, by such as this code:

  # Request event
  $connpass->fetch( 'event' );
  
  # Print each events title
  while ( my $event = $connpass->next ){
        print $event->title . "\n";
  }

In the case of default, you can fetch max 10 items by single request to Connpass 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 $connpass = WebService::Connpass->new(disable_nextpage_fetch => 1);

  # Request event
  $connpass->fetch( 'event' );
  
  # Print each events title
  while ( my $event = $connpass->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
  $connpass->fetch( 'event', start => 10 ); # Fetch continue after 10th items.

=head2 next

Get a next item, from the fetched items in instance.

The item that you got is an object.

You can use the getter-methods (same as a API response fields name, such as: 'title', 'event_id', 'catch', etc...) 

 my $event = $conpass->next; # Get a next one item
 print $event->title . "\n"; # Output a 'title' (included in this item)

In addition, you can also use a following getter-methods : 'started', 'ended', 'updated'.
So, these methods return the each object as the 'DateTime::Format::ISO8601', from 'started_at', 'ended_at' and 'updated_at' field.

=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<https://github.com/mugifly/p5-WebService-Connpass/> - Your feedback is highly appreciated.

L<WebService::Zussar> - https://github.com/mugifly/WebService-Zussar/

L<DateTime::Format::ISO8601>

L<Hash::AsObject>

L<LWP::UserAgent>

=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.

Thanks, Perl Mongers & CPAN authors. 
