Pithub-0.01042/0000775000175000017500000000000015014062322011534 5ustar olafolafPithub-0.01042/perlcriticrc0000644000175000017500000000463415014062322014151 0ustar olafolafseverity = 3 verbose = 11 theme = core + pbp + bugs + maintenance + cosmetic + complexity + security + tests + moose exclude = Subroutines::ProhibitCallsToUndeclaredSubs [BuiltinFunctions::ProhibitStringySplit] severity = 3 [CodeLayout::RequireTrailingCommas] severity = 3 [ControlStructures::ProhibitCStyleForLoops] severity = 3 [InputOutput::RequireCheckedSyscalls] functions = :builtins exclude_functions = sleep severity = 3 [Moose::RequireCleanNamespace] modules = Moose Moose::Role MooseX::Role::Parameterized Moose::Util::TypeConstraints cleaners = namespace::autoclean [NamingConventions::Capitalization] package_exemptions = [A-Z]\w+|minFraud file_lexical_variables = [A-Z]\w+|[^A-Z]+ global_variables = :starts_with_upper scoped_lexical_variables = [A-Z]\w+|[^A-Z]+ severity = 3 # Given our code base, leaving this at 5 would be a huge pain [Subroutines::ProhibitManyArgs] max_arguments = 10 [RegularExpressions::ProhibitComplexRegexes] max_characters = 200 [RegularExpressions::ProhibitUnusualDelimiters] severity = 3 [Subroutines::ProhibitUnusedPrivateSubroutines] private_name_regex = _(?!build)\w+ skip_when_using = Moo::Role Moose::Role MooseX::Role::Parameterized Role::Tiny Test::Class::Moose::Role [TestingAndDebugging::ProhibitNoWarnings] allow = redefine [ValuesAndExpressions::ProhibitEmptyQuotes] severity = 3 [ValuesAndExpressions::ProhibitInterpolationOfLiterals] severity = 3 [ValuesAndExpressions::RequireUpperCaseHeredocTerminator] severity = 3 [Variables::ProhibitPackageVars] add_packages = Test::Builder [TestingAndDebugging::RequireUseStrict] equivalent_modules = Moo Test::Most [TestingAndDebugging::RequireUseWarnings] equivalent_modules = Moo Test::Most [-ControlStructures::ProhibitCascadingIfElse] [-ErrorHandling::RequireCarping] [-InputOutput::RequireBriefOpen] [-ValuesAndExpressions::ProhibitConstantPragma] # No need for /xsm everywhere [-RegularExpressions::RequireDotMatchAnything] [-RegularExpressions::RequireExtendedFormatting] [-RegularExpressions::RequireLineBoundaryMatching] [-Subroutines::ProhibitExplicitReturnUndef] # http://stackoverflow.com/questions/2275317/why-does-perlcritic-dislike-using-shift-to-populate-subroutine-variables [-Subroutines::RequireArgUnpacking] [-Subroutines::RequireFinalReturn] # "use v5.14" is more readable than "use 5.014" [-ValuesAndExpressions::ProhibitVersionStrings] # delete gets used all over the place [-Subroutines::ProhibitBuiltinHomonyms] Pithub-0.01042/tidyall.ini0000644000175000017500000000042015014062322013671 0ustar olafolaf[PerlTidy] select = **/*.{pl,pm,t,psgi} ignore = .build/**/* ignore = Pithub-*/**/* ignore = blib/**/* ignore = t/00-* ignore = t/author-* ignore = t/release-* ignore = t/zzz-* ignore = xt/**/* argv = --profile=$ROOT/perltidyrc [SortLines::Naturally] select = .gitignore Pithub-0.01042/t/0000775000175000017500000000000015014062322011777 5ustar olafolafPithub-0.01042/t/test.t0000755000175000017500000000067515014062322013154 0ustar olafolaf#!perl use strict; use warnings; use lib 't/lib'; use Pithub::Test qw( uri_is ); subtest 'Test::Most imported' => sub { pass('Loaded test functions'); cmp_deeply {}, {}, 'Test::Deep imported'; }; subtest 'uri_is' => sub { uri_is 'http://example.com', 'http://example.com', 'same URI'; uri_is 'http://example.com?foo=bar&up=down', 'http://example.com?up=down&foo=bar', 'same query, different order'; }; done_testing; Pithub-0.01042/t/search.t0000755000175000017500000000477115014062322013443 0ustar olafolaf#!perl use strict; use warnings; use Test::Differences qw( eq_or_diff ); use Test::Exception; # throws_ok use Test::More import => [qw( done_testing is isa_ok )]; use lib 't/lib'; use Pithub::Search (); use Pithub::Test::Factory (); # Pithub::Search->email { my $obj = Pithub::Test::Factory->create('Pithub::Search'); isa_ok $obj, 'Pithub::Search'; throws_ok { $obj->email } qr{Missing key in parameters: email}, 'Missing email parameter'; { my $result = $obj->email( email => 'bla' ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/legacy/user/email/bla', 'HTTP path'; } } # Pithub::Search->issues { my $obj = Pithub::Test::Factory->create( 'Pithub::Search', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Search'; throws_ok { $obj->issues } qr{Missing key in parameters: state}, 'Missing state parameter'; throws_ok { $obj->issues( state => 'open' ) } qr{Missing key in parameters: keyword}, 'Missing keyword parameter'; { my $result = $obj->issues( state => 'open', keyword => 'term', ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/legacy/issues/search/foo/bar/open/term', 'HTTP path'; } } # Pithub::Search->repos { my $obj = Pithub::Test::Factory->create('Pithub::Search'); isa_ok $obj, 'Pithub::Search'; throws_ok { $obj->repos } qr{Missing key in parameters: keyword}, 'Missing keyword parameter'; { my $result = $obj->repos( keyword => 'bla', params => { language => 'Perl', start_page => '100' } ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/legacy/repos/search/bla', 'HTTP path'; eq_or_diff { $result->request->uri->query_form }, { language => 'Perl', start_page => '100', per_page => 100 }, 'Query params'; } } # Pithub::Search->users { my $obj = Pithub::Test::Factory->create('Pithub::Search'); isa_ok $obj, 'Pithub::Search'; throws_ok { $obj->users } qr{Missing key in parameters: keyword}, 'Missing keyword parameter'; { my $result = $obj->users( keyword => 'bla' ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/legacy/user/search/bla', 'HTTP path'; } } done_testing; Pithub-0.01042/t/users.t0000755000175000017500000002756615014062322013346 0ustar olafolaf#!perl use strict; use warnings; use JSON::MaybeXS qw( JSON ); use Pithub::Users (); use Test::Differences qw( eq_or_diff ); use Test::Exception; # throws_ok use Test::More import => [qw( done_testing is isa_ok ok )]; use lib 't/lib'; use Pithub::Test::Factory (); # Pithub::Users->get { my $obj = Pithub::Test::Factory->create('Pithub::Users'); $obj->ua->add_response('users/plu.GET'); isa_ok $obj, 'Pithub::Users'; throws_ok { $obj->get } qr{Access token required for: GET /user }, 'Token required'; { my $result = $obj->get( user => 'plu' ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/users/plu', 'HTTP path'; is $result->code, 200, 'HTTP status'; is $result->success, 1, 'Successful'; is $result->content->{bio}, undef, 'Attribute exists: bio'; is $result->content->{blog}, q{}, 'Attribute exists: blog'; is $result->content->{company}, q{}, 'Attribute exists: company'; is $result->content->{created_at}, '2008-10-29T09:03:04Z', 'Attribute exists: created_at'; is $result->content->{email}, 'plu@pqpq.de', 'Attribute exists: email'; is $result->content->{followers}, 54, 'Attribute exists: followers'; is $result->content->{following}, 178, 'Attribute exists: following'; is $result->content->{html_url}, 'https://github.com/plu', 'Attribute exists: html_url'; is $result->content->{id}, 31597, 'Attribute exists: id'; is $result->content->{location}, 'Dubai', 'Attribute exists: location'; is $result->content->{login}, 'plu', 'Attribute exists: login'; is $result->content->{name}, 'Johannes Plunien', 'Attribute exists: name'; is $result->content->{public_gists}, 38, 'Attribute exists: public_gists'; is $result->content->{public_repos}, 17, 'Attribute exists: public_repos'; is $result->content->{type}, 'User', 'Attribute exists: type'; is $result->content->{url}, 'https://api.github.com/users/plu', 'Attribute exists: url'; } { ok $obj->token(123), 'Token set'; my $result = $obj->get; is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/user', 'HTTP path'; } } # Pithub::Users->update { my $obj = Pithub::Test::Factory->create('Pithub::Users'); isa_ok $obj, 'Pithub::Users'; throws_ok { $obj->update } qr{Missing key in parameters: data \(hashref\)}, 'No parameters'; throws_ok { $obj->update( data => { foo => 'bar' } ) } qr{Access token required for: PATCH /user}, 'Token required'; ok $obj->token(123), 'Token set'; my $result = $obj->update( data => { email => 'foo@bar.com' } ); is $result->request->method, 'PATCH', 'HTTP method'; is $result->request->uri->path, '/user', 'HTTP path'; } # Pithub::Users::Emails->add { my $obj = Pithub::Test::Factory->create('Pithub::Users::Emails'); isa_ok $obj, 'Pithub::Users::Emails'; throws_ok { $obj->add( data => 123 ) } qr{Missing key in parameters: data \(arrayref\)}, 'No parameters'; throws_ok { $obj->add( data => ['xxx'] ) } qr{Access token required for: POST /user/emails}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->add( data => ['foo@bar.com'] ); is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/user/emails', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), ['foo@bar.com'], 'HTTP body'; } { my $json = JSON->new; my $result = $obj->add( data => [ 'foo@bar.com', 'bar@foo.com' ] ); is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/user/emails', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), [ 'foo@bar.com', 'bar@foo.com' ], 'HTTP body'; } } # Pithub::Users::Emails->delete { my $obj = Pithub::Test::Factory->create('Pithub::Users::Emails'); isa_ok $obj, 'Pithub::Users::Emails'; throws_ok { $obj->delete( data => 123 ) } qr{Missing key in parameters: data \(arrayref\)}, 'No parameters'; throws_ok { $obj->delete( data => ['xxx'] ) } qr{Access token required for: DELETE /user/emails}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->delete( data => ['foo@bar.com'] ); is $result->request->method, 'DELETE', 'HTTP method'; is $result->request->uri->path, '/user/emails', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), ['foo@bar.com'], 'HTTP body'; } { my $json = JSON->new; my $result = $obj->delete( data => [ 'foo@bar.com', 'bar@foo.com' ] ); is $result->request->method, 'DELETE', 'HTTP method'; is $result->request->uri->path, '/user/emails', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), [ 'foo@bar.com', 'bar@foo.com' ], 'HTTP body'; } } # Pithub::Users::Emails->list { my $obj = Pithub::Test::Factory->create('Pithub::Users::Emails'); isa_ok $obj, 'Pithub::Users::Emails'; throws_ok { $obj->list } qr{Access token required for: GET /user/emails}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->list; is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/user/emails', 'HTTP path'; } } # Pithub::Users::Followers->follow { my $obj = Pithub::Test::Factory->create('Pithub::Users::Followers'); isa_ok $obj, 'Pithub::Users::Followers'; throws_ok { $obj->follow } qr{Missing key in parameters: user}, 'No parameters'; throws_ok { $obj->follow( user => 'plu' ) } qr{Access token required for: PUT /user/following/plu}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->follow( user => 'plu' ); is $result->request->method, 'PUT', 'HTTP method'; is $result->request->uri->path, '/user/following/plu', 'HTTP path'; } } # Pithub::Users::Followers->is_following { my $obj = Pithub::Test::Factory->create('Pithub::Users::Followers'); $obj->ua->add_response('user/following/rafl.GET'); isa_ok $obj, 'Pithub::Users::Followers'; throws_ok { $obj->is_following } qr{Missing key in parameters: user}, 'No parameters'; throws_ok { $obj->is_following( user => 'rafl' ) } qr{Access token required for: GET /user/following/rafl}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->is_following( user => 'rafl' ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/user/following/rafl', 'HTTP path'; is $result->code, 204, 'HTTP status'; is $result->success, 1, 'Successful'; is $result->raw_content, q{}, 'HTTP body is empty'; is $result->count, 0, 'Empty HTTP body return zero'; eq_or_diff $result->content, {}, 'Empty HTTP body generates empty hashref'; } } # Pithub::Users::Followers->list { my $obj = Pithub::Test::Factory->create('Pithub::Users::Followers'); isa_ok $obj, 'Pithub::Users::Followers'; throws_ok { $obj->list } qr{Access token required for: GET /user/followers}, 'Token required'; { my $result = $obj->list( user => 'plu' ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/users/plu/followers', 'HTTP path'; } { ok $obj->token(123), 'Token set'; my $result = $obj->list; is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/user/followers', 'HTTP path'; } } # Pithub::Users::Followers->list_following { my $obj = Pithub::Test::Factory->create('Pithub::Users::Followers'); isa_ok $obj, 'Pithub::Users::Followers'; throws_ok { $obj->list_following } qr{Access token required for: GET /user/following}, 'Token required'; { my $result = $obj->list_following( user => 'plu' ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/users/plu/following', 'HTTP path'; } { ok $obj->token(123), 'Token set'; my $result = $obj->list_following; is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/user/following', 'HTTP path'; } } # Pithub::Users::Followers->unfollow { my $obj = Pithub::Test::Factory->create('Pithub::Users::Followers'); isa_ok $obj, 'Pithub::Users::Followers'; throws_ok { $obj->unfollow } qr{Missing key in parameters: user}, 'No parameters'; throws_ok { $obj->unfollow( user => 'plu' ) } qr{Access token required for: DELETE /user/following/plu}, 'Token required'; { ok $obj->token(123), 'Token set'; my $result = $obj->unfollow( user => 'plu' ); is $result->request->method, 'DELETE', 'HTTP method'; is $result->request->uri->path, '/user/following/plu', 'HTTP path'; } } # Pithub::Users::Keys->create { my $obj = Pithub::Test::Factory->create('Pithub::Users::Keys'); isa_ok $obj, 'Pithub::Users::Keys'; throws_ok { $obj->create } qr{Missing key in parameters: data \(hashref\)}, 'No parameters'; throws_ok { $obj->create( data => { foo => 'bar' } ) } qr{Access token required for: POST /user/keys}, 'Token required'; ok $obj->token(123), 'Token set'; my $result = $obj->create( data => { title => 'plu@localhost', key => 'ssh-rsa AAA...' } ); is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/user/keys', 'HTTP path'; } # Pithub::Users::Keys->delete { my $obj = Pithub::Test::Factory->create('Pithub::Users::Keys'); isa_ok $obj, 'Pithub::Users::Keys'; throws_ok { $obj->delete } qr{Missing key in parameters: key_id}, 'Token required'; throws_ok { $obj->delete( key_id => 123 ) } qr{Access token required for: DELETE /user/keys/123}, 'Token required'; { ok $obj->token(123), 'Token set'; my $result = $obj->delete( key_id => 123 ); is $result->request->method, 'DELETE', 'HTTP method'; is $result->request->uri->path, '/user/keys/123', 'HTTP path'; } } # Pithub::Users::Keys->get { my $obj = Pithub::Test::Factory->create('Pithub::Users::Keys'); isa_ok $obj, 'Pithub::Users::Keys'; throws_ok { $obj->get } qr{Missing key in parameters: key_id}, 'Token required'; throws_ok { $obj->get( key_id => 123 ) } qr{Access token required for: GET /user/keys/123}, 'Token required'; { ok $obj->token(123), 'Token set'; my $result = $obj->get( key_id => 123 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/user/keys/123', 'HTTP path'; } } # Pithub::Users::Keys->list { my $obj = Pithub::Test::Factory->create('Pithub::Users::Keys'); isa_ok $obj, 'Pithub::Users::Keys'; throws_ok { $obj->list } qr{Access token required for: GET /user/keys}, 'Token required'; { ok $obj->token(123), 'Token set'; my $result = $obj->list; is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/user/keys', 'HTTP path'; } } done_testing; Pithub-0.01042/t/issues.t0000644000175000017500000006300715014062322013503 0ustar olafolaf#!perl use strict; use warnings; use JSON::MaybeXS qw( JSON ); use Test::Most import => [qw( done_testing eq_or_diff is isa_ok ok throws_ok use_ok )]; use lib 't/lib'; use Pithub::Test::Factory (); BEGIN { use_ok('Pithub::Issues'); use_ok('Pithub::Issues::Assignees'); use_ok('Pithub::Issues::Comments'); use_ok('Pithub::Issues::Events'); use_ok('Pithub::Issues::Labels'); use_ok('Pithub::Issues::Milestones'); } # Pithub::Issues->create { my $obj = Pithub::Test::Factory->create( 'Pithub::Issues', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Issues'; throws_ok { $obj->create } qr{Missing key in parameters: data \(hashref\)}, 'No parameters'; throws_ok { $obj->create( data => 5 ) } qr{Missing key in parameters: data \(hashref\)}, 'Wrong data parameter'; throws_ok { $obj->create( data => { foo => 123 } ); } qr{Access token required for: POST /repos/foo/bar/issues}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->create( data => { assignee => 'octocat', body => q{I'm having a problem with this.}, labels => [ 'Label1', 'Label2' ], milestone => 1, title => 'Found a bug' } ); is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/issues', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'body' => q{I'm having a problem with this.}, 'assignee' => 'octocat', 'milestone' => 1, 'title' => 'Found a bug', 'labels' => [ 'Label1', 'Label2' ] }, 'HTTP body'; } } # Pithub::Issues->get { my $obj = Pithub::Test::Factory->create( 'Pithub::Issues', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Issues'; throws_ok { $obj->get } qr{Missing key in parameters: issue_id}, 'No parameters'; { my $result = $obj->get( issue_id => 123 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/issues/123', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Issues->list { { my $obj = Pithub::Test::Factory->create( 'Pithub::Issues', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Issues'; my $result = $obj->list; is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/issues', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; is $result->prev_page_uri, undef, 'No prev link header set'; } { my $obj = Pithub::Test::Factory->create('Pithub::Issues'); isa_ok $obj, 'Pithub::Issues'; throws_ok { $obj->list; } qr{Access token required for: GET /issues}, 'Token required'; ok $obj->token(123), 'Token set'; my $result = $obj->list; is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/issues', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Issues->update { my $obj = Pithub::Test::Factory->create( 'Pithub::Issues', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Issues'; throws_ok { $obj->update } qr{Missing key in parameters: issue_id}, 'No parameters'; throws_ok { $obj->update( issue_id => 123 ) } qr{Missing key in parameters: data \(hashref\)}, 'No parameters'; throws_ok { $obj->update( issue_id => 123, data => 5 ) } qr{Missing key in parameters: data \(hashref\)}, 'Wrong data parameter'; throws_ok { $obj->update( issue_id => 123, data => { foo => 123 } ); } qr{Access token required for: PATCH /repos/foo/bar/issues/123}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->update( issue_id => 123, data => { assignee => 'octocat', body => q{I'm having a problem with this.}, labels => [ 'Label1', 'Label2' ], milestone => 1, state => 'open', title => 'Found a bug' } ); is $result->request->method, 'PATCH', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/issues/123', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'body' => q{I'm having a problem with this.}, 'assignee' => 'octocat', 'milestone' => 1, 'title' => 'Found a bug', 'labels' => [ 'Label1', 'Label2' ], 'state' => 'open' }, 'HTTP body'; } } # Pithub::Issues::Assignees->check { my $obj = Pithub::Test::Factory->create( 'Pithub::Issues::Assignees', user => 'foo', repo => 'bar' ); throws_ok { $obj->check } qr{Missing key in parameters: assignee}, 'No parameters'; isa_ok $obj, 'Pithub::Issues::Assignees'; { my $result = $obj->check( assignee => 'plu' ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/assignees/plu', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Issues::Assignees->list { my $obj = Pithub::Test::Factory->create( 'Pithub::Issues::Assignees', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Issues::Assignees'; { my $result = $obj->list; is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/assignees', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Issues::Comments->create { my $obj = Pithub::Test::Factory->create( 'Pithub::Issues::Comments', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Issues::Comments'; throws_ok { $obj->create } qr{Missing key in parameters: issue_id}, 'No parameters'; throws_ok { $obj->create( issue_id => 1 ) } qr{Missing key in parameters: data \(hashref\)}, 'No data parameter'; throws_ok { $obj->create( issue_id => 1, data => 5 ) } qr{Missing key in parameters: data \(hashref\)}, 'Wrong data parameter'; throws_ok { $obj->create( issue_id => 1, data => { foo => 123 } ); } qr{Access token required for: POST /repos/foo/bar/issues/1/comments\s+}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->create( issue_id => 123, data => { body => 'comment' } ); is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/issues/123/comments', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'body' => 'comment' }, 'HTTP body'; } } # Pithub::Issues::Comments->delete { my $obj = Pithub::Test::Factory->create( 'Pithub::Issues::Comments', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Issues::Comments'; throws_ok { $obj->delete } qr{Missing key in parameters: comment_id}, 'No parameters'; throws_ok { $obj->delete( comment_id => 123 ); } qr{DELETE /repos/foo/bar/issues/comments/123\s+}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->delete( comment_id => 123, ); is $result->request->method, 'DELETE', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/issues/comments/123', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Issues::Comments->get { my $obj = Pithub::Test::Factory->create( 'Pithub::Issues::Comments', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Issues::Comments'; throws_ok { $obj->get } qr{Missing key in parameters: comment_id}, 'No parameters'; { my $result = $obj->get( comment_id => 123, ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/issues/comments/123', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Issues::Comments->list { my $obj = Pithub::Test::Factory->create( 'Pithub::Issues::Comments', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Issues::Comments'; throws_ok { $obj->list } qr{Missing key in parameters: issue_id}, 'No parameters'; { my $result = $obj->list( issue_id => 123, ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/issues/123/comments', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Issues::Comments->update { my $obj = Pithub::Test::Factory->create( 'Pithub::Issues::Comments', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Issues::Comments'; throws_ok { $obj->update } qr{Missing key in parameters: comment_id}, 'No parameters'; throws_ok { $obj->update( comment_id => 1 ) } qr{Missing key in parameters: data \(hashref\)}, 'No data parameter'; throws_ok { $obj->update( comment_id => 1, data => 5 ) } qr{Missing key in parameters: data \(hashref\)}, 'Wrong data parameter'; throws_ok { $obj->update( comment_id => 1, data => { foo => 123 } ); } qr{PATCH /repos/foo/bar/issues/comments/1\s+}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->update( comment_id => 123, data => { body => 'comment' } ); is $result->request->method, 'PATCH', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/issues/comments/123', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'body' => 'comment' }, 'HTTP body'; } } # Pithub::Issues::Events->get { my $obj = Pithub::Test::Factory->create( 'Pithub::Issues::Events', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Issues::Events'; throws_ok { $obj->get } qr{Missing key in parameters: event_id}, 'No parameters'; { my $result = $obj->get( event_id => 123, ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/issues/events/123', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Issues::Events->list { my $obj = Pithub::Test::Factory->create( 'Pithub::Issues::Events', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Issues::Events'; { my $result = $obj->list; is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/issues/events', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } { my $result = $obj->list( issue_id => 123, ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/issues/123/events', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Issues::Labels->add { my $obj = Pithub::Test::Factory->create( 'Pithub::Issues::Labels', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Issues::Labels'; throws_ok { $obj->add } qr{Missing key in parameters: issue_id}, 'No parameters'; throws_ok { $obj->add( issue_id => 1 ) } qr{Missing key in parameters: data \(arrayref\)}, 'No data parameter'; throws_ok { $obj->add( issue_id => 1, data => 5 ) } qr{Missing key in parameters: data \(arrayref\)}, 'Wrong data parameter'; throws_ok { $obj->add( issue_id => 123, data => [qw(label1 label2)] ); } qr{Access token required for: POST /repos/foo/bar/issues/123/labels\s+}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->add( issue_id => 123, data => [qw(label1 label2)], ); is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/issues/123/labels', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), [ 'label1', 'label2' ], 'HTTP body'; } } # Pithub::Issues::Labels->create { my $obj = Pithub::Test::Factory->create( 'Pithub::Issues::Labels', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Issues::Labels'; throws_ok { $obj->create } qr{Missing key in parameters: data \(hashref\)}, 'No parameters'; throws_ok { $obj->create( data => 5 ) } qr{Missing key in parameters: data \(hashref\)}, 'Wrong data parameter'; throws_ok { $obj->create( data => { name => 'foo' } ); } qr{Access token required for: POST /repos/foo/bar/labels\s+}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->create( data => { name => 'label1', color => 'FFFFFF', } ); is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/labels', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'color' => 'FFFFFF', 'name' => 'label1' }, 'HTTP body'; } } # Pithub::Issues::Labels->delete { my $obj = Pithub::Test::Factory->create( 'Pithub::Issues::Labels', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Issues::Labels'; throws_ok { $obj->delete } qr{Missing key in parameters: label}, 'No parameters'; throws_ok { $obj->delete( label => 123 ); } qr{Access token required for: DELETE /repos/foo/bar/labels/123\s+}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->delete( label => 123 ); is $result->request->method, 'DELETE', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/labels/123', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Issues::Labels->get { my $obj = Pithub::Test::Factory->create( 'Pithub::Issues::Labels', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Issues::Labels'; throws_ok { $obj->get } qr{Missing key in parameters: label}, 'No parameters'; { my $result = $obj->get( label => 'bug' ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/labels/bug', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Issues::Labels->list { my $obj = Pithub::Test::Factory->create( 'Pithub::Issues::Labels', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Issues::Labels'; { my $result = $obj->list; is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/labels', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } { my $result = $obj->list( issue_id => 123 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/issues/123/labels', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } { my $result = $obj->list( milestone_id => 123 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/milestones/123/labels', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Issues::Labels->remove { my $obj = Pithub::Test::Factory->create( 'Pithub::Issues::Labels', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Issues::Labels'; throws_ok { $obj->remove } qr{Missing key in parameters: issue_id}, 'No parameters'; throws_ok { $obj->remove( issue_id => 123 ); } qr{Access token required for: DELETE /repos/foo/bar/issues/123/labels\s+}, 'Token required'; throws_ok { $obj->remove( issue_id => 123, label => 456 ); } qr{Access token required for: DELETE /repos/foo/bar/issues/123/labels/456\s+}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->remove( issue_id => 123 ); is $result->request->method, 'DELETE', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/issues/123/labels', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } { my $result = $obj->remove( issue_id => 123, label => 456 ); is $result->request->method, 'DELETE', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/issues/123/labels/456', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Issues::Labels->replace { my $obj = Pithub::Test::Factory->create( 'Pithub::Issues::Labels', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Issues::Labels'; throws_ok { $obj->replace } qr{Missing key in parameters: issue_id}, 'No parameters'; throws_ok { $obj->replace( issue_id => 1 ) } qr{Missing key in parameters: data \(arrayref\)}, 'No data parameter'; throws_ok { $obj->replace( issue_id => 1, data => 5 ) } qr{Missing key in parameters: data \(arrayref\)}, 'Wrong data parameter'; throws_ok { $obj->replace( issue_id => 123, data => [qw(label1 label2)] ); } qr{Access token required for: PUT /repos/foo/bar/issues/123/labels\s+}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->replace( issue_id => 123, data => [qw(label1 label2)], ); is $result->request->method, 'PUT', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/issues/123/labels', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), [ 'label1', 'label2' ], 'HTTP body'; } } # Pithub::Issues::Labels->update { my $obj = Pithub::Test::Factory->create( 'Pithub::Issues::Labels', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Issues::Labels'; throws_ok { $obj->update } qr{Missing key in parameters: label}, 'No parameters'; throws_ok { $obj->update( label => 123, data => 5 ) } qr{Missing key in parameters: data \(hashref\)}, 'Wrong data parameter'; throws_ok { $obj->update( label => 123, data => { name => 'foo' } ); } qr{Access token required for: PATCH /repos/foo/bar/labels/123\s+}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->update( label => 123, data => { name => 'label2', color => 'FF0000', } ); is $result->request->method, 'PATCH', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/labels/123', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'color' => 'FF0000', 'name' => 'label2' }, 'HTTP body'; } } # Pithub::Issues::Milestones->create { my $obj = Pithub::Test::Factory->create( 'Pithub::Issues::Milestones', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Issues::Milestones'; throws_ok { $obj->create } qr{Missing key in parameters: data \(hashref\)}, 'No parameters'; throws_ok { $obj->create( data => 5 ) } qr{Missing key in parameters: data \(hashref\)}, 'Wrong data parameter'; throws_ok { $obj->create( data => { name => 'foo' } ); } qr{Access token required for: POST /repos/foo/bar/milestones\s+}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->create( data => { description => 'String', due_on => 'Time', state => 'open or closed', title => 'String' } ); is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/milestones', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'title' => 'String', 'due_on' => 'Time', 'description' => 'String', 'state' => 'open or closed' }, 'HTTP body'; } } # Pithub::Issues::Milestones->delete { my $obj = Pithub::Test::Factory->create( 'Pithub::Issues::Milestones', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Issues::Milestones'; throws_ok { $obj->delete } qr{Missing key in parameters: milestone_id}, 'No parameters'; throws_ok { $obj->delete( milestone_id => 123 ); } qr{Access token required for: DELETE /repos/foo/bar/milestones/123\s+}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->delete( milestone_id => 123 ); is $result->request->method, 'DELETE', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/milestones/123', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Issues::Milestones->get { my $obj = Pithub::Test::Factory->create( 'Pithub::Issues::Milestones', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Issues::Milestones'; throws_ok { $obj->get } qr{Missing key in parameters: milestone_id}, 'No parameters'; { my $result = $obj->get( milestone_id => 123 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/milestones/123', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Issues::Milestones->list { my $obj = Pithub::Test::Factory->create( 'Pithub::Issues::Milestones', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Issues::Milestones'; { my $result = $obj->list; is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/milestones', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Issues::Milestones->update { my $obj = Pithub::Test::Factory->create( 'Pithub::Issues::Milestones', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Issues::Milestones'; throws_ok { $obj->update } qr{Missing key in parameters: milestone_id}, 'No parameters'; throws_ok { $obj->update( milestone_id => 123, data => 5 ) } qr{Missing key in parameters: data \(hashref\)}, 'Wrong data parameter'; throws_ok { $obj->update( milestone_id => 123, data => { name => 'foo' } ); } qr{Access token required for: PATCH /repos/foo/bar/milestones/123\s+}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->update( milestone_id => 123, data => { description => 'String', due_on => 'Time', state => 'open or closed', title => 'String' } ); is $result->request->method, 'PATCH', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/milestones/123', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'title' => 'String', 'due_on' => 'Time', 'description' => 'String', 'state' => 'open or closed' }, 'HTTP body'; } } done_testing; Pithub-0.01042/t/live/0000775000175000017500000000000015014062322012736 5ustar olafolafPithub-0.01042/t/live/users.t0000644000175000017500000001344115014062322014265 0ustar olafolafuse FindBin (); use lib "$FindBin::Bin/../lib"; use Pithub::Test::Factory (); use Test::Most import => [qw( done_testing is isnt ok skip use_ok )]; BEGIN { use_ok('Pithub'); } # These tests may break very easily because data on Github can and will change, of course. # And they also might fail once the ratelimit has been reached. SKIP: { skip 'Set PITHUB_TEST_LIVE_DATA to true to run these tests', 1 unless $ENV{PITHUB_TEST_LIVE_DATA}; my $p = Pithub->new; # Pithub::Users->get { my $result = $p->users->get( user => 'plu' ); is $result->success, 1, 'Pithub::Users->get successful'; is $result->content->{id}, '31597', 'Pithub::Users->get: Attribute id'; is $result->content->{login}, 'plu', 'Pithub::Users->get: Attribute login'; is $result->content->{name}, 'Johannes Plunien', 'Pithub::Users->get: Attribute name'; } } # Following tests require a token and should only be run on a test # account since they will create a lot of activity in that account. SKIP: { skip 'PITHUB_TEST_TOKEN required to run this test - DO NOT DO THIS UNLESS YOU KNOW WHAT YOU ARE DOING', 1 unless $ENV{PITHUB_TEST_TOKEN}; my $org = Pithub::Test::Factory->test_account->{org}; my $org_repo = Pithub::Test::Factory->test_account->{org_repo}; my $repo = Pithub::Test::Factory->test_account->{repo}; my $user = Pithub::Test::Factory->test_account->{user}; my $p = Pithub->new( user => $user, repo => $repo, token => $ENV{PITHUB_TEST_TOKEN} ); { # Pithub::Users::Keys->create my $key_id = $p->users->keys->create( data => { title => 'someone@somewhere', key => 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCuK40Ng6C0NfMrrVuE+6mkUyj90JcvPdwrqFi/tv4g5Ncny5FCkEMATmYA0NtByAS+2p+jwClbVI9dav077+DxHJbwDwcecXXqjUA4gnZM+03kksPbTjfuYql9nC8PdhgZ3kiftop7AVZZnhSKF5stLwa0hkCZkXVeaajQzaG1pCnJJNOcnaRPcuEkTToTnkw8y3Q3fpuMmRjz3NCayh/gJgcj/EtrextqnNpDT4j4r3IeCGvCMEtmUvepKG6sTdnh1EDX5U163is9Qnwfdo3D7CVUh2rhJ8pM6RnAbqbzWqQ+gbhWoXQ7T1Qdq1GXKN7lMMbjz9M7cPK3Vs0p5yl1', } )->content->{id}; # Pithub::Users::Keys->get is $p->users->keys->get( key_id => $key_id )->content->{title}, 'someone@somewhere', 'Pithub::Users::Keys->get title attribute'; # Pithub::Users::Keys->list is $p->users->keys->list->first->{title}, 'someone@somewhere', 'Pithub::Users::Keys->list title attribute'; # Pithub::Users::Keys->delete ok $p->users->keys->delete( key_id => $key_id )->success, 'Pithub::Users::Keys->delete successful'; # Pithub::Users::Keys->get ok !$p->users->keys->get( key_id => $key_id )->success, 'Pithub::Users::Keys->get not successful after delete'; } { # Pithub::Users::Emails->add ok $p->users->emails->add( data => ['johannes@plunien.name'] ) ->success, 'Pithub::Users::Emails->add successful'; # Pithub::Users::Emails->list is $p->users->emails->list->content->[0]->{email}, 'johannes@plunien.name', 'Pithub::Users::Emails->list recently added email address'; # Pithub::Users::Emails->delete ok $p->users->emails->delete( data => ['johannes@plunien.name'] ) ->success, 'Pithub::Users::Emails->delete successful'; # Pithub::Users::Emails->list isnt $p->users->emails->list->content->[-1], 'johannes@plunien.name', 'Pithub::Users::Emails->list after delete'; } { # Pithub::Users->update ok $p->users->update( data => { location => "somewhere $$" } ) ->success, 'Pithub::Users->update successful'; # Pithub::Users->update is $p->users->get->content->{location}, "somewhere $$", 'Pithub::Users->get location successful after update'; } { # Pithub::Users::Followers->list ok $p->users->followers->list( user => 'plu' )->count >= 30, 'Pithub::Users::Followers->list count'; # Pithub::Users::Followers->list_following ok $p->users->followers->list_following( user => 'plu' )->count >= 30, 'Pithub::Users::Followers->list_following count'; # Pithub::Users::Followers->list ok $p->users->followers->list->count >= 0, 'Pithub::Users::Followers->list count authenticated user'; # Pithub::Users::Followers->list_following is $p->users->followers->list_following->count, 0, 'Pithub::Users::Followers->list_following count authenticated user'; # Pithub::Users::Followers->is_following ok !$p->users->followers->is_following( user => 'plu' )->success, 'Pithub::Users::Followers->is_following not successful yet'; # Pithub::Users::Followers->follow ok $p->users->followers->follow( user => 'plu' )->success, 'Pithub::Users::Followers->follow successful'; # Pithub::Users::Followers->list_following is $p->users->followers->list_following->count, 1, 'Pithub::Users::Followers->list_following authenticated user now following one user'; # Pithub::Users::Followers->is_following ok $p->users->followers->is_following( user => 'plu' )->success, 'Pithub::Users::Followers->is_following successful now'; # Pithub::Users::Followers->unfollow ok $p->users->followers->unfollow( user => 'plu' )->success, 'Pithub::Users::Followers->unfollow successful'; # Pithub::Users::Followers->is_following ok !$p->users->followers->is_following( user => 'plu' )->success, 'Pithub::Users::Followers->is_following not successful anymore'; } } done_testing; Pithub-0.01042/t/live/issues.t0000644000175000017500000002441215014062322014437 0ustar olafolafuse FindBin (); use lib "$FindBin::Bin/../lib"; use Pithub::Test::Factory (); use Test::Most import => [qw( done_testing eq_or_diff is like ok skip use_ok )]; BEGIN { use_ok('Pithub'); } # These tests may break very easily because data on Github can and will change, of course. # And they also might fail once the ratelimit has been reached. SKIP: { skip 'Set PITHUB_TEST_LIVE_DATA to true to run these tests', 1 unless $ENV{PITHUB_TEST_LIVE_DATA}; my $p = Pithub->new; # Pithub::Issues::Labels->list { my $result = $p->issues->labels->list( user => 'plu', repo => 'Pithub' ); is $result->success, 1, 'Pithub::Issues::Labels->list successful'; my @labels = splice @{ $result->content }, 0, 2; eq_or_diff \@labels, [ { 'color' => 'e10c02', 'name' => 'Bug', 'url' => 'https://api.github.com/repos/plu/Pithub/labels/Bug' }, { 'color' => '02e10c', 'name' => 'Feature', 'url' => 'https://api.github.com/repos/plu/Pithub/labels/Feature' } ], 'Pithub::Issues::Labels->list content'; } # Pithub::Issues::Labels->get { my $result = $p->issues->labels->get( user => 'plu', repo => 'Pithub', label => 'Bug' ); is $result->success, 1, 'Pithub::Issues::Labels->get successful'; eq_or_diff $result->content, { 'color' => 'e10c02', 'name' => 'Bug', 'url' => 'https://api.github.com/repos/plu/Pithub/labels/Bug' }, 'Pithub::Issues::Labels->get content'; } # Pithub::Issues::Milestones->get { my $result = $p->issues->milestones->get( user => 'plu', repo => 'Pithub', milestone_id => 1 ); is $result->success, 1, 'Pithub::Issues::Milestones->get successful'; is $result->content->{creator}{login}, 'plu', 'Pithub::Issues::Milestones->get: Attribute creator.login'; } # Pithub::Issues::Milestones->list { my $result = $p->issues->milestones->list( user => 'plu', repo => 'Pithub' ); is $result->success, 1, 'Pithub::Issues::Milestones->list successful'; ok $result->count > 0, 'Pithub::Issues::Milestones->list has some rows'; is $result->content->[0]{creator}{login}, 'plu', 'Pithub::Issues::Milestones->list: Attribute creator.login'; } } # Following tests require a token and should only be run on a test # account since they will create a lot of activity in that account. SKIP: { skip 'PITHUB_TEST_TOKEN required to run this test - DO NOT DO THIS UNLESS YOU KNOW WHAT YOU ARE DOING', 1 unless $ENV{PITHUB_TEST_TOKEN}; my $org = Pithub::Test::Factory->test_account->{org}; my $org_repo = Pithub::Test::Factory->test_account->{org_repo}; my $repo = Pithub::Test::Factory->test_account->{repo}; my $user = Pithub::Test::Factory->test_account->{user}; my $p = Pithub->new( user => $user, repo => $repo, token => $ENV{PITHUB_TEST_TOKEN} ); { # Pithub::Issues->create my $issue_id = $p->issues->create( data => { body => 'Your software breaks if you do this and that', title => 'Found a bug', } )->content->{number}; # Pithub::Issues->get is $p->issues->get( issue_id => $issue_id )->content->{title}, 'Found a bug', 'Pithub::Issues->get title attribute'; # Pithub::Issues->update ok $p->issues->update( issue_id => $issue_id, data => { body => 'Your software breaks if you do this and that', title => 'Found a bug [UPDATED]', } )->success, 'Pithub::Issues->update successful'; # Pithub::Issues->get is $p->issues->get( issue_id => $issue_id )->content->{title}, 'Found a bug [UPDATED]', 'Pithub::Issues->get updated title attribute'; # Pithub::Issues->list is $p->issues->list->first->{number}, $issue_id, 'Pithub::Issues->list first item'; # Pithub::Issues::Comments->create my $comment_id = $p->issues->comments->create( issue_id => $issue_id, data => { body => 'some comment' } )->content->{id}; # Pithub::Issues::Comments->get is $p->issues->comments->get( comment_id => $comment_id ) ->content->{body}, 'some comment', 'Pithub::Issues::Comments->get body attribute'; # Pithub::Issues::Comments->list is $p->issues->comments->list( issue_id => $issue_id )->first->{body}, 'some comment', 'Pithub::Issues::Comments->list updated attribute'; # Pithub::Issues::Comments->update ok $p->issues->comments->update( comment_id => $comment_id, data => { body => 'some UPDATED comment' } )->success, 'Pithub::Issues::Comments->update successful'; # Pithub::Issues::Comments->get is $p->issues->comments->get( comment_id => $comment_id ) ->content->{body}, 'some UPDATED comment', 'Pithub::Issues::Comments->get updated body attribute'; # Pithub::Issues::Comments->delete ok $p->issues->comments->delete( comment_id => $comment_id )->success, 'Pithub::Issues::Comments->delete successful'; # Pithub::Issues::Comments->get ok !$p->issues->comments->get( comment_id => $comment_id )->success, 'Pithub::Issues::Comments->get not successful after delete'; # Pithub::Issues::Labels->create ok $p->issues->labels->create( data => { color => 'FF0000', name => "label #$_", } )->success, 'Pithub::Issues::Labels->create successful' for 1 .. 2; # Pithub::Issues::Labels->get is $p->issues->labels->get( label => 'label #1' )->content->{color}, 'FF0000', 'Pithub::Issues::Labels->get new label'; # Pithub::Issues::Labels->update ok $p->issues->labels->update( label => 'label #1', data => { color => 'C0FF33' } )->success, 'Pithub::Issues::Labels->update successful'; # Pithub::Issues::Labels->get is $p->issues->labels->get( label => 'label #1' )->content->{color}, 'C0FF33', 'Pithub::Issues::Labels->get updated label'; # Pithub::Issues::Labels->list is $p->issues->labels->list( issue_id => $issue_id )->count, 0, 'Pithub::Issues::Labels->list no labels attached to the issue yet'; # Pithub::Issues::Labels->add ok $p->issues->labels->add( issue_id => $issue_id, data => [ 'label #1', 'label #2' ] )->success, 'Pithub::Issues::Labels->add successful'; # Pithub::Issues::Labels->list is $p->issues->labels->list( issue_id => $issue_id )->count, 2, 'Pithub::Issues::Labels->list one label attached to the issue'; # Pithub::Issues::Labels->remove ok $p->issues->labels->remove( issue_id => $issue_id, label => 'label #1' )->success, 'Pithub::Issues::Labels->remove successful'; # Pithub::Issues::Labels->list is $p->issues->labels->list( issue_id => $issue_id )->count, 1, 'Pithub::Issues::Labels->list label removed again'; # Pithub::Issues::Labels->replace ok $p->issues->labels->replace( issue_id => $issue_id, data => ['label #2'] )->success, 'Pithub::Issues::Labels->replace successful'; # Pithub::Issues::Labels->list is $p->issues->labels->list( issue_id => $issue_id )->count, 1, 'Pithub::Issues::Labels->list one label'; is $p->issues->labels->list( issue_id => $issue_id )->first->{name}, 'label #2', 'Pithub::Issues::Labels->list label got replaced'; # Pithub::Issues::Labels->remove ok $p->issues->labels->remove( issue_id => $issue_id ), 'Pithub::Issues::Labels->remove all labels'; # Pithub::Issues::Labels->list is $p->issues->labels->list( issue_id => $issue_id )->count, 0, 'Pithub::Issues::Labels->list no labels left'; # Pithub::Issues::Labels->delete ok $p->issues->labels->delete( label => "label #$_" )->success, 'Pithub::Issues::Labels->delete successful' for 1 .. 2; # Pithub::Issues::Labels->get ok !$p->issues->labels->get( label => "label #$_" )->success, 'Pithub::Issues::Labels->get not successful after delete' for 1 .. 2; # Pithub::Issues::Milestones->create my $milestone_id = $p->issues->milestones->create( data => { title => 'some milestone' } )->content->{number}; like $milestone_id, qr{^\d+$}, 'Pithub::Issues::Milestones->create returned a milestone number'; # Pithub::Issues::Milestones->get is $p->issues->milestones->get( milestone_id => $milestone_id ) ->content->{title}, 'some milestone', 'Pithub::Issues::Milestones->get new milestone'; # Pithub::Issues::Milestones->update ok $p->issues->milestones->update( milestone_id => $milestone_id, data => { title => 'updated' } )->success, 'Pithub::Issues::Milestones->update successful'; # Pithub::Issues::Milestones->get is $p->issues->milestones->get( milestone_id => $milestone_id ) ->content->{title}, 'updated', 'Pithub::Issues::Milestones->get updated title'; # Pithub::Issues::Milestones->delete ok $p->issues->milestones->delete( milestone_id => $milestone_id ) ->success, 'Pithub::Issues::Milestones->delete successful'; # Pithub::Issues::Milestones->get ok !$p->issues->milestones->get( milestone_id => $milestone_id ) ->success, 'Pithub::Issues::Milestones->get not successful after delete'; } } done_testing; Pithub-0.01042/t/live/gists.t0000644000175000017500000001376215014062322014263 0ustar olafolafuse FindBin (); use lib "$FindBin::Bin/../lib"; use Pithub::Test::Factory (); use Test::Most import => [qw( done_testing is like ok skip use_ok )]; BEGIN { use_ok('Pithub'); } # These tests may break very easily because data on Github can and will change, of course. # And they also might fail once the ratelimit has been reached. SKIP: { skip 'Set PITHUB_TEST_LIVE_DATA to true to run these tests', 1 unless $ENV{PITHUB_TEST_LIVE_DATA}; my $p = Pithub->new; # Pithub::Gists->get { my $result = $p->gists->get( gist_id => 1 ); is $result->success, 1, 'Pithub::Gists->get successful'; is $result->content->{created_at}, '2008-07-15T18:17:13Z', 'Pithub::Gists->get created_at'; } # Pithub::Gists->list { my $result = $p->gists->list( public => 1 ); is $result->success, 1, 'Pithub::Gists->list successful'; while ( my $row = $result->next ) { ok $row->{id}, "Pithub::Gists->list has id: $row->{id}"; like $row->{url}, qr{https://api.github.com/gists/[a-f\d]+$}, "Pithub::Gists->list has url: $row->{url}"; } } # Pithub::Gists::Comments->list { my $result = $p->gists->comments->list( gist_id => 1 ); is $result->success, 1, 'Pithub::Gists::Comments->list successful'; while ( my $row = $result->next ) { ok $row->{id}, "Pithub::Gists::Comments->list has id: $row->{id}"; like $row->{url}, qr{https://api.github.com/gists/[a-f\d]+/comments/\d+$}, "Pithub::Gists::Comments->list has url: $row->{url}"; } } } # Following tests require a token and should only be run on a test # account since they will create a lot of activity in that account. SKIP: { skip 'PITHUB_TEST_TOKEN required to run this test - DO NOT DO THIS UNLESS YOU KNOW WHAT YOU ARE DOING', 1 unless $ENV{PITHUB_TEST_TOKEN}; my $org = Pithub::Test::Factory->test_account->{org}; my $org_repo = Pithub::Test::Factory->test_account->{org_repo}; my $repo = Pithub::Test::Factory->test_account->{repo}; my $user = Pithub::Test::Factory->test_account->{user}; my $p = Pithub->new( user => $user, repo => $repo, token => $ENV{PITHUB_TEST_TOKEN} ); { # Pithub::Gists->create my $gist_id = $p->gists->create( data => { description => 'the description for this gist', public => 1, files => { 'file1.txt' => { content => 'String file content' } } } )->content->{id}; # Pithub::Gists->is_starred ok !$p->gists->is_starred( gist_id => $gist_id )->success, 'Pithub::Gists->is_starred not successful, gist not starred yet'; # Pithub::Gists->star ok $p->gists->star( gist_id => $gist_id )->success, 'Pithub::Gists->star successful'; # Pithub::Gists->is_starred ok $p->gists->is_starred( gist_id => $gist_id )->success, 'Pithub::Gists->is_starred successful, gist is starred now'; # Pithub::Gists->unstar ok $p->gists->unstar( gist_id => $gist_id )->success, 'Pithub::Gists->unstar successful'; # Pithub::Gists->is_starred ok !$p->gists->is_starred( gist_id => $gist_id )->success, 'Pithub::Gists->is_starred not successful, gist not starred anymore'; # Pithub::Gists->get is $p->gists->get( gist_id => $gist_id )->content->{description}, 'the description for this gist', 'Pithub::Gists->get file content'; # Pithub::Gists->update ok $p->gists->update( gist_id => $gist_id, data => { description => 'the UPDATED description for this gist' } )->success, 'Pithub::Gists->update successful'; # Pithub::Gists->get is $p->gists->get( gist_id => $gist_id )->content->{description}, 'the UPDATED description for this gist', 'Pithub::Gists->get file content'; # Pithub::Gists::Comments->create my $comment_id = $p->gists->comments->create( gist_id => $gist_id, data => { body => 'some gist comment' } )->content->{id}; like $comment_id, qr{^\d+$}, 'Pithub::Gists::Comments->create returned a comment id'; # Pithub::Gists::Comments->get is $p->gists->comments->get( gist_id => $gist_id, comment_id => $comment_id )->content->{body}, 'some gist comment', 'Pithub::Gists::Comments->get body'; # Pithub::Gists::Comments->update ok $p->gists->comments->update( gist_id => $gist_id, comment_id => $comment_id, data => { body => 'some UPDATED gist comment' } )->success, 'Pithub::Gists::Comments->update successful'; # Pithub::Gists::Comments->get is $p->gists->comments->get( gist_id => $gist_id, comment_id => $comment_id )->content->{body}, 'some UPDATED gist comment', 'Pithub::Gists::Comments->get body after update'; # Pithub::Gists::Comments->delete ok $p->gists->comments->delete( gist_id => $gist_id, comment_id => $comment_id )->success, 'Pithub::Gists::Comments->delete successful'; # Pithub::Gists::Comments->get ok !$p->gists->comments->get( gist_id => $gist_id, comment_id => $comment_id )->success, 'Pithub::Gists::Comments->get not successful after delete'; # Pithub::Gists->delete ok $p->gists->delete( gist_id => $gist_id )->success, 'Pithub::Gists->delete successful'; # Pithub::Gists->get ok !$p->gists->get( gist_id => $gist_id )->success, 'Pithub::Gists->get not successful after delete'; } } done_testing; Pithub-0.01042/t/live/cache-lru.t0000755000175000017500000000216515014062322014773 0ustar olafolaf#!perl use strict; use warnings; use Pithub (); use Scalar::Util qw( refaddr ); use Test::Most import => [qw( done_testing isnt plan )]; use Test::Needs qw( Cache::LRU ); plan skip_all => 'Set PITHUB_TEST_LIVE to true to run these tests' unless $ENV{PITHUB_TEST_LIVE}; # This is a test to ensure that switching from Cache::LRU to CHI has not # inadvertently broken something which depends on Pithub. my $p = Pithub->new; my $hash = {}; # Reduce the cache size to just two elements for easier testing $p->set_shared_cache( Cache::LRU->new( size => 2 ) ); # Get two items to fill the cache my $repo_pithub = $p->repos->get( user => 'plu', repo => 'Pithub' ); my $user_plu = $p->users->get( user => 'plu' ); # Get a third to bump $repo_pithub out my $branches = $p->repos->branches( user => 'plu', repo => 'Pithub', per_page => 1, ); # Get $repo_pithub again, it should not be cached. my $repo_pithub2 = $p->repos->get( user => 'plu', repo => 'Pithub' ); isnt( refaddr $repo_pithub->response, refaddr $repo_pithub2->response, 'refaddrs do not match after cache size exceeded' ); done_testing; Pithub-0.01042/t/live/cache.t0000755000175000017500000000325615014062322014175 0ustar olafolaf#!perl use strict; use warnings; use CHI (); use Pithub (); use Scalar::Util qw( refaddr ); use Test::Most import => [qw( done_testing is isnt note plan subtest )]; plan skip_all => 'Set PITHUB_TEST_LIVE to true to run these tests' unless $ENV{PITHUB_TEST_LIVE}; subtest 'cached result' => sub { my $p = Pithub->new; my $result1 = $p->request( method => 'GET', path => '/' ); my $result2 = $p->request( method => 'GET', path => '/' ); is( $result1->etag, $result2->etag, 'etags match' ); is( refaddr $result1->response, refaddr $result2->response, 'refaddr matches' ); }; subtest cache => sub { my $p = Pithub->new; my $hash = {}; # Reduce the cache size to just two elements for easier testing $p->set_shared_cache( CHI->new( datastore => $hash, driver => 'RawMemory', max_size => 2, size => 2, ) ); # Get two items to fill the cache my $repo_pithub = $p->repos->get( user => 'plu', repo => 'Pithub' ); my $user_plu = $p->users->get( user => 'plu' ); # Get a third to bump $repo_pithub out my $branches = $p->repos->branches( user => 'plu', repo => 'Pithub', per_page => 1 ); # Get $repo_pithub again, it should not be cached. my $repo_pithub2 = $p->repos->get( user => 'plu', repo => 'Pithub' ); note @{ [ $repo_pithub->etag ] }; note @{ [ $repo_pithub2->etag ] }; isnt( refaddr $repo_pithub->response, refaddr $repo_pithub2->response, 'refaddrs do not match after cache size exceeded' ); }; done_testing; Pithub-0.01042/t/live/basic.t0000644000175000017500000001311115014062322014177 0ustar olafolaf#!perl use strict; use warnings; use Pithub (); use Test::Differences qw( eq_or_diff ); use Test::More import => [qw( done_testing is like ok skip $TODO )]; SKIP: { skip 'Set PITHUB_TEST_LIVE to true to run these tests', 1 unless $ENV{PITHUB_TEST_LIVE}; my $p = Pithub->new; my $result = $p->request( method => 'GET', path => '/' ); is $result->code, 200, 'HTTP status is 200'; is $result->success, 1, 'Successful'; { local $TODO = 'Not sure why this is failing'; like $result->etag, qr{^"[a-f0-9]+"$}, 'ETag'; } my $base_url = 'https://api.github.com'; eq_or_diff( $result->content, { authorizations_url => "$base_url/authorizations", code_search_url => "$base_url/search/code?q={query}{&page,per_page,sort,order}", commit_search_url => "$base_url/search/commits?q={query}{&page,per_page,sort,order}", current_user_authorizations_html_url => 'https://github.com/settings/connections/applications{/client_id}', current_user_repositories_url => "$base_url/user/repos{?type,page,per_page,sort}", current_user_url => "$base_url/user", emails_url => "$base_url/user/emails", emojis_url => "$base_url/emojis", events_url => "$base_url/events", feeds_url => "$base_url/feeds", followers_url => "$base_url/user/followers", following_url => "$base_url/user/following{/target}", gists_url => "$base_url/gists{/gist_id}", hub_url => "$base_url/hub", issue_search_url => "$base_url/search/issues?q={query}{&page,per_page,sort,order}", issues_url => "$base_url/issues", keys_url => "$base_url/user/keys", label_search_url => "$base_url/search/labels?q={query}&repository_id={repository_id}{&page,per_page}", notifications_url => "$base_url/notifications", organization_repositories_url => "$base_url/orgs/{org}/repos{?type,page,per_page,sort}", organization_teams_url => "$base_url/orgs/{org}/teams", organization_url => "$base_url/orgs/{org}", public_gists_url => "$base_url/gists/public", rate_limit_url => "$base_url/rate_limit", repository_search_url => "$base_url/search/repositories?q={query}{&page,per_page,sort,order}", repository_url => "$base_url/repos/{owner}/{repo}", starred_gists_url => "$base_url/gists/starred", starred_url => "$base_url/user/starred{/owner}{/repo}", topic_search_url => "$base_url/search/topics?q={query}{&page,per_page}", user_organizations_url => "$base_url/user/orgs", user_repositories_url => "$base_url/users/{user}/repos{?type,page,per_page,sort}", user_search_url => "$base_url/search/users?q={query}{&page,per_page,sort,order}", user_url => "$base_url/users/{user}", }, 'Empty response' ); } # These tests may break very easily because data on Github can and will change, of course. # And they also might fail once the ratelimit has been reached. SKIP: { skip 'Set PITHUB_TEST_LIVE_DATA to true to run these tests', 1 unless $ENV{PITHUB_TEST_LIVE_DATA}; my $p = Pithub->new; # Pagination + per_page { my $g = Pithub::Gists->new( per_page => 2 ); my @seen = (); my $test = sub { my ( $row, $seen ) = @_; my $verb = $seen ? 'did' : 'did not'; my $id = $row->{id}; ok $id, "Pithub::Gists->list found gist id ${id}"; is grep( $_ eq $id, @seen ), $seen, "Pithub::Gists->list we ${verb} see id ${id}"; push @seen, $id; }; my $result = $g->list( public => 1 ); is $result->success, 1, 'Pithub::Gists->list successful'; is $result->count, 2, 'The per_page setting was successful'; foreach my $page ( 1 .. 2 ) { while ( my $row = $result->next ) { $test->( $row, 0 ); } $result = $result->next_page unless $page == 2; } # Browse to the last page and see if we can get some gist id's there $result = $result->last_page; while ( my $row = $result->next ) { $test->( $row, 0 ); } # Browse to the previous page and see if we can get some gist id's there $result = $result->prev_page; while ( my $row = $result->next ) { $test->( $row, 0 ); } # Browse to the first page and see if we can get some gist id's there $result = $result->first_page; while ( my $row = $result->next ) { $test->( $row, 1 ); # we saw those gists already! } } } done_testing; # TODO: implement tests for following methods: # Pithub::GitData::References->create # Pithub::GitData::Tags->get # Pithub::GitData::Tags->create # Pithub::Gists->fork # Pithub::Issues::Events->get # Pithub::Issues::Events->list # Pithub::Orgs::Members->delete # Pithub::PullRequests->merge # Pithub::PullRequests::Comments->create # Pithub::PullRequests::Comments->delete # Pithub::PullRequests::Comments->get # Pithub::PullRequests::Comments->list # Pithub::PullRequests::Comments->update # Pithub::Repos->teams Pithub-0.01042/t/live/repos.t0000644000175000017500000004473215014062322014263 0ustar olafolaf#!perl use strict; use warnings; use Pithub (); use Test::Differences qw( eq_or_diff ); use Test::More import => [qw( done_testing is isnt like ok skip subtest )]; use lib 't/lib'; use Pithub::Test::Factory (); # These tests may break very easily because data on Github can and will change, of course. # And they also might fail once the ratelimit has been reached. SKIP: { skip 'Set PITHUB_TEST_LIVE_DATA to true to run these tests', 1 unless $ENV{PITHUB_TEST_LIVE_DATA}; my $p = Pithub->new; # Pithub::Repos->branches { my $result = $p->repos->branches( user => 'plu', repo => 'Pithub' ); is $result->success, 1, 'Pithub::Repos->branches successful'; ok $result->count > 0, 'Pithub::Repos->branches has some rows'; ok $result->content->[0]{name}; like $result->content->[0]{commit}{sha}, qr{^[a-f0-9]+$}; } # Pithub::Repos->contributors { my $result = $p->repos->contributors( user => 'plu', repo => 'Pithub' ); is $result->success, 1, 'Pithub::Repos->contributors successful'; is $result->content->[0]{login}, 'plu', 'Pithub::Repos->contributors: Attribute login' } # Pithub::Repos->get { my $result = $p->repos->get( user => 'plu', repo => 'Pithub' ); is $result->success, 1, 'Pithub::Repos->get successful'; is $result->content->{name}, 'Pithub', 'Pithub::Repos->get: Attribute name'; is $result->content->{owner}{login}, 'plu', 'Pithub::Repos->get: Attribute owner.login'; } subtest 'Pithub::Repos->branch' => sub { my $result = $p->repos->branch( user => 'plu', repo => 'Pithub', branch => 'master' ); ok $result->success; is $result->content->{name}, 'master'; like $result->content->{commit}{sha}, qr{^[a-f0-9]+$}; }; # Pithub::Repos->languages { my $result = $p->repos->languages( user => 'plu', repo => 'Pithub' ); is $result->success, 1, 'Pithub::Repos->languages successful'; like $result->content->{Perl}, qr{^\d+$}, 'Pithub::Repos->languages: Attribute Perl'; } # Pithub::Repos->list { my $result = $p->repos->list( user => 'plu' ); is $result->success, 1, 'Pithub::Repos->list successful'; ok $result->count > 0, 'Pithub::Repos->list has some rows'; while ( my $row = $result->next ) { ok $row->{name}, "Pithub::Repos->list: Attribute name ($row->{name})"; } } # Pithub::Repos->tags { my $result = $p->repos->tags( user => 'plu', repo => 'Pithub' ); is $result->success, 1, 'Pithub::Repos->tags successful'; ok $result->count > 0, 'Pithub::Repos->tags has some rows'; my @sorted = sort { $a->{name} cmp $b->{name} } @{ $result->content }; my @tags = splice @sorted, 0, 2; eq_or_diff \@tags, [ { 'commit' => { 'sha' => '1c5230f42d6d3e376162591f223fc4130d671937', 'url' => 'https://api.github.com/repos/plu/Pithub/commits/1c5230f42d6d3e376162591f223fc4130d671937' }, 'name' => 'v0.01000', 'tarball_url' => 'https://api.github.com/repos/plu/Pithub/tarball/v0.01000', 'zipball_url' => 'https://api.github.com/repos/plu/Pithub/zipball/v0.01000' }, { 'commit' => { 'sha' => '09da9bff13167ca9940ff6540a7e7dcc936ca25e', 'url' => 'https://api.github.com/repos/plu/Pithub/commits/09da9bff13167ca9940ff6540a7e7dcc936ca25e' }, 'name' => 'v0.01001', 'tarball_url' => 'https://api.github.com/repos/plu/Pithub/tarball/v0.01001', 'zipball_url' => 'https://api.github.com/repos/plu/Pithub/zipball/v0.01001' } ], 'Pithub::Repos->tags content'; } # Pithub::Repos::Commits->get { my $result = $p->repos->commits->compare( user => 'plu', repo => 'Pithub', base => 'v0.01008', head => 'master' ); is $result->success, 1, 'Pithub::Repos::Commits->compare successful'; is $result->content->{status}, 'ahead', 'Pithub::Repos::Commits->compare status'; ok $result->content->{total_commits} >= 2, 'Pithub::Repos::Commits->compare total_commits'; } # Pithub::Repos::Commits->get { my $result = $p->repos->commits->get( user => 'plu', repo => 'Pithub', sha => '7e351527f62acaaeadc69acf2b80c38e48214df8' ); is $result->success, 1, 'Pithub::Repos::Commits->get successful'; eq_or_diff $result->content->{commit}, { 'author' => { 'date' => '2011-07-01T05:37:12Z', 'email' => 'plu@pqpq.de', 'name' => 'Johannes Plunien' }, 'comment_count' => 0, 'committer' => { 'date' => '2011-07-01T05:37:12Z', 'email' => 'plu@pqpq.de', 'name' => 'Johannes Plunien' }, 'message' => 'Implement Pithub::Result->count.', 'tree' => { 'sha' => '7e6152aa778dd2b92c0f41c4ba243ad7482d46ab', 'url' => 'https://api.github.com/repos/plu/Pithub/git/trees/7e6152aa778dd2b92c0f41c4ba243ad7482d46ab' }, 'url' => 'https://api.github.com/repos/plu/Pithub/git/commits/7e351527f62acaaeadc69acf2b80c38e48214df8' }, 'Pithub::Repos::Commits->get commit content'; } # Pithub::Repos::Commits->list { my $result = $p->repos->commits->list( user => 'plu', repo => 'Pithub' ); is $result->success, 1, 'Pithub::Repos::Commits->list successful'; ok $result->count > 0, 'Pithub::Repos::Commits->list has some rows'; while ( my $row = $result->next ) { ok $row->{sha}, "Pithub::Repos::Commits->list: Attribute sha ($row->{sha})"; } } # Pithub::Repos::Watching->list { my $result = $p->repos->watching->list( user => 'plu', repo => 'Pithub' ); is $result->success, 1, 'Pithub::Repos::Watching->list successful'; like $result->content->[0]{id}, qr{^\d+$}, 'Pithub::Repos::Watching->list: Attribute id'; } } # Following tests require a token and should only be run on a test # account since they will create a lot of activity in that account. SKIP: { skip 'PITHUB_TEST_TOKEN required to run this test - DO NOT DO THIS UNLESS YOU KNOW WHAT YOU ARE DOING', 1 unless $ENV{PITHUB_TEST_TOKEN}; my $org = Pithub::Test::Factory->test_account->{org}; my $org_repo = Pithub::Test::Factory->test_account->{org_repo}; my $repo = Pithub::Test::Factory->test_account->{repo}; my $user = Pithub::Test::Factory->test_account->{user}; my $p = Pithub->new( user => $user, repo => $repo, token => $ENV{PITHUB_TEST_TOKEN} ); # Pithub::Repos->create { my $result = $p->repos->create( data => { name => $repo, description => 'Testing Github v3 API', homepage => "http://github.com/${user}/${repo}", public => 1, } ); ok grep( $_ eq $result->code, qw(201 422) ), 'Pithub::Repos->create HTTP status'; } { # Pithub::Repos::Watching->is_watching ok $p->repos->watching->is_watching->success, 'Pithub::Repos::Watching->is_watching successful'; # Pithub::Repos::Watching->is_watching ok !$p->repos->watching->is_watching( user => 'plu', repos => 'Pithub' )->success, 'Pithub::Repos::Watching->is_watching not successful'; } { # Pithub::Repos::Watching->list_repos is $p->repos->watching->list_repos->first->{name}, $repo, 'Pithub::Repos::Watching->list_repos name'; # Pithub::Repos::Watching->start_watching ok $p->repos->watching->start_watching( user => 'plu', repo => 'Pithub' )->success, 'Pithub::Repos::Watching->start_watching successful'; # Pithub::Repos::Watching->list_repos is $p->repos->watching->list_repos->first->{name}, 'Pithub', 'Pithub::Repos::Watching->list_repos new watched repo'; # Pithub::Repos::Watching->stop_watching ok $p->repos->watching->stop_watching( user => 'plu', repo => 'Pithub' )->success, 'Pithub::Repos::Watching->stop_watching successful'; # Pithub::Repos::Watching->list_repos isnt $p->repos->watching->list_repos->content->[-1]->{name}, 'Pithub', 'Pithub::Repos::Watching->list_repos not watching anymore'; } { # Pithub::Repos::Downloads->create my $result = $p->repos->downloads->create( data => { name => path(__FILE__)->basename, size => -s __FILE__, description => 'This test (t/live.t)', content_type => 'text/plain', }, ); my $id = $result->content->{id}; ok $result->success, 'Pithub::Repos::Downloads->create successful'; # Pithub::Repos::Downloads->upload ok $p->repos->downloads->upload( result => $result, file => __FILE__, )->is_success, 'Pithub::Repos::Downloads->upload successful'; # Pithub::Repos::Downloads->get is $p->repos->downloads->get( download_id => $id ) ->content->{description}, 'This test (t/live.t)', 'Pithub::Repos::Downloads->get new download'; # Pithub::Repos::Downloads->list is $p->repos->downloads->list->first->{description}, 'This test (t/live.t)', 'Pithub::Repos::Downloads->list new download'; # Pithub::Repos::Downloads->delete ok $p->repos->downloads->delete( download_id => $id )->success, 'Pithub::Repos::Downloads->delete successful'; # Pithub::Repos::Downloads->get ok !$p->repos->downloads->get( download_id => $id )->success, 'Pithub::Repos::Downloads->get not successful after delete'; } { # Pithub::Repos::Keys->create my $key_id = $p->repos->keys->create( data => { title => 'someone@somewhere', key => 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDFkRr3GEn06UrbFEUbDFy+N0rcGyqcSVFa0FfSGXWK52143U7zTyFW0fLEhVHiD585sn8oRCOn44xfUeEHgiC6S0oto/2XELWjTO9O0nBcfxeDjvZN+8tN/w4iz0tYLOejy5FnQWJbk537TOu17v3cYgOMU1+eSLzxpxHIg3qk4dSMqdL3mI8EQ8esMu2c584BkEd6UkCNpU+3Zbq0bGzLOgKHCisvSmI0rDTtGXv3vPYyxxJ1gbRCL6MjGaGqWzJsl6cqutlhw/QCHKGnupsmiiIb58E162rg63/gugogWRi4tfmh6IlSgIx6jdTHf/20cjIcjKcyL8OFTgpA3o3V', } )->content->{id}; # Pithub::Repos::Keys->get is $p->repos->keys->get( key_id => $key_id )->content->{title}, 'someone@somewhere', 'Pithub::Repos::Keys->get title attribute'; # Pithub::Repos::Keys->list is $p->repos->keys->list->first->{title}, 'someone@somewhere', 'Pithub::Repos::Keys->list title attribute'; # Pithub::Repos::Keys->delete ok $p->repos->keys->delete( key_id => $key_id )->success, 'Pithub::Repos::Keys->delete successful'; # Pithub::Repos::Keys->get ok !$p->repos->keys->get( key_id => $key_id )->success, 'Pithub::Repos::Keys->get not successful after delete'; } { # Pithub::Repos->update ok $p->repos->update( repo => $repo, data => { description => "foo $$" } )->success, 'Pithub::Repos->update successful'; # Pithub::Repos->get is $p->repos->get( repo => $repo )->content->{description}, "foo $$", 'Pithub::Repos->get description after update'; } { # Pithub::Repos::Collaborators->is_collaborator ok !$p->repos->collaborators->is_collaborator( collaborator => 'plu' ) ->success, 'Pithub::Repos->Collaborators->is_collaborator not successful yet'; # Pithub::Repos::Collaborators->add ok $p->repos->collaborators->add( collaborator => 'plu' )->success, 'Pithub::Repos->Collaborators->add successful'; # Pithub::Repos::Collaborators->is_collaborator ok $p->repos->collaborators->is_collaborator( collaborator => 'plu' ) ->success, 'Pithub::Repos->Collaborators->is_collaborator successful now'; # Pithub::Repos::Collaborators->list is $p->repos->collaborators->list->content->[-1]->{login}, 'plu', 'Pithub::Repos->Collaborators->list first attribute login'; # Pithub::Repos::Collaborators->remove ok $p->repos->collaborators->remove( collaborator => 'plu' )->success, 'Pithub::Repos->Collaborators->remove successful now'; # Pithub::Repos::Collaborators->is_collaborator ok !$p->repos->collaborators->is_collaborator( collaborator => 'plu' ) ->success, 'Pithub::Repos->Collaborators->is_collaborator not successful anymore after remove'; } { # Pithub::Repos::Commits->create_comment my $comment_id = $p->repos->commits->create_comment( sha => '54436a6b2e335c9725f45f6562e904ad8b72d683', data => { body => 'some comment' }, )->content->{id}; like $comment_id, qr{^\d+$}, 'Pithub::Repos::Commits->create_comment returned comment id'; # Pithub::Repos::Commits->list_comments is $p->repos->commits->list_comments->content->[-1]->{id}, $comment_id, 'Pithub::Repos::Commits->list_comments last comment id'; # Pithub::Repos::Commits->update_comment ok $p->repos->commits->update_comment( comment_id => $comment_id, data => { body => 'updated comment' } )->success, 'Pithub::Repos::Commits->update_comment successful'; # Pithub::Repos::Commits->get_comment is $p->repos->commits->get_comment( comment_id => $comment_id ) ->content->{body}, 'updated comment', 'Pithub::Repos::Commits->get_comment after update'; # Pithub::Repos::Commits->delete_comment ok $p->repos->commits->delete_comment( comment_id => $comment_id ) ->success, 'Pithub::Repos::Commits->delete_comment successful'; # Pithub::Repos::Commits->get_comment ok !$p->repos->commits->get_comment( comment_id => $comment_id ) ->success, 'Pithub::Repos::Commits->get_comment not successful after delete'; } { # Pithub::Repos::Forks->create my $result = $p->repos->forks->create( user => $org, repo => $org_repo, ); ok grep( $_ eq $result->code, qw(201 422) ), 'Pithub::Repos::Forks->create HTTP status'; # Pithub::Repos::Forks->list is $p->repos->forks->list( user => $org, repo => $org_repo ) ->first->{name}, 'buhtip-org-repo', 'Pithub::Repos::Forks->list after create'; } { # Pithub::Repos::Hooks->create my $hook_id = $p->repos->hooks->create( data => { name => 'irc', active => 1, config => { port => 6667, room => 'asdf', server => 'irc.perl.org', }, }, )->content->{id}; like $hook_id, qr{^\d+$}, 'Pithub::Repos::Hooks->create returned hook id'; # Pithub::Repos::Hooks->list is $p->repos->hooks->list->content->[-1]->{id}, $hook_id, 'Pithub::Repos::Hooks->list last hook id'; # Pithub::Repos::Hooks->update ok $p->repos->hooks->update( hook_id => $hook_id, data => { config => { port => 6667, room => 'pithub', server => 'irc.perl.org', } } )->success, 'Pithub::Repos::Hooks->update successful'; # Pithub::Repos::Hooks->get is $p->repos->hooks->get( hook_id => $hook_id ) ->content->{config}{room}, 'pithub', 'Pithub::Repos::Hooks->get after update'; # Pithub::Repos::Hooks->test is $p->repos->hooks->test( hook_id => $hook_id )->code, 204, 'Pithub::Repos::Hooks->test successful'; # Pithub::Repos::Hooks->delete ok $p->repos->hooks->delete( hook_id => $hook_id )->success, 'Pithub::Repos::Hooks->delete successful'; # Pithub::Repos::Hooks->get ok !$p->repos->hooks->get( hook_id => $hook_id )->success, 'Pithub::Repos::Hooks->hook_id not successful after delete'; } { # Pithub::Repos::Releases->create # Using JSON true/false values require JSON::MaybeXS; my $result = $p->repos->releases->create( data => { tag_name => "v0.01000", target_commitish => "master", name => "This is a test release of v0.01000", body => "Here be notes", draft => JSON::MaybeXS::false(), prerelease => JSON::MaybeXS::false(), generate_release_notes => JSON::MaybeXS::true(), } ); ok $result->success, 'Pithub::Repos::Releases->create true/false constants succeeded'; # Pithub::Repos::Releases->create # Using zero/one as false/true $result = $p->repos->releases->create( data => { tag_name => "v0.01000", target_commitish => "master", name => "This is a test release of v0.01000", body => "Here be notes", draft => 0, prerelease => 0, generate_release_notes => 1, } ); ok ! $result->success, 'Pithub::Repos::Releases->create zero and one Failed as expected'; } } done_testing; Pithub-0.01042/t/live/events.t0000644000175000017500000000640515014062322014432 0ustar olafolafuse FindBin (); use lib "$FindBin::Bin/../lib"; use Pithub::Test::Factory (); use Test::Most import => [qw( done_testing is ok skip use_ok )]; BEGIN { use_ok('Pithub'); } # These tests may break very easily because data on Github can and will change, of course. # And they also might fail once the ratelimit has been reached. SKIP: { skip 'Set PITHUB_TEST_LIVE_DATA to true to run these tests', 1 unless $ENV{PITHUB_TEST_LIVE_DATA}; my $p = Pithub->new; # Pithub::Events->issue { my $result = $p->events->issue( user => 'plu', repo => 'Pithub' ); is $result->success, 1, 'Pithub::Events->issue successful'; ok $result->count > 0, 'Pithub::Events->issue has some rows'; } # Pithub::Events->network { my $result = $p->events->network( user => 'plu', repo => 'Pithub' ); is $result->success, 1, 'Pithub::Events->network successful'; ok $result->count > 0, 'Pithub::Events->network has some rows'; } # Pithub::Events->org { my $result = $p->events->org( org => 'CPAN-API' ); is $result->success, 1, 'Pithub::Events->org successful'; ok $result->count > 0, 'Pithub::Events->org has some rows'; } # Pithub::Events->public { my $result = $p->events->public; is $result->success, 1, 'Pithub::Events->public successful'; ok $result->count > 0, 'Pithub::Events->public has some rows'; ok $result->content->[0]{public}, 'Pithub::Events->public: Attribute public' } # Pithub::Events->repos { my $result = $p->events->repos( user => 'plu', repo => 'Pithub' ); is $result->success, 1, 'Pithub::Events->repos successful'; ok $result->count > 0, 'Pithub::Events->repos has some rows'; } # Pithub::Events->user_performed { my $result = $p->events->user_performed( user => 'plu' ); is $result->success, 1, 'Pithub::Events->user_performed successful'; ok $result->count > 0, 'Pithub::Events->user_performed has some rows'; } # Pithub::Events->user_received { my $result = $p->events->user_received( user => 'plu' ); is $result->success, 1, 'Pithub::Events->user_received successful'; ok $result->count > 0, 'Pithub::Events->user_received has some rows'; } } # Following tests require a token and should only be run on a test # account since they will create a lot of activity in that account. SKIP: { skip 'PITHUB_TEST_TOKEN required to run this test - DO NOT DO THIS UNLESS YOU KNOW WHAT YOU ARE DOING', 1 unless $ENV{PITHUB_TEST_TOKEN}; my $org = Pithub::Test::Factory->test_account->{org}; my $org_repo = Pithub::Test::Factory->test_account->{org_repo}; my $repo = Pithub::Test::Factory->test_account->{repo}; my $user = Pithub::Test::Factory->test_account->{user}; my $p = Pithub->new( user => $user, repo => $repo, token => $ENV{PITHUB_TEST_TOKEN} ); # Pithub::Events->org_for_user { my $result = $p->events->org_for_user( org => $org, user => $user ); is $result->success, 1, 'Pithub::Events->org_for_user successful'; ok $result->count > 0, 'Pithub::Events->org_for_user has some rows'; } } done_testing; Pithub-0.01042/t/live/repos/0000775000175000017500000000000015014062322014066 5ustar olafolafPithub-0.01042/t/live/repos/actions/0000775000175000017500000000000015014062322015526 5ustar olafolafPithub-0.01042/t/live/repos/actions/workflows.t0000755000175000017500000000221415014062322017750 0ustar olafolaf#!perl use strict; use warnings; use Pithub (); use Test::More import => [qw( done_testing is ok skip subtest )]; # These tests may break very easily because data on Github can and will change, of course. # And they also might fail once the ratelimit has been reached. SKIP: { skip 'Set PITHUB_TEST_LIVE_DATA to true to run these tests', 1 unless $ENV{PITHUB_TEST_LIVE_DATA}; my $p = Pithub->new; subtest 'list and get workflows' => sub { my $result = $p->repos->actions->workflows->list( user => 'Perl', repo => 'docker-perl-tester' ); is( $result->success, 1, 'Pithub::Repos::Actions::Workflows->branches successful' ); ok( $result->count > 0, 'has some rows' ); my $id = $result->content->{workflows}[0]{id}; ok( $id, 'workflow id' ); my $wf = $p->repos->actions->workflows->get( user => 'Perl', repo => 'docker-perl-tester', workflow_id => $id, ); ok( $wf->success, 'success' ); is( $wf->content->{id}, $id, 'id matches' ); }; } done_testing; Pithub-0.01042/t/live/pull_requests.t0000644000175000017500000000623015014062322016031 0ustar olafolafuse FindBin (); use lib "$FindBin::Bin/../lib"; use Pithub::Test::Factory (); use Test::Most import => [qw( done_testing is like ok skip use_ok )]; BEGIN { use_ok('Pithub'); } # Following tests require a token and should only be run on a test # account since they will create a lot of activity in that account. SKIP: { skip 'PITHUB_TEST_TOKEN required to run this test - DO NOT DO THIS UNLESS YOU KNOW WHAT YOU ARE DOING', 1 unless $ENV{PITHUB_TEST_TOKEN}; my $org = Pithub::Test::Factory->test_account->{org}; my $org_repo = Pithub::Test::Factory->test_account->{org_repo}; my $repo = Pithub::Test::Factory->test_account->{repo}; my $user = Pithub::Test::Factory->test_account->{user}; # Attention! Here we use $org and $org_repo my $p = Pithub->new( user => $org, repo => $org_repo, token => $ENV{PITHUB_TEST_TOKEN} ); { # Pithub::PullRequests->create my $pr_id = $p->pull_requests->create( data => { base => 'buhtip-org:master', body => 'Please pull this in!', head => "${user}:master", title => 'Amazing new feature', } )->content->{number}; like $pr_id, qr{^\d+$}, 'Pithub::PullRequests->create successful, returned pull request number'; # Pithub::PullRequests->commits is $p->pull_requests->commits( pull_request_id => $pr_id ) ->first->{sha}, '52ad3a8c84b8a480c16b616a4c1e7505aa20f64a', 'Pithub::PullRequests->commit first SHA'; # Pithub::PullRequests->files is $p->pull_requests->files( pull_request_id => $pr_id ) ->first->{filename}, 'dist.ini', 'Pithub::PullRequests->files first filename'; # Pithub::PullRequests->update ok $p->pull_requests->update( pull_request_id => $pr_id, data => { title => "updated title $$" } )->success, 'Pithub::PullRequests->update successful'; # Pithub::PullRequests->get is $p->pull_requests->get( pull_request_id => $pr_id ) ->content->{title}, "updated title $$", 'Pithub::PullRequests->get after update'; # Pithub::PullRequests->list is $p->pull_requests->list->content->[-1]->{title}, "updated title $$", 'Pithub::PullRequests->list after update'; # Pithub::PullRequests->is_merged ok !$p->pull_requests->is_merged( pull_request_id => $pr_id ) ->success, 'Pithub::PullRequests->is_merged not successful yet, pull request not merged yet'; # Pithub::PullRequests::Comments->create # Pithub::PullRequests::Comments->delete # Pithub::PullRequests::Comments->get # Pithub::PullRequests::Comments->list # Pithub::PullRequests::Comments->update # Pithub::PullRequests->update ok $p->pull_requests->update( pull_request_id => $pr_id, data => { state => 'closed' } )->success, 'Pithub::PullRequests->update closing the pull request'; } } done_testing; Pithub-0.01042/t/live/orgs.t0000644000175000017500000002151415014062322014076 0ustar olafolafuse FindBin (); use lib "$FindBin::Bin/../lib"; use Pithub::Test::Factory (); use Test::Most import => [qw( done_testing eq_or_diff is like ok skip use_ok )]; BEGIN { use_ok('Pithub'); } # These tests may break very easily because data on Github can and will change, of course. # And they also might fail once the ratelimit has been reached. SKIP: { skip 'Set PITHUB_TEST_LIVE_DATA to true to run these tests', 1 unless $ENV{PITHUB_TEST_LIVE_DATA}; my $p = Pithub->new; # Pithub::Orgs->get { my $result = $p->orgs->get( org => 'CPAN-API' ); is $result->success, 1, 'Pithub::Orgs->get successful'; is $result->content->{type}, 'Organization', 'Pithub::Orgs->get: Attribute type'; is $result->content->{login}, 'CPAN-API', 'Pithub::Orgs->get: Attribute login'; is $result->content->{name}, 'MetaCPAN', 'Pithub::Orgs->get: Attribute name'; is $result->content->{id}, 460239, 'Pithub::Orgs->get: Attribute id'; } # Pithub::Orgs->list { my $result = $p->orgs->list( user => 'plu' ); is $result->success, 1, 'Pithub::Orgs->list successful'; is $result->content->[1]{login}, 'CPAN-API', 'Pithub::Orgs->get: Attribute login'; is $result->content->[1]{id}, 460239, 'Pithub::Orgs->get: Attribute id'; } # Pithub::Orgs::Members->list_public { my $result = $p->orgs->members->list_public( org => 'CPAN-API' ); is $result->success, 1, 'Pithub::Orgs::Members->list_public successful'; ok $result->count > 0, 'Pithub::Orgs::Members->list_public has some rows'; while ( my $row = $result->next ) { ok $row->{id}, "Pithub::Orgs::Members->list_public: Attribute id ($row->{id})"; ok $row->{login}, "Pithub::Orgs::Members->list_public: Attribute login ($row->{login})"; } } } # Following tests require a token and should only be run on a test # account since they will create a lot of activity in that account. SKIP: { skip 'PITHUB_TEST_TOKEN required to run this test - DO NOT DO THIS UNLESS YOU KNOW WHAT YOU ARE DOING', 1 unless $ENV{PITHUB_TEST_TOKEN}; my $org = Pithub::Test::Factory->test_account->{org}; my $org_repo = Pithub::Test::Factory->test_account->{org_repo}; my $repo = Pithub::Test::Factory->test_account->{repo}; my $user = Pithub::Test::Factory->test_account->{user}; my $p = Pithub->new( user => $user, repo => $repo, token => $ENV{PITHUB_TEST_TOKEN} ); { # Pithub::Orgs->update ok $p->orgs->update( org => $org, data => { location => "somewhere $$" } )->success, 'Pithub::Orgs->update successful'; # Pithub::Orgs->get is $p->orgs->get( org => $org )->content->{location}, "somewhere $$", 'Pithub::Orgs->get location after update'; # Pithub::Orgs::Members->is_member ok $p->orgs->members->is_member( org => $org, user => $user, )->success, 'Pithub::Orgs::Members->is_member successful'; # Pithub::Orgs::Members->conceal ok $p->orgs->members->conceal( org => $org, user => $user, )->success, 'Pithub::Orgs::Members->conceal successful'; # Pithub::Orgs::Members->is_public ok !$p->orgs->members->is_public( org => $org, user => $user, )->success, 'Pithub::Orgs::Members->is_public not successful after conceal'; # Pithub::Orgs::Members->list_public is $p->orgs->members->list_public( org => $org, user => $user, )->count, 0, 'Pithub::Orgs::Members->list_public no public members'; # Pithub::Orgs::Members->publicize ok $p->orgs->members->publicize( org => $org, user => $user, )->success, 'Pithub::Orgs::Members->publicize successful'; # Pithub::Orgs::Members->list_public is $p->orgs->members->list_public( org => $org, user => $user, )->count, 1, 'Pithub::Orgs::Members->list_public one public member after publicize'; # Pithub::Orgs::Members->is_public ok $p->orgs->members->is_public( org => $org, user => $user, )->success, 'Pithub::Orgs::Members->is_public successful after publicize'; # Pithub::Orgs::Members->list is $p->orgs->members->list( org => $org, user => $user, )->count, 1, 'Pithub::Orgs::Members->list one member'; foreach my $team ( @{ $p->orgs->teams->list( org => $org )->content } ) { $p->orgs->teams->delete( team_id => $team->{id} ); } # Pithub::Orgs::Teams->create my $team_id = $p->orgs->teams->create( org => $org, data => { name => 'Core' } )->content->{id}; like $team_id, qr{^\d+$}, 'Pithub::Orgs::Teams->create successful, returned team id'; # Pithub::Orgs::Teams->list my @teams = splice @{ $p->orgs->teams->list( org => $org )->content }, 0, 2; eq_or_diff [ sort map { $_->{name} } @teams ], [ sort qw(Core Owners) ], 'Pithub::Orgs::Teams->list after create'; # Pithub::Orgs::Teams->update ok $p->orgs->teams->update( team_id => $team_id, data => { name => 'CoreTeam' }, )->success, 'Pithub::Orgs::Teams->update successful'; # Pithub::Orgs::Teams->get is $p->orgs->teams->get( team_id => $team_id )->content->{name}, 'CoreTeam', 'Pithub::Orgs::Teams->get after update'; # Pithub::Orgs::Teams->is_member ok !$p->orgs->teams->is_member( team_id => $team_id, user => $user, )->success, 'Pithub::Orgs::Teams->is_member not successful yet'; # Pithub::Orgs::Teams->add_member ok $p->orgs->teams->add_member( team_id => $team_id, user => $user, )->success, 'Pithub::Orgs::Teams->add_member successful'; # Pithub::Orgs::Teams->is_member ok $p->orgs->teams->is_member( team_id => $team_id, user => $user, )->success, 'Pithub::Orgs::Teams->is_member successful after add_member'; # Pithub::Orgs::Teams->list_members is $p->orgs->teams->list_members( team_id => $team_id ) ->first->{login}, $user, 'Pithub::Orgs::Teams->list_members after add_member'; # Pithub::Orgs::Teams->remove_member ok $p->orgs->teams->remove_member( team_id => $team_id, user => $user, )->success, 'Pithub::Orgs::Teams->remove_member successful'; # Pithub::Orgs::Teams->is_member ok !$p->orgs->teams->is_member( team_id => $team_id, user => $user, )->success, 'Pithub::Orgs::Teams-is_member not successful after remove_member'; # Pithub::Orgs::Teams->has_repo ok !$p->orgs->teams->has_repo( team_id => $team_id, repo => "${org}/${org_repo}", )->success, 'Pithub::Orgs::Teams->has_repo not successful yet'; # Pithub::Orgs::Teams->add_repo ok $p->orgs->teams->add_repo( team_id => $team_id, org => $org, repo => $org_repo, )->success, 'Pithub::Orgs::Teams->add_repo successful'; # Pithub::Orgs::Teams->has_repo ok $p->orgs->teams->has_repo( team_id => $team_id, repo => "${org}/${org_repo}", )->success, 'Pithub::Orgs::Teams->has_repo successful after add_repo'; # Pithub::Orgs::Teams->list_repos is $p->orgs->teams->list_repos( team_id => $team_id )->count, 1, 'Pithub::Orgs::Teams->list_repos one repo'; # Pithub::Orgs::Teams->remove_repo ok $p->orgs->teams->remove_repo( team_id => $team_id, repo => "${org}/${org_repo}", )->success, 'Pithub::Orgs::Teams->remove_repo successful'; # Pithub::Orgs::Teams->has_repo ok !$p->orgs->teams->has_repo( team_id => $team_id, repo => "${org}/${org_repo}", )->success, 'Pithub::Orgs::Teams->has_repo not successful after remove_repo'; # Pithub::Orgs::Teams->delete ok $p->orgs->teams->delete( team_id => $team_id )->success, 'Pithub::Orgs::Teams->delete successful'; # Pithub::Orgs::Teams->get ok !$p->orgs->teams->get( team_id => $team_id )->success, 'Pithub::Orgs::Teams->get not successful after delete'; } } done_testing; Pithub-0.01042/t/live/git_data.t0000644000175000017500000003070115014062322014676 0ustar olafolafuse FindBin (); use lib "$FindBin::Bin/../lib"; use Pithub::Test::Factory (); use Test::Most import => [qw( done_testing eq_or_diff is ok skip use_ok )]; use JSON::MaybeXS qw( JSON ); BEGIN { use_ok('Pithub'); } # These tests may break very easily because data on Github can and will change, of course. # And they also might fail once the ratelimit has been reached. SKIP: { skip 'Set PITHUB_TEST_LIVE_DATA to true to run these tests', 1 unless $ENV{PITHUB_TEST_LIVE_DATA}; my $p = Pithub->new; # Pithub::GitData::Blobs->get { my $result = $p->git_data->blobs->get( user => 'plu', repo => 'Pithub', sha => '5ab76a4e0253f527bf5bee2a02072261c8d2b811' ); is $result->success, 1, 'Pithub::GitData::Blobs->get successful'; eq_or_diff $result->content, { 'content' => 'UmV2aXNpb24gaGlzdG9yeSBmb3Ige3skZGlzdC0+bmFtZX19Cgp7eyRORVhU fX0KICAgICAgICAgIC0gbWlub3IgUE9EIGNoYW5nZXMKCjAuMDEwMDAgICAy MDExLTA2LTI3IDEyOjM2OjQ0IEFzaWEvRHViYWkKICAgICAgICAgIC0gZmly c3QgcmVsZWFzZQo= ', 'encoding' => 'base64', 'sha' => '5ab76a4e0253f527bf5bee2a02072261c8d2b811', 'size' => 146, 'url' => 'https://api.github.com/repos/plu/Pithub/git/blobs/5ab76a4e0253f527bf5bee2a02072261c8d2b811' }, 'Pithub::GitData::Blobs->get content'; } # Pithub::GitData::Commits->get { my $result = $p->git_data->commits->get( user => 'plu', repo => 'Pithub', sha => '20f946f933a911253e480eb0e9feced1e36dbd45' ); is $result->success, 1, 'Pithub::GitData::Commits->get successful'; eq_or_diff $result->content, { 'author' => { 'date' => '2011-06-28T04:38:09Z', 'email' => 'plu@pqpq.de', 'name' => 'Johannes Plunien' }, 'committer' => { 'date' => '2011-06-28T04:56:24Z', 'email' => 'plu@pqpq.de', 'name' => 'Johannes Plunien' }, 'message' => 'Add Changes file.', 'html_url' => 'https://github.com/plu/Pithub/commit/20f946f933a911253e480eb0e9feced1e36dbd45', 'parents' => [ { 'html_url' => 'https://github.com/plu/Pithub/commit/9616d4f1515bf4de1a32f85a8fa1b1cc441da164', 'sha' => '9616d4f1515bf4de1a32f85a8fa1b1cc441da164', 'url' => 'https://api.github.com/repos/plu/Pithub/git/commits/9616d4f1515bf4de1a32f85a8fa1b1cc441da164' } ], 'sha' => '20f946f933a911253e480eb0e9feced1e36dbd45', 'tree' => { 'sha' => '8776942cb834e5107317403a8a167e30167f8056', 'url' => 'https://api.github.com/repos/plu/Pithub/git/trees/8776942cb834e5107317403a8a167e30167f8056' }, 'url' => 'https://api.github.com/repos/plu/Pithub/git/commits/20f946f933a911253e480eb0e9feced1e36dbd45' }, 'Pithub::GitData::Commits->get content'; } # Pithub::GitData::References->get { my $result = $p->git_data->references->get( user => 'plu', repo => 'Pithub', ref => 'tags/v0.01000' ); is $result->success, 1, 'Pithub::GitData::References->get successful'; eq_or_diff $result->content, { 'object' => { 'sha' => '1c5230f42d6d3e376162591f223fc4130d671937', 'type' => 'commit', 'url' => 'https://api.github.com/repos/plu/Pithub/git/commits/1c5230f42d6d3e376162591f223fc4130d671937' }, 'ref' => 'refs/tags/v0.01000', 'url' => 'https://api.github.com/repos/plu/Pithub/git/refs/tags/v0.01000' }, 'Pithub::GitData::References->get content'; } # Pithub::GitData::References->list { my $result = $p->git_data->references->list( user => 'plu', repo => 'Pithub', ref => 'tags' ); my @tags = splice @{ $result->content }, 0, 2; is $result->success, 1, 'Pithub::GitData::References->list successful'; eq_or_diff \@tags, [ { 'object' => { 'sha' => '1c5230f42d6d3e376162591f223fc4130d671937', 'type' => 'commit', 'url' => 'https://api.github.com/repos/plu/Pithub/git/commits/1c5230f42d6d3e376162591f223fc4130d671937' }, 'ref' => 'refs/tags/v0.01000', 'url' => 'https://api.github.com/repos/plu/Pithub/git/refs/tags/v0.01000' }, { 'object' => { 'sha' => 'ef328a0679a992bd2c0ac537cf19d379f1c8d177', 'type' => 'tag', 'url' => 'https://api.github.com/repos/plu/Pithub/git/tags/ef328a0679a992bd2c0ac537cf19d379f1c8d177' }, 'ref' => 'refs/tags/v0.01001', 'url' => 'https://api.github.com/repos/plu/Pithub/git/refs/tags/v0.01001' } ], 'Pithub::GitData::References->list content'; } # Pithub::GitData::Trees->get { my $result = $p->git_data->trees->get( user => 'plu', repo => 'Pithub', sha => '7331484696162bf7b5c97de488fd2c1289fd175c' ); is $result->success, 1, 'Pithub::GitData::Trees->get successful'; eq_or_diff $result->content, { 'sha' => '7331484696162bf7b5c97de488fd2c1289fd175c', 'tree' => [ { 'mode' => '100644', 'path' => '.gitignore', 'sha' => '39c3bf7b7e4a25b8673083311cfba2d2389f705e', 'size' => 179, 'type' => 'blob', 'url' => 'https://api.github.com/repos/plu/Pithub/git/blobs/39c3bf7b7e4a25b8673083311cfba2d2389f705e' }, { 'mode' => '100644', 'path' => 'dist.ini', 'sha' => 'fb4c94cc3717143903b7d0aae1b12e30653a8e7c', 'size' => 210, 'type' => 'blob', 'url' => 'https://api.github.com/repos/plu/Pithub/git/blobs/fb4c94cc3717143903b7d0aae1b12e30653a8e7c' }, { 'mode' => '040000', 'path' => 'lib', 'sha' => '7d2b61bafb9a703b393af386e4bcc350ad2c9aa9', 'type' => 'tree', 'url' => 'https://api.github.com/repos/plu/Pithub/git/trees/7d2b61bafb9a703b393af386e4bcc350ad2c9aa9' } ], 'url' => 'https://api.github.com/repos/plu/Pithub/git/trees/7331484696162bf7b5c97de488fd2c1289fd175c', truncated => JSON->false, }, 'Pithub::GitData::Trees->get content'; my $result_recursive = $p->git_data->trees->get( user => 'plu', repo => 'Pithub', sha => '7331484696162bf7b5c97de488fd2c1289fd175c', recursive => 1, ); is $result_recursive->success, 1, 'Pithub::GitData::Trees->get successful'; eq_or_diff $result_recursive->content, { 'sha' => '7331484696162bf7b5c97de488fd2c1289fd175c', 'tree' => [ { 'mode' => '100644', 'path' => '.gitignore', 'sha' => '39c3bf7b7e4a25b8673083311cfba2d2389f705e', 'size' => 179, 'type' => 'blob', 'url' => 'https://api.github.com/repos/plu/Pithub/git/blobs/39c3bf7b7e4a25b8673083311cfba2d2389f705e' }, { 'mode' => '100644', 'path' => 'dist.ini', 'sha' => 'fb4c94cc3717143903b7d0aae1b12e30653a8e7c', 'size' => 210, 'type' => 'blob', 'url' => 'https://api.github.com/repos/plu/Pithub/git/blobs/fb4c94cc3717143903b7d0aae1b12e30653a8e7c' }, { 'mode' => '040000', 'path' => 'lib', 'sha' => '7d2b61bafb9a703b393af386e4bcc350ad2c9aa9', 'type' => 'tree', 'url' => 'https://api.github.com/repos/plu/Pithub/git/trees/7d2b61bafb9a703b393af386e4bcc350ad2c9aa9' }, { 'mode' => '100644', 'path' => 'lib/Pithub.pm', 'sha' => 'b493b43e8016b86550c065fcf83df537052ad371', 'size' => 121, 'type' => 'blob', 'url' => 'https://api.github.com/repos/plu/Pithub/git/blobs/b493b43e8016b86550c065fcf83df537052ad371' } ], truncated => JSON->false, 'url' => 'https://api.github.com/repos/plu/Pithub/git/trees/7331484696162bf7b5c97de488fd2c1289fd175c' }, 'Pithub::GitData::Trees->get content recursive'; } } # Following tests require a token and should only be run on a test # account since they will create a lot of activity in that account. SKIP: { skip 'PITHUB_TEST_TOKEN required to run this test - DO NOT DO THIS UNLESS YOU KNOW WHAT YOU ARE DOING', 1 unless $ENV{PITHUB_TEST_TOKEN}; my $org = Pithub::Test::Factory->test_account->{org}; my $org_repo = Pithub::Test::Factory->test_account->{org_repo}; my $repo = Pithub::Test::Factory->test_account->{repo}; my $user = Pithub::Test::Factory->test_account->{user}; my $p = Pithub->new( user => $user, repo => $repo, token => $ENV{PITHUB_TEST_TOKEN} ); { # Pithub::GitData::Blobs->create my $blob_sha = $p->git_data->blobs->create( data => { content => 'Content of the blob', encoding => 'utf-8', } )->content->{sha}; ok $blob_sha, 'Pithub::GitData::Blobs->create returned a SHA'; my $result = $p->git_data->blobs->get( sha => $blob_sha ); is $result->content->{content}, "Q29udGVudCBvZiB0aGUgYmxvYg==\n", 'Pithub::GitData::Blobs->get content after create'; is $result->content->{encoding}, 'base64', 'Pithub::GitData::Blobs->get encoding after create'; # Pithub::GitData::References->get my $master_sha = $p->git_data->references->get( ref => 'heads/master' ) ->content->{object}{sha}; ok $master_sha, 'Pithub::GitData::Trees->get returned a SHA'; # Pithub::GitData::Commits->get my $base_tree_sha = $p->git_data->commits->get( sha => $master_sha ) ->content->{tree}{sha}; ok $master_sha, 'Pithub::GitData::Commits->get returned a tree SHA'; # Pithub::GitData::Trees->create my $tree_sha = $p->git_data->trees->create( data => { base_tree => $base_tree_sha, tree => [ { path => "${blob_sha}.blob", mode => '100644', type => 'blob', sha => $blob_sha, } ], } )->content->{sha}; ok $tree_sha, 'Pithub::GitData::Trees->create returned a SHA'; # Pithub::GitData::Commits->create my $commit_sha = $p->git_data->commits->create( data => { message => 'my commit message', parents => [$master_sha], tree => $tree_sha, } )->content->{sha}; ok $commit_sha, 'Pithub::GitData::Commits->create returned a SHA'; # Pithub::GitData::References->update ok $p->git_data->references->update( ref => 'heads/master', data => { sha => $commit_sha } )->success, 'Pithub::GitData::References->update successful'; } } done_testing; Pithub-0.01042/t/multi.t0000644000175000017500000003250115014062322013315 0ustar olafolafuse FindBin (); use lib "$FindBin::Bin/lib"; use Pithub::Test::Factory (); use Test::Most import => [qw( done_testing is throws_ok use_ok )]; # branches.t # collaborators/list.t # commits/list.t # contributors.t # downloads/list.t # forks/list.t # get.t # keys/list.t # languages.t # pull_requests/list.t # tags.t # teams.t # watching/list.t BEGIN { use_ok('Pithub'); use_ok('Pithub::PullRequests'); use_ok('Pithub::Repos'); use_ok('Pithub::Repos::Collaborators'); use_ok('Pithub::Repos::Commits'); use_ok('Pithub::Repos::Downloads'); use_ok('Pithub::Repos::Forks'); use_ok('Pithub::Repos::Keys'); use_ok('Pithub::Repos::Watching'); } throws_ok { Pithub->new->pull_requests->list } qr{Missing key in parameters: user}, 'No parameters'; throws_ok { Pithub::PullRequests->new->list } qr{Missing key in parameters: user}, 'No parameters'; throws_ok { Pithub->new->repos->collaborators->list } qr{Missing key in parameters: user}, 'No parameters'; throws_ok { Pithub::Repos->new->collaborators->list } qr{Missing key in parameters: user}, 'No parameters'; throws_ok { Pithub::Repos::Collaborators->new->list } qr{Missing key in parameters: user}, 'No parameters'; throws_ok { Pithub->new->repos->commits->list } qr{Missing key in parameters: user}, 'No parameters'; throws_ok { Pithub::Repos->new->commits->list } qr{Missing key in parameters: user}, 'No parameters'; throws_ok { Pithub::Repos::Commits->new->list } qr{Missing key in parameters: user}, 'No parameters'; throws_ok { Pithub->new->repos->downloads->list } qr{Missing key in parameters: user}, 'No parameters'; throws_ok { Pithub::Repos->new->downloads->list } qr{Missing key in parameters: user}, 'No parameters'; throws_ok { Pithub::Repos::Downloads->new->list } qr{Missing key in parameters: user}, 'No parameters'; throws_ok { Pithub->new->repos->forks->list } qr{Missing key in parameters: user}, 'No parameters'; throws_ok { Pithub::Repos->new->forks->list } qr{Missing key in parameters: user}, 'No parameters'; throws_ok { Pithub::Repos::Forks->new->list } qr{Missing key in parameters: user}, 'No parameters'; throws_ok { Pithub->new->repos->keys->list } qr{Missing key in parameters: user}, 'No parameters'; throws_ok { Pithub::Repos->new->keys->list } qr{Missing key in parameters: user}, 'No parameters'; throws_ok { Pithub::Repos::Keys->new->list } qr{Missing key in parameters: user}, 'No parameters'; throws_ok { Pithub->new->repos->watching->list } qr{Missing key in parameters: user}, 'No parameters'; throws_ok { Pithub::Repos->new->watching->list } qr{Missing key in parameters: user}, 'No parameters'; throws_ok { Pithub::Repos::Watching->new->list } qr{Missing key in parameters: user}, 'No parameters'; throws_ok { Pithub->new->pull_requests->list( user => 'plu' ) } qr{Missing key in parameters: repo}, 'No repo parameter'; throws_ok { Pithub::PullRequests->new->list( user => 'plu' ) } qr{Missing key in parameters: repo}, 'No repo parameter'; throws_ok { Pithub->new->repos->collaborators->list( user => 'plu' ) } qr{Missing key in parameters: repo}, 'No repo parameter'; throws_ok { Pithub::Repos->new->collaborators->list( user => 'plu' ) } qr{Missing key in parameters: repo}, 'No repo parameter'; throws_ok { Pithub::Repos::Collaborators->new->list( user => 'plu' ) } qr{Missing key in parameters: repo}, 'No repo parameter'; throws_ok { Pithub->new->repos->commits->list( user => 'plu' ) } qr{Missing key in parameters: repo}, 'No repo parameter'; throws_ok { Pithub::Repos->new->commits->list( user => 'plu' ) } qr{Missing key in parameters: repo}, 'No repo parameter'; throws_ok { Pithub::Repos::Commits->new->list( user => 'plu' ) } qr{Missing key in parameters: repo}, 'No repo parameter'; throws_ok { Pithub->new->repos->downloads->list( user => 'plu' ) } qr{Missing key in parameters: repo}, 'No repo parameter'; throws_ok { Pithub::Repos->new->downloads->list( user => 'plu' ) } qr{Missing key in parameters: repo}, 'No repo parameter'; throws_ok { Pithub::Repos::Downloads->new->list( user => 'plu' ) } qr{Missing key in parameters: repo}, 'No repo parameter'; throws_ok { Pithub->new->repos->forks->list( user => 'plu' ) } qr{Missing key in parameters: repo}, 'No repo parameter'; throws_ok { Pithub::Repos->new->forks->list( user => 'plu' ) } qr{Missing key in parameters: repo}, 'No repo parameter'; throws_ok { Pithub::Repos::Forks->new->list( user => 'plu' ) } qr{Missing key in parameters: repo}, 'No repo parameter'; throws_ok { Pithub->new->repos->keys->list( user => 'plu' ) } qr{Missing key in parameters: repo}, 'No repo parameter'; throws_ok { Pithub::Repos->new->keys->list( user => 'plu' ) } qr{Missing key in parameters: repo}, 'No repo parameter'; throws_ok { Pithub::Repos::Keys->new->list( user => 'plu' ) } qr{Missing key in parameters: repo}, 'No repo parameter'; throws_ok { Pithub->new->repos->watching->list( user => 'plu' ) } qr{Missing key in parameters: repo}, 'No repo parameter'; throws_ok { Pithub::Repos->new->watching->list( user => 'plu' ) } qr{Missing key in parameters: repo}, 'No repo parameter'; throws_ok { Pithub::Repos::Watching->new->list( user => 'plu' ) } qr{Missing key in parameters: repo}, 'No repo parameter'; # c_args => constructor args # m_args => method args my @tests = ( { c_args => { token => 1 }, m_args => { user => 'plu', repo => 'Pithub' }, }, { c_args => { token => 1, user => 'plu', }, m_args => { repo => 'Pithub' }, }, { c_args => { token => 1, repo => 'Pithub' }, m_args => { user => 'plu', }, }, { c_args => { token => 1, user => 'plu', repo => 'Pithub' }, m_args => {}, }, ); test( code => sub { my ( $c_args, $m_args ) = @_; return Pithub::Test::Factory->create( 'Pithub', %$c_args ) ->pull_requests->list(%$m_args); }, path => '/repos/plu/Pithub/pulls', tests => \@tests, ); test( code => sub { my ( $c_args, $m_args ) = @_; return Pithub::Test::Factory->create( 'Pithub::PullRequests', %$c_args )->list(%$m_args); }, path => '/repos/plu/Pithub/pulls', tests => \@tests, ); test( code => sub { my ( $c_args, $m_args ) = @_; return Pithub::Test::Factory->create( 'Pithub', %$c_args ) ->repos->collaborators->list(%$m_args); }, path => '/repos/plu/Pithub/collaborators', tests => \@tests, ); test( code => sub { my ( $c_args, $m_args ) = @_; return Pithub::Test::Factory->create( 'Pithub::Repos', %$c_args ) ->collaborators->list(%$m_args); }, path => '/repos/plu/Pithub/collaborators', tests => \@tests, ); test( code => sub { my ( $c_args, $m_args ) = @_; return Pithub::Test::Factory->create( 'Pithub::Repos::Collaborators', %$c_args )->list(%$m_args); }, path => '/repos/plu/Pithub/collaborators', tests => \@tests, ); test( code => sub { my ( $c_args, $m_args ) = @_; return Pithub::Test::Factory->create( 'Pithub', %$c_args ) ->repos->commits->list(%$m_args); }, path => '/repos/plu/Pithub/commits', tests => \@tests, ); test( code => sub { my ( $c_args, $m_args ) = @_; return Pithub::Test::Factory->create( 'Pithub::Repos', %$c_args ) ->commits->list(%$m_args); }, path => '/repos/plu/Pithub/commits', tests => \@tests, ); test( code => sub { my ( $c_args, $m_args ) = @_; return Pithub::Test::Factory->create( 'Pithub::Repos::Commits', %$c_args )->list(%$m_args); }, path => '/repos/plu/Pithub/commits', tests => \@tests, ); test( code => sub { my ( $c_args, $m_args ) = @_; return Pithub::Test::Factory->create( 'Pithub', %$c_args ) ->repos->downloads->list(%$m_args); }, path => '/repos/plu/Pithub/downloads', tests => \@tests, ); test( code => sub { my ( $c_args, $m_args ) = @_; return Pithub::Test::Factory->create( 'Pithub::Repos', %$c_args ) ->downloads->list(%$m_args); }, path => '/repos/plu/Pithub/downloads', tests => \@tests, ); test( code => sub { my ( $c_args, $m_args ) = @_; return Pithub::Test::Factory->create( 'Pithub::Repos::Downloads', %$c_args )->list(%$m_args); }, path => '/repos/plu/Pithub/downloads', tests => \@tests, ); test( code => sub { my ( $c_args, $m_args ) = @_; return Pithub::Test::Factory->create( 'Pithub', %$c_args ) ->repos->forks->list(%$m_args); }, path => '/repos/plu/Pithub/forks', tests => \@tests, ); test( code => sub { my ( $c_args, $m_args ) = @_; return Pithub::Test::Factory->create( 'Pithub::Repos', %$c_args ) ->forks->list(%$m_args); }, path => '/repos/plu/Pithub/forks', tests => \@tests, ); test( code => sub { my ( $c_args, $m_args ) = @_; return Pithub::Test::Factory->create( 'Pithub::Repos::Forks', %$c_args )->list(%$m_args); }, path => '/repos/plu/Pithub/forks', tests => \@tests, ); test( code => sub { my ( $c_args, $m_args ) = @_; return Pithub::Test::Factory->create( 'Pithub', %$c_args ) ->repos->keys->list(%$m_args); }, path => '/repos/plu/Pithub/keys', tests => \@tests, ); test( code => sub { my ( $c_args, $m_args ) = @_; return Pithub::Test::Factory->create( 'Pithub::Repos', %$c_args ) ->keys->list(%$m_args); }, path => '/repos/plu/Pithub/keys', tests => \@tests, ); test( code => sub { my ( $c_args, $m_args ) = @_; return Pithub::Test::Factory->create( 'Pithub::Repos::Keys', %$c_args )->list(%$m_args); }, path => '/repos/plu/Pithub/keys', tests => \@tests, ); test( code => sub { my ( $c_args, $m_args ) = @_; return Pithub::Test::Factory->create( 'Pithub', %$c_args ) ->repos->watching->list(%$m_args); }, path => '/repos/plu/Pithub/watchers', tests => \@tests, ); test( code => sub { my ( $c_args, $m_args ) = @_; return Pithub::Test::Factory->create( 'Pithub::Repos', %$c_args ) ->watching->list(%$m_args); }, path => '/repos/plu/Pithub/watchers', tests => \@tests, ); test( code => sub { my ( $c_args, $m_args ) = @_; return Pithub::Test::Factory->create( 'Pithub::Repos::Watching', %$c_args )->list(%$m_args); }, path => '/repos/plu/Pithub/watchers', tests => \@tests, ); test( code => sub { my ( $c_args, $m_args ) = @_; return Pithub::Test::Factory->create( 'Pithub', %$c_args ) ->repos->branches(%$m_args); }, path => '/repos/plu/Pithub/branches', tests => \@tests, ); test( code => sub { my ( $c_args, $m_args ) = @_; return Pithub::Test::Factory->create( 'Pithub::Repos', %$c_args ) ->branches(%$m_args); }, path => '/repos/plu/Pithub/branches', tests => \@tests, ); test( code => sub { my ( $c_args, $m_args ) = @_; return Pithub::Test::Factory->create( 'Pithub', %$c_args ) ->repos->contributors(%$m_args); }, path => '/repos/plu/Pithub/contributors', tests => \@tests, ); test( code => sub { my ( $c_args, $m_args ) = @_; return Pithub::Test::Factory->create( 'Pithub::Repos', %$c_args ) ->contributors(%$m_args); }, path => '/repos/plu/Pithub/contributors', tests => \@tests, ); test( code => sub { my ( $c_args, $m_args ) = @_; return Pithub::Test::Factory->create( 'Pithub', %$c_args ) ->repos->languages(%$m_args); }, path => '/repos/plu/Pithub/languages', tests => \@tests, ); test( code => sub { my ( $c_args, $m_args ) = @_; return Pithub::Test::Factory->create( 'Pithub::Repos', %$c_args ) ->languages(%$m_args); }, path => '/repos/plu/Pithub/languages', tests => \@tests, ); test( code => sub { my ( $c_args, $m_args ) = @_; return Pithub::Test::Factory->create( 'Pithub', %$c_args ) ->repos->tags(%$m_args); }, path => '/repos/plu/Pithub/tags', tests => \@tests, ); test( code => sub { my ( $c_args, $m_args ) = @_; return Pithub::Test::Factory->create( 'Pithub::Repos', %$c_args ) ->tags(%$m_args); }, path => '/repos/plu/Pithub/tags', tests => \@tests, ); test( code => sub { my ( $c_args, $m_args ) = @_; return Pithub::Test::Factory->create( 'Pithub', %$c_args ) ->repos->teams(%$m_args); }, path => '/repos/plu/Pithub/teams', tests => \@tests, ); test( code => sub { my ( $c_args, $m_args ) = @_; return Pithub::Test::Factory->create( 'Pithub::Repos', %$c_args ) ->teams(%$m_args); }, path => '/repos/plu/Pithub/teams', tests => \@tests, ); sub test { my (%args) = @_; foreach my $test ( @{ $args{tests} } ) { my $result = $args{code}->( $test->{c_args}, $test->{m_args} ); is $result->request->method, 'GET', "HTTP method for $args{path}"; is $result->request->uri->path, $args{path}, "HTTP path for $args{path}"; } } done_testing; Pithub-0.01042/t/gists.t0000755000175000017500000003107115014062322013320 0ustar olafolaf#!perl use strict; use warnings; use JSON::MaybeXS qw( JSON ); use Pithub::Gists (); use Test::Exception; # throws_ok use Test::Most import => [qw( done_testing eq_or_diff is isa_ok ok )]; use lib 't/lib'; use Pithub::Test::Factory (); # Pithub::Gists->create { my $json = JSON->new; my $obj = Pithub::Test::Factory->create('Pithub::Gists'); isa_ok $obj, 'Pithub::Gists'; throws_ok { $obj->create } qr{Missing key in parameters: data \(hashref\)}, 'No data parameter'; { my $result = $obj->create( data => { description => 'the description for this gist', public => 1, files => { 'file1.txt' => { content => 'String file content' } } } ); is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/gists', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'files' => { 'file1.txt' => { 'content' => 'String file content' } }, 'public' => 1, 'description' => 'the description for this gist' }, 'HTTP body'; } } # Pithub::Gists->delete { my $obj = Pithub::Test::Factory->create('Pithub::Gists'); isa_ok $obj, 'Pithub::Gists'; throws_ok { $obj->delete } qr{Missing key in parameters: gist_id}, 'No parameter'; throws_ok { $obj->delete( gist_id => 123 ) } qr{Access token required for: DELETE /gists/123}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->delete( gist_id => 123 ); is $result->request->method, 'DELETE', 'HTTP method'; is $result->request->uri->path, '/gists/123', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Gists->fork { my $obj = Pithub::Test::Factory->create('Pithub::Gists'); isa_ok $obj, 'Pithub::Gists'; throws_ok { $obj->fork } qr{Missing key in parameters: gist_id}, 'No parameter'; { my $result = $obj->fork( gist_id => 123 ); is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/gists/123/forks', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Gists->get { my $obj = Pithub::Test::Factory->create('Pithub::Gists'); isa_ok $obj, 'Pithub::Gists'; throws_ok { $obj->get } qr{Missing key in parameters: gist_id}, 'No parameter'; { my $result = $obj->get( gist_id => 123 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/gists/123', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Gists->is_starred { my $obj = Pithub::Test::Factory->create('Pithub::Gists'); isa_ok $obj, 'Pithub::Gists'; throws_ok { $obj->is_starred } qr{Missing key in parameters: gist_id}, 'No parameter'; throws_ok { $obj->is_starred( gist_id => 123 ); } qr{Access token required for: GET /gists/123/star}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->is_starred( gist_id => 123 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/gists/123/star', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Gists->list { my $obj = Pithub::Test::Factory->create('Pithub::Gists'); isa_ok $obj, 'Pithub::Gists'; { my $result = $obj->list( user => 'foo' ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/users/foo/gists', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } { throws_ok { $obj->list( starred => 1 ) } qr{Access token required for: GET /gists/starred }, 'Token required'; ok $obj->token(123), 'Token set'; my $result = $obj->list( starred => 1 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/gists/starred', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; ok $obj->clear_token, 'Token removed'; } { my $result = $obj->list( public => 1 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/gists/public', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } { my $result = $obj->list; is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/gists', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Gists->star { my $obj = Pithub::Test::Factory->create('Pithub::Gists'); isa_ok $obj, 'Pithub::Gists'; throws_ok { $obj->star } qr{Missing key in parameters: gist_id}, 'No parameter'; throws_ok { $obj->star( gist_id => 123 ) } qr{Access token required for: PUT /gists/123/star}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->star( gist_id => 123 ); is $result->request->method, 'PUT', 'HTTP method'; is $result->request->uri->path, '/gists/123/star', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Gists->unstar { my $obj = Pithub::Test::Factory->create('Pithub::Gists'); isa_ok $obj, 'Pithub::Gists'; throws_ok { $obj->unstar } qr{Missing key in parameters: gist_id}, 'No parameter'; throws_ok { $obj->unstar( gist_id => 123 ) } qr{Access token required for: DELETE /gists/123/star}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->unstar( gist_id => 123 ); is $result->request->method, 'DELETE', 'HTTP method'; is $result->request->uri->path, '/gists/123/star', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Gists->update { my $obj = Pithub::Test::Factory->create('Pithub::Gists'); isa_ok $obj, 'Pithub::Gists'; throws_ok { $obj->update } qr{Missing key in parameters: gist_id}, 'No parameter'; throws_ok { $obj->update( gist_id => 123 ) } qr{Missing key in parameters: data \(hashref\)}, 'No data parameter'; throws_ok { $obj->update( gist_id => 123, data => { foo => 'bar' } ) } qr{Access token required for: PATCH /gists/123}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->update( gist_id => 123, data => { description => 'the description for this gist', public => 1, files => { 'file1.txt' => { content => 'String file content' } } } ); is $result->request->method, 'PATCH', 'HTTP method'; is $result->request->uri->path, '/gists/123', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'files' => { 'file1.txt' => { 'content' => 'String file content' } }, 'public' => 1, 'description' => 'the description for this gist' }, 'HTTP body'; } } # Pithub::Gists::Comments->create { my $obj = Pithub::Test::Factory->create('Pithub::Gists::Comments'); isa_ok $obj, 'Pithub::Gists::Comments'; throws_ok { $obj->create } qr{Missing key in parameters: gist_id}, 'No parameters'; throws_ok { $obj->create( gist_id => 'c0ff33' ) } qr{Missing key in parameters: data \(hashref\)}, 'No data parameter'; throws_ok { $obj->create( gist_id => 'c0ff33', data => 5 ) } qr{Missing key in parameters: data \(hashref\)}, 'Wrong type'; throws_ok { $obj->create( gist_id => 'c0ff33', data => { body => 'bar' } ); } qr{Access token required for: POST /gists/c0ff33/comments}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->create( gist_id => 'c0ff33', data => { body => 'some comment' } ); is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/gists/c0ff33/comments', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'body' => 'some comment' }, 'HTTP body'; } } # Pithub::Gists::Comments->delete { my $obj = Pithub::Test::Factory->create('Pithub::Gists::Comments'); isa_ok $obj, 'Pithub::Gists::Comments'; throws_ok { $obj->delete } qr{Missing key in parameters: gist_id}, 'No parameters'; throws_ok { $obj->delete( gist_id => 'c0ff33' ) } qr{Missing key in parameters: comment_id}, 'No parameters'; throws_ok { $obj->delete( gist_id => 'c0ff33', comment_id => 123 ); } qr{Access token required for: DELETE /gists/c0ff33/comments/123}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->delete( gist_id => 'c0ff33', comment_id => 123 ); is $result->request->method, 'DELETE', 'HTTP method'; is $result->request->uri->path, '/gists/c0ff33/comments/123', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Gists::Comments->get { my $obj = Pithub::Test::Factory->create('Pithub::Gists::Comments'); isa_ok $obj, 'Pithub::Gists::Comments'; throws_ok { $obj->get } qr{Missing key in parameters: gist_id}, 'No parameters'; throws_ok { $obj->get( gist_id => 'c0ff33' ) } qr{Missing key in parameters: comment_id}, 'No parameters'; { my $result = $obj->get( gist_id => 'c0ff33', comment_id => 123 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/gists/c0ff33/comments/123', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Gists::Comments->list { my $obj = Pithub::Test::Factory->create('Pithub::Gists::Comments'); isa_ok $obj, 'Pithub::Gists::Comments'; throws_ok { $obj->list } qr{Missing key in parameters: gist_id}, 'No parameters'; { my $result = $obj->list( gist_id => 123 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/gists/123/comments', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Gists::Comments->update { my $obj = Pithub::Test::Factory->create('Pithub::Gists::Comments'); isa_ok $obj, 'Pithub::Gists::Comments'; throws_ok { $obj->update } qr{Missing key in parameters: gist_id}, 'No parameters'; throws_ok { $obj->update( gist_id => 'c0ff33' ) } qr{Missing key in parameters: comment_id}, 'No parameters'; throws_ok { $obj->update( gist_id => 'c0ff33', comment_id => 123 ) } qr{Missing key in parameters: data \(hashref\)}, 'No data parameter'; throws_ok { $obj->update( gist_id => 'c0ff33', comment_id => 123, data => 5 ) } qr{Missing key in parameters: data \(hashref\)}, 'Wrong type'; throws_ok { $obj->update( gist_id => 'c0ff33', comment_id => 123, data => { body => 'bar' } ); } qr{Access token required for: PATCH /gists/c0ff33/comments/123}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->update( gist_id => 'c0ff33', comment_id => 123, data => { body => 'some comment' } ); is $result->request->method, 'PATCH', 'HTTP method'; is $result->request->uri->path, '/gists/c0ff33/comments/123', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'body' => 'some comment' }, 'HTTP body'; } } done_testing; Pithub-0.01042/t/00-report-prereqs.dd0000644000175000017500000000755115014062322015525 0ustar olafolafdo { my $x = { 'configure' => { 'requires' => { 'ExtUtils::MakeMaker' => '0', 'perl' => '5.006' } }, 'develop' => { 'recommends' => { 'Dist::Zilla::PluginBundle::Git::VersionManager' => '0.007' }, 'requires' => { 'Code::TidyAll' => '0.71', 'Code::TidyAll::Plugin::SortLines::Naturally' => '0.000003', 'Code::TidyAll::Plugin::Test::Vars' => '0.04', 'Code::TidyAll::Plugin::UniqueLines' => '0.000003', 'Parallel::ForkManager' => '1.19', 'Perl::Critic' => '1.132', 'Perl::Tidy' => '20180220', 'Pod::Coverage::TrustPod' => '0', 'Pod::Wordlist' => '0', 'Test::CPAN::Changes' => '0.19', 'Test::EOL' => '0', 'Test::Mojibake' => '0', 'Test::More' => '0.96', 'Test::Pod::Coverage' => '1.08', 'Test::Spelling' => '0.17', 'Test::Synopsis' => '0', 'Test::Vars' => '0.014', 'Test::Version' => '1' } }, 'runtime' => { 'requires' => { 'CHI' => '0', 'Carp' => '0', 'HTTP::Headers' => '0', 'HTTP::Request' => '0', 'HTTP::Request::Common' => '0', 'JSON::MaybeXS' => '0', 'LWP::UserAgent' => '0', 'Moo' => '0', 'Moo::Role' => '0', 'URI' => '0', 'perl' => '5.013010', 'strict' => '0', 'warnings' => '0' } }, 'test' => { 'recommends' => { 'CPAN::Meta' => '2.120900' }, 'requires' => { 'Exporter' => '0', 'ExtUtils::MakeMaker' => '0', 'File::Spec' => '0', 'FindBin' => '0', 'HTTP::Response' => '0', 'Import::Into' => '0', 'MIME::Base64' => '0', 'Path::Tiny' => '0', 'Scalar::Util' => '0', 'Test::Builder' => '0', 'Test::Differences' => '0', 'Test::Exception' => '0', 'Test::More' => '0', 'Test::Most' => '0', 'Test::Needs' => '0', 'lib' => '0', 'perl' => '5.013010' } } }; $x; }Pithub-0.01042/t/basic.t0000644000175000017500000006402715014062322013254 0ustar olafolaf#!perl use strict; use warnings; use JSON::MaybeXS qw( JSON ); use Pithub (); use Test::More import => [qw( can_ok done_testing fail is isa_ok isnt ok subtest use_ok )]; use lib 't/lib'; use Pithub::Test qw( uri_is ); use Pithub::Test::Factory (); use Pithub::Test::UA (); BEGIN { use_ok('Pithub'); } my @tree = ( { accessor => 'events', isa => 'Pithub::Events', methods => [ qw(issue network org org_for_user public repos user_performed user_received) ], subtree => [], }, { accessor => 'gists', isa => 'Pithub::Gists', methods => [qw(create delete fork get is_starred list star unstar update)], subtree => [ { accessor => 'comments', isa => 'Pithub::Gists::Comments', methods => [qw(create delete get list update)], }, ], }, { accessor => 'git_data', isa => 'Pithub::GitData', methods => [], subtree => [ { accessor => 'blobs', isa => 'Pithub::GitData::Blobs', methods => [qw(create get)], }, { accessor => 'commits', isa => 'Pithub::GitData::Commits', methods => [qw(create get)], }, { accessor => 'references', isa => 'Pithub::GitData::References', methods => [qw(create get list update)], }, { accessor => 'tags', isa => 'Pithub::GitData::Tags', methods => [qw(create get)], }, { accessor => 'trees', isa => 'Pithub::GitData::Trees', methods => [qw(create get)], }, ], }, { accessor => 'issues', isa => 'Pithub::Issues', methods => [qw(create get list update)], subtree => [ { accessor => 'assignees', isa => 'Pithub::Issues::Assignees', methods => [qw(check list)], }, { accessor => 'comments', isa => 'Pithub::Issues::Comments', methods => [qw(create delete get list update)], }, { accessor => 'events', isa => 'Pithub::Issues::Events', methods => [qw(get list)], }, { accessor => 'labels', isa => 'Pithub::Issues::Labels', methods => [qw(add create delete get list remove replace update)], }, { accessor => 'milestones', isa => 'Pithub::Issues::Milestones', methods => [qw(create delete get list update)], }, ], }, { accessor => 'markdown', isa => 'Pithub::Markdown', methods => [qw(render)], }, { accessor => 'orgs', isa => 'Pithub::Orgs', methods => [qw(get list update)], subtree => [ { accessor => 'members', isa => 'Pithub::Orgs::Members', methods => [ qw(conceal delete is_member is_public list list_public publicize) ], }, { accessor => 'teams', isa => 'Pithub::Orgs::Teams', methods => [ qw(add_member add_membership add_repo create delete get has_repo is_member list list_members list_repos remove_member remove_membership remove_repo update) ], }, ], }, { accessor => 'pull_requests', isa => 'Pithub::PullRequests', methods => [qw(commits create files get is_merged list merge update)], subtree => [ { accessor => 'comments', isa => 'Pithub::PullRequests::Comments', methods => [qw(create delete get list update)], }, ], }, { accessor => 'repos', isa => 'Pithub::Repos', methods => [ qw(branch branches rename_branch merge_branch contributors create get languages list tags teams update) ], subtree => [ { accessor => 'collaborators', isa => 'Pithub::Repos::Collaborators', methods => [qw(add is_collaborator list remove)], }, { accessor => 'commits', isa => 'Pithub::Repos::Commits', methods => [ qw(create_comment delete_comment get get_comment list list_comments update_comment) ], }, { accessor => 'contents', isa => 'Pithub::Repos::Contents', methods => [qw(archive get readme)], }, { accessor => 'downloads', isa => 'Pithub::Repos::Downloads', methods => [qw(create delete get list upload)], }, { accessor => 'forks', isa => 'Pithub::Repos::Forks', methods => [qw(create list)], }, { accessor => 'hooks', isa => 'Pithub::Repos::Hooks', methods => [qw(create delete get list update test)], }, { accessor => 'issues', isa => 'Pithub::Issues', methods => [qw(create get list update)], }, { accessor => 'keys', isa => 'Pithub::Repos::Keys', methods => [qw(create delete get list)], }, { accessor => 'markdown', isa => 'Pithub::Markdown', methods => [qw(render)], }, { accessor => 'pull_requests', isa => 'Pithub::PullRequests', methods => [ qw(commits create files get is_merged list merge update)], }, { accessor => 'releases', isa => 'Pithub::Repos::Releases', methods => [qw(list get create update delete)], subtree => [ { accessor => 'assets', isa => 'Pithub::Repos::Releases::Assets', methods => [qw(list get create update delete)], } ], }, { accessor => 'starring', isa => 'Pithub::Repos::Starring', methods => [qw(has_starred list_repos list star unstar)], }, { accessor => 'stats', isa => 'Pithub::Repos::Stats', methods => [qw(contributors)], }, { accessor => 'statuses', isa => 'Pithub::Repos::Statuses', methods => [qw(create list)], }, { accessor => 'watching', isa => 'Pithub::Repos::Watching', methods => [ qw(is_watching list_repos list start_watching stop_watching) ], }, ], }, { accessor => 'users', isa => 'Pithub::Users', methods => [qw(get update)], subtree => [ { accessor => 'emails', isa => 'Pithub::Users::Emails', methods => [qw(add delete list)], }, { accessor => 'followers', isa => 'Pithub::Users::Followers', methods => [qw(follow is_following list list_following unfollow)], }, { accessor => 'keys', isa => 'Pithub::Users::Keys', methods => [qw(create delete get list)], }, ], }, { accessor => 'search', isa => 'Pithub::Search', methods => [qw(email issues repos users)], }, { accessor => 'search', args => [ search_api => 'legacy' ], isa => 'Pithub::Search', methods => [qw(email issues repos users)], }, { accessor => 'search', args => [ search_api => 'v3' ], isa => 'Pithub::SearchV3', methods => [qw(issues repos users)], }, ); sub validate_tree { my (%args) = @_; my $obj = $args{obj}; my $tests = $args{tests}; my $tree = $args{tree}; foreach my $node (@$tree) { my $accessor = $node->{accessor}; $tests->( $node, $obj ); validate_tree( tree => $node->{subtree}, obj => $obj->$accessor( @{ $node->{args} || [] } ), tests => $tests, ) if $node->{subtree}; } } # Make sure all attributes get curried down the objects { my %attributes = ( api_uri => 'http://foo.com', auto_pagination => 1, jsonp_callback => 'evil', per_page => 42, prepare_request => sub { }, repo => 'Pithub', token => 123, ua => Pithub::Test::UA->new, user => 'plu', ); local $SIG{__WARN__} = sub { fail( $_[0] ) unless $_[0] =~ m{is deprecated} }; validate_tree( tree => \@tree, obj => Pithub->new(%attributes), tests => sub { my ( $node, $obj ) = @_; my $accessor = $node->{accessor}; my $methods = $node->{methods}; can_ok $obj, $accessor; my $val = $obj->$accessor( @{ $node->{args} || [] } ); isa_ok $val, $node->{isa}; can_ok $val, @$methods if @{ $methods || [] }; can_ok $val, 'rate_limit'; foreach my $attr ( keys %attributes ) { is $obj->$attr, $attributes{$attr}, "Attribute ${attr} was curried to ${obj}"; } # the following arguments are in no way real world arguments, it's just to # satisfy -every- method with those arguments! foreach my $method (@$methods) { next if $node->{isa} eq 'Pithub::Repos::Downloads' and $method eq 'upload'; my $result; my $data = { state => 'pending', branch => 'master', base => 'master', head => 'another_branch', new_name => 'new_name' }; # unfortunately the API expects arrayrefs on a very few calls $data = [] if ( $node->{isa} eq 'Pithub::Users::Emails' and grep $_ eq $method, qw(add delete) ) or ( $node->{isa} eq 'Pithub::Issues::Labels' and grep $_ eq $method, qw(add replace) ); lives_ok { $result = $val->$method( archive_format => 'tarball', asset_id => 1, assignee => 'john', base => 'master', branch => 'master', collaborator => 1, comment_id => 1, content_type => 'text/plain', data => $data, download_id => 1, email => 'foo', event_id => 1, gist_id => 1, head => 'branch', hook_id => 1, issue_id => 1, key_id => 1, keyword => 'foo', label => 1, milestone_id => 1, name => 'foo', new_name => 'new', options => { prepare_request => sub { shift->header( 'Accept' => 'foo.bar' ); }, }, org => 1, pull_request_id => 1, q => 'foo', ref => 1, release_id => 1, repo => 1, sha => 1, state => 'open', team_id => 1, user => 1, ); } "Calling $node->{isa}->$method with pseudo arguments"; is $result->request->header('Accept'), 'foo.bar', "$node->{isa}->$method options prepare_request set"; } } ); validate_tree( tree => \@tree, obj => Pithub->new, tests => sub { my ( $node, $obj ) = @_; foreach my $attr ( keys %attributes ) { isnt $obj->$attr, $attributes{$attr}, "Attribute ${attr} was not curried to ${obj}"; } } ); } { my $p = Pithub::Test::Factory->create('Pithub'); isa_ok $p, 'Pithub'; throws_ok { $p->request } qr{Missing mandatory key in parameters: method}, 'Not given any parameters'; throws_ok { $p->request( method => 'GET' ) } qr{Missing mandatory key in parameters: path}, 'Parameter path missing'; throws_ok { $p->request( method => 'xxx', path => '/bar' ) } qr{Invalid method: xxx}, 'Not a valid HTTP method'; lives_ok { $p->request( method => 'GET', path => 'bar' ) } 'Correct parameters do not throw an exception'; throws_ok { $p->request( method => 'GET', path => '/bar', options => [] ) } qr{The key options must be a hashref}, 'options must be a hashref'; throws_ok { $p->request( method => 'GET', path => '/bar', options => { prepare_request => 1 } ) } qr{The key prepare_request in the options hashref must be a coderef}, 'prepare_request must be a coderef'; lives_ok { $p->request( method => 'GET', path => 'bar', options => {} ) } 'Empty options hashref'; my $result = $p->request( method => 'GET', path => '/bar' ); my $response = $result->response; my $http_request = $response->request; isa_ok $result, 'Pithub::Result'; isa_ok $response, 'HTTP::Response'; isa_ok $http_request, 'HTTP::Request'; is $http_request->content, q{}, 'The data hashref is undef'; is $http_request->uri->path, '/bar', 'The HTTP path was set in the HTTP::Request object'; is $http_request->header('Authorization'), undef, 'Authorization header was not set in the HTTP::Request object'; is $http_request->header('Content-Length'), 0, 'Content-Length header was set'; } { my $json = JSON->new; my $p = Pithub::Test::Factory->create('Pithub'); $p->token('123'); my $request = $p->request( method => 'POST', path => '/foo', data => { some => 'data' } )->request; eq_or_diff $json->decode( $request->content ), { some => 'data' }, 'The JSON content was set in the request object'; is $request->header('Authorization'), 'token 123', 'Authorization header was set in the HTTP::Request object'; ok $p->clear_token, 'Access token clearer'; is $p->token, undef, 'No token set anymore'; $request = $p->request( method => 'POST', path => '/foo', data => { some => 'data' } )->request; is $request->header('Authorization'), undef, 'Authorization header was not set in the HTTP::Request object'; } { my $p = Pithub::Test::Factory->create('Pithub'); $p->ua->add_response('error/notfound.GET'); my $result = $p->request( method => 'GET', path => '/error/notfound' ); is $result->code, 404, 'HTTP status is 404'; is $result->success, q{}, 'Unsuccessful response'; ok $result->raw_content, 'Has raw JSON content'; is ref( $result->content ), 'HASH', 'Has decoded JSON hashref'; is $result->content->{message}, 'Not Found', 'Attribute exists in response: message'; is $result->ratelimit, 5000, 'Accessor to X-RateLimit-Limit header'; is $result->ratelimit_remaining, 4962, 'Accessor to X-RateLimit-Remaining header'; is $result->count, 0, 'Count accessor'; } { my $p = Pithub::Test::Factory->create('Pithub'); $p->ua->add_response('users/miyagawa/followers.GET'); my $result = $p->users->followers->list( user => 'miyagawa' ); is $result->count, 30, 'Count accessor'; is $result->first_page_uri, undef, 'First page link on first page'; is $result->prev_page_uri, undef, 'First page link on first page'; is $result->next_page_uri, 'https://api.github.com/users/miyagawa/followers?page=2', 'Next page link on first page'; is $result->last_page_uri, 'https://api.github.com/users/miyagawa/followers?page=26', 'Last page link on first page'; is $result->first_page, undef, 'We are on first page already'; is $result->prev_page, undef, 'No prev page on the first page'; uri_is $result->next_page->request->uri, 'https://api.github.com/users/miyagawa/followers?page=2&per_page=100', 'Next page call'; uri_is $result->last_page->request->uri, 'https://api.github.com/users/miyagawa/followers?page=26&per_page=100', 'Last page call'; uri_is $result->get_page(42)->request->uri, 'https://api.github.com/users/miyagawa/followers?page=42&per_page=100', 'URI for get_page is generated, no matter if it exists or not'; } { my $p = Pithub::Test::Factory->create('Pithub'); $p->ua->add_response('users/miyagawa/followers.GET'); $p->ua->add_response('users/miyagawa/followers.GET.page-3'); my $result = $p->users->followers->list( user => 'miyagawa' )->get_page(3); is $result->first_page_uri, 'https://api.github.com/users/miyagawa/followers?page=1', 'First page link on third page'; is $result->prev_page_uri, 'https://api.github.com/users/miyagawa/followers?page=2', 'First page link no third page'; is $result->next_page_uri, 'https://api.github.com/users/miyagawa/followers?page=4', 'Next page link no third page'; is $result->last_page_uri, 'https://api.github.com/users/miyagawa/followers?page=26', 'Last page link no third page'; uri_is $result->first_page->request->uri, 'https://api.github.com/users/miyagawa/followers?page=1&per_page=100', 'First page call'; uri_is $result->prev_page->request->uri, 'https://api.github.com/users/miyagawa/followers?page=2&per_page=100', 'Prev page call'; uri_is $result->next_page->request->uri, 'https://api.github.com/users/miyagawa/followers?page=4&per_page=100', 'Next page call'; uri_is $result->last_page->request->uri, 'https://api.github.com/users/miyagawa/followers?page=26&per_page=100', 'Last page call'; } { my $p = Pithub::Test::Factory->create('Pithub'); $p->ua->add_response('users/miyagawa/followers.GET'); $p->ua->add_response('users/miyagawa/followers.GET.page-26'); my $result = $p->users->followers->list( user => 'miyagawa' )->get_page(26); uri_is $result->first_page->request->uri, 'https://api.github.com/users/miyagawa/followers?page=1&per_page=100', 'First page call'; uri_is $result->prev_page->request->uri, 'https://api.github.com/users/miyagawa/followers?page=25&per_page=100', 'Prev page call'; is $result->next_page, undef, 'No next page on the last page'; is $result->last_page, undef, 'We are on last page already'; uri_is $result->get_page(42)->request->uri, 'https://api.github.com/users/miyagawa/followers?page=42&per_page=100', 'URI for get_page is generated, no matter if it exists or not'; } { my $p = Pithub::Test::Factory->create( 'Pithub', per_page => 1 ); $p->ua->add_response('users/miyagawa/followers.GET.per_page-1'); my $result = $p->users->followers->list( user => 'miyagawa' ); eq_or_diff { $result->next_page->request->uri->query_form }, { page => 2, per_page => 1 }, 'Next page call'; eq_or_diff { $result->last_page->request->uri->query_form }, { page => 769, per_page => 1 }, 'Last page call'; is $result->prev_page, undef, 'No prev page on the first page'; is $result->first_page, undef, 'We are on first page already'; eq_or_diff { $result->get_page(42)->request->uri->query_form }, { page => 42, per_page => 1 }, 'URI for get_page is generated, no matter if it exists or not'; } { my $p = Pithub::Test::Factory->create('Pithub'); $p->ua->add_response('users/plu.GET'); my $result = $p->users->get( user => 'plu' ); is $result->first_page, undef, 'First page call'; is $result->prev_page, undef, 'Prev page call'; is $result->next_page, undef, 'No next page on the last page'; is $result->last_page, undef, 'We are on last page already'; is $result->get_page(1), undef, 'No page 1'; is $result->count, 1, 'Count accessor'; } { my $p = Pithub::Test::Factory->create( 'Pithub', jsonp_callback => 'foo' ); my $result = $p->request( method => 'GET', path => '/foo' ); eq_or_diff { $result->request->uri->query_form }, { callback => 'foo', per_page => 100 }, 'The callback parameter was set'; } { my $p = Pithub::Test::Factory->create('Pithub'); $p->ua->add_response('orgs/CPAN-API/repos.GET'); my $result = $p->request( method => 'GET', path => '/orgs/CPAN-API/repos' ); my @expectations = ( 'https://github.com/CPAN-API/cpan-api', 'https://github.com/CPAN-API/search-metacpan-org', 'https://github.com/CPAN-API/cpanvote-server', 'https://github.com/CPAN-API/cpanvote-db', 'https://github.com/CPAN-API/metacpan-web', ); is $result->first->{html_url}, $expectations[0], 'Accesor first on an arrayref content'; while ( my $row = $result->next ) { is $row->{html_url}, shift(@expectations), 'Iterator next'; } is scalar(@expectations), 0, 'Consumed all rows'; } { my $p = Pithub::Test::Factory->create('Pithub'); $p->ua->add_response('users/plu.GET'); my $result = $p->request( method => 'GET', path => '/users/plu' ); my $row = $result->next; is $row->{id}, 31597, 'Row data found'; eq_or_diff $result->first, $row, 'Accessor first on a hashref content'; is $result->next, undef, 'There is only one record'; } { my $p = Pithub::Test::Factory->create( 'Pithub', per_page => 15 ); $p->ua->add_response('users/plu/followers.GET.per_page-15'); $p->ua->add_response('users/plu/followers.GET.page-2.per_page-15'); $p->ua->add_response('users/plu/followers.GET.page-3.per_page-15'); $p->ua->add_response('users/plu/followers.GET.page-4.per_page-15'); my $result = $p->users->followers->list( user => 'plu' ); $result->auto_pagination(1); my @followers = (); while ( my $row = $result->next ) { push @followers, $row; } is scalar(@followers), 54, 'Automatically paginate through four pages'; } { my $p = Pithub::Test::Factory->create( 'Pithub', per_page => 15, auto_pagination => 1 ); $p->ua->add_response('users/plu/followers.GET.per_page-15'); $p->ua->add_response('users/plu/followers.GET.page-2.per_page-15'); $p->ua->add_response('users/plu/followers.GET.page-3.per_page-15'); $p->ua->add_response('users/plu/followers.GET.page-4.per_page-15'); my $result = $p->users->followers->list( user => 'plu' ); my @followers = (); while ( my $row = $result->next ) { push @followers, $row; } is scalar(@followers), 54, 'Automatically paginate through four pages'; } { my $p = Pithub::Test::Factory->create( 'Pithub', prepare_request => sub { my ($request) = @_; $request->header( Accept => 'anything' ); } ); my $result = $p->users->followers->list( user => 'plu' ); is $result->request->header('Accept'), 'anything', 'The request header got set using global prepare_request'; } { my $p = Pithub::Test::Factory->create('Pithub'); my $result = $p->users->followers->list( user => 'plu', options => { prepare_request => sub { my ($request) = @_; $request->header( Accept => 'foobar' ); } } ); is $result->request->header('Accept'), 'foobar', 'The request header got set via the method call'; } { my $p = Pithub::Test::Factory->create('Pithub'); throws_ok { $p->users->get( user => 'foo', params => 5 ); } qr{The key params must be a hashref}, 'The params key must be a hashref'; my $result = $p->users->get( user => 'foo', params => { direction => 'asc' } ); my %query = $result->request->uri->query_form; eq_or_diff \%query, { direction => 'asc', per_page => 100 }, 'The params were set'; } subtest '_create_instance passes attributes' => sub { my $p = Pithub::Test::Factory->create( 'Pithub', per_page => 10 ); is $p->repos->per_page, 10; is $p->repos( per_page => 5 )->per_page, 5; is $p->issues->comments( per_page => 3 )->per_page, 3; is $p->repos( per_page => undef )->per_page, undef, 'undef is allowed'; }; done_testing; Pithub-0.01042/t/encoding.t0000755000175000017500000000537315014062322013763 0ustar olafolaf#!/usr/bin/env perl use strict; use warnings; use JSON::MaybeXS qw( JSON ); use Pithub (); use Pithub::Users (); use Test::Differences qw( eq_or_diff ); use Test::More import => [qw( done_testing is isa_ok like ok )]; use lib 't/lib'; use Pithub::Test::Factory (); { my $obj = Pithub::Test::Factory->create('Pithub::Users'); ok $obj->utf8, 'enabled en/decoding json'; $obj->ua->add_response('users/rwstauner.GET'); isa_ok $obj, 'Pithub::Users'; { my $result = $obj->get( user => 'rwstauner' ); ok $result->utf8, 'enabled en/decoding json'; my $string = $result->content->{bio}; is $string, "\x{26F0}", 'Attribute exists'; ok utf8::is_utf8($string), 'field is a character string'; utf8::encode($string); ok !utf8::is_utf8($string), 'encoded to a byte string'; is $string, "\xe2\x9b\xb0", 'string encodes to utf-8'; } } { my $json = JSON->new->utf8; my $p = Pithub::Test::Factory->create('Pithub'); ok $p->utf8, 'enabled en/decoding json'; $p->token('123'); my $request = $p->request( method => 'POST', path => '/foo', data => { some => "bullet \x{2022}" } )->request; like $request->content, qr/bullet \xe2\x80\xa2/, 'character string utf-8 encoded in request'; eq_or_diff $json->decode( $request->content ), { some => "bullet \x{2022}" }, 'character strings preserved in json round-trip'; } { my $obj = Pithub::Test::Factory->create( 'Pithub::Users', utf8 => 0 ) ; # disable en/decoding ok !$obj->utf8, 'disabled en/decoding json'; $obj->ua->add_response('users/rwstauner.GET'); isa_ok $obj, 'Pithub::Users'; { my $result = $obj->get( user => 'rwstauner' ); ok !$result->utf8, 'disabled en/decoding json'; my $string = $result->content->{bio}; is $string, "\xe2\x9b\xb0", 'Attribute exists'; ok utf8::is_utf8($string), 'field is a character string'; utf8::decode($string); ok utf8::is_utf8($string), 'decoded to a wide character'; is $string, "\x{26F0}", 'string decodes to a wide character'; } } { my $json = JSON->new; my $p = Pithub::Test::Factory->create( 'Pithub', utf8 => 0 ) ; # disable en/decoding ok !$p->utf8, 'disabled en/decoding json'; $p->token('123'); my $request = $p->request( method => 'POST', path => '/foo', data => { some => "bullet \xe2\x80\xa2" } )->request; like $request->content, qr/bullet \xe2\x80\xa2/, 'character string utf-8 encoded in request'; eq_or_diff $json->decode( $request->content ), { some => "bullet \xe2\x80\xa2" }, 'character strings preserved in json round-trip'; } done_testing; Pithub-0.01042/t/repos.t0000755000175000017500000013415015014062322013321 0ustar olafolaf#!perl use strict; use warnings; use JSON::MaybeXS qw( JSON ); use lib 't/lib'; use Pithub::Test qw( uri_is ); use Pithub::Test::Factory (); BEGIN { use_ok('Pithub::Repos'); use_ok('Pithub::Repos::Actions'); use_ok('Pithub::Repos::Collaborators'); use_ok('Pithub::Repos::Commits'); use_ok('Pithub::Repos::Downloads'); use_ok('Pithub::Repos::Forks'); use_ok('Pithub::Repos::Hooks'); use_ok('Pithub::Repos::Keys'); use_ok('Pithub::Repos::Releases'); use_ok('Pithub::Repos::Releases::Assets'); use_ok('Pithub::Repos::Starring'); use_ok('Pithub::Repos::Stats'); use_ok('Pithub::Repos::Statuses'); use_ok('Pithub::Repos::Watching'); } # Pithub::Repos->create { my $obj = Pithub::Test::Factory->create('Pithub::Repos'); isa_ok $obj, 'Pithub::Repos'; throws_ok { $obj->create( data => 5 ) } qr{Missing key in parameters: data \(hashref\)}, 'Wrong data parameter'; throws_ok { $obj->create( data => { foo => 1 } ) } qr{Access token required for: POST /user/repos}, 'Token required'; throws_ok { $obj->create( org => 'foo', data => { foo => 1 } ) } qr{Access token required for: POST /orgs/foo/repos}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->create( data => { foo => 1 } ); is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/user/repos', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'foo' => 1 }, 'HTTP body'; } { my $json = JSON->new; my $result = $obj->create( org => 'foobarorg', data => { bar => 1 } ); is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/orgs/foobarorg/repos', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'bar' => 1 }, 'HTTP body'; } } subtest 'Pithub::Repos->delete' => sub { my $obj = Pithub::Test::Factory->create('Pithub::Repos'); throws_ok { $obj->delete } qr{^Missing key in parameters: user}; throws_ok { $obj->delete( user => 'foobarorg' ); } qr{^Missing key in parameters: repo}; throws_ok { $obj->delete( user => 'foobarorg', repo => 'blahblah' ); } qr{^Access token required for: DELETE /repos/foobarorg/blahblah}; $obj->token(123); my $result = $obj->delete( user => 'foobarorg', repo => 'blahblah' ); is $result->request->method, 'DELETE'; uri_is $result->request->uri, 'https://api.github.com/repos/foobarorg/blahblah?per_page=100'; }; # Pithub::Repos->get { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos'; { my $result = $obj->get; is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } subtest 'Pithub::Repos->branch' => sub { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos'; subtest 'too few arguments' => sub { throws_ok { $obj->branch } qr/^Missing key in parameters: branch/; }; subtest 'basic get branch' => sub { my $result = $obj->branch( branch => 'master' ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/branches/master', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; }; }; # Pithub::Repos::Branches->rename { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos'; { my $result = $obj->rename_branch( branch => 'old', data => { new_name => 'new' } ); is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/branches/old/rename', 'HTTP path'; } } # Pithub::Repos::Branches->merge { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos'; { my $result = $obj->merge_branch( data => { base => 'base', head => 'head' } ); is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/merges', 'HTTP path'; } } # Pithub::Repos->list { my $obj = Pithub::Test::Factory->create('Pithub::Repos'); $obj->ua->add_response('users/plu/repos.GET'); $obj->ua->add_response('orgs/CPAN-API/repos.GET'); isa_ok $obj, 'Pithub::Repos'; throws_ok { $obj->list } qr{Access token required for: GET /user/repos}, 'Token required'; { my $result = $obj->list( user => 'plu' ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/users/plu/repos', 'HTTP path'; is $result->code, 200, 'HTTP status'; is $result->success, 1, 'Successful'; is $result->content->[0]{clone_url}, 'https://github.com/plu/poe-component-irc-plugin-blowfish.git', 'Attribute exists: clone_url'; is $result->content->[1]{clone_url}, 'https://github.com/plu/efa-wdgt-common.git', 'Attribute exists: clone_url'; is $result->content->[0]{owner}{login}, 'plu', 'Attribute exists: owner.login'; is $result->content->[1]{owner}{login}, 'plu', 'Attribute exists: owner.login'; } { my $result = $obj->list( org => 'CPAN-API' ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/orgs/CPAN-API/repos', 'HTTP path'; is $result->code, 200, 'HTTP status is 200'; is $result->success, 1, 'Successful'; is $result->content->[0]{git_url}, 'git://github.com/CPAN-API/cpan-api.git', 'Attribute exists: git_url'; is $result->content->[1]{git_url}, 'git://github.com/CPAN-API/search-metacpan-org.git', 'Attribute exists: git_url'; is $result->content->[0]{owner}{id}, 460239, 'Attribute exists: owner.id'; is $result->content->[1]{owner}{id}, 460239, 'Attribute exists: owner.id'; } { $obj->token(123); my $result = $obj->list; is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/user/repos', 'HTTP path'; } } # Pithub::Repos->markdown { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos', user => 'foo', repo => 'bar' ); { my $md = $obj->markdown; is $md->mode, 'gfm', 'Markdown sets default mode to gfm'; is $md->context, 'foo/bar', 'Markdown sets default context to repo'; } } # Pithub::Repos->update { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos'; throws_ok { $obj->update( data => 5 ) } qr{Missing key in parameters: data \(hashref\)}, 'Wrong data parameter'; throws_ok { $obj->update( data => { foo => 1 } ) } qr{Access token required for: PATCH /repos/foo/bar}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->update( user => 'bla', repo => 'fasel', data => { foo => 1 } ); is $result->request->method, 'PATCH', 'HTTP method'; is $result->request->uri->path, '/repos/bla/fasel', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'foo' => 1 }, 'HTTP body'; } } # Pithub::Repos::Collaborators->add { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Collaborators', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Collaborators'; throws_ok { $obj->add } qr{Missing key in parameters: collaborator}, 'No parameters'; throws_ok { $obj->add( collaborator => 'somebody' ) } qr{Access token required for: PUT /repos/foo/bar/collaborators/somebody}, 'Token required'; ok $obj->token(123), 'Token set'; my $result = $obj->add( collaborator => 'somebody' ); is $result->request->method, 'PUT', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/collaborators/somebody', 'HTTP path'; } # Pithub::Repos::Collaborators->is_collaborator { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Collaborators', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Collaborators'; throws_ok { $obj->is_collaborator } qr{Missing key in parameters: collaborator}, 'No parameters'; throws_ok { $obj->is_collaborator( collaborator => 'somebody' ) } qr{Access token required for: GET /repos/foo/bar/collaborators/somebody}, 'Token required'; ok $obj->token(123), 'Token set'; my $result = $obj->is_collaborator( collaborator => 'somebody' ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/collaborators/somebody', 'HTTP path'; } # Pithub::Repos::Collaborators->remove { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Collaborators', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Collaborators'; throws_ok { $obj->remove } qr{Missing key in parameters: collaborator}, 'No parameters'; throws_ok { $obj->remove( collaborator => 'somebody' ) } qr{Access token required for: DELETE /repos/foo/bar/collaborators/somebody}, 'Token required'; ok $obj->token(123), 'Token set'; my $result = $obj->remove( collaborator => 'somebody' ); is $result->request->method, 'DELETE', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/collaborators/somebody', 'HTTP path'; } # Pithub::Repos::Commits->compare { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Commits', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Commits'; throws_ok { $obj->compare } qr{Missing key in parameters: base}, 'No parameters'; throws_ok { $obj->compare( base => 'from' ) } qr{Missing key in parameters: head}, 'Not enough parameters'; { my $result = $obj->compare( base => 'from', head => 'to' ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/compare/from...to', 'HTTP path'; } } # Pithub::Repos::Commits->create_comment { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Commits', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Commits'; throws_ok { $obj->create_comment } qr{Missing key in parameters: sha}, 'No parameters'; throws_ok { $obj->create_comment( sha => 123 ) } qr{Missing key in parameters: data \(hashref\)}, 'No data parameter'; throws_ok { $obj->create_comment( sha => 123, data => 5 ) } qr{Missing key in parameters: data \(hashref\)}, 'Wrong type'; throws_ok { $obj->create_comment( sha => 123, data => { foo => 'bar' } ); } qr{Access token required for: POST /repos/foo/bar/commits/123/comments}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->create_comment( sha => 123, data => { body => 'some comment' } ); is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/commits/123/comments', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'body' => 'some comment' }, 'HTTP body'; } } # Pithub::Repos::Commits->delete_comment { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Commits', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Commits'; throws_ok { $obj->delete_comment } qr{Missing key in parameters: comment_id}, 'No parameters'; throws_ok { $obj->delete_comment( comment_id => 123 ) } qr{Access token required for: DELETE /repos/foo/bar/comments/123}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->delete_comment( comment_id => 123 ); is $result->request->method, 'DELETE', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/comments/123', 'HTTP path'; } } # Pithub::Repos::Commits->get { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Commits', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Commits'; throws_ok { $obj->get } qr{Missing key in parameters: sha}, 'No parameters'; { my $result = $obj->get( sha => 123 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/commits/123', 'HTTP path'; } } # Pithub::Repos::Commits->get_comment { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Commits', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Commits'; throws_ok { $obj->get_comment } qr{Missing key in parameters: comment_id}, 'No parameters'; { my $result = $obj->get_comment( comment_id => 123 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/comments/123', 'HTTP path'; } } # Pithub::Repos::Commits->list_comments { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Commits', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Commits'; { my $result = $obj->list_comments; is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/comments', 'HTTP path'; } { my $result = $obj->list_comments( sha => 123 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/commits/123/comments', 'HTTP path'; } } # Pithub::Repos::Commits->update_comment { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Commits', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Commits'; throws_ok { $obj->update_comment } qr{Missing key in parameters: comment_id}, 'No parameters'; throws_ok { $obj->update_comment( comment_id => 123 ) } qr{Missing key in parameters: data \(hashref\)}, 'No data parameter'; throws_ok { $obj->update_comment( comment_id => 123, data => 5 ) } qr{Missing key in parameters: data \(hashref\)}, 'Wrong type'; throws_ok { $obj->update_comment( comment_id => 123, data => { foo => 'bar' } ) } qr{Access token required for: PATCH /repos/foo/bar/comments/123}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->update_comment( comment_id => 123, data => { body => 'some comment' } ); is $result->request->method, 'PATCH', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/comments/123', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'body' => 'some comment' }, 'HTTP body'; } } # Pithub::Repos::Contents->archive { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Contents', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Contents'; throws_ok { $obj->archive } qr{Missing key in parameters: archive_format}, 'No parameters'; throws_ok { $obj->archive( archive_format => 'foo' ) } qr{Invalid archive_format. Valid formats: tarball, zipball}, 'No parameters'; for my $format (qw(tarball zipball)) { my $result = $obj->archive( archive_format => $format ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, "/repos/foo/bar/$format", 'HTTP path'; } } # Pithub::Repos::Contents->get { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Contents', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Contents'; { my $result = $obj->get( params => { ref => 'bla' } ); is $result->request->method, 'GET', 'HTTP method'; uri_is $result->request->uri, 'https://api.github.com/repos/foo/bar/contents?ref=bla&per_page=100'; } { my $result = $obj->get( path => 'bla/fasel/file.pm', params => { ref => 'bla' } ); is $result->request->method, 'GET', 'HTTP method'; uri_is $result->request->uri, 'https://api.github.com/repos/foo/bar/contents/bla/fasel/file.pm?ref=bla&per_page=100'; } } # Pithub::Repos::Contents->readme { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Contents', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Contents'; { my $result = $obj->readme( params => { ref => 'bla' } ); is $result->request->method, 'GET', 'HTTP method'; uri_is $result->request->uri, 'https://api.github.com/repos/foo/bar/readme?ref=bla&per_page=100'; } } # Pithub::Repos::Downloads->create { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Downloads', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Downloads'; throws_ok { $obj->create( data => 123 ) } qr{Missing key in parameters: data \(hashref\)}, 'No parameters'; throws_ok { $obj->create( data => { foo => 'bar' } ) } qr{Access token required for: POST /repos/foo/bar/downloads\s+}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->create( user => 'foo', repo => 'bar', data => { name => 'new_file.jpg', size => 114034, description => 'Latest release', content_type => 'text/plain', }, ); is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/downloads', 'HTTP path'; } } # Pithub::Repos::Downloads->delete { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Downloads', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Downloads'; throws_ok { $obj->delete } qr{Missing key in parameters: download_id}, 'No parameters'; throws_ok { $obj->delete( download_id => 123 ) } qr{Access token required for: DELETE /repos/foo/bar/downloads/123}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->delete( download_id => 123 ); is $result->request->method, 'DELETE', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/downloads/123', 'HTTP path'; } } # Pithub::Repos::Downloads->get { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Downloads', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Downloads'; throws_ok { $obj->get } qr{Missing key in parameters: download_id}, 'No parameters'; { my $result = $obj->get( download_id => 123 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/downloads/123', 'HTTP path'; } } # Pithub::Repos::Downloads->upload { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Downloads', user => 'foo', repo => 'bar' ); $obj->ua->add_response('repos/foo/bar/downloads.POST'); isa_ok $obj, 'Pithub::Repos::Downloads'; ok $obj->token(123), 'Token set'; my $result = $obj->create( user => 'foo', repo => 'bar', data => { name => 'new_file.jpg', size => 114034, description => 'Latest release', content_type => 'text/plain', }, ); throws_ok { $obj->upload( result => 123 ) } qr{Missing key in parameters: result \(Pithub::Result object\)}, 'No parameters'; throws_ok { $obj->upload( result => $result ) } qr{Missing key in parameters: file}, 'No file parameter'; my $response = $obj->upload( result => $result, file => __FILE__ ); my $request = $response->request; isa_ok $response, 'HTTP::Response'; isa_ok $request, 'HTTP::Request'; is $request->uri, 'https://github.s3.amazonaws.com/', 'Amazon S3 API URI'; is $request->method, 'POST', 'HTTP method for Amazon S3 API call'; delete $result->content->{path}; throws_ok { $obj->upload( result => $result, file => __FILE__ ) } qr{Missing key in Pithub::Result content: path}, 'Missing key in Pithub::Result'; } # Pithub::Repos::Forks->create { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Forks', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Forks'; throws_ok { $obj->create } qr{POST /repos/foo/bar/forks}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->create; is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/forks', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } { my $json = JSON->new; my $result = $obj->create( org => 'foobarorg' ); is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/forks', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'organization' => 'foobarorg' }, 'HTTP body'; } } # Pithub::Repos::Keys->create { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Keys', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Keys'; throws_ok { $obj->create } qr{Missing key in parameters: data \(hashref\)}, 'No parameters'; throws_ok { $obj->create( data => { title => 'some key' } ); } qr{Access token required for: POST /repos/foo/bar/keys}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->create( data => { title => 'some key' } ); is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/keys', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'title' => 'some key' }, 'HTTP body'; } } # Pithub::Repos::Keys->delete { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Keys', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Keys'; throws_ok { $obj->delete } qr{Missing key in parameters: key_id}, 'No parameters'; throws_ok { $obj->delete( key_id => 123 ); } qr{Access token required for: DELETE /repos/foo/bar/keys/123}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->delete( key_id => 123 ); is $result->request->method, 'DELETE', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/keys/123', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Repos::Keys->get { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Keys', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Keys'; throws_ok { $obj->get } qr{Missing key in parameters: key_id}, 'No parameters'; throws_ok { $obj->get( key_id => 123 ); } qr{Access token required for: GET /repos/foo/bar/keys/123}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->get( key_id => 123 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/keys/123', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Repos::Releases->list { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Releases', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Releases'; { my $result = $obj->list; is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/releases', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Repos::Releases->get { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Releases', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Releases'; throws_ok { $obj->get } qr{Missing key in parameters: release_id}, 'No parameters'; { my $result = $obj->get( release_id => 1 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/releases/1', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Repos::Releases->create { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Releases', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Releases'; throws_ok { $obj->create } qr{Missing key in parameters: data \(hashref\)}, 'No data parameter'; throws_ok { $obj->create( data => { foo => 'bar' } ); } qr{Access token required for: POST /repos/foo/bar/releases}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->create( data => { tag_name => 'foo' } ); is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/releases', 'HTTP path'; my $http_request = $result->request; my $json = JSON->new; eq_or_diff $json->decode( $http_request->content ), { tag_name => 'foo' }, 'HTTP body'; } } # Pithub::Repos::Releases->update { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Releases', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Releases'; throws_ok { $obj->update } qr{Missing key in parameters: release_id}, 'No parameters'; throws_ok { $obj->update( release_id => 1 ) } qr{Missing key in parameters: data \(hashref\)}, 'No data parameter'; throws_ok { $obj->update( release_id => 1, data => { foo => 'bar' } ); } qr{Access token required for: PATCH /repos/foo/bar/releases/1}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->update( release_id => 1, data => { tag_name => 'foo' } ); is $result->request->method, 'PATCH', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/releases/1', 'HTTP path'; my $http_request = $result->request; my $json = JSON->new; eq_or_diff $json->decode( $http_request->content ), { tag_name => 'foo' }, 'HTTP body'; } } # Pithub::Repos::Releases->delete { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Releases', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Releases'; throws_ok { $obj->delete } qr{Missing key in parameters: release_id}, 'No parameters'; throws_ok { $obj->delete( release_id => 1 ); } qr{Access token required for: DELETE /repos/foo/bar/releases/1}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->delete( release_id => 1 ); is $result->request->method, 'DELETE', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/releases/1', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Repos::Releases::Assets->create { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Releases::Assets', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Releases::Assets'; throws_ok { $obj->create } qr{Missing key in parameters: name}, 'No parameters'; throws_ok { $obj->create( name => 'foo' ) } qr{Missing key in parameters: release_id}, 'No release_id parameter'; throws_ok { $obj->create( name => 'foo', release_id => 1 ) } qr{Missing key in parameters: data}, 'No data parameter'; throws_ok { $obj->create( name => 'foo', release_id => 1, data => 'data' ) } qr{Missing key in parameters: content_type}, 'No content_type parameter'; throws_ok { $obj->create( name => 'foo', release_id => 1, data => 'data', content_type => 'text/plain' ) } qr{Access token required for: POST /repos/foo/bar/releases/1/assets}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->create( release_id => 1, name => 'foo', data => 'data', content_type => 'text/plain' ); is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/releases/1/assets', 'HTTP path'; is $result->request->uri->host, 'uploads.github.com', 'HTTP host'; is $result->request->uri->query, 'per_page=100&name=foo', 'HTTP query'; is $result->request->content, 'data', 'HTTP body'; is $result->request->header('Content-Type'), 'text/plain', 'HTTP content type header'; } } # Pithub::Repos::Releases::Assets->delete { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Releases::Assets', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Releases::Assets'; throws_ok { $obj->delete } qr{Missing key in parameters: asset_id}, 'No parameters'; throws_ok { $obj->delete( asset_id => 1 ); } qr{Access token required for: DELETE /repos/foo/bar/releases/assets/1}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->delete( asset_id => 1 ); is $result->request->method, 'DELETE', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/releases/assets/1', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Repos::Releases::Assets->get { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Releases::Assets', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Releases::Assets'; throws_ok { $obj->get } qr{Missing key in parameters: asset_id}, 'No parameters'; isa_ok $obj, 'Pithub::Repos::Releases::Assets'; { my $result = $obj->get( asset_id => 51 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/releases/assets/51', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Repos::Releases::Assets->list { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Releases::Assets', user => 'foo', repo => 'bar' ); throws_ok { $obj->list } qr{Missing key in parameters: release_id}, 'No parameters'; isa_ok $obj, 'Pithub::Repos::Releases::Assets'; { my $result = $obj->list( release_id => 51 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/releases/51/assets', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Repos::Releases::Assets->update { my $json = JSON->new; my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Releases::Assets', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Releases::Assets'; throws_ok { $obj->update } qr{Missing key in parameters: asset_id}, 'No parameters'; throws_ok { $obj->update( asset_id => 1 ) } qr{Missing key in parameters: data}, 'No data parameter'; throws_ok { $obj->update( asset_id => 1, data => {} ) } qr{Access token required for: PATCH /repos/foo/bar/releases/assets/1}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->update( asset_id => 1, data => { name => 'foo', label => 'bar' } ); is $result->request->method, 'PATCH', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/releases/assets/1', 'HTTP path'; eq_or_diff $json->decode( $result->request->content ), { name => 'foo', label => 'bar', }, 'HTTP body'; } } # Pithub::Repos::Starring->has_watching { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Starring', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Starring'; throws_ok { $obj->has_starred } qr{Access token required for: GET /user/starred/foo/bar}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->has_starred; is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/user/starred/foo/bar', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Repos::Starring->list_repos { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Starring', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Starring'; { my $result = $obj->list_repos( user => 'bla' ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/users/bla/starred', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } { ok $obj->token(123), 'Token set'; my $result = $obj->list_repos; is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/user/starred', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Repos::Starring->star { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Starring', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Starring'; throws_ok { $obj->star } qr{Access token required for: PUT /user/starred/foo/bar}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->star; is $result->request->method, 'PUT', 'HTTP method'; is $result->request->uri->path, '/user/starred/foo/bar', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Repos::Starring->unstar { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Starring', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Starring'; throws_ok { $obj->unstar } qr{Access token required for: DELETE /user/starred/foo/bar}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->unstar; is $result->request->method, 'DELETE', 'HTTP method'; is $result->request->uri->path, '/user/starred/foo/bar', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Repos::Watching->is_watching { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Watching', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Watching'; throws_ok { $obj->is_watching } qr{Access token required for: GET /user/watched/foo/bar}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->is_watching; is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/user/watched/foo/bar', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Repos::Watching->list_repos { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Watching', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Watching'; throws_ok { $obj->list_repos } qr{Access token required for: GET /user/watched}, 'Token required'; { my $result = $obj->list_repos( user => 'bla' ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/users/bla/watched', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } { ok $obj->token(123), 'Token set'; my $result = $obj->list_repos; is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/user/watched', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Repos::Watching->start_watching { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Watching', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Watching'; throws_ok { $obj->start_watching } qr{Access token required for: PUT /user/watched/foo/bar}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->start_watching; is $result->request->method, 'PUT', 'HTTP method'; is $result->request->uri->path, '/user/watched/foo/bar', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Repos::Watching->stop_watching { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Watching', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Watching'; throws_ok { $obj->stop_watching } qr{Access token required for: DELETE /user/watched/foo/bar}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->stop_watching; is $result->request->method, 'DELETE', 'HTTP method'; is $result->request->uri->path, '/user/watched/foo/bar', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Repos::Hooks->list { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Hooks', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Hooks'; throws_ok { $obj->list } qr{Access token required for: GET /repos/foo/bar/hooks}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->list( user => 'plu' ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/plu/bar/hooks', 'HTTP path'; } } # Pithub::Repos::Hooks->get { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Hooks', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Hooks'; throws_ok { $obj->get } qr{Missing key in parameters: hook_id}, 'No parameters'; throws_ok { $obj->get( hook_id => 5 ) } qr{Access token required for: GET /repos/foo/bar/hooks/5}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->get( hook_id => 123 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/hooks/123', 'HTTP path'; } } # Pithub::Repos::Hooks->delete { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Hooks', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Hooks'; throws_ok { $obj->delete } qr{Missing key in parameters: hook_id}, 'No parameters'; throws_ok { $obj->delete( hook_id => 5 ) } qr{Access token required for: DELETE /repos/foo/bar/hooks/5}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->delete( hook_id => 123 ); is $result->request->method, 'DELETE', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/hooks/123', 'HTTP path'; } } # Pithub::Repos::Hooks->test { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Hooks', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Hooks'; throws_ok { $obj->test } qr{Missing key in parameters: hook_id}, 'No parameters'; throws_ok { $obj->test( hook_id => 5 ) } qr{Access token required for: POST /repos/foo/bar/hooks/5/test}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->test( hook_id => 123 ); is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/hooks/123/test', 'HTTP path'; } } # Pithub::Repos::Hooks->create { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Hooks', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Hooks'; throws_ok { $obj->create } qr{Missing key in parameters: data \(hashref\)}, 'No data parameter'; throws_ok { $obj->create( data => 5 ) } qr{Missing key in parameters: data \(hashref\)}, 'Wrong type'; throws_ok { $obj->create( data => { name => 'web' } ); } qr{Access token required for: POST /repos/foo/bar/hooks}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->create( data => { name => 'web' } ); is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/hooks', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'name' => 'web' }, 'HTTP body'; } } # Pithub::Repos::Hooks->update { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Hooks', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Hooks'; throws_ok { $obj->update } qr{Missing key in parameters: hook_id}, 'No parameters'; throws_ok { $obj->update( hook_id => 123 ) } qr{Missing key in parameters: data \(hashref\)}, 'No data parameter'; throws_ok { $obj->update( hook_id => 123, data => 5 ) } qr{Missing key in parameters: data \(hashref\)}, 'Wrong type'; throws_ok { $obj->update( hook_id => 123, data => { name => 'irc' } ); } qr{Access token required for: PATCH /repos/foo/bar/hooks/123}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->update( hook_id => 123, data => { name => 'irc' } ); is $result->request->method, 'PATCH', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/hooks/123', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'name' => 'irc' }, 'HTTP body'; } } # Pithub::Repos::Stats->contributors { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Stats', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Stats'; { my $result = $obj->contributors; is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/stats/contributors', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Repos::Statuses->list # # Pithub::Repos::Statuses->create # { my $obj = Pithub::Test::Factory->create( 'Pithub::Repos::Statuses', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Repos::Statuses'; { my $result = $obj->list( ref => 'abcdef' ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/statuses/abcdef', 'HTTP Path'; is $result->request->content, q{}, 'HTTP body'; } { my $json = JSON->new; my $result = $obj->create( sha => '0123456', data => { state => 'error', description => 'testing' }, ); is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/statuses/0123456', 'HTTP path'; eq_or_diff $json->decode( $result->request->content ), { 'description' => 'testing', 'state' => 'error' }, 'HTTP body'; } } subtest actions => sub { my $repos = Pithub::Test::Factory->create( Pithub::Repos::, user => 'foo', repo => 'bar', ); isa_ok( $repos, 'Pithub::Repos', 'repos' ); my $actions = $repos->actions; isa_ok( $actions, 'Pithub::Repos::Actions', 'actions' ); my $workflows = $actions->workflows(); isa_ok( $workflows, 'Pithub::Repos::Actions::Workflows', 'workflows' ); throws_ok { $workflows->get() } qr{Missing key in parameters: workflow_id}, 'Missing workflow_id parameter'; }; done_testing; Pithub-0.01042/t/events.t0000755000175000017500000000536415014062322013501 0ustar olafolaf#!perl use strict; use warnings; use Pithub::Events (); use Test::Exception; # throws_ok use Test::Most import => [qw( done_testing is isa_ok ok )]; use lib 't/lib'; use Pithub::Test::Factory (); { my $obj = Pithub::Test::Factory->create( 'Pithub::Events', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Events'; throws_ok { $obj->org_for_user( user => 'foo', org => 'bar' ) } qr{Access token required for: GET /users/foo/events/orgs/bar\s+}, 'Token required'; ok $obj->token(123), 'Token set'; throws_ok { $obj->org } qr{Missing key in parameters: org}, 'No parameters'; throws_ok { $obj->org_for_user } qr{Missing key in parameters: org}, 'No parameters'; throws_ok { $obj->org_for_user( org => 'foo' ) } qr{Missing key in parameters: user}, 'No parameters'; throws_ok { $obj->user_performed } qr{Missing key in parameters: user}, 'No parameters'; throws_ok { $obj->user_received } qr{Missing key in parameters: user}, 'No parameters'; my @tests = ( { method => 'issue', path => '/repos/foo/bar/issues/events', }, { method => 'network', path => '/networks/foo/bar/events', }, { method => 'public', path => '/events', }, { method => 'repos', path => '/repos/foo/bar/events', }, { method => 'org', params => [ org => 'some-org' ], path => '/orgs/some-org/events', }, { method => 'org_for_user', params => [ org => 'some-org', user => 'some-user' ], path => '/users/some-user/events/orgs/some-org', }, { method => 'user_performed', params => [ user => 'some-user' ], path => '/users/some-user/events', }, { method => 'user_received', params => [ user => 'some-user' ], path => '/users/some-user/received_events', }, ); foreach my $test (@tests) { my $method = $test->{method}; my $path = $test->{path}; my @params = @{ $test->{params} || [] }; my $result = $obj->$method(@params); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, $path, 'HTTP path'; is $result->request->content, q{}, 'HTTP body'; } is $obj->user_performed( user => 'foo', public => 1 )->request->uri->path, '/users/foo/events/public', 'HTTP path'; is $obj->user_received( user => 'foo', public => 1 )->request->uri->path, '/users/foo/received_events/public', 'HTTP path'; } done_testing; Pithub-0.01042/t/pull_requests.t0000755000175000017500000003355215014062322015104 0ustar olafolaf#!perl use strict; use warnings; use JSON::MaybeXS qw( JSON ); use Pithub::PullRequests (); use Test::Differences qw( eq_or_diff ); use Test::Exception; # throws_ok use Test::More import => [qw( done_testing is isa_ok ok )]; use lib 't/lib'; use Pithub::Test::Factory (); # Pithub::PullRequests->commits { my $obj = Pithub::Test::Factory->create( 'Pithub::PullRequests', user => 'foo', repo => 'bar' ); throws_ok { $obj->commits } qr{Missing key in parameters: pull_request_id}, 'No parameters'; isa_ok $obj, 'Pithub::PullRequests'; { my $result = $obj->commits( pull_request_id => 1 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/pulls/1/commits', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::PullRequests->create { my $obj = Pithub::Test::Factory->create( 'Pithub::PullRequests', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::PullRequests'; throws_ok { $obj->create } qr{Missing key in parameters: data \(hashref\)}, 'No data parameter'; throws_ok { $obj->create( data => { foo => 'bar' } ); } qr{Access token required for: POST /repos/foo/bar/pulls}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->create( data => { base => 'master', body => 'Please pull this in!', head => 'octocat:new-feature', title => 'Amazing new feature', } ); is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/pulls', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'body' => 'Please pull this in!', 'base' => 'master', 'head' => 'octocat:new-feature', 'title' => 'Amazing new feature' }, 'HTTP body'; } } # Pithub::PullRequests->files { my $obj = Pithub::Test::Factory->create( 'Pithub::PullRequests', user => 'foo', repo => 'bar' ); throws_ok { $obj->files } qr{Missing key in parameters: pull_request_id}, 'No parameters'; isa_ok $obj, 'Pithub::PullRequests'; { my $result = $obj->files( pull_request_id => 1 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/pulls/1/files', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::PullRequests->get { my $obj = Pithub::Test::Factory->create( 'Pithub::PullRequests', user => 'foo', repo => 'bar' ); throws_ok { $obj->get } qr{Missing key in parameters: pull_request_id}, 'No parameters'; isa_ok $obj, 'Pithub::PullRequests'; { my $result = $obj->get( pull_request_id => 1 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/pulls/1', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::PullRequests->is_merged { my $obj = Pithub::Test::Factory->create( 'Pithub::PullRequests', user => 'foo', repo => 'bar' ); throws_ok { $obj->is_merged } qr{Missing key in parameters: pull_request_id}, 'No parameters'; isa_ok $obj, 'Pithub::PullRequests'; { my $result = $obj->is_merged( pull_request_id => 1 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/pulls/1/merge', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::PullRequests->merge { my $obj = Pithub::Test::Factory->create( 'Pithub::PullRequests', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::PullRequests'; throws_ok { $obj->merge } qr{Missing key in parameters: pull_request_id}, 'No parameters'; throws_ok { $obj->merge( pull_request_id => 123 ); } qr{Access token required for: PUT /repos/foo/bar/pulls/123/merge}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->merge( pull_request_id => 123 ); is $result->request->method, 'PUT', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/pulls/123/merge', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::PullRequests->update { my $obj = Pithub::Test::Factory->create( 'Pithub::PullRequests', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::PullRequests'; throws_ok { $obj->update } qr{Missing key in parameters: pull_request_id}, 'No parameter'; throws_ok { $obj->update( pull_request_id => 1 ) } qr{Missing key in parameters: data \(hashref\)}, 'No data parameter'; throws_ok { $obj->update( pull_request_id => 5, data => { foo => 'bar' } ); } qr{Access token required for: PATCH /repos/foo/bar/pulls/5}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->update( pull_request_id => 123, data => { base => 'master', body => 'Please pull this in!', head => 'octocat:new-feature', title => 'Amazing new feature', } ); is $result->request->method, 'PATCH', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/pulls/123', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'body' => 'Please pull this in!', 'base' => 'master', 'head' => 'octocat:new-feature', 'title' => 'Amazing new feature' }, 'HTTP body'; } } # Pithub::PullRequests::Comments->create { my $obj = Pithub::Test::Factory->create( 'Pithub::PullRequests::Comments', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::PullRequests::Comments'; throws_ok { $obj->create } qr{Missing key in parameters: pull_request_id}, 'No parameters'; throws_ok { $obj->create( pull_request_id => 123 ) } qr{Missing key in parameters: data \(hashref\)}, 'No data parameter'; throws_ok { $obj->create( pull_request_id => 123, data => 5 ) } qr{Missing key in parameters: data \(hashref\)}, 'Wrong type'; throws_ok { $obj->create( pull_request_id => 123, data => { foo => 'bar' } ); } qr{Access token required for: POST /repos/foo/bar/pulls/123/comments}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->create( pull_request_id => 123, data => { body => 'some comment' } ); is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/pulls/123/comments', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'body' => 'some comment' }, 'HTTP body'; } } # Pithub::PullRequests::Comments->delete { my $obj = Pithub::Test::Factory->create( 'Pithub::PullRequests::Comments', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::PullRequests::Comments'; throws_ok { $obj->delete } qr{Missing key in parameters: comment_id}, 'No parameters'; throws_ok { $obj->delete( comment_id => 123 ); } qr{Access token required for: DELETE /repos/foo/bar/pulls/comments/123}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->delete( comment_id => 456 ); is $result->request->method, 'DELETE', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/pulls/comments/456', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::PullRequests::Comments->get { my $obj = Pithub::Test::Factory->create( 'Pithub::PullRequests::Comments', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::PullRequests::Comments'; throws_ok { $obj->get } qr{Missing key in parameters: comment_id}, 'No parameters'; { my $result = $obj->get( comment_id => 456 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/pulls/comments/456', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::PullRequests::Comments->list { my $obj = Pithub::Test::Factory->create( 'Pithub::PullRequests::Comments', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::PullRequests::Comments'; throws_ok { $obj->list } qr{Missing key in parameters: pull_request_id}, 'No parameters'; { my $result = $obj->list( pull_request_id => 456 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/pulls/456/comments', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::PullRequests::Comments->update { my $obj = Pithub::Test::Factory->create( 'Pithub::PullRequests::Comments', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::PullRequests::Comments'; throws_ok { $obj->update } qr{Missing key in parameters: comment_id}, 'No parameters'; throws_ok { $obj->update( comment_id => 123 ) } qr{Missing key in parameters: data \(hashref\)}, 'No data parameter'; throws_ok { $obj->update( comment_id => 123, data => 5 ) } qr{Missing key in parameters: data \(hashref\)}, 'Wrong type'; throws_ok { $obj->update( comment_id => 123, data => { foo => 'bar' } ); } qr{Access token required for: PATCH /repos/foo/bar/pulls/comments/123}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->update( comment_id => 123, data => { body => 'some comment' } ); is $result->request->method, 'PATCH', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/pulls/comments/123', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'body' => 'some comment' }, 'HTTP body'; } } # Pithub::PullRequests::Reviewers->delete { my $obj = Pithub::Test::Factory->create( 'Pithub::PullRequests::Reviewers', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::PullRequests::Reviewers'; throws_ok { $obj->delete } qr{Missing key in parameters: pull_request_id}, 'No parameters'; throws_ok { $obj->delete( pull_request_id => 123 ); } qr{Access token required for: DELETE /repos/foo/bar/pulls/123/requested_reviewers}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->delete( pull_request_id => 456 ); is $result->request->method, 'DELETE', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/pulls/456/requested_reviewers', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::PullRequests::Reviewers->list { my $obj = Pithub::Test::Factory->create( 'Pithub::PullRequests::Reviewers', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::PullRequests::Reviewers'; throws_ok { $obj->list } qr{Missing key in parameters: pull_request_id}, 'No parameters'; { my $result = $obj->list( pull_request_id => 456 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/pulls/456/requested_reviewers', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::PullRequests::Reviewers->update { my $obj = Pithub::Test::Factory->create( 'Pithub::PullRequests::Reviewers', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::PullRequests::Reviewers'; throws_ok { $obj->update } qr{Missing key in parameters: pull_request_id}, 'No parameters'; throws_ok { $obj->update( pull_request_id => 123 ) } qr{Missing key in parameters: data \(hashref\)}, 'No data parameter'; throws_ok { $obj->update( pull_request_id => 123, data => 5 ) } qr{Missing key in parameters: data \(hashref\)}, 'Wrong type'; throws_ok { $obj->update( pull_request_id => 123, data => { reviewers => ['bar'] } ); } qr{Access token required for: POST /repos/foo/bar/pulls/123/requested_reviewers}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->update( pull_request_id => 123, data => { reviewers => ['baz'] } ); is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/pulls/123/requested_reviewers', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'reviewers' => ['baz'] }, 'HTTP body'; } } done_testing; Pithub-0.01042/t/orgs.t0000755000175000017500000005627315014062322013154 0ustar olafolaf#!perl use strict; use warnings; use JSON::MaybeXS qw( JSON ); use MIME::Base64 (); use Pithub::Orgs (); use Test::Differences qw( eq_or_diff ); use Test::Exception; # throws_ok use Test::More import => [qw( done_testing fail is isa_ok ok )]; use lib 't/lib'; use Pithub::Test::Factory (); # Pithub::Orgs->get { my $obj = Pithub::Test::Factory->create( 'Pithub::Orgs', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Orgs'; throws_ok { $obj->get } qr{Missing key in parameters: org}, 'No parameters'; { my $result = $obj->get( org => 'some-org' ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/orgs/some-org', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Orgs->list { my $obj = Pithub::Test::Factory->create( 'Pithub::Orgs', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Orgs'; { my $result = $obj->list( user => 'foo' ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/users/foo/orgs', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } { throws_ok { $obj->list } qr{Access token required for: GET /user/orgs}, 'Token required'; ok $obj->token(123), 'Token set'; my $result = $obj->list; is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/user/orgs', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } { # Check if prepare_request is able to add a authorization header to # satisfy has_token $obj->clear_token; throws_ok { $obj->list } qr{Access token required for: GET /user/orgs}, 'Token required'; $obj->prepare_request( sub { my $req = shift; $req->header( 'Authorization' => 'Basic ' . MIME::Base64::encode('someuser:sometoken') ); } ); my $result = $obj->list; is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/user/orgs', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Orgs->update { my $obj = Pithub::Test::Factory->create( 'Pithub::Orgs', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Orgs'; throws_ok { $obj->update } qr{Missing key in parameters: org}, 'No parameters'; throws_ok { $obj->update( org => 'bla' ) } qr{Missing key in parameters: data \(hashref\)}, 'No parameters'; throws_ok { $obj->update( org => 'bla', data => 5 ) } qr{Missing key in parameters: data \(hashref\)}, 'Wrong data parameter'; throws_ok { $obj->update( org => 'bla', data => { foo => 123 } ); } qr{Access token required for: PATCH /orgs/bla}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->update( org => 'some-org', data => { billing_email => 'support@github.com', blog => 'https://github.com/blog', company => 'GitHub', email => 'support@github.com', location => 'San Francisco', name => 'github', } ); is $result->request->method, 'PATCH', 'HTTP method'; is $result->request->uri->path, '/orgs/some-org', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'email' => 'support@github.com', 'location' => 'San Francisco', 'billing_email' => 'support@github.com', 'name' => 'github', 'blog' => 'https://github.com/blog', 'company' => 'GitHub' }, 'HTTP body'; } } # Pithub::Orgs::Members->conceal { my $obj = Pithub::Test::Factory->create('Pithub::Orgs::Members'); isa_ok $obj, 'Pithub::Orgs::Members'; throws_ok { $obj->conceal } qr{Missing key in parameters: org}, 'No parameters'; throws_ok { $obj->conceal( org => 'foo-org' ) } qr{Missing key in parameters: user}, 'No user parameter'; throws_ok { $obj->conceal( org => 'foo', user => 'bar' ); } qr{Access token required for: DELETE /orgs/foo/public_members/bar\s+}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->conceal( org => 'foo', user => 'bar' ); is $result->request->method, 'DELETE', 'HTTP method'; is $result->request->uri->path, '/orgs/foo/public_members/bar', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Orgs::Members->delete { my $obj = Pithub::Test::Factory->create('Pithub::Orgs::Members'); isa_ok $obj, 'Pithub::Orgs::Members'; throws_ok { $obj->delete } qr{Missing key in parameters: org}, 'No parameters'; throws_ok { $obj->delete( org => 'foo-org' ) } qr{Missing key in parameters: user}, 'No user parameter'; throws_ok { $obj->delete( org => 'foo', user => 'bar' ); } qr{Access token required for: DELETE /orgs/foo/members/bar\s+}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->delete( org => 'foo', user => 'bar' ); is $result->request->method, 'DELETE', 'HTTP method'; is $result->request->uri->path, '/orgs/foo/members/bar', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Orgs::Members->is_member { my $obj = Pithub::Test::Factory->create('Pithub::Orgs::Members'); isa_ok $obj, 'Pithub::Orgs::Members'; throws_ok { $obj->is_member } qr{Missing key in parameters: org}, 'No parameters'; throws_ok { $obj->is_member( org => 'foo-org' ) } qr{Missing key in parameters: user}, 'No user parameter'; throws_ok { $obj->is_member( org => 'foo', user => 'bar' ); } qr{Access token required for: GET /orgs/foo/members/bar\s+}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->is_member( org => 'foo', user => 'bar' ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/orgs/foo/members/bar', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Orgs::Members->is_public { my $obj = Pithub::Test::Factory->create('Pithub::Orgs::Members'); isa_ok $obj, 'Pithub::Orgs::Members'; throws_ok { $obj->is_public } qr{Missing key in parameters: org}, 'No parameters'; throws_ok { $obj->is_public( org => 'foo-org' ) } qr{Missing key in parameters: user}, 'No user parameter'; ok $obj->token(123), 'Token set'; { my $result = $obj->is_public( org => 'foo', user => 'bar' ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/orgs/foo/public_members/bar', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Orgs::Members->list { my $obj = Pithub::Test::Factory->create( 'Pithub::Orgs::Members', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Orgs::Members'; throws_ok { $obj->list } qr{Missing key in parameters: org}, 'No parameters'; { my $result = $obj->list( org => 'foo' ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/orgs/foo/members', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Orgs::Members->list_public { my $obj = Pithub::Test::Factory->create( 'Pithub::Orgs::Members', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::Orgs::Members'; throws_ok { $obj->list_public } qr{Missing key in parameters: org}, 'No parameters'; { my $result = $obj->list_public( org => 'foo' ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/orgs/foo/public_members', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Orgs::Members->publicize { my $obj = Pithub::Test::Factory->create('Pithub::Orgs::Members'); isa_ok $obj, 'Pithub::Orgs::Members'; throws_ok { $obj->publicize } qr{Missing key in parameters: org}, 'No parameters'; throws_ok { $obj->publicize( org => 'foo-org' ) } qr{Missing key in parameters: user}, 'No user parameter'; throws_ok { $obj->publicize( org => 'foo', user => 'bar' ); } qr{Access token required for: PUT /orgs/foo/public_members/bar\s+}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->publicize( org => 'foo', user => 'bar' ); is $result->request->method, 'PUT', 'HTTP method'; is $result->request->uri->path, '/orgs/foo/public_members/bar', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Orgs::Teams->add_member { my $obj = Pithub::Test::Factory->create('Pithub::Orgs::Teams'); local $SIG{__WARN__} = sub { fail( $_[0] ) unless $_[0] =~ m{is deprecated} }; isa_ok $obj, 'Pithub::Orgs::Teams'; throws_ok { $obj->add_member } qr{Missing key in parameters: team_id}, 'No parameters'; throws_ok { $obj->add_member( team_id => 123 ) } qr{Missing key in parameters: user}, 'No user parameter'; throws_ok { $obj->add_member( team_id => 123, user => 'bar' ); } qr{Access token required for: PUT /teams/123/members/bar\s+}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->add_member( team_id => 123, user => 'bar' ); is $result->request->method, 'PUT', 'HTTP method'; is $result->request->uri->path, '/teams/123/members/bar', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Orgs::Teams->add_membership { my $obj = Pithub::Test::Factory->create('Pithub::Orgs::Teams'); isa_ok $obj, 'Pithub::Orgs::Teams'; throws_ok { $obj->add_membership } qr{Missing key in parameters: team_id}, 'No parameters'; throws_ok { $obj->add_membership( team_id => 123 ) } qr{Missing key in parameters: user}, 'No user parameter'; throws_ok { $obj->add_membership( team_id => 123, user => 'bar' ) } qr{Missing key in parameters: data}, 'No user parameter'; throws_ok { $obj->add_membership( team_id => 123, user => 'bar', data => { role => 'member' } ); } qr{Access token required for: PUT /teams/123/memberships/bar\s+}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->add_membership( team_id => 123, user => 'bar', data => { role => 'member' } ); is $result->request->method, 'PUT', 'HTTP method'; is $result->request->uri->path, '/teams/123/memberships/bar', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q[{"role":"member"}], 'HTTP body'; } } # Pithub::Orgs::Teams->add_repo { my $obj = Pithub::Test::Factory->create('Pithub::Orgs::Teams'); isa_ok $obj, 'Pithub::Orgs::Teams'; throws_ok { $obj->add_repo } qr{Missing key in parameters: team_id}, 'No parameters'; throws_ok { $obj->add_repo( team_id => 123 ) } qr{Missing key in parameters: repo}, 'No repo parameter'; throws_ok { $obj->add_repo( team_id => 123, repo => 'bar' ); } qr{Missing key in parameters: org}, 'No org paramter'; throws_ok { $obj->add_repo( team_id => 123, repo => 'bar', org => 'myorg' ); } qr{Access token required for: PUT /teams/123/repos/myorg/bar\s+}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->add_repo( team_id => 123, repo => 'bar', org => 'myorg' ); is $result->request->method, 'PUT', 'HTTP method'; is $result->request->uri->path, '/teams/123/repos/myorg/bar', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Orgs::Teams->create { my $obj = Pithub::Test::Factory->create('Pithub::Orgs::Teams'); isa_ok $obj, 'Pithub::Orgs::Teams'; throws_ok { $obj->create } qr{Missing key in parameters: org}, 'No parameters'; throws_ok { $obj->create( org => 'blorg', data => 5 ) } qr{Missing key in parameters: data \(hashref\)}, 'No data parameter'; throws_ok { $obj->create( org => 'blorg', data => { foo => 1 } ); } qr{Access token required for: POST /orgs/blorg/teams\s+}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->create( org => 'blorg', data => { name => 'new team', permission => 'push', repo_names => ['github/dotfiles'] } ); is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/orgs/blorg/teams', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'permission' => 'push', 'name' => 'new team', 'repo_names' => ['github/dotfiles'] }, 'HTTP body'; } } # Pithub::Orgs::Teams->delete { my $obj = Pithub::Test::Factory->create('Pithub::Orgs::Teams'); isa_ok $obj, 'Pithub::Orgs::Teams'; throws_ok { $obj->delete } qr{Missing key in parameters: team_id}, 'No parameters'; throws_ok { $obj->delete( team_id => 123 ); } qr{Access token required for: DELETE /teams/123\s+}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->delete( team_id => 123 ); is $result->request->method, 'DELETE', 'HTTP method'; is $result->request->uri->path, '/teams/123', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Orgs::Teams->get { my $obj = Pithub::Test::Factory->create('Pithub::Orgs::Teams'); isa_ok $obj, 'Pithub::Orgs::Teams'; throws_ok { $obj->get } qr{Missing key in parameters: team_id}, 'No parameters'; throws_ok { $obj->get( team_id => 123 ); } qr{Access token required for: GET /teams/123\s+}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->get( team_id => 123 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/teams/123', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Orgs::Teams->has_repo { my $obj = Pithub::Test::Factory->create('Pithub::Orgs::Teams'); isa_ok $obj, 'Pithub::Orgs::Teams'; throws_ok { $obj->has_repo } qr{Missing key in parameters: team_id}, 'No parameters'; throws_ok { $obj->has_repo( team_id => 123 ) } qr{Missing key in parameters: repo}, 'No parameters'; throws_ok { $obj->has_repo( team_id => 123, repo => 'foo' ); } qr{Access token required for: GET /teams/123/repos/foo\s+}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->has_repo( team_id => 123, repo => 'foo' ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/teams/123/repos/foo', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Orgs::Teams->is_member { my $obj = Pithub::Test::Factory->create('Pithub::Orgs::Teams'); isa_ok $obj, 'Pithub::Orgs::Teams'; throws_ok { $obj->is_member } qr{Missing key in parameters: team_id}, 'No parameters'; throws_ok { $obj->is_member( team_id => 123 ) } qr{Missing key in parameters: user}, 'No parameters'; throws_ok { $obj->is_member( team_id => 123, user => 'foo' ); } qr{Access token required for: GET /teams/123/members/foo\s+}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->is_member( team_id => 123, user => 'foo' ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/teams/123/members/foo', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Orgs::Teams->list { my $obj = Pithub::Test::Factory->create('Pithub::Orgs::Teams'); isa_ok $obj, 'Pithub::Orgs::Teams'; throws_ok { $obj->list } qr{Missing key in parameters: org}, 'No parameters'; throws_ok { $obj->list( org => 'foorg' ); } qr{Access token required for: GET /orgs/foorg/teams\s+}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->list( org => 'foorg' ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/orgs/foorg/teams', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Orgs::Teams->list_members { my $obj = Pithub::Test::Factory->create('Pithub::Orgs::Teams'); isa_ok $obj, 'Pithub::Orgs::Teams'; throws_ok { $obj->list_members } qr{Missing key in parameters: team_id}, 'No parameters'; throws_ok { $obj->list_members( team_id => 123 ); } qr{Access token required for: GET /teams/123/members\s+}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->list_members( team_id => 123 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/teams/123/members', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Orgs::Teams->list_repos { my $obj = Pithub::Test::Factory->create('Pithub::Orgs::Teams'); isa_ok $obj, 'Pithub::Orgs::Teams'; throws_ok { $obj->list_repos } qr{Missing key in parameters: team_id}, 'No parameters'; throws_ok { $obj->list_repos( team_id => 123 ); } qr{Access token required for: GET /teams/123/repos\s+}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->list_repos( team_id => 123 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/teams/123/repos', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Orgs::Teams->remove_member { my $obj = Pithub::Test::Factory->create('Pithub::Orgs::Teams'); isa_ok $obj, 'Pithub::Orgs::Teams'; throws_ok { $obj->remove_member } qr{Missing key in parameters: team_id}, 'No parameters'; throws_ok { $obj->remove_member( team_id => 123 ) } qr{Missing key in parameters: user}, 'No user parameter'; local $SIG{__WARN__} = sub { fail( $_[0] ) unless $_[0] =~ m{is deprecated} }; throws_ok { $obj->remove_member( team_id => 123, user => 'bar' ); } qr{Access token required for: DELETE /teams/123/members/bar\s+}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->remove_member( team_id => 123, user => 'bar' ); is $result->request->method, 'DELETE', 'HTTP method'; is $result->request->uri->path, '/teams/123/members/bar', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Orgs::Teams->remove_membership { my $obj = Pithub::Test::Factory->create('Pithub::Orgs::Teams'); isa_ok $obj, 'Pithub::Orgs::Teams'; throws_ok { $obj->remove_membership } qr{Missing key in parameters: team_id}, 'No parameters'; throws_ok { $obj->remove_membership( team_id => 123 ) } qr{Missing key in parameters: user}, 'No user parameter'; throws_ok { $obj->remove_membership( team_id => 123, user => 'bar' ); } qr{Access token required for: DELETE /teams/123/memberships/bar\s+}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->remove_membership( team_id => 123, user => 'bar' ); is $result->request->method, 'DELETE', 'HTTP method'; is $result->request->uri->path, '/teams/123/memberships/bar', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Orgs::Teams->remove_repo { my $obj = Pithub::Test::Factory->create('Pithub::Orgs::Teams'); isa_ok $obj, 'Pithub::Orgs::Teams'; throws_ok { $obj->remove_repo } qr{Missing key in parameters: team_id}, 'No parameters'; throws_ok { $obj->remove_repo( team_id => 123 ) } qr{Missing key in parameters: repo}, 'No repo parameter'; throws_ok { $obj->remove_repo( team_id => 123, repo => 'bar' ); } qr{Access token required for: DELETE /teams/123/repos/bar\s+}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->remove_repo( team_id => 123, repo => 'bar' ); is $result->request->method, 'DELETE', 'HTTP method'; is $result->request->uri->path, '/teams/123/repos/bar', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::Orgs::Teams->update { my $obj = Pithub::Test::Factory->create('Pithub::Orgs::Teams'); isa_ok $obj, 'Pithub::Orgs::Teams'; throws_ok { $obj->update } qr{Missing key in parameters: team_id}, 'No parameters'; throws_ok { $obj->update( team_id => 123, data => 5 ) } qr{Missing key in parameters: data \(hashref\)}, 'No data parameter'; throws_ok { $obj->update( team_id => 123, data => { foo => 1 } ); } qr{Access token required for: PATCH /teams/123\s+}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->update( team_id => 123, data => { name => 'new team name', permission => 'push', } ); is $result->request->method, 'PATCH', 'HTTP method'; is $result->request->uri->path, '/teams/123', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'permission' => 'push', 'name' => 'new team name' }, 'HTTP body'; } } done_testing; Pithub-0.01042/t/git_data.t0000644000175000017500000002673215014062322013750 0ustar olafolafuse FindBin (); use lib "$FindBin::Bin/lib"; use JSON::MaybeXS qw( JSON ); use Pithub::Test::Factory (); use Pithub::Test qw( uri_is ); BEGIN { use_ok('Pithub::GitData::Blobs'); use_ok('Pithub::GitData::Commits'); use_ok('Pithub::GitData::References'); use_ok('Pithub::GitData::Tags'); use_ok('Pithub::GitData::Trees'); } # Pithub::GitData::Blobs->create { my $json = JSON->new; my $obj = Pithub::Test::Factory->create( 'Pithub::GitData::Blobs', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::GitData::Blobs'; throws_ok { $obj->create } qr{Missing key in parameters: data \(hashref\)}, 'No parameters'; throws_ok { $obj->create( data => 5 ) } qr{Missing key in parameters: data \(hashref\)}, 'Wrong data parameter'; throws_ok { $obj->create( data => { content => 123 } ); } qr{Access token required for: POST /repos/foo/bar/git/blobs}, 'Token required'; ok $obj->token(123), 'Token set'; { my $result = $obj->create( data => { content => 'Content of the blob', encoding => 'utf-8', } ); is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/git/blobs', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'content' => 'Content of the blob', 'encoding' => 'utf-8' }, 'HTTP body'; } } # Pithub::GitData::Blobs->get { my $obj = Pithub::Test::Factory->create( 'Pithub::GitData::Blobs', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::GitData::Blobs'; throws_ok { $obj->get } qr{Missing key in parameters: sha}, 'No parameters'; { my $result = $obj->get( sha => 123 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/git/blobs/123', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::GitData::Commits->create { my $obj = Pithub::Test::Factory->create( 'Pithub::GitData::Commits', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::GitData::Commits'; throws_ok { $obj->create } qr{Missing key in parameters: data \(hashref\)}, 'No parameters'; throws_ok { $obj->create( data => 5 ) } qr{Missing key in parameters: data \(hashref\)}, 'Wrong data parameter'; throws_ok { $obj->create( data => { content => 123 } ); } qr{Access token required for: POST /repos/foo/bar/git/commits}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->create( data => { message => 'my commit message' } ); is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/git/commits', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'message' => 'my commit message' }, 'HTTP body'; } } # Pithub::GitData::Commits->get { my $obj = Pithub::Test::Factory->create( 'Pithub::GitData::Commits', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::GitData::Commits'; throws_ok { $obj->get } qr{Missing key in parameters: sha}, 'No parameters'; { my $result = $obj->get( sha => 123 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/git/commits/123', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::GitData::References->get { my $obj = Pithub::Test::Factory->create( 'Pithub::GitData::References', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::GitData::References'; throws_ok { $obj->get } qr{Missing key in parameters: ref}, 'No parameters'; { my $result = $obj->get( ref => 'heads/sc/featureA' ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/git/refs/heads/sc/featureA', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::GitData::References->create { my $obj = Pithub::Test::Factory->create( 'Pithub::GitData::References', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::GitData::References'; throws_ok { $obj->create } qr{Missing key in parameters: data \(hashref\)}, 'No parameters'; throws_ok { $obj->create( data => 5 ) } qr{Missing key in parameters: data \(hashref\)}, 'Wrong data parameter'; throws_ok { $obj->create( data => { ref => 'refs/heads/master' } ); } qr{Access token required for: POST /repos/foo/bar/git/refs}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->create( data => { ref => 'refs/heads/master' } ); is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/git/refs', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'ref' => 'refs/heads/master' }, 'HTTP body'; } } # Pithub::GitData::References->list { my $obj = Pithub::Test::Factory->create( 'Pithub::GitData::References', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::GitData::References'; { my $result = $obj->list; is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/git/refs', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } { my $result = $obj->list( ref => 'tags' ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/git/refs/tags', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::GitData::References->update { my $obj = Pithub::Test::Factory->create( 'Pithub::GitData::References', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::GitData::References'; throws_ok { $obj->update } qr{Missing key in parameters: ref}, 'No parameters'; throws_ok { $obj->update( ref => 'foo/bar' ) } qr{Missing key in parameters: data \(hashref\)}, 'No data parameter'; throws_ok { $obj->update( ref => 'foo/bar', data => 5 ) } qr{Missing key in parameters: data \(hashref\)}, 'Wrong data parameter'; throws_ok { $obj->update( ref => 'foo/bar', data => { sha => 123 } ); } qr{Access token required for: PATCH /repos/foo/bar/git/refs}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->update( ref => 'foo/bar', data => { sha => '123' } ); is $result->request->method, 'PATCH', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/git/refs/foo/bar', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'sha' => '123' }, 'HTTP body'; } } # Pithub::GitData::Tags->get { my $obj = Pithub::Test::Factory->create( 'Pithub::GitData::Tags', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::GitData::Tags'; throws_ok { $obj->get } qr{Missing key in parameters: sha}, 'No parameters'; { my $result = $obj->get( sha => 123 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/git/tags/123', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::GitData::Tags->create { my $obj = Pithub::Test::Factory->create( 'Pithub::GitData::Tags', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::GitData::Tags'; throws_ok { $obj->create } qr{Missing key in parameters: data \(hashref\)}, 'No parameters'; throws_ok { $obj->create( data => 5 ) } qr{Missing key in parameters: data \(hashref\)}, 'Wrong data parameter'; throws_ok { $obj->create( data => { bla => 'fasel' } ); } qr{Access token required for: POST /repos/foo/bar/git/tags}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->create( data => { message => 'Tagged v0.1', object => '827efc6d56897b048c772eb4087f854f46256132', tag => 'v0.1', type => 'commit', } ); is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/git/tags', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'object' => '827efc6d56897b048c772eb4087f854f46256132', 'type' => 'commit', 'tag' => 'v0.1', 'message' => 'Tagged v0.1' }, 'HTTP body'; } } # Pithub::GitData::Trees->get { my $obj = Pithub::Test::Factory->create( 'Pithub::GitData::Trees', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::GitData::Trees'; throws_ok { $obj->get } qr{Missing key in parameters: sha}, 'No parameters'; { my $result = $obj->get( sha => 123 ); is $result->request->method, 'GET', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/git/trees/123', 'HTTP path'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } { my $result = $obj->get( sha => 456, recursive => 1 ); is $result->request->method, 'GET', 'HTTP method'; uri_is $result->request->uri, 'https://api.github.com/repos/foo/bar/git/trees/456?recursive=1&per_page=100'; my $http_request = $result->request; is $http_request->content, q{}, 'HTTP body'; } } # Pithub::GitData::Trees->create { my $obj = Pithub::Test::Factory->create( 'Pithub::GitData::Trees', user => 'foo', repo => 'bar' ); isa_ok $obj, 'Pithub::GitData::Trees'; throws_ok { $obj->create } qr{Missing key in parameters: data \(hashref\)}, 'No parameters'; throws_ok { $obj->create( data => 5 ) } qr{Missing key in parameters: data \(hashref\)}, 'Wrong data parameter'; throws_ok { $obj->create( data => { tree => [ { path => 'file1.pl' } ] } ); } qr{Access token required for: POST /repos/foo/bar/git/trees}, 'Token required'; ok $obj->token(123), 'Token set'; { my $json = JSON->new; my $result = $obj->create( data => { tree => [ { path => 'file1.pl' } ] } ); is $result->request->method, 'POST', 'HTTP method'; is $result->request->uri->path, '/repos/foo/bar/git/trees', 'HTTP path'; my $http_request = $result->request; eq_or_diff $json->decode( $http_request->content ), { 'tree' => [ { 'path' => 'file1.pl' } ] }, 'HTTP body'; } } done_testing; Pithub-0.01042/t/00-report-prereqs.t0000644000175000017500000001360115014062322015372 0ustar olafolaf#!perl use strict; use warnings; # This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.029 use Test::More tests => 1; use ExtUtils::MakeMaker; use File::Spec; # from $version::LAX my $lax_version_re = qr/(?: undef | (?: (?:[0-9]+) (?: \. | (?:\.[0-9]+) (?:_[0-9]+)? )? | (?:\.[0-9]+) (?:_[0-9]+)? ) | (?: v (?:[0-9]+) (?: (?:\.[0-9]+)+ (?:_[0-9]+)? )? | (?:[0-9]+)? (?:\.[0-9]+){2,} (?:_[0-9]+)? ) )/x; # hide optional CPAN::Meta modules from prereq scanner # and check if they are available my $cpan_meta = "CPAN::Meta"; my $cpan_meta_pre = "CPAN::Meta::Prereqs"; my $HAS_CPAN_META = eval "require $cpan_meta; $cpan_meta->VERSION('2.120900')" && eval "require $cpan_meta_pre"; ## no critic # Verify requirements? my $DO_VERIFY_PREREQS = 1; sub _max { my $max = shift; $max = ( $_ > $max ) ? $_ : $max for @_; return $max; } sub _merge_prereqs { my ($collector, $prereqs) = @_; # CPAN::Meta::Prereqs object if (ref $collector eq $cpan_meta_pre) { return $collector->with_merged_prereqs( CPAN::Meta::Prereqs->new( $prereqs ) ); } # Raw hashrefs for my $phase ( keys %$prereqs ) { for my $type ( keys %{ $prereqs->{$phase} } ) { for my $module ( keys %{ $prereqs->{$phase}{$type} } ) { $collector->{$phase}{$type}{$module} = $prereqs->{$phase}{$type}{$module}; } } } return $collector; } my @include = qw( ); my @exclude = qw( ); # Add static prereqs to the included modules list my $static_prereqs = do './t/00-report-prereqs.dd'; # Merge all prereqs (either with ::Prereqs or a hashref) my $full_prereqs = _merge_prereqs( ( $HAS_CPAN_META ? $cpan_meta_pre->new : {} ), $static_prereqs ); # Add dynamic prereqs to the included modules list (if we can) my ($source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; my $cpan_meta_error; if ( $source && $HAS_CPAN_META && (my $meta = eval { CPAN::Meta->load_file($source) } ) ) { $full_prereqs = _merge_prereqs($full_prereqs, $meta->prereqs); } else { $cpan_meta_error = $@; # capture error from CPAN::Meta->load_file($source) $source = 'static metadata'; } my @full_reports; my @dep_errors; my $req_hash = $HAS_CPAN_META ? $full_prereqs->as_string_hash : $full_prereqs; # Add static includes into a fake section for my $mod (@include) { $req_hash->{other}{modules}{$mod} = 0; } for my $phase ( qw(configure build test runtime develop other) ) { next unless $req_hash->{$phase}; next if ($phase eq 'develop' and not $ENV{AUTHOR_TESTING}); for my $type ( qw(requires recommends suggests conflicts modules) ) { next unless $req_hash->{$phase}{$type}; my $title = ucfirst($phase).' '.ucfirst($type); my @reports = [qw/Module Want Have/]; for my $mod ( sort keys %{ $req_hash->{$phase}{$type} } ) { next if grep { $_ eq $mod } @exclude; my $want = $req_hash->{$phase}{$type}{$mod}; $want = "undef" unless defined $want; $want = "any" if !$want && $want == 0; if ($mod eq 'perl') { push @reports, ['perl', $want, $]]; next; } my $req_string = $want eq 'any' ? 'any version required' : "version '$want' required"; my $file = $mod; $file =~ s{::}{/}g; $file .= ".pm"; my ($prefix) = grep { -e File::Spec->catfile($_, $file) } @INC; if ($prefix) { my $have = MM->parse_version( File::Spec->catfile($prefix, $file) ); $have = "undef" unless defined $have; push @reports, [$mod, $want, $have]; if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META && $type eq 'requires' ) { if ( $have !~ /\A$lax_version_re\z/ ) { push @dep_errors, "$mod version '$have' cannot be parsed ($req_string)"; } elsif ( ! $full_prereqs->requirements_for( $phase, $type )->accepts_module( $mod => $have ) ) { push @dep_errors, "$mod version '$have' is not in required range '$want'"; } } } else { push @reports, [$mod, $want, "missing"]; if ( $DO_VERIFY_PREREQS && $type eq 'requires' ) { push @dep_errors, "$mod is not installed ($req_string)"; } } } if ( @reports ) { push @full_reports, "=== $title ===\n\n"; my $ml = _max( map { length $_->[0] } @reports ); my $wl = _max( map { length $_->[1] } @reports ); my $hl = _max( map { length $_->[2] } @reports ); if ($type eq 'modules') { splice @reports, 1, 0, ["-" x $ml, "", "-" x $hl]; push @full_reports, map { sprintf(" %*s %*s\n", -$ml, $_->[0], $hl, $_->[2]) } @reports; } else { splice @reports, 1, 0, ["-" x $ml, "-" x $wl, "-" x $hl]; push @full_reports, map { sprintf(" %*s %*s %*s\n", -$ml, $_->[0], $wl, $_->[1], $hl, $_->[2]) } @reports; } push @full_reports, "\n"; } } } if ( @full_reports ) { diag "\nVersions for all modules listed in $source (including optional ones):\n\n", @full_reports; } if ( $cpan_meta_error || @dep_errors ) { diag "\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***\n"; } if ( $cpan_meta_error ) { my ($orig_source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; diag "\nCPAN::Meta->load_file('$orig_source') failed with: $cpan_meta_error\n"; } if ( @dep_errors ) { diag join("\n", "\nThe following REQUIRED prerequisites were not satisfied:\n", @dep_errors, "\n" ); } pass('Reported prereqs'); # vim: ts=4 sts=4 sw=4 et: Pithub-0.01042/t/lib/0000775000175000017500000000000015014062322012545 5ustar olafolafPithub-0.01042/t/lib/Pithub/0000775000175000017500000000000015014062322014000 5ustar olafolafPithub-0.01042/t/lib/Pithub/Test.pm0000644000175000017500000000262215014062322015255 0ustar olafolafpackage Pithub::Test; use strict; use warnings; use Import::Into; use Test::Builder (); use Test::Differences qw( eq_or_diff ); use Test::More import => [qw( diag is )]; BEGIN { ## no critic (ClassHierarchies::ProhibitExplicitISA, Modules::ProhibitAutomaticExportation) require Exporter; our @ISA = qw(Exporter); our @EXPORT = qw(uri_is); } sub import { my $class = shift; my $caller = caller; Test::Most->import::into($caller); $class->export_to_level( 1, @_ ); } sub uri_is { my ( $have, $want, $name ) = @_; local $Test::Builder::Level = $Test::Builder::Level + 1; $have = _make_uri($have); $want = _make_uri($want); for my $method (qw(scheme authority path fragment)) { my $have_val = $have->$method; my $want_val = $want->$method; next if !defined $have_val && !defined $want_val; if ( ( defined $have_val xor defined $want_val ) || ( $have_val ne $want_val ) ) { return is( $have, $want, $name ) || diag "$method does not match"; } } my %have_queries = $have->query_form; my %want_queries = $want->query_form; return eq_or_diff( \%have_queries, \%want_queries, $name ) || diag "$have ne $want, queries do not match"; } sub _make_uri { my $uri = shift; return $uri if ref $uri && $uri->isa('URI'); require URI; return URI->new($uri); } 1; Pithub-0.01042/t/lib/Pithub/Test/0000775000175000017500000000000015014062322014717 5ustar olafolafPithub-0.01042/t/lib/Pithub/Test/http_response/0000775000175000017500000000000015014062322017614 5ustar olafolafPithub-0.01042/t/lib/Pithub/Test/http_response/api.github.com/0000775000175000017500000000000015014062322022423 5ustar olafolafPithub-0.01042/t/lib/Pithub/Test/http_response/api.github.com/orgs/0000775000175000017500000000000015014062322023375 5ustar olafolafPithub-0.01042/t/lib/Pithub/Test/http_response/api.github.com/orgs/CPAN-API/0000775000175000017500000000000015014062322024525 5ustar olafolafPithub-0.01042/t/lib/Pithub/Test/http_response/api.github.com/orgs/CPAN-API/repos.GET0000644000175000017500000001235315014062322026220 0ustar olafolafHTTP/1.1 200 OK Server: nginx/0.7.67 Date: Fri, 24 Jun 2011 07:28:48 GMT Content-Type: application/json Connection: keep-alive Status: 200 OK X-RateLimit-Limit: 5000 X-RateLimit-Remaining: 4890 Content-Length: 5140 [ { "watchers": 82, "description": "A free, open API for everything you want to know about CPAN", "ssh_url": "git@github.com:CPAN-API/cpan-api.git", "url": "https://api.github.com/repos/CPAN-API/cpan-api", "svn_url": "https://svn.github.com/CPAN-API/cpan-api", "homepage": "http://www.metacpan.org/", "git_url": "git://github.com/CPAN-API/cpan-api.git", "fork": false, "html_url": "https://github.com/CPAN-API/cpan-api", "language": "Perl", "open_issues": 41, "private": false, "size": 144, "owner": { "url": "https://api.github.com/users/CPAN-API", "avatar_url": "https://secure.gravatar.com/avatar/7733efdfa4ceb15dd68fdfff71be56f1?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png", "login": "CPAN-API", "id": 460239 }, "name": "cpan-api", "pushed_at": "2011-06-21T03:35:37Z", "created_at": "2010-10-30T04:43:00Z", "forks": 37, "clone_url": "https://github.com/CPAN-API/cpan-api.git" }, { "watchers": 31, "description": "Proof of concept search page for using api.metacpan.org", "ssh_url": "git@github.com:CPAN-API/search-metacpan-org.git", "url": "https://api.github.com/repos/CPAN-API/search-metacpan-org", "svn_url": "https://svn.github.com/CPAN-API/search-metacpan-org", "homepage": "", "git_url": "git://github.com/CPAN-API/search-metacpan-org.git", "fork": false, "html_url": "https://github.com/CPAN-API/search-metacpan-org", "language": "JavaScript", "open_issues": 24, "private": false, "size": 256, "owner": { "url": "https://api.github.com/users/CPAN-API", "avatar_url": "https://secure.gravatar.com/avatar/7733efdfa4ceb15dd68fdfff71be56f1?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png", "login": "CPAN-API", "id": 460239 }, "name": "search-metacpan-org", "pushed_at": "2011-06-07T19:08:09Z", "created_at": "2010-11-04T04:00:59Z", "forks": 5, "clone_url": "https://github.com/CPAN-API/search-metacpan-org.git" }, { "watchers": 2, "description": "CPANvote Catalyst server", "ssh_url": "git@github.com:CPAN-API/cpanvote-server.git", "url": "https://api.github.com/repos/CPAN-API/cpanvote-server", "svn_url": "https://svn.github.com/CPAN-API/cpanvote-server", "homepage": "", "git_url": "git://github.com/CPAN-API/cpanvote-server.git", "fork": true, "html_url": "https://github.com/CPAN-API/cpanvote-server", "language": "Perl", "open_issues": 0, "private": false, "size": 572, "owner": { "url": "https://api.github.com/users/CPAN-API", "avatar_url": "https://secure.gravatar.com/avatar/7733efdfa4ceb15dd68fdfff71be56f1?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png", "login": "CPAN-API", "id": 460239 }, "name": "cpanvote-server", "pushed_at": "2011-02-25T01:10:36Z", "created_at": "2011-02-08T01:36:46Z", "forks": 0, "clone_url": "https://github.com/CPAN-API/cpanvote-server.git" }, { "watchers": 2, "description": "The database backend of cpanvote", "ssh_url": "git@github.com:CPAN-API/cpanvote-db.git", "url": "https://api.github.com/repos/CPAN-API/cpanvote-db", "svn_url": "https://svn.github.com/CPAN-API/cpanvote-db", "homepage": "", "git_url": "git://github.com/CPAN-API/cpanvote-db.git", "fork": true, "html_url": "https://github.com/CPAN-API/cpanvote-db", "language": "Perl", "open_issues": 0, "private": false, "size": 536, "owner": { "url": "https://api.github.com/users/CPAN-API", "avatar_url": "https://secure.gravatar.com/avatar/7733efdfa4ceb15dd68fdfff71be56f1?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png", "login": "CPAN-API", "id": 460239 }, "name": "cpanvote-db", "pushed_at": "2011-02-13T20:50:43Z", "created_at": "2011-02-08T01:37:11Z", "forks": 0, "clone_url": "https://github.com/CPAN-API/cpanvote-db.git" }, { "watchers": 51, "description": "Web interface for MetaCPAN", "ssh_url": "git@github.com:CPAN-API/metacpan-web.git", "url": "https://api.github.com/repos/CPAN-API/metacpan-web", "svn_url": "https://svn.github.com/CPAN-API/metacpan-web", "homepage": "", "git_url": "git://github.com/CPAN-API/metacpan-web.git", "fork": false, "html_url": "https://github.com/CPAN-API/metacpan-web", "language": "Perl", "open_issues": 49, "private": false, "size": 148, "owner": { "url": "https://api.github.com/users/CPAN-API", "avatar_url": "https://secure.gravatar.com/avatar/7733efdfa4ceb15dd68fdfff71be56f1?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png", "login": "CPAN-API", "id": 460239 }, "name": "metacpan-web", "pushed_at": "2011-06-22T14:31:43Z", "created_at": "2011-04-18T14:25:49Z", "forks": 17, "clone_url": "https://github.com/CPAN-API/metacpan-web.git" } ]Pithub-0.01042/t/lib/Pithub/Test/http_response/api.github.com/error/0000775000175000017500000000000015014062322023554 5ustar olafolafPithub-0.01042/t/lib/Pithub/Test/http_response/api.github.com/error/notfound.GET0000644000175000017500000000040115014062322025742 0ustar olafolafHTTP/1.1 404 Not Found Server: nginx/0.7.67 Date: Fri, 24 Jun 2011 04:14:47 GMT Content-Type: application/json Connection: keep-alive Status: 404 Not Found X-RateLimit-Limit: 5000 X-RateLimit-Remaining: 4962 Content-Length: 29 { "message": "Not Found" } Pithub-0.01042/t/lib/Pithub/Test/http_response/api.github.com/user/0000775000175000017500000000000015014062322023401 5ustar olafolafPithub-0.01042/t/lib/Pithub/Test/http_response/api.github.com/user/following/0000775000175000017500000000000015014062322025401 5ustar olafolafPithub-0.01042/t/lib/Pithub/Test/http_response/api.github.com/user/following/rafl.GET0000644000175000017500000000026315014062322026665 0ustar olafolafHTTP/1.1 204 No Content Server: nginx/0.7.67 Date: Fri, 24 Jun 2011 11:12:38 GMT Connection: keep-alive Status: 204 No Content X-RateLimit-Limit: 5000 X-RateLimit-Remaining: 4959 Pithub-0.01042/t/lib/Pithub/Test/http_response/api.github.com/repos/0000775000175000017500000000000015014062322023553 5ustar olafolafPithub-0.01042/t/lib/Pithub/Test/http_response/api.github.com/repos/foo/0000775000175000017500000000000015014062322024336 5ustar olafolafPithub-0.01042/t/lib/Pithub/Test/http_response/api.github.com/repos/foo/bar/0000775000175000017500000000000015014062322025102 5ustar olafolafPithub-0.01042/t/lib/Pithub/Test/http_response/api.github.com/repos/foo/bar/downloads.POST0000644000175000017500000000142415014062322027602 0ustar olafolafHTTP/1.1 201 Created Content-Type: application/json Status: 201 Created X-RateLimit-Limit: 5000 X-RateLimit-Remaining: 4962 { "url": "https://api.github.com/repos/octocat/Hello-World/downloads/1", "html_url": "https://github.com/repos/octocat/Hello-World/downloads/new_file.jpg", "id": 1, "name": "new_file.jpg", "description": "Description of your download", "size": 1024, "download_count": 40, "policy": "ewogICAg...", "signature": "mwnFDC...", "bucket": "github", "accesskeyid": "1ABCDEFG...", "path": "downloads/ocotocat/Hello-World/new_file.jpg", "acl": "public-read", "expirationdate": "2011-04-14T16:00:49Z", "prefix": "downloads/octocat/Hello-World/", "mime_type": "image/jpeg", "redirect": false, "s3_url": "https://github.s3.amazonaws.com/" }Pithub-0.01042/t/lib/Pithub/Test/http_response/api.github.com/repos/foo/bar/issues.GET0000644000175000017500000000060015014062322026750 0ustar olafolafHTTP/1.1 200 OK Server: nginx/1.0.4 Date: Sat, 13 Aug 2011 03:47:06 GMT Content-Type: application/json Connection: keep-alive Status: 200 OK X-RateLimit-Limit: 5000 X-RateLimit-Remaining: 4998 Link: <>; rel="create"; method="POST", ; rel="next", ; rel="last"Pithub-0.01042/t/lib/Pithub/Test/http_response/api.github.com/users/0000775000175000017500000000000015014062322023564 5ustar olafolafPithub-0.01042/t/lib/Pithub/Test/http_response/api.github.com/users/miyagawa/0000775000175000017500000000000015014062322025363 5ustar olafolafPithub-0.01042/t/lib/Pithub/Test/http_response/api.github.com/users/miyagawa/followers.GET.page-30000644000175000017500000002074615014062322031022 0ustar olafolafHTTP/1.1 200 OK Server: nginx/1.0.4 Date: Thu, 30 Jun 2011 11:41:47 GMT Content-Type: application/json Connection: keep-alive Status: 200 OK X-RateLimit-Limit: 5000 X-RateLimit-Remaining: 4996 Link: ; rel="next", ; rel="last", ; rel="first", ; rel="prev" Content-Length: 8177 [ { "url": "https://api.github.com/users/akio0911", "avatar_url": "https://secure.gravatar.com/avatar/3b3d987a6065dce3ba2b38dc1e562e94?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "akio0911", "id": 43180 }, { "url": "https://api.github.com/users/lyokato", "avatar_url": "https://secure.gravatar.com/avatar/0b63462eb18efbfb764b0c226abff4a0?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "lyokato", "id": 30877 }, { "url": "https://api.github.com/users/itkz", "avatar_url": "https://secure.gravatar.com/avatar/a00d11e3507a04637d6804c9b23417e1?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "itkz", "id": 36298 }, { "url": "https://api.github.com/users/bonnu", "avatar_url": "https://secure.gravatar.com/avatar/e80741cb0e02bafef7c9a3ded975dabc?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "bonnu", "id": 26857 }, { "url": "https://api.github.com/users/hsbt", "avatar_url": "https://secure.gravatar.com/avatar/eabad423977cfc6873b8f5df62b848a6?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "hsbt", "id": 12301 }, { "url": "https://api.github.com/users/gom", "avatar_url": "https://secure.gravatar.com/avatar/85bdde880183d08217abf1cb28d5a906?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "gom", "id": 21202 }, { "url": "https://api.github.com/users/mizzy", "avatar_url": "https://secure.gravatar.com/avatar/0d5d8fb9cc4c06f581825f5a61d3f5f1?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "mizzy", "id": 3620 }, { "url": "https://api.github.com/users/dragon3", "avatar_url": "https://secure.gravatar.com/avatar/04e5cb7a072d3be66ffba00be1bfe465?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "dragon3", "id": 20374 }, { "url": "https://api.github.com/users/rafl", "avatar_url": "https://secure.gravatar.com/avatar/b7623d3ead9eb46172a44e1bd761b37a?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "rafl", "id": 25669 }, { "url": "https://api.github.com/users/twada", "avatar_url": "https://secure.gravatar.com/avatar/9f3a83db74bee75a64b5e6ed106a775c?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "twada", "id": 19881 }, { "url": "https://api.github.com/users/woremacx", "avatar_url": "https://secure.gravatar.com/avatar/fe222c9e36094d32c200e2025ba0e310?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "woremacx", "id": 10683 }, { "url": "https://api.github.com/users/hasimo", "avatar_url": "https://secure.gravatar.com/avatar/6e3d1578114e5d3951a7f90579fff74c?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "hasimo", "id": 26832 }, { "url": "https://api.github.com/users/dmc", "avatar_url": "https://secure.gravatar.com/avatar/156642e8c7932b1f6988bac4bf6c5471?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "dmc", "id": 44504 }, { "url": "https://api.github.com/users/jrockway", "avatar_url": "https://secure.gravatar.com/avatar/c020aeae684d0e137d1da9d3ac3fda17?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "jrockway", "id": 2367 }, { "url": "https://api.github.com/users/sartak", "avatar_url": "https://secure.gravatar.com/avatar/609c52819f220e49667a53cc0a82bfa7?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "sartak", "id": 45430 }, { "url": "https://api.github.com/users/Kimtaro", "avatar_url": "https://secure.gravatar.com/avatar/2986330e38386f92fee4774b0c54ed66?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "Kimtaro", "id": 15438 }, { "url": "https://api.github.com/users/yannk", "avatar_url": "https://secure.gravatar.com/avatar/e744128f9d1195bba5b781ee560e282f?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "yannk", "id": 40152 }, { "url": "https://api.github.com/users/jshirley", "avatar_url": "https://secure.gravatar.com/avatar/714a9312e3e32ef04a6525969a9422be?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "jshirley", "id": 21035 }, { "url": "https://api.github.com/users/hiratara", "avatar_url": "https://secure.gravatar.com/avatar/e1c3df1bb4cb55926cbf2dd9e9f3b9b8?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "hiratara", "id": 45287 }, { "url": "https://api.github.com/users/yoko", "avatar_url": "https://secure.gravatar.com/avatar/6d4cc28deedb0378ecb67bb9bc818381?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "yoko", "id": 16744 }, { "url": "https://api.github.com/users/obra", "avatar_url": "https://secure.gravatar.com/avatar/a145dbf5d67ba1eb717fbe3a1f51509c?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "obra", "id": 45416 }, { "url": "https://api.github.com/users/kenn", "avatar_url": "https://secure.gravatar.com/avatar/f3c42aa7989a9a0c37709abc08a6327f?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "kenn", "id": 10350 }, { "url": "https://api.github.com/users/hiroyukim", "avatar_url": "https://secure.gravatar.com/avatar/71328ea556bbac1fac3c4aaed111da46?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "hiroyukim", "id": 42721 }, { "url": "https://api.github.com/users/matsuu", "avatar_url": "https://secure.gravatar.com/avatar/c3a4a9f0d030d46df47e40ed7e750716?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "matsuu", "id": 4395 }, { "url": "https://api.github.com/users/nekokak", "avatar_url": "https://secure.gravatar.com/avatar/6a4f5a57f6afbcff5bb4f69935cdc3db?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "nekokak", "id": 47076 }, { "url": "https://api.github.com/users/atushi", "avatar_url": "https://secure.gravatar.com/avatar/a301e703308ce17b911ea6fd1ec811c2?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "atushi", "id": 14158 }, { "url": "https://api.github.com/users/masaki", "avatar_url": "https://secure.gravatar.com/avatar/96cf07c92435dd03b2c936f066aafad4?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "masaki", "id": 3663 }, { "url": "https://api.github.com/users/bricas", "avatar_url": "https://secure.gravatar.com/avatar/a12ace08cb63bace871a7648c2d6fc8c?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "bricas", "id": 18400 }, { "url": "https://api.github.com/users/daijiro", "avatar_url": "https://secure.gravatar.com/avatar/bb4c83540e6924f932f2ac0fae214eb6?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "daijiro", "id": 45045 }, { "url": "https://api.github.com/users/lorn", "avatar_url": "https://secure.gravatar.com/avatar/362b77d943afe986bc6ead2bf11d0e3f?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "lorn", "id": 45376 } ]Pithub-0.01042/t/lib/Pithub/Test/http_response/api.github.com/users/miyagawa/followers.GET.page-260000644000175000017500000001276515014062322031111 0ustar olafolafHTTP/1.1 200 OK Server: nginx/1.0.4 Date: Thu, 30 Jun 2011 11:42:46 GMT Content-Type: application/json Connection: keep-alive Status: 200 OK X-RateLimit-Limit: 5000 X-RateLimit-Remaining: 4995 Link: ; rel="first", ; rel="prev" Content-Length: 5260 [ { "url": "https://api.github.com/users/wata", "avatar_url": "https://secure.gravatar.com/avatar/78f337c7bec2e54f6f41e21f4bf71ee9?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "wata", "id": 519695 }, { "url": "https://api.github.com/users/Angelia2041", "avatar_url": "https://secure.gravatar.com/avatar/a2d59a658de50368dbd57ea826ad985d?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "Angelia2041", "id": 234744 }, { "url": "https://api.github.com/users/jberger", "avatar_url": "https://secure.gravatar.com/avatar/cc767569f5863a7c261991ee5b23f147?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "jberger", "id": 735765 }, { "url": "https://api.github.com/users/wolverian", "avatar_url": "https://secure.gravatar.com/avatar/a87982e94405e64404b2e48479f70604?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "wolverian", "id": 42124 }, { "url": "https://api.github.com/users/benvanstaveren", "avatar_url": "https://secure.gravatar.com/avatar/4e07aff599df78e2838d93bcd0b16a93?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "benvanstaveren", "id": 274836 }, { "url": "https://api.github.com/users/cybersiddhu", "avatar_url": "https://secure.gravatar.com/avatar/a9a174a5f6160c01f6cff41a7eb8a220?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "cybersiddhu", "id": 48740 }, { "url": "https://api.github.com/users/olegwtf", "avatar_url": "https://secure.gravatar.com/avatar/42ce55db02194eba4cb77a620a3f1774?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "olegwtf", "id": 722138 }, { "url": "https://api.github.com/users/spadin", "avatar_url": "https://secure.gravatar.com/avatar/b2214599720c63e7714e17faf14ccb66?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "spadin", "id": 21626 }, { "url": "https://api.github.com/users/camelmasa", "avatar_url": "https://secure.gravatar.com/avatar/fb1b5190cdff1bc48be2644362ee8b12?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "camelmasa", "id": 189824 }, { "url": "https://api.github.com/users/cond", "avatar_url": "https://secure.gravatar.com/avatar/9001d49e8e280cbdc35a6fd217db6332?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "cond", "id": 511613 }, { "url": "https://api.github.com/users/yko", "avatar_url": "https://secure.gravatar.com/avatar/a6f8c3d0bcea9fcf4ab0a67ce38c7e90?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "yko", "id": 177497 }, { "url": "https://api.github.com/users/Shinpeim", "avatar_url": "https://secure.gravatar.com/avatar/40904a1ca8c4244163c67c677737f8ca?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "Shinpeim", "id": 876988 }, { "url": "https://api.github.com/users/benkolera", "avatar_url": "https://secure.gravatar.com/avatar/a3a40b5b547344370d45ad0f805b4d81?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "benkolera", "id": 159197 }, { "url": "https://api.github.com/users/tetu1225", "avatar_url": "https://secure.gravatar.com/avatar/11c9656001063fe04e9d0a347bcd3e1b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "tetu1225", "id": 731471 }, { "url": "https://api.github.com/users/Kivutar", "avatar_url": "https://secure.gravatar.com/avatar/429a2a9fc4560fd8f5482e7541b1ffdd?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "Kivutar", "id": 442722 }, { "url": "https://api.github.com/users/reezer", "avatar_url": "https://secure.gravatar.com/avatar/3d8f95f51401a52705432b7d3986f99a?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "reezer", "id": 653995 }, { "url": "https://api.github.com/users/dha", "avatar_url": "https://secure.gravatar.com/avatar/e42baff4499a1d49c8a806feb0c8eee4?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "dha", "id": 97890 }, { "url": "https://api.github.com/users/mcanlas", "avatar_url": "https://secure.gravatar.com/avatar/f13af12d1c3ed9cc7d39381305df90c0?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "mcanlas", "id": 881934 }, { "url": "https://api.github.com/users/lungching", "avatar_url": "https://secure.gravatar.com/avatar/671cdc9143758468b0c702bbc840f831?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "lungching", "id": 60586 } ]././@LongLink0000644000000000000000000000014600000000000011604 Lustar rootrootPithub-0.01042/t/lib/Pithub/Test/http_response/api.github.com/users/miyagawa/followers.GET.per_page-1Pithub-0.01042/t/lib/Pithub/Test/http_response/api.github.com/users/miyagawa/followers.GET.per_page-0000644000175000017500000000121715014062322031575 0ustar olafolafHTTP/1.1 200 OK Server: nginx/1.0.4 Date: Thu, 30 Jun 2011 12:03:06 GMT Content-Type: application/json Connection: keep-alive Status: 200 OK X-RateLimit-Limit: 5000 X-RateLimit-Remaining: 4993 Link: ; rel="next", ; rel="last" Content-Length: 273 [ { "url": "https://api.github.com/users/naoya", "avatar_url": "https://secure.gravatar.com/avatar/b4afc7d853d7f1cb6a253d3c7183c05a?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "naoya", "id": 8991 } ]Pithub-0.01042/t/lib/Pithub/Test/http_response/api.github.com/users/miyagawa/followers.GET0000644000175000017500000002053615014062322027744 0ustar olafolafHTTP/1.1 200 OK Server: nginx/1.0.4 Date: Thu, 30 Jun 2011 11:41:02 GMT Content-Type: application/json Connection: keep-alive Status: 200 OK X-RateLimit-Limit: 5000 X-RateLimit-Remaining: 4997 Link: ; rel="next", ; rel="last" Content-Length: 8182 [ { "url": "https://api.github.com/users/naoya", "avatar_url": "https://secure.gravatar.com/avatar/b4afc7d853d7f1cb6a253d3c7183c05a?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "naoya", "id": 8991 }, { "url": "https://api.github.com/users/kentaro", "avatar_url": "https://secure.gravatar.com/avatar/23f4d5d797a91b6d17d627b90b5a42d9?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "kentaro", "id": 3458 }, { "url": "https://api.github.com/users/typester", "avatar_url": "https://secure.gravatar.com/avatar/fbc6511bcc0649366086c0445fb456d3?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "typester", "id": 3420 }, { "url": "https://api.github.com/users/cho45", "avatar_url": "https://secure.gravatar.com/avatar/c6fb2af8cf4ae9047afeb92990e7f61f?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "cho45", "id": 3092 }, { "url": "https://api.github.com/users/yappo", "avatar_url": "https://secure.gravatar.com/avatar/6b783f98e70fda69a0fede4329ffa5fb?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "yappo", "id": 9958 }, { "url": "https://api.github.com/users/coji", "avatar_url": "https://secure.gravatar.com/avatar/02debdfc01e2fcbc02c4d395dd5eaec9?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "coji", "id": 9904 }, { "url": "https://api.github.com/users/dann", "avatar_url": "https://secure.gravatar.com/avatar/6c336cac38027aee98b47d959bff77d7?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "dann", "id": 5257 }, { "url": "https://api.github.com/users/cesare", "avatar_url": "https://secure.gravatar.com/avatar/695ebf56302648af39595814b9d96da5?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "cesare", "id": 9944 }, { "url": "https://api.github.com/users/hirose31", "avatar_url": "https://secure.gravatar.com/avatar/c1ccb81aa27de309933384652c7b0635?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "hirose31", "id": 9108 }, { "url": "https://api.github.com/users/walf443", "avatar_url": "https://secure.gravatar.com/avatar/dea4fe079aec284744ad02eb3d2594f5?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "walf443", "id": 2655 }, { "url": "https://api.github.com/users/amachang", "avatar_url": "https://secure.gravatar.com/avatar/fd5f685078e05abc24334d86adf20fae?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "amachang", "id": 10735 }, { "url": "https://api.github.com/users/takuma104", "avatar_url": "https://secure.gravatar.com/avatar/a9ed576e0ad16e71be3df472867db9c0?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "takuma104", "id": 10776 }, { "url": "https://api.github.com/users/hakobe", "avatar_url": "https://secure.gravatar.com/avatar/7e8bb5931a14030dc6a297aa364197bf?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "hakobe", "id": 6882 }, { "url": "https://api.github.com/users/tkmr", "avatar_url": "https://secure.gravatar.com/avatar/07f67ca9b7984a273f1a519ad65c661c?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "tkmr", "id": 8937 }, { "url": "https://api.github.com/users/ujihisa", "avatar_url": "https://secure.gravatar.com/avatar/d9d0ceb387e3b6de5c4562af78e8a910?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "ujihisa", "id": 11504 }, { "url": "https://api.github.com/users/otsune", "avatar_url": "https://secure.gravatar.com/avatar/96137e8beb09ef61e628fe7d52351de8?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "otsune", "id": 13574 }, { "url": "https://api.github.com/users/yhara", "avatar_url": "https://secure.gravatar.com/avatar/22270b6a4e909f6b926fa272596d41b9?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "yhara", "id": 12285 }, { "url": "https://api.github.com/users/dai", "avatar_url": "https://secure.gravatar.com/avatar/52e0a1ab3fecd8c46dae64848daf3c38?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "dai", "id": 12391 }, { "url": "https://api.github.com/users/psychs", "avatar_url": "https://secure.gravatar.com/avatar/4f0b1592036392a00aac1a3683aee706?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "psychs", "id": 3147 }, { "url": "https://api.github.com/users/motemen", "avatar_url": "https://secure.gravatar.com/avatar/9b741203feda475cbeae8b384de9f415?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "motemen", "id": 8465 }, { "url": "https://api.github.com/users/hotchpotch", "avatar_url": "https://secure.gravatar.com/avatar/2997ec7879942bd0415690c85731e328?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "hotchpotch", "id": 3500 }, { "url": "https://api.github.com/users/beppu", "avatar_url": "https://secure.gravatar.com/avatar/32093c41c663ea62b17d66dab11b789f?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "beppu", "id": 4425 }, { "url": "https://api.github.com/users/eto", "avatar_url": "https://secure.gravatar.com/avatar/ee67564a1a0e290cccf3c4a415e51c48?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "eto", "id": 8441 }, { "url": "https://api.github.com/users/ap", "avatar_url": "https://secure.gravatar.com/avatar/e17949267bbfe21a0fadf1bbf00592b4?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "ap", "id": 1683 }, { "url": "https://api.github.com/users/gugod", "avatar_url": "https://secure.gravatar.com/avatar/4d8c65b603554811079a7ea9b7aab9c0?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "gugod", "id": 4970 }, { "url": "https://api.github.com/users/tokuhirom", "avatar_url": "https://secure.gravatar.com/avatar/36a17db871aaa3267948cf3a557a2575?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "tokuhirom", "id": 21084 }, { "url": "https://api.github.com/users/n0ts", "avatar_url": "https://secure.gravatar.com/avatar/70ac3ee07a305c4e4105dc59a5fdd785?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "n0ts", "id": 19618 }, { "url": "https://api.github.com/users/dealforest", "avatar_url": "https://secure.gravatar.com/avatar/0a86666ca90016b2a28289dda921b0d7?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "dealforest", "id": 22857 }, { "url": "https://api.github.com/users/pfenwick", "avatar_url": "https://secure.gravatar.com/avatar/c796116002768900a951a1b08a35d513?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "pfenwick", "id": 12072 }, { "url": "https://api.github.com/users/monjudoh", "avatar_url": "https://secure.gravatar.com/avatar/4c632ac0a8b5d26f8fc18f002bf449b2?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "monjudoh", "id": 23662 } ]Pithub-0.01042/t/lib/Pithub/Test/http_response/api.github.com/users/plu.GET0000644000175000017500000000143415014062322024725 0ustar olafolafHTTP/1.1 200 OK Server: nginx/0.7.67 Date: Fri, 24 Jun 2011 02:25:53 GMT Content-Type: application/json Connection: keep-alive Status: 200 OK X-RateLimit-Limit: 5000 X-RateLimit-Remaining: 4994 Content-Length: 581 { "type": "User", "location": "Dubai", "url": "https://api.github.com/users/plu", "avatar_url": "https://secure.gravatar.com/avatar/cacc359ee20d3423087f957241cffd2b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "public_repos": 17, "followers": 54, "hireable": false, "html_url": "https://github.com/plu", "bio": null, "login": "plu", "public_gists": 38, "name": "Johannes Plunien", "following": 178, "created_at": "2008-10-29T09:03:04Z", "email": "plu@pqpq.de", "id": 31597, "company": "", "blog": "" } Pithub-0.01042/t/lib/Pithub/Test/http_response/api.github.com/users/plu/0000775000175000017500000000000015014062322024364 5ustar olafolafPithub-0.01042/t/lib/Pithub/Test/http_response/api.github.com/users/plu/repos.GET0000644000175000017500000004222415014062322026057 0ustar olafolafHTTP/1.1 200 OK Server: nginx/0.7.67 Date: Fri, 24 Jun 2011 07:07:38 GMT Content-Type: application/json Connection: keep-alive Status: 200 OK X-RateLimit-Limit: 5000 X-RateLimit-Remaining: 4894 Content-Length: 17340 [ { "watchers": 2, "description": "A POE::Component::IRC plugin that provides blowfish encryption.", "ssh_url": "git@github.com:plu/poe-component-irc-plugin-blowfish.git", "url": "https://api.github.com/repos/plu/poe-component-irc-plugin-blowfish", "html_url": "https://github.com/plu/poe-component-irc-plugin-blowfish", "pushed_at": "2009-05-26T07:52:34Z", "open_issues": 0, "homepage": "http://search.cpan.org/dist/POE-Component-IRC-Plugin-Blowfish/", "fork": false, "language": null, "private": false, "size": 648, "forks": 1, "svn_url": "https://svn.github.com/plu/poe-component-irc-plugin-blowfish", "owner": { "url": "https://api.github.com/users/plu", "avatar_url": "https://secure.gravatar.com/avatar/cacc359ee20d3423087f957241cffd2b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "plu", "id": 31597 }, "name": "poe-component-irc-plugin-blowfish", "git_url": "git://github.com/plu/poe-component-irc-plugin-blowfish.git", "created_at": "2009-05-26T07:52:13Z", "clone_url": "https://github.com/plu/poe-component-irc-plugin-blowfish.git" }, { "watchers": 1, "description": "Common code for EFA widgets (MVV/VGN/VVS)", "ssh_url": "git@github.com:plu/efa-wdgt-common.git", "url": "https://api.github.com/repos/plu/efa-wdgt-common", "html_url": "https://github.com/plu/efa-wdgt-common", "pushed_at": "2009-05-27T11:57:56Z", "open_issues": 0, "homepage": "http://www.efa-widgets.de/", "fork": false, "language": null, "private": false, "size": 132, "forks": 1, "svn_url": "https://svn.github.com/plu/efa-wdgt-common", "owner": { "url": "https://api.github.com/users/plu", "avatar_url": "https://secure.gravatar.com/avatar/cacc359ee20d3423087f957241cffd2b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "plu", "id": 31597 }, "name": "efa-wdgt-common", "git_url": "git://github.com/plu/efa-wdgt-common.git", "created_at": "2009-05-27T11:57:10Z", "clone_url": "https://github.com/plu/efa-wdgt-common.git" }, { "watchers": 1, "description": "MVV Dashboard Widget", "ssh_url": "git@github.com:plu/mvv-wdgt.git", "url": "https://api.github.com/repos/plu/mvv-wdgt", "html_url": "https://github.com/plu/mvv-wdgt", "pushed_at": "2009-05-27T12:20:23Z", "open_issues": 0, "homepage": "http://www.efa-widgets.de/mvv/", "fork": false, "language": null, "private": false, "size": 1024, "forks": 1, "svn_url": "https://svn.github.com/plu/mvv-wdgt", "owner": { "url": "https://api.github.com/users/plu", "avatar_url": "https://secure.gravatar.com/avatar/cacc359ee20d3423087f957241cffd2b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "plu", "id": 31597 }, "name": "mvv-wdgt", "git_url": "git://github.com/plu/mvv-wdgt.git", "created_at": "2009-05-27T12:05:29Z", "clone_url": "https://github.com/plu/mvv-wdgt.git" }, { "watchers": 1, "description": "VVS Dashboard Widget", "ssh_url": "git@github.com:plu/vvs-wdgt.git", "url": "https://api.github.com/repos/plu/vvs-wdgt", "html_url": "https://github.com/plu/vvs-wdgt", "pushed_at": "2009-05-27T12:31:09Z", "open_issues": 0, "homepage": "http://www.efa-widgets.de/vvs/", "fork": false, "language": null, "private": false, "size": 1024, "forks": 1, "svn_url": "https://svn.github.com/plu/vvs-wdgt", "owner": { "url": "https://api.github.com/users/plu", "avatar_url": "https://secure.gravatar.com/avatar/cacc359ee20d3423087f957241cffd2b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "plu", "id": 31597 }, "name": "vvs-wdgt", "git_url": "git://github.com/plu/vvs-wdgt.git", "created_at": "2009-05-27T12:21:52Z", "clone_url": "https://github.com/plu/vvs-wdgt.git" }, { "watchers": 1, "description": "VGN Dashboard Widget", "ssh_url": "git@github.com:plu/vgn-wdgt.git", "url": "https://api.github.com/repos/plu/vgn-wdgt", "html_url": "https://github.com/plu/vgn-wdgt", "pushed_at": "2009-05-27T12:31:27Z", "open_issues": 0, "homepage": "http://www.efa-widgets.de/vgn/", "fork": false, "language": null, "private": false, "size": 1024, "forks": 1, "svn_url": "https://svn.github.com/plu/vgn-wdgt", "owner": { "url": "https://api.github.com/users/plu", "avatar_url": "https://secure.gravatar.com/avatar/cacc359ee20d3423087f957241cffd2b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "plu", "id": 31597 }, "name": "vgn-wdgt", "git_url": "git://github.com/plu/vgn-wdgt.git", "created_at": "2009-05-27T12:22:19Z", "clone_url": "https://github.com/plu/vgn-wdgt.git" }, { "watchers": 1, "description": "Remote form validation with Catalyst/ExtJS", "ssh_url": "git@github.com:plu/rfv-example.git", "url": "https://api.github.com/repos/plu/rfv-example", "html_url": "https://github.com/plu/rfv-example", "pushed_at": "2009-05-27T12:38:41Z", "open_issues": 0, "homepage": "http://www.pqpq.de/mt/2008/07/remote-form-validation.html", "fork": false, "language": null, "private": false, "size": 492, "forks": 1, "svn_url": "https://svn.github.com/plu/rfv-example", "owner": { "url": "https://api.github.com/users/plu", "avatar_url": "https://secure.gravatar.com/avatar/cacc359ee20d3423087f957241cffd2b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "plu", "id": 31597 }, "name": "rfv-example", "git_url": "git://github.com/plu/rfv-example.git", "created_at": "2009-05-27T12:38:09Z", "clone_url": "https://github.com/plu/rfv-example.git" }, { "watchers": 1, "description": "DAO example using Catalyst + DBIC", "ssh_url": "git@github.com:plu/dao-example.git", "url": "https://api.github.com/repos/plu/dao-example", "html_url": "https://github.com/plu/dao-example", "pushed_at": "2009-05-27T19:21:06Z", "open_issues": 0, "homepage": "http://www.pqpq.de/mt/2009/05/catalyst-dbic-dao.html", "fork": false, "language": null, "private": false, "size": 568, "forks": 1, "svn_url": "https://svn.github.com/plu/dao-example", "owner": { "url": "https://api.github.com/users/plu", "avatar_url": "https://secure.gravatar.com/avatar/cacc359ee20d3423087f957241cffd2b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "plu", "id": 31597 }, "name": "dao-example", "git_url": "git://github.com/plu/dao-example.git", "created_at": "2009-05-27T18:47:46Z", "clone_url": "https://github.com/plu/dao-example.git" }, { "watchers": 3, "description": "Log::Handler::Output::Gearman - Send log messages to a Gearman worker.", "ssh_url": "git@github.com:plu/log-handler-output-gearman.git", "url": "https://api.github.com/repos/plu/log-handler-output-gearman", "html_url": "https://github.com/plu/log-handler-output-gearman", "pushed_at": "2010-08-26T07:11:25Z", "open_issues": 0, "homepage": "http://search.cpan.org/dist/Log-Handler-Output-Gearman", "fork": false, "language": "Perl", "private": false, "size": 1548, "forks": 1, "svn_url": "https://svn.github.com/plu/log-handler-output-gearman", "owner": { "url": "https://api.github.com/users/plu", "avatar_url": "https://secure.gravatar.com/avatar/cacc359ee20d3423087f957241cffd2b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "plu", "id": 31597 }, "name": "log-handler-output-gearman", "git_url": "git://github.com/plu/log-handler-output-gearman.git", "created_at": "2009-07-14T16:32:17Z", "clone_url": "https://github.com/plu/log-handler-output-gearman.git" }, { "watchers": 2, "description": "TextMate bundle that will let you keep a directory on a remote server in sync with your local work directory.", "ssh_url": "git@github.com:plu/synchronize-remote-directory-rsync-ssh-tmbundle.git", "url": "https://api.github.com/repos/plu/synchronize-remote-directory-rsync-ssh-tmbundle", "html_url": "https://github.com/plu/synchronize-remote-directory-rsync-ssh-tmbundle", "pushed_at": "2010-01-12T09:52:37Z", "open_issues": 0, "homepage": "http://david.olrik.dk/projects/", "fork": true, "language": null, "private": false, "size": 296, "forks": 1, "svn_url": "https://svn.github.com/plu/synchronize-remote-directory-rsync-ssh-tmbundle", "owner": { "url": "https://api.github.com/users/plu", "avatar_url": "https://secure.gravatar.com/avatar/cacc359ee20d3423087f957241cffd2b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "plu", "id": 31597 }, "name": "synchronize-remote-directory-rsync-ssh-tmbundle", "git_url": "git://github.com/plu/synchronize-remote-directory-rsync-ssh-tmbundle.git", "created_at": "2009-09-08T13:04:17Z", "clone_url": "https://github.com/plu/synchronize-remote-directory-rsync-ssh-tmbundle.git" }, { "watchers": 3, "description": "Net::Telnet::Gearman - interact with a Gearman server through its telnet interface", "ssh_url": "git@github.com:plu/net-telnet-gearman.git", "url": "https://api.github.com/repos/plu/net-telnet-gearman", "html_url": "https://github.com/plu/net-telnet-gearman", "pushed_at": "2010-03-24T15:21:30Z", "open_issues": 0, "homepage": "http://search.cpan.org/dist/Net-Telnet-Gearman/", "fork": false, "language": null, "private": false, "size": 720, "forks": 1, "svn_url": "https://svn.github.com/plu/net-telnet-gearman", "owner": { "url": "https://api.github.com/users/plu", "avatar_url": "https://secure.gravatar.com/avatar/cacc359ee20d3423087f957241cffd2b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "plu", "id": 31597 }, "name": "net-telnet-gearman", "git_url": "git://github.com/plu/net-telnet-gearman.git", "created_at": "2009-10-21T18:20:24Z", "clone_url": "https://github.com/plu/net-telnet-gearman.git" }, { "watchers": 16, "description": "Manage Gearman workers", "ssh_url": "git@github.com:plu/gearman-driver.git", "url": "https://api.github.com/repos/plu/gearman-driver", "html_url": "https://github.com/plu/gearman-driver", "pushed_at": "2011-06-03T06:25:39Z", "open_issues": 0, "homepage": "", "fork": false, "language": "Perl", "private": false, "size": 248, "forks": 5, "svn_url": "https://svn.github.com/plu/gearman-driver", "owner": { "url": "https://api.github.com/users/plu", "avatar_url": "https://secure.gravatar.com/avatar/cacc359ee20d3423087f957241cffd2b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "plu", "id": 31597 }, "name": "gearman-driver", "git_url": "git://github.com/plu/gearman-driver.git", "created_at": "2009-12-28T08:35:53Z", "clone_url": "https://github.com/plu/gearman-driver.git" }, { "watchers": 1, "description": "Wrapper for installing libevent v1.4.13", "ssh_url": "git@github.com:plu/alien-libevent.git", "url": "https://api.github.com/repos/plu/alien-libevent", "html_url": "https://github.com/plu/alien-libevent", "pushed_at": "2010-01-05T21:44:01Z", "open_issues": 0, "homepage": "", "fork": false, "language": null, "private": false, "size": 972, "forks": 1, "svn_url": "https://svn.github.com/plu/alien-libevent", "owner": { "url": "https://api.github.com/users/plu", "avatar_url": "https://secure.gravatar.com/avatar/cacc359ee20d3423087f957241cffd2b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "plu", "id": 31597 }, "name": "alien-libevent", "git_url": "git://github.com/plu/alien-libevent.git", "created_at": "2009-12-30T15:24:48Z", "clone_url": "https://github.com/plu/alien-libevent.git" }, { "watchers": 1, "description": "Wrapper for installing libgearman v0.11", "ssh_url": "git@github.com:plu/alien-gearman.git", "url": "https://api.github.com/repos/plu/alien-gearman", "html_url": "https://github.com/plu/alien-gearman", "pushed_at": "2010-02-21T16:11:51Z", "open_issues": 0, "homepage": "", "fork": false, "language": null, "private": false, "size": 384, "forks": 1, "svn_url": "https://svn.github.com/plu/alien-gearman", "owner": { "url": "https://api.github.com/users/plu", "avatar_url": "https://secure.gravatar.com/avatar/cacc359ee20d3423087f957241cffd2b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "plu", "id": 31597 }, "name": "alien-gearman", "git_url": "git://github.com/plu/alien-gearman.git", "created_at": "2009-12-30T15:37:58Z", "clone_url": "https://github.com/plu/alien-gearman.git" }, { "watchers": 1, "description": "~/bin", "ssh_url": "git@github.com:plu/bin.git", "url": "https://api.github.com/repos/plu/bin", "html_url": "https://github.com/plu/bin", "pushed_at": "2011-06-18T03:17:30Z", "open_issues": 0, "homepage": "", "fork": false, "language": "Perl", "private": false, "size": 668, "forks": 1, "svn_url": "https://svn.github.com/plu/bin", "owner": { "url": "https://api.github.com/users/plu", "avatar_url": "https://secure.gravatar.com/avatar/cacc359ee20d3423087f957241cffd2b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "plu", "id": 31597 }, "name": "bin", "git_url": "git://github.com/plu/bin.git", "created_at": "2010-09-15T12:16:18Z", "clone_url": "https://github.com/plu/bin.git" }, { "watchers": 2, "description": "plunien.de on Google AppEngine", "ssh_url": "git@github.com:plu/plunien-de.git", "url": "https://api.github.com/repos/plu/plunien-de", "html_url": "https://github.com/plu/plunien-de", "pushed_at": "2011-05-10T16:48:51Z", "open_issues": 0, "homepage": "", "fork": false, "language": "Python", "private": false, "size": 12660, "forks": 1, "svn_url": "https://svn.github.com/plu/plunien-de", "owner": { "url": "https://api.github.com/users/plu", "avatar_url": "https://secure.gravatar.com/avatar/cacc359ee20d3423087f957241cffd2b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "plu", "id": 31597 }, "name": "plunien-de", "git_url": "git://github.com/plu/plunien-de.git", "created_at": "2010-09-19T16:00:30Z", "clone_url": "https://github.com/plu/plunien-de.git" }, { "watchers": 2, "description": "helpers for any Catalyst app", "ssh_url": "git@github.com:plu/AnyCat.git", "url": "https://api.github.com/repos/plu/AnyCat", "html_url": "https://github.com/plu/AnyCat", "pushed_at": "2011-06-10T14:52:18Z", "open_issues": 0, "homepage": "", "fork": false, "language": "Perl", "private": false, "size": 296, "forks": 1, "svn_url": "https://svn.github.com/plu/AnyCat", "owner": { "url": "https://api.github.com/users/plu", "avatar_url": "https://secure.gravatar.com/avatar/cacc359ee20d3423087f957241cffd2b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "plu", "id": 31597 }, "name": "AnyCat", "git_url": "git://github.com/plu/AnyCat.git", "created_at": "2011-06-10T10:39:58Z", "clone_url": "https://github.com/plu/AnyCat.git" }, { "watchers": 1, "description": "TextMate bundle collection", "ssh_url": "git@github.com:plu/textmate-bundles.git", "url": "https://api.github.com/repos/plu/textmate-bundles", "html_url": "https://github.com/plu/textmate-bundles", "pushed_at": "2011-06-21T15:23:21Z", "open_issues": 0, "homepage": "", "fork": false, "language": "Perl", "private": false, "size": 360, "forks": 1, "svn_url": "https://svn.github.com/plu/textmate-bundles", "owner": { "url": "https://api.github.com/users/plu", "avatar_url": "https://secure.gravatar.com/avatar/cacc359ee20d3423087f957241cffd2b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "plu", "id": 31597 }, "name": "textmate-bundles", "git_url": "git://github.com/plu/textmate-bundles.git", "created_at": "2011-06-18T03:45:15Z", "clone_url": "https://github.com/plu/textmate-bundles.git" } ]././@LongLink0000644000000000000000000000015100000000000011600 Lustar rootrootPithub-0.01042/t/lib/Pithub/Test/http_response/api.github.com/users/plu/followers.GET.page-4.per_page-15Pithub-0.01042/t/lib/Pithub/Test/http_response/api.github.com/users/plu/followers.GET.page-4.per_pag0000644000175000017500000000545215014062322031435 0ustar olafolafHTTP/1.1 200 OK Server: nginx/1.0.4 Date: Thu, 30 Jun 2011 12:22:50 GMT Content-Type: application/json Connection: keep-alive Status: 200 OK X-RateLimit-Limit: 5000 X-RateLimit-Remaining: 4972 Link: ; rel="first", ; rel="prev" Content-Length: 2484 [ { "url": "https://api.github.com/users/hma", "login": "hma", "avatar_url": "https://secure.gravatar.com/avatar/eb0885a144e4c9ec1f0c360e9da7f72f?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "id": 111391 }, { "url": "https://api.github.com/users/reneeb", "login": "reneeb", "avatar_url": "https://secure.gravatar.com/avatar/76480ff2803bb96e12b3b2151afabc02?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "id": 144096 }, { "url": "https://api.github.com/users/tcaine", "login": "tcaine", "avatar_url": "https://secure.gravatar.com/avatar/167fb481ee6690638094e28e4c8b711c?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "id": 146609 }, { "url": "https://api.github.com/users/marcelmay", "login": "marcelmay", "avatar_url": "https://secure.gravatar.com/avatar/136af25610a6c7ad3cb2b41565d4b2cc?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "id": 213806 }, { "url": "https://api.github.com/users/codeholic", "login": "codeholic", "avatar_url": "https://secure.gravatar.com/avatar/fb7d0e5dd1af9f2b9bc7d5d24cbea1e9?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "id": 107519 }, { "url": "https://api.github.com/users/ibudai", "login": "ibudai", "avatar_url": "https://secure.gravatar.com/avatar/d7cf892246be4b3f58421a8bd94410a8?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "id": 615538 }, { "url": "https://api.github.com/users/CebZam", "login": "CebZam", "avatar_url": "https://secure.gravatar.com/avatar/84f9cd09a2ebf2181103c7b835bc3e10?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "id": 641997 }, { "url": "https://api.github.com/users/mmchaney", "login": "mmchaney", "avatar_url": "https://secure.gravatar.com/avatar/56044beec317a02175fcc7b92803324e?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "id": 469907 }, { "url": "https://api.github.com/users/cub-uanic", "login": "cub-uanic", "avatar_url": "https://secure.gravatar.com/avatar/6a60eb79d930055d7b6acc27f097e084?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "id": 75673 } ]././@LongLink0000644000000000000000000000015100000000000011600 Lustar rootrootPithub-0.01042/t/lib/Pithub/Test/http_response/api.github.com/users/plu/followers.GET.page-3.per_page-15Pithub-0.01042/t/lib/Pithub/Test/http_response/api.github.com/users/plu/followers.GET.page-3.per_pag0000644000175000017500000001110615014062322031425 0ustar olafolafHTTP/1.1 200 OK Server: nginx/1.0.4 Date: Thu, 30 Jun 2011 12:22:23 GMT Content-Type: application/json Connection: keep-alive Status: 200 OK X-RateLimit-Limit: 5000 X-RateLimit-Remaining: 4973 Link: ; rel="next", ; rel="last", ; rel="first", ; rel="prev" Content-Length: 4150 [ { "url": "https://api.github.com/users/Stereobit", "login": "Stereobit", "avatar_url": "https://secure.gravatar.com/avatar/26bf316adf9d6df49b6d697ca0f31d37?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "id": 150493 }, { "url": "https://api.github.com/users/heytrav", "login": "heytrav", "avatar_url": "https://secure.gravatar.com/avatar/20cd64e18f1623aaed58deb06499049c?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "id": 64812 }, { "url": "https://api.github.com/users/mrhiccup", "login": "mrhiccup", "avatar_url": "https://secure.gravatar.com/avatar/201d11ffebace8e9a77a1e898ddcc688?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "id": 226808 }, { "url": "https://api.github.com/users/nightsailer", "login": "nightsailer", "avatar_url": "https://secure.gravatar.com/avatar/996e7087c7bcd5b7e91df1d14ae2efc7?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "id": 44058 }, { "url": "https://api.github.com/users/thoren", "login": "thoren", "avatar_url": "https://secure.gravatar.com/avatar/2a210b6be10bf56012dab2cfa54d8093?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "id": 311809 }, { "url": "https://api.github.com/users/aurora", "login": "aurora", "avatar_url": "https://secure.gravatar.com/avatar/be4cf404a9ae1f27da2004a0c11ef79c?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "id": 304837 }, { "url": "https://api.github.com/users/leobm", "login": "leobm", "avatar_url": "https://secure.gravatar.com/avatar/e67e99687172acf45186d49798d54ed0?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "id": 25712 }, { "url": "https://api.github.com/users/koyachi", "login": "koyachi", "avatar_url": "https://secure.gravatar.com/avatar/b5e3d4216d25dcc0a3b51ff98e17e456?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "id": 19330 }, { "url": "https://api.github.com/users/rainboxx", "login": "rainboxx", "avatar_url": "https://secure.gravatar.com/avatar/f5263c8fcf1a9adba99c660164076aad?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "id": 301178 }, { "url": "https://api.github.com/users/cooldaemon", "login": "cooldaemon", "avatar_url": "https://secure.gravatar.com/avatar/6df68c600984ac81b8fe1fc335d1c6d6?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "id": 10272 }, { "url": "https://api.github.com/users/leedo", "login": "leedo", "avatar_url": "https://secure.gravatar.com/avatar/e51fde0c43e5adfbfc72f2cc1062a142?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "id": 37561 }, { "url": "https://api.github.com/users/alanhaggai", "login": "alanhaggai", "avatar_url": "https://secure.gravatar.com/avatar/3843ec7861e271e803ea076035d683dd?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "id": 46288 }, { "url": "https://api.github.com/users/nevesenin", "login": "nevesenin", "avatar_url": "https://secure.gravatar.com/avatar/48151326de710a61a37dbd9ee6860e0e?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "id": 102794 }, { "url": "https://api.github.com/users/erickd", "login": "erickd", "avatar_url": "https://secure.gravatar.com/avatar/3d432b1133aee59eac61b9cbc967e8c3?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "id": 47961 }, { "url": "https://api.github.com/users/horaci", "login": "horaci", "avatar_url": "https://secure.gravatar.com/avatar/5077e052e1efe5fc6346f140d349701e?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "id": 37765 } ]Pithub-0.01042/t/lib/Pithub/Test/http_response/api.github.com/users/plu/followers.GET.per_page-150000644000175000017500000001060415014062322030744 0ustar olafolafHTTP/1.1 200 OK Server: nginx/1.0.4 Date: Thu, 30 Jun 2011 12:20:58 GMT Content-Type: application/json Connection: keep-alive Status: 200 OK X-RateLimit-Limit: 5000 X-RateLimit-Remaining: 4975 Link: ; rel="next", ; rel="last" Content-Length: 4111 [ { "url": "https://api.github.com/users/marcusramberg", "avatar_url": "https://secure.gravatar.com/avatar/25484352cbd4cd37598a3b5d96b87d91?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "marcusramberg", "id": 5526 }, { "url": "https://api.github.com/users/kraih", "avatar_url": "https://secure.gravatar.com/avatar/d9fae208c6398bc6172b97ad62427842?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "kraih", "id": 30094 }, { "url": "https://api.github.com/users/rbo", "avatar_url": "https://secure.gravatar.com/avatar/96eccf11bdcae5086f223a11d9a88a25?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "rbo", "id": 36604 }, { "url": "https://api.github.com/users/rafl", "avatar_url": "https://secure.gravatar.com/avatar/b7623d3ead9eb46172a44e1bd761b37a?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "rafl", "id": 25669 }, { "url": "https://api.github.com/users/nothingmuch", "avatar_url": "https://secure.gravatar.com/avatar/81912bc5ca02376f99a5ee44531dee27?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "nothingmuch", "id": 14242 }, { "url": "https://api.github.com/users/jrockway", "avatar_url": "https://secure.gravatar.com/avatar/c020aeae684d0e137d1da9d3ac3fda17?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "jrockway", "id": 2367 }, { "url": "https://api.github.com/users/wreis", "avatar_url": "https://secure.gravatar.com/avatar/2547197e5ddd5ab29a569943002dd7ee?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "wreis", "id": 39332 }, { "url": "https://api.github.com/users/bingos", "avatar_url": "https://secure.gravatar.com/avatar/6f39929efe35c3e2272d2c7e1306565f?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "bingos", "id": 62011 }, { "url": "https://api.github.com/users/webiest", "avatar_url": "https://secure.gravatar.com/avatar/4151a046d8e438a1631a9dd91f33c803?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "webiest", "id": 10476 }, { "url": "https://api.github.com/users/arcanez", "avatar_url": "https://secure.gravatar.com/avatar/be68b0e46958d0dcb621f696f9b1bc1c?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "arcanez", "id": 71438 }, { "url": "https://api.github.com/users/perigrin", "avatar_url": "https://secure.gravatar.com/avatar/72ca0434d6998fb97198f278926c6abf?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "perigrin", "id": 39840 }, { "url": "https://api.github.com/users/aemkei", "avatar_url": "https://secure.gravatar.com/avatar/0d9da77bb99bea710cbf711ed08e57d7?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "aemkei", "id": 1521 }, { "url": "https://api.github.com/users/datamuc", "avatar_url": "https://secure.gravatar.com/avatar/02d18fd1eb2005b469ee217ae9a1da93?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "datamuc", "id": 51400 }, { "url": "https://api.github.com/users/ryd", "avatar_url": "https://secure.gravatar.com/avatar/51f05d5c9539f3d9c0a9cf94b482d966?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "ryd", "id": 36664 }, { "url": "https://api.github.com/users/rhuss", "avatar_url": "https://secure.gravatar.com/avatar/dd1b4868440682ba4ed7e62d8b86d735?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "rhuss", "id": 99080 } ]././@LongLink0000644000000000000000000000015100000000000011600 Lustar rootrootPithub-0.01042/t/lib/Pithub/Test/http_response/api.github.com/users/plu/followers.GET.page-2.per_page-15Pithub-0.01042/t/lib/Pithub/Test/http_response/api.github.com/users/plu/followers.GET.page-2.per_pag0000644000175000017500000001104515014062322031426 0ustar olafolafHTTP/1.1 200 OK Server: nginx/1.0.4 Date: Thu, 30 Jun 2011 12:22:00 GMT Content-Type: application/json Connection: keep-alive Status: 200 OK X-RateLimit-Limit: 5000 X-RateLimit-Remaining: 4974 Link: ; rel="next", ; rel="last", ; rel="first", ; rel="prev" Content-Length: 4117 [ { "url": "https://api.github.com/users/sni", "avatar_url": "https://secure.gravatar.com/avatar/203192f49deb9412dc79e387334b940f?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "sni", "id": 150844 }, { "url": "https://api.github.com/users/burntime", "avatar_url": "https://secure.gravatar.com/avatar/0112d4e4f09b4740a2e3e1afc5e5b9f6?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "burntime", "id": 160396 }, { "url": "https://api.github.com/users/fayland", "avatar_url": "https://secure.gravatar.com/avatar/454038f12793de98a5cb28f9c00ef728?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "fayland", "id": 22424 }, { "url": "https://api.github.com/users/botanica", "avatar_url": "https://secure.gravatar.com/avatar/29b25a4346a97ef4e53e4ae0f020936a?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "botanica", "id": 51151 }, { "url": "https://api.github.com/users/tiff", "avatar_url": "https://secure.gravatar.com/avatar/f4d2e3ebf33bc765070f9a4e3b345e91?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "tiff", "id": 37363 }, { "url": "https://api.github.com/users/martincik", "avatar_url": "https://secure.gravatar.com/avatar/56170d47f1021e3722d57cbaacea8f69?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "martincik", "id": 2183 }, { "url": "https://api.github.com/users/ralph", "avatar_url": "https://secure.gravatar.com/avatar/a7a7dddca32cd8b6e5af394c500934d5?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "ralph", "id": 2190 }, { "url": "https://api.github.com/users/boosty", "avatar_url": "https://secure.gravatar.com/avatar/dfa23014c0bf13bf38b4ef9871e5d8f2?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "boosty", "id": 4270 }, { "url": "https://api.github.com/users/hinnerk-a", "avatar_url": "https://secure.gravatar.com/avatar/491186967c5a2a982080e03864c592b4?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "hinnerk-a", "id": 185016 }, { "url": "https://api.github.com/users/paukul", "avatar_url": "https://secure.gravatar.com/avatar/748521f8ae12460dfa2acd0777072b94?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "paukul", "id": 34843 }, { "url": "https://api.github.com/users/christophd", "avatar_url": "https://secure.gravatar.com/avatar/20246c2d07d886728a0d980353999173?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "christophd", "id": 195264 }, { "url": "https://api.github.com/users/lausser", "avatar_url": "https://secure.gravatar.com/avatar/6674542847b4ce49d82a7367a279dd32?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "lausser", "id": 198968 }, { "url": "https://api.github.com/users/miyagawa", "avatar_url": "https://secure.gravatar.com/avatar/49e1240c84b221f3dcca57d005a2f569?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "miyagawa", "id": 3499 }, { "url": "https://api.github.com/users/barbie", "avatar_url": "https://secure.gravatar.com/avatar/2459f554c069e44527716e3f35e1d0d1?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "barbie", "id": 54998 }, { "url": "https://api.github.com/users/uwe", "avatar_url": "https://secure.gravatar.com/avatar/284d2e08903b7de4ff16705d6b598306?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", "login": "uwe", "id": 34015 } ]Pithub-0.01042/t/lib/Pithub/Test/http_response/api.github.com/users/rwstauner.GET0000644000175000017500000000314215014062322026155 0ustar olafolafHTTP/1.1 200 OK Server: GitHub.com Date: Sun, 04 Oct 2015 18:33:53 GMT Content-Type: application/json; charset=utf-8 Content-Length: 1311 Status: 200 OK X-RateLimit-Limit: 60 X-RateLimit-Remaining: 57 X-RateLimit-Reset: 1443985395 Cache-Control: public, max-age=60, s-maxage=60 Last-Modified: Sun, 04 Oct 2015 18:33:46 GMT X-GitHub-Media-Type: github.v3 { "login": "rwstauner", "id": 142719, "avatar_url": "https://avatars.githubusercontent.com/u/142719?v=3", "gravatar_id": "", "url": "https://api.github.com/users/rwstauner", "html_url": "https://github.com/rwstauner", "followers_url": "https://api.github.com/users/rwstauner/followers", "following_url": "https://api.github.com/users/rwstauner/following{/other_user}", "gists_url": "https://api.github.com/users/rwstauner/gists{/gist_id}", "starred_url": "https://api.github.com/users/rwstauner/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/rwstauner/subscriptions", "organizations_url": "https://api.github.com/users/rwstauner/orgs", "repos_url": "https://api.github.com/users/rwstauner/repos", "events_url": "https://api.github.com/users/rwstauner/events{/privacy}", "received_events_url": "https://api.github.com/users/rwstauner/received_events", "type": "User", "site_admin": false, "name": "Randy Stauner", "company": null, "blog": "", "location": "Mesa, AZ", "email": "randy@magnificent-tears.com", "hireable": true, "bio": "⛰", "public_repos": 183, "public_gists": 14, "followers": 41, "following": 32, "created_at": "2009-10-21T15:58:36Z", "updated_at": "2015-10-04T18:33:46Z" } Pithub-0.01042/t/lib/Pithub/Test/Factory.pm0000644000175000017500000000063015014062322016661 0ustar olafolafpackage # hide from PAUSE Pithub::Test::Factory; use strict; use warnings; use Pithub::Test::UA (); sub create { my ( $self, $class, %args ) = @_; return $class->new( ua => Pithub::Test::UA->new, %args ); } sub test_account { return { org => 'buhtip-org', org_repo => 'buhtip-org-repo', repo => 'buhtip-repo', user => 'buhtip', }; } 1; Pithub-0.01042/t/lib/Pithub/Test/UA.pm0000644000175000017500000000123115014062322015555 0ustar olafolafpackage # hide from PAUSE Pithub::Test::UA; use Moo; use Path::Tiny qw( path ); use HTTP::Response (); my @responses; sub add_response { my ( $self, $path ) = @_; my $full_path = sprintf '%s/http_response/api.github.com/%s', path(__FILE__)->dirname, $path; my $response_string = path($full_path)->slurp; my $response = HTTP::Response->parse($response_string); push @responses, $response; } sub request { my ( $self, $request ) = @_; my $result = HTTP::Response->new; if ( my $response = shift(@responses) ) { $result = $response; } $result->request($request); return $result; } 1; Pithub-0.01042/LICENSE0000644000175000017500000004644315014062322012552 0ustar olafolafThis software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2011 by Johannes Plunien. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Perl Artistic License 1.0 --- This software is Copyright (c) 2011 by Johannes Plunien. This is free software, licensed under: The Perl Artistic License 1.0 The "Artistic License" Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder as specified below. "Copyright Holder" is whoever is named in the copyright or copyrights for the package. "You" is you, if you're thinking about copying or distributing this Package. "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as uunet.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) give non-standard executables non-standard names, and clearly document the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. You may embed this Package's interpreter within an executable of yours (by linking); this shall be construed as a mere form of aggregation, provided that the complete Standard Version of the interpreter is so embedded. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whoever generated them, and may be sold commercially, and may be aggregated with this Package. If such scripts or library files are aggregated with this Package via the so-called "undump" or "unexec" methods of producing a binary executable image, then distribution of such an image shall neither be construed as a distribution of this Package nor shall it fall under the restrictions of Paragraphs 3 and 4, provided that you do not represent such an executable image as a Standard Version of this Package. 7. C subroutines (or comparably compiled subroutines in other languages) supplied by you and linked into this Package in order to emulate subroutines and variables of the language defined by this Package shall not be considered part of this Package, but are the equivalent of input as in Paragraph 6, provided these subroutines do not change the language in any way that would cause it to fail the regression tests for the language. 8. Aggregation of this Package with a commercial distribution is always permitted provided that the use of this Package is embedded; that is, when no overt attempt is made to make this Package's interfaces visible to the end user of the commercial distribution. Such use shall not be construed as a distribution of this Package. 9. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End Pithub-0.01042/MANIFEST0000644000175000017500000000713615014062322012672 0ustar olafolaf# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.032. CONTRIBUTORS Changes INSTALL LICENSE MANIFEST META.json META.yml Makefile.PL README.md cpanfile dist.ini examples/cache.pl examples/collaborators.pl examples/create_release.pl examples/fork_to_org.pl examples/gitdata_commit.pl examples/list_branches.pl examples/list_repos.pl examples/merge_branch.pl examples/releases.pl examples/rename_branch.pl examples/show_commit.pl lib/Pithub.pm lib/Pithub/Base.pm lib/Pithub/Events.pm lib/Pithub/Gists.pm lib/Pithub/Gists/Comments.pm lib/Pithub/GitData.pm lib/Pithub/GitData/Blobs.pm lib/Pithub/GitData/Commits.pm lib/Pithub/GitData/References.pm lib/Pithub/GitData/Tags.pm lib/Pithub/GitData/Trees.pm lib/Pithub/Issues.pm lib/Pithub/Issues/Assignees.pm lib/Pithub/Issues/Comments.pm lib/Pithub/Issues/Events.pm lib/Pithub/Issues/Labels.pm lib/Pithub/Issues/Milestones.pm lib/Pithub/Markdown.pm lib/Pithub/Orgs.pm lib/Pithub/Orgs/Members.pm lib/Pithub/Orgs/Teams.pm lib/Pithub/PullRequests.pm lib/Pithub/PullRequests/Comments.pm lib/Pithub/PullRequests/Reviewers.pm lib/Pithub/Repos.pm lib/Pithub/Repos/Actions.pm lib/Pithub/Repos/Actions/Workflows.pm lib/Pithub/Repos/Collaborators.pm lib/Pithub/Repos/Commits.pm lib/Pithub/Repos/Contents.pm lib/Pithub/Repos/Downloads.pm lib/Pithub/Repos/Forks.pm lib/Pithub/Repos/Hooks.pm lib/Pithub/Repos/Keys.pm lib/Pithub/Repos/Releases.pm lib/Pithub/Repos/Releases/Assets.pm lib/Pithub/Repos/Starring.pm lib/Pithub/Repos/Stats.pm lib/Pithub/Repos/Statuses.pm lib/Pithub/Repos/Watching.pm lib/Pithub/Result.pm lib/Pithub/Result/SharedCache.pm lib/Pithub/ResultSet.pm lib/Pithub/Search.pm lib/Pithub/SearchV3.pm lib/Pithub/Users.pm lib/Pithub/Users/Emails.pm lib/Pithub/Users/Followers.pm lib/Pithub/Users/Keys.pm perlcriticrc perltidyrc t/00-report-prereqs.dd t/00-report-prereqs.t t/basic.t t/encoding.t t/events.t t/gists.t t/git_data.t t/issues.t t/lib/Pithub/Test.pm t/lib/Pithub/Test/Factory.pm t/lib/Pithub/Test/UA.pm t/lib/Pithub/Test/http_response/api.github.com/error/notfound.GET t/lib/Pithub/Test/http_response/api.github.com/orgs/CPAN-API/repos.GET t/lib/Pithub/Test/http_response/api.github.com/repos/foo/bar/downloads.POST t/lib/Pithub/Test/http_response/api.github.com/repos/foo/bar/issues.GET t/lib/Pithub/Test/http_response/api.github.com/user/following/rafl.GET t/lib/Pithub/Test/http_response/api.github.com/users/miyagawa/followers.GET t/lib/Pithub/Test/http_response/api.github.com/users/miyagawa/followers.GET.page-26 t/lib/Pithub/Test/http_response/api.github.com/users/miyagawa/followers.GET.page-3 t/lib/Pithub/Test/http_response/api.github.com/users/miyagawa/followers.GET.per_page-1 t/lib/Pithub/Test/http_response/api.github.com/users/plu.GET t/lib/Pithub/Test/http_response/api.github.com/users/plu/followers.GET.page-2.per_page-15 t/lib/Pithub/Test/http_response/api.github.com/users/plu/followers.GET.page-3.per_page-15 t/lib/Pithub/Test/http_response/api.github.com/users/plu/followers.GET.page-4.per_page-15 t/lib/Pithub/Test/http_response/api.github.com/users/plu/followers.GET.per_page-15 t/lib/Pithub/Test/http_response/api.github.com/users/plu/repos.GET t/lib/Pithub/Test/http_response/api.github.com/users/rwstauner.GET t/live/basic.t t/live/cache-lru.t t/live/cache.t t/live/events.t t/live/gists.t t/live/git_data.t t/live/issues.t t/live/orgs.t t/live/pull_requests.t t/live/repos.t t/live/repos/actions/workflows.t t/live/users.t t/multi.t t/orgs.t t/pull_requests.t t/repos.t t/search.t t/test.t t/users.t tidyall.ini xt/author/eol.t xt/author/mojibake.t xt/author/pod-coverage.t xt/author/pod-spell.t xt/author/synopsis.t xt/author/test-version.t xt/release/cpan-changes.t Pithub-0.01042/CONTRIBUTORS0000644000175000017500000000130615014062322013412 0ustar olafolaf # PITHUB CONTRIBUTORS # This is the (likely incomplete) list of people who have helped make this distribution what it is, either via code contributions, patches, bug reports, help with troubleshooting, etc. A huge 'thank you' to all of them. * Alessandro Ghedini * Andreas Marienborg * Corey Farwell * dependabot[bot] * Florian Ragwitz * Graham Ollis * H.Merijn Brand - Tux * Ichinose Shogo * Ivan Bessarabov * Johannes Plunien * José Joaquín Atria * Konboi * Michael G. Schwern * Olaf Alders * Randy Stauner * Rich Bowen * Roland Huß * SUZUKI Masashi * teckl * Thibault DUPONCHELLE * Timothy Legge * Zoffix Znet Pithub-0.01042/INSTALL0000644000175000017500000000447515014062322012575 0ustar olafolafThis is the Perl distribution Pithub. Installing Pithub is straightforward. ## Installation with cpanm If you have cpanm, you only need one line: % cpanm Pithub If it does not have permission to install modules to the current perl, cpanm will automatically set up and install to a local::lib in your home directory. See the local::lib documentation (https://metacpan.org/pod/local::lib) for details on enabling it in your environment. ## Installing with the CPAN shell Alternatively, if your CPAN shell is set up, you should just be able to do: % cpan Pithub ## Manual installation As a last resort, you can manually install it. If you have not already downloaded the release tarball, you can find the download link on the module's MetaCPAN page: https://metacpan.org/pod/Pithub Untar the tarball, install configure prerequisites (see below), then build it: % perl Makefile.PL % make && make test Then install it: % make install On Windows platforms, you should use `dmake` or `nmake`, instead of `make`. If your perl is system-managed, you can create a local::lib in your home directory to install modules to. For details, see the local::lib documentation: https://metacpan.org/pod/local::lib The prerequisites of this distribution will also have to be installed manually. The prerequisites are listed in one of the files: `MYMETA.yml` or `MYMETA.json` generated by running the manual build process described above. ## Configure Prerequisites This distribution requires other modules to be installed before this distribution's installer can be run. They can be found under the "configure_requires" key of META.yml or the "{prereqs}{configure}{requires}" key of META.json. ## Other Prerequisites This distribution may require additional modules to be installed after running Makefile.PL. Look for prerequisites in the following phases: * to run make, PHASE = build * to use the module code itself, PHASE = runtime * to run tests, PHASE = test They can all be found in the "PHASE_requires" key of MYMETA.yml or the "{prereqs}{PHASE}{requires}" key of MYMETA.json. ## Documentation Pithub documentation is available as POD. You can run `perldoc` from a shell to read the documentation: % perldoc Pithub For more information on installing Perl modules via CPAN, please see: https://www.cpan.org/modules/INSTALL.html Pithub-0.01042/perltidyrc0000644000175000017500000000033015014062322013632 0ustar olafolaf--blank-lines-before-packages=0 --iterations=2 --no-outdent-long-comments -b -bar -boc -ci=4 -i=4 -l=78 -nolq -se -wbb="% + - * / x != == >= <= =~ !~ < > | & >= < = **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x=" Pithub-0.01042/examples/0000775000175000017500000000000015014062322013352 5ustar olafolafPithub-0.01042/examples/cache.pl0000755000175000017500000000121715014062322014754 0ustar olafolaf#!/usr/bin/env perl use strict; use warnings; use CHI (); use Pithub::Repos (); use WWW::Mechanize::Cached (); my $cache = CHI->new( driver => 'File', root_dir => '/tmp/pithub-example' ); my $mech = WWW::Mechanize::Cached->new( cache => $cache ); my $b = Pithub::Repos->new( auto_pagination => 1, per_page => 100, ua => $mech, ); my $result = $b->branches( user => 'plu', repo => 'Pithub' ); unless ( $result->success ) { printf "something is fishy: %s\n", $result->response->status_line; exit 1; } while ( my $row = $result->next ) { printf "%s\n", $row->{name}; } Pithub-0.01042/examples/gitdata_commit.pl0000755000175000017500000000374415014062322016705 0ustar olafolaf#!/usr/bin/env perl use strict; use warnings; use Path::Tiny qw( path ); use Pithub::GitData (); my $git = Pithub::GitData->new( repo => 'Pithub', token => $ENV{GITHUB_TOKEN}, user => 'plu', ); my $content = path(__FILE__)->slurp; # the encoding can also be 'base64', if necessary my $blob = $git->blobs->create( data => { content => $content, encoding => 'utf-8', } ); die 'Could not create blob' unless $blob->success; # we need the current master reference, actually just its SHA my $master = $git->references->get( ref => 'heads/master' ); die 'Could not get the heads/master reference' unless $master->success; # and we need the full commit of this SHA. Later we will # extract the tree SHA this commit belongs to. my $base_commit = $git->commits->get( sha => $master->content->{object}{sha} ); die 'Could not get the base commit' unless $base_commit->success; # create a new tree, based on the old one, that adds the new blob my $tree = $git->trees->create( data => { base_tree => $base_commit->content->{tree}{sha}, tree => [ { path => 'examples/gitdata_commit.pl', mode => '100755', type => 'blob', sha => $blob->content->{sha}, } ], } ); die 'Could not create the new tree' unless $tree->success; # create a new commit based on the new tree and # having the current master as a parent my $commit = $git->commits->create( data => { message => 'Add examples/gitdata_commit.pl.', parents => [ $master->content->{object}{sha} ], tree => $tree->content->{sha}, } ); die 'Could not create the commit' unless $commit->success; # finally point the master branch to the new commit my $reference = $git->references->update( ref => 'heads/master', data => { sha => $commit->content->{sha} } ); die 'Could not update the heads/master reference' unless $reference->success; print "Done.\n"; Pithub-0.01042/examples/fork_to_org.pl0000755000175000017500000000036515014062322016226 0ustar olafolaf#!/usr/bin/env perl use strict; use warnings; use Pithub::Repos::Forks (); my $fork = Pithub::Repos::Forks->new( token => $ENV{GITHUB_TOKEN}, ); my $result = $fork->create( org => 'my_org', user => 'plu', repo => 'Pithub', ); Pithub-0.01042/examples/show_commit.pl0000755000175000017500000000146415014062322016245 0ustar olafolaf#!/usr/bin/env perl use strict; use warnings; use Pithub::Repos::Commits (); # https://github.com/kraih/mojo/commit/ad0b3b3fcaacffe39fea34b126cd927e3f02ec78 my $url = $ARGV[0] || die "usage: show_commit.pl \n"; my ( $user, $repo, $sha ) = $url =~ qr{https?://github.com/([^/]+)/([^/]+)/commit/([^/]+)}; my $commit = Pithub::Repos::Commits->new->get( user => $user, repo => $repo, sha => $sha, ); unless ( $commit->success ) { die "could not fetch the commit from Github: $url\n"; } my $c = $commit->content; print <{sha} Author: $c->{commit}{author}{name} <$c->{commit}{author}{email}> Date: $c->{commit}{author}{date} $c->{commit}{message} EOF foreach my $f ( @{ $c->{files} } ) { print <{filename} b/$f->{filename} $f->{patch} EOF } Pithub-0.01042/examples/releases.pl0000755000175000017500000000100115014062322015503 0ustar olafolaf#!/usr/bin/env perl use strict; use warnings; use Pithub::Repos::Releases (); # https://api.github.com/repos/Graylog2/graylog2-server/releases my $input = $ARGV[0] || 'Graylog2/graylog2-server'; my ( $user, $repo ) = split qr{/}, $input; my $result = Pithub::Repos::Releases->new->list( user => $user, repo => $repo ); unless ( $result->success ) { printf "something is fishy: %s\n", $result->response->status_line; exit 1; } while ( my $row = $result->next ) { printf "%s\n", $row->{name}; } Pithub-0.01042/examples/list_repos.pl0000755000175000017500000000065615014062322016102 0ustar olafolaf#!/usr/bin/env perl use strict; use warnings; use Pithub::Repos (); my $r = Pithub::Repos->new( per_page => 100, auto_pagination => 1, ); my $result = $r->list( user => 'rjbs' ); unless ( $result->success ) { printf "something is fishy: %s\n", $result->response->status_line; exit 1; } while ( my $row = $result->next ) { printf "%s: %s\n", $row->{name}, $row->{description} || 'no description'; } Pithub-0.01042/examples/merge_branch.pl0000755000175000017500000000060715014062322016327 0ustar olafolaf#!/usr/bin/env perl use strict; use warnings; use Pithub::Repos (); my $b = Pithub::Repos->new( token => 'ghp_YoUrTokeN' ); # Merge a branch my $result = $b->merge_branch( user => 'plu', repo => 'Pithub', data => { base => 'master', head => 'branch-to-merge' } ); unless ( $result->success ) { printf "something is fishy: %s\n", $result->response->status_line; exit 1; } Pithub-0.01042/examples/create_release.pl0000755000175000017500000000165315014062322016660 0ustar olafolaf#!/usr/bin/env perl use strict; use warnings; use Data::Dumper qw( Dumper ); use Pithub::Repos::Releases (); my $releases = Pithub::Repos::Releases->new( repo => 'buhtip-repo', token => $ENV{GITHUB_TOKEN}, user => 'buhtip', ); require JSON::MaybeXS; my $release = $releases->create( data => { name => "v1.0.$$", tag_name => "v1.0.$$", target_commitisih => 'master', draft => JSON::MaybeXS::false(); } ); my $asset = $releases->assets->create( release_id => $release->content->{id}, name => 'Some Asset', data => 'the asset data', content_type => 'text/plain', ); $releases->assets->update( asset_id => $asset->content->{id}, data => { name => 'Updated Name', label => 'Updated Label', } ); warn Dumper $releases->get( release_id => $release->content->{id} )->content; Pithub-0.01042/examples/list_branches.pl0000755000175000017500000000062615014062322016534 0ustar olafolaf#!/usr/bin/env perl use strict; use warnings; use Pithub::Repos (); my $b = Pithub::Repos->new( per_page => 100, auto_pagination => 1, ); my $result = $b->branches( user => 'plu', repo => 'Pithub' ); unless ( $result->success ) { printf "something is fishy: %s\n", $result->response->status_line; exit 1; } while ( my $row = $result->next ) { printf "%s\n", $row->{name}; } Pithub-0.01042/examples/collaborators.pl0000755000175000017500000000231315014062322016555 0ustar olafolaf#!/usr/bin/perl env =head1 SYNOPSIS LWPCL_REDACT_HEADERS=Authorization perl examples/collaborators.pl =head1 DESCRIPTION List all of the collaborators for a repository. Also, display user agent debugging information. =cut use strict; use warnings; use feature qw( say ); use Git::Raw::Config (); use LWP::ConsoleLogger::Easy 0.000029 qw( debug_ua ); use LWP::UserAgent (); use Pithub::Repos::Collaborators (); # WWW::Mechanize accepts gzip by default but then doesn't actually decode it # for you. See https://github.com/kentnl/HTTP-Tiny-Mech/pull/2 for a detailed # discussion. my $ua = LWP::UserAgent->new; debug_ua($ua); my $c = Pithub::Repos::Collaborators->new( token => get_token(), ua => $ua, ); my $result = $c->list( repo => 'test-www-mechanize-psgi', user => 'acme', ); while ( my $next = $result->next ) { say $next->{login}; } # This script requires a GitHub access token. You may either use the # GITHUB_TOKEN environment variable or set "github.token" in your Git config. sub get_token { return $ENV{GITHUB_TOKEN} if $ENV{GITHUB_TOKEN}; my $config = Git::Raw::Config->default; return $config->str('github.token'); } Pithub-0.01042/examples/rename_branch.pl0000755000175000017500000000060315014062322016473 0ustar olafolaf#!/usr/bin/env perl use strict; use warnings; use Pithub::Repos (); my $b = Pithub::Repos->new( token => 'ghp_YoUrTokeN' ); # Rename branch my $result = $b->rename_branch( user => 'plu', repo => 'Pithub', branch => 'name', data => { new_name => 'newname' } ); unless ( $result->success ) { printf "something is fishy: %s\n", $result->response->status_line; exit 1; } Pithub-0.01042/Makefile.PL0000644000175000017500000000424715014062322013513 0ustar olafolaf# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.032. use strict; use warnings; use 5.013010; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "Github v3 API", "AUTHOR" => "Johannes Plunien ", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0 }, "DISTNAME" => "Pithub", "LICENSE" => "perl", "MIN_PERL_VERSION" => "5.013010", "NAME" => "Pithub", "PREREQ_PM" => { "CHI" => 0, "Carp" => 0, "HTTP::Headers" => 0, "HTTP::Request" => 0, "HTTP::Request::Common" => 0, "JSON::MaybeXS" => 0, "LWP::UserAgent" => 0, "Moo" => 0, "Moo::Role" => 0, "URI" => 0, "strict" => 0, "warnings" => 0 }, "TEST_REQUIRES" => { "Exporter" => 0, "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "FindBin" => 0, "HTTP::Response" => 0, "Import::Into" => 0, "MIME::Base64" => 0, "Path::Tiny" => 0, "Scalar::Util" => 0, "Test::Builder" => 0, "Test::Differences" => 0, "Test::Exception" => 0, "Test::More" => 0, "Test::Most" => 0, "Test::Needs" => 0, "lib" => 0 }, "VERSION" => "0.01042", "test" => { "TESTS" => "t/*.t t/live/*.t t/live/repos/actions/*.t" } ); my %FallbackPrereqs = ( "CHI" => 0, "Carp" => 0, "Exporter" => 0, "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "FindBin" => 0, "HTTP::Headers" => 0, "HTTP::Request" => 0, "HTTP::Request::Common" => 0, "HTTP::Response" => 0, "Import::Into" => 0, "JSON::MaybeXS" => 0, "LWP::UserAgent" => 0, "MIME::Base64" => 0, "Moo" => 0, "Moo::Role" => 0, "Path::Tiny" => 0, "Scalar::Util" => 0, "Test::Builder" => 0, "Test::Differences" => 0, "Test::Exception" => 0, "Test::More" => 0, "Test::Most" => 0, "Test::Needs" => 0, "URI" => 0, "lib" => 0, "strict" => 0, "warnings" => 0 ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); Pithub-0.01042/dist.ini0000644000175000017500000000100515014062322013172 0ustar olafolafauthor = Johannes Plunien copyright_holder = Johannes Plunien copyright_year = 2011 license = Perl_5 name = Pithub [@Author::OALDERS] -remove = PodSyntaxTests -remove = Test::Portability -remove = Test::TidyAll ; enable after oustanding pull requests are merged StaticInstall.mode = on StaticInstall.dry_run = 0 [Authority] authority = cpan:PLU [GitHubREADME::Badge] badges = codecov badges = cpancover badges = cpants badges = github_actions/test.yml badges = license badges = version place = top Pithub-0.01042/cpanfile0000644000175000017500000000420015014062322013232 0ustar olafolaf# This file is generated by Dist::Zilla::Plugin::CPANFile v6.032 # Do not edit this file directly. To change prereqs, edit the `dist.ini` file. requires "CHI" => "0"; requires "Carp" => "0"; requires "HTTP::Headers" => "0"; requires "HTTP::Request" => "0"; requires "HTTP::Request::Common" => "0"; requires "JSON::MaybeXS" => "0"; requires "LWP::UserAgent" => "0"; requires "Moo" => "0"; requires "Moo::Role" => "0"; requires "URI" => "0"; requires "perl" => "5.013010"; requires "strict" => "0"; requires "warnings" => "0"; on 'test' => sub { requires "Exporter" => "0"; requires "ExtUtils::MakeMaker" => "0"; requires "File::Spec" => "0"; requires "FindBin" => "0"; requires "HTTP::Response" => "0"; requires "Import::Into" => "0"; requires "MIME::Base64" => "0"; requires "Path::Tiny" => "0"; requires "Scalar::Util" => "0"; requires "Test::Builder" => "0"; requires "Test::Differences" => "0"; requires "Test::Exception" => "0"; requires "Test::More" => "0"; requires "Test::Most" => "0"; requires "Test::Needs" => "0"; requires "lib" => "0"; requires "perl" => "5.013010"; }; on 'test' => sub { recommends "CPAN::Meta" => "2.120900"; }; on 'configure' => sub { requires "ExtUtils::MakeMaker" => "0"; requires "perl" => "5.006"; }; on 'develop' => sub { requires "Code::TidyAll" => "0.71"; requires "Code::TidyAll::Plugin::SortLines::Naturally" => "0.000003"; requires "Code::TidyAll::Plugin::Test::Vars" => "0.04"; requires "Code::TidyAll::Plugin::UniqueLines" => "0.000003"; requires "Parallel::ForkManager" => "1.19"; requires "Perl::Critic" => "1.132"; requires "Perl::Tidy" => "20180220"; requires "Pod::Coverage::TrustPod" => "0"; requires "Pod::Wordlist" => "0"; requires "Test::CPAN::Changes" => "0.19"; requires "Test::EOL" => "0"; requires "Test::Mojibake" => "0"; requires "Test::More" => "0.96"; requires "Test::Pod::Coverage" => "1.08"; requires "Test::Spelling" => "0.17"; requires "Test::Synopsis" => "0"; requires "Test::Vars" => "0.014"; requires "Test::Version" => "1"; }; on 'develop' => sub { recommends "Dist::Zilla::PluginBundle::Git::VersionManager" => "0.007"; }; Pithub-0.01042/README.md0000644000175000017500000005044215014062322013016 0ustar olafolaf# NAME Pithub - Github v3 API # VERSION version 0.01042 # SYNOPSIS use Pithub (); my $p = Pithub->new; # my $p = Pithub->new(utf8 => 0); # enable compatibility options for version 0.01029 or lower my $repo = $p->repos->get( user => 'plu', repo => 'Pithub' ); # $repo->content is either an arrayref or an hashref # depending on the API call that has been made printf "%s\n", $repo->content->{html_url}; # prints https://github.com/plu/Pithub printf "%s\n", $repo->content->{clone_url}; # prints https://github.com/plu/Pithub.git # if the result is an arrayref, you can use the result iterator my $repos = $p->repos->list( user => 'plu' ); while ( my $row = $repos->next ) { printf "%s\n", $row->{name}; } # Connect to your local GitHub Enterprise instance my $ghe_p = Pithub->new( api_uri => 'https://github.yourdomain.com/api/v3/' ); # No need to provide user/repo to each module: my $pit = Pithub->new( user => 'plu', repo => 'pithub', token => 'my_oauth_token', ); $pit->repos->get; $pit->repos->commits->list; # Use a caching UserAgent use CHI (); use Pithub::Repos (); use WWW::Mechanize::Cached (); my $cache = CHI->new( driver => 'File', root_dir => '/tmp/pithub-example' ); my $mech = WWW::Mechanize::Cached->new( cache => $cache ); my $cached_pithub = Pithub::Repos->new( auto_pagination => 1, per_page => 100, ua => $mech, ); # DESCRIPTION [Pithub](https://metacpan.org/pod/Pithub) (**P**erl + G**ithub**) provides a set of modules to access the [Github v3 API](http://developer.github.com/v3/) in an object oriented way. There is also [Net::GitHub](https://metacpan.org/pod/Net%3A%3AGitHub) which does the same for all the versions (v1, v2, v3) of the Github API. [Pithub](https://metacpan.org/pod/Pithub) supports all API calls so far, but only for v3. # ATTRIBUTES ## search\_api my $p = Pithub->new({ search_api => 'v3' }); my $search = $p->search; # $search->isa('Pithub::SearchV3'); This attribute allows the default for the API to use for searches to be specified. The two accepted values are `v3` and `legacy`. For compatibility reasons the default is `legacy`. # METHODS ## events Provides access to [Pithub::Events](https://metacpan.org/pod/Pithub%3A%3AEvents). ## gists Provides access to [Pithub::Gists](https://metacpan.org/pod/Pithub%3A%3AGists). ## git\_data Provides access to [Pithub::GitData](https://metacpan.org/pod/Pithub%3A%3AGitData). ## issues Provides access to [Pithub::Issues](https://metacpan.org/pod/Pithub%3A%3AIssues). ## markdown Provides access to [Pithub::Markdown](https://metacpan.org/pod/Pithub%3A%3AMarkdown). ## orgs Provides access to [Pithub::Orgs](https://metacpan.org/pod/Pithub%3A%3AOrgs). ## pull\_requests Provides access to [Pithub::PullRequests](https://metacpan.org/pod/Pithub%3A%3APullRequests). ## repos Provides access to [Pithub::Repos](https://metacpan.org/pod/Pithub%3A%3ARepos). ## search my $legacy_search = $p->search(search_api => 'legacy'); my $v3_search = $p->search(search_api => 'v3'); my $default_search = $p->search; Provides access to [Pithub::Search](https://metacpan.org/pod/Pithub%3A%3ASearch) and [Pithub::SearchV3](https://metacpan.org/pod/Pithub%3A%3ASearchV3). When no `search_api` option is given, the value provided by the `search_api` attribute is used. ## users Provides access to [Pithub::Users](https://metacpan.org/pod/Pithub%3A%3AUsers). # DOCUMENTATION Quite a lot of the [Pithub](https://metacpan.org/pod/Pithub) documentation has been taken directly from the great API documentation at [Github](http://developer.github.com/v3/). Please also read the documentation there, since it might be more complete and more up-to-date. [Pithub::Base](https://metacpan.org/pod/Pithub%3A%3ABase) contains documentation for attributes inherited by all Pithub modules. # WARNING [Pithub](https://metacpan.org/pod/Pithub) as well as the [Github v3 API](http://developer.github.com/v3/) are still under development. So there might be things broken on both sides. Besides that it's possible that the API will change. This applies to [Pithub](https://metacpan.org/pod/Pithub) itself as well as the [Github v3 API](http://developer.github.com/v3/). # CONTRIBUTE This module is hosted on [Github](https://github.com/plu/Pithub), so feel free to fork it and send pull requests. There are two different kinds of test suites, one is just checking the HTTP requests that are created by the method calls, without actually sending them. The second one is sending real requests to the Github API. If you want to contribute to this project, I highly recommend to run the live tests on a test account, because it will generate a lot of activity. # MODULES There are different ways of using the Pithub library. You can either use the main module [Pithub](https://metacpan.org/pod/Pithub) to get access to all other modules, like [Pithub::Repos](https://metacpan.org/pod/Pithub%3A%3ARepos) for example. Or you can use [Pithub::Repos](https://metacpan.org/pod/Pithub%3A%3ARepos) directly and create an instance of it. All modules accept the same [attributes](https://metacpan.org/pod/Pithub%3A%3ABase#ATTRIBUTES), either in the constructor or later by calling the setters. Besides that there are other modules involved. Every method call which maps directly to a Github API call returns a [Pithub::Result](https://metacpan.org/pod/Pithub%3A%3AResult) object. This contains everything interesting about the response returned from the API call. [Pithub::Base](https://metacpan.org/pod/Pithub%3A%3ABase) might be interesting for two reasons: - The list of [attributes](https://metacpan.org/pod/Pithub%3A%3ABase#ATTRIBUTES) which all modules accept. - The [request](https://metacpan.org/pod/Pithub%3A%3ABase#request) method: In case Github adds a new API call which is not supported yet by [Pithub](https://metacpan.org/pod/Pithub) the [request](https://metacpan.org/pod/Pithub%3A%3ABase#request) method can be used directly to perform this new API call, there's some documentation on how to use it. - [Pithub::Events](https://metacpan.org/pod/Pithub%3A%3AEvents) See also: [http://developer.github.com/v3/events/](http://developer.github.com/v3/events/) my $events = Pithub->new->events; my $events = Pithub::Events->new; - [Pithub::Gists](https://metacpan.org/pod/Pithub%3A%3AGists) See also: [http://developer.github.com/v3/gists/](http://developer.github.com/v3/gists/) my $gists = Pithub->new->gists; my $gists = Pithub::Gists->new; - [Pithub::Gists::Comments](https://metacpan.org/pod/Pithub%3A%3AGists%3A%3AComments) See also: [http://developer.github.com/v3/gists/comments/](http://developer.github.com/v3/gists/comments/) my $comments = Pithub->new->gists->comments; my $comments = Pithub::Gists->new->comments; my $comments = Pithub::Gists::Comments->new; - [Pithub::GitData](https://metacpan.org/pod/Pithub%3A%3AGitData) See also: [http://developer.github.com/v3/git/](http://developer.github.com/v3/git/) my $git_data = Pithub->new->git_data; my $git_data = Pithub::GitData->new; - [Pithub::GitData::Blobs](https://metacpan.org/pod/Pithub%3A%3AGitData%3A%3ABlobs) See also: [http://developer.github.com/v3/git/blobs/](http://developer.github.com/v3/git/blobs/) my $blobs = Pithub->new->git_data->blobs; my $blobs = Pithub::GitData->new->blobs; my $blobs = Pithub::GitData::Blobs->new; - [Pithub::GitData::Commits](https://metacpan.org/pod/Pithub%3A%3AGitData%3A%3ACommits) See also: [http://developer.github.com/v3/git/commits/](http://developer.github.com/v3/git/commits/) my $commits = Pithub->new->git_data->commits; my $commits = Pithub::GitData->new->commits; my $commits = Pithub::GitData::Commits->new; - [Pithub::GitData::References](https://metacpan.org/pod/Pithub%3A%3AGitData%3A%3AReferences) See also: [http://developer.github.com/v3/git/refs/](http://developer.github.com/v3/git/refs/) my $references = Pithub->new->git_data->references; my $references = Pithub::GitData->new->references; my $references = Pithub::GitData::References->new; - [Pithub::GitData::Tags](https://metacpan.org/pod/Pithub%3A%3AGitData%3A%3ATags) See also: [http://developer.github.com/v3/git/tags/](http://developer.github.com/v3/git/tags/) my $tags = Pithub->new->git_data->tags; my $tags = Pithub::GitData->new->tags; my $tags = Pithub::GitData::Tags->new; - [Pithub::GitData::Trees](https://metacpan.org/pod/Pithub%3A%3AGitData%3A%3ATrees) See also: [http://developer.github.com/v3/git/trees/](http://developer.github.com/v3/git/trees/) my $trees = Pithub->new->git_data->trees; my $trees = Pithub::GitData->new->trees; my $trees = Pithub::GitData::Trees->new; - [Pithub::Issues](https://metacpan.org/pod/Pithub%3A%3AIssues) See also: [http://developer.github.com/v3/issues/](http://developer.github.com/v3/issues/) my $issues = Pithub->new->issues; my $issues = Pithub::Issues->new; - [Pithub::Issues::Assignees](https://metacpan.org/pod/Pithub%3A%3AIssues%3A%3AAssignees) See also: [http://developer.github.com/v3/issues/assignees/](http://developer.github.com/v3/issues/assignees/) my $assignees = Pithub->new->issues->assignees; my $assignees = Pithub::Issues->new->assignees; my $assignees = Pithub::Issues::Assignees->new; - [Pithub::Issues::Comments](https://metacpan.org/pod/Pithub%3A%3AIssues%3A%3AComments) See also: [http://developer.github.com/v3/issues/comments/](http://developer.github.com/v3/issues/comments/) my $comments = Pithub->new->issues->comments; my $comments = Pithub::Issues->new->comments; my $comments = Pithub::Issues::Comments->new; - [Pithub::Issues::Events](https://metacpan.org/pod/Pithub%3A%3AIssues%3A%3AEvents) See also: [http://developer.github.com/v3/issues/events/](http://developer.github.com/v3/issues/events/) my $events = Pithub->new->issues->events; my $events = Pithub::Issues->new->events; my $events = Pithub::Issues::Events->new; - [Pithub::Issues::Labels](https://metacpan.org/pod/Pithub%3A%3AIssues%3A%3ALabels) See also: [http://developer.github.com/v3/issues/labels/](http://developer.github.com/v3/issues/labels/) my $labels = Pithub->new->issues->labels; my $labels = Pithub::Issues->new->labels; my $labels = Pithub::Issues::Labels->new; - [Pithub::Issues::Milestones](https://metacpan.org/pod/Pithub%3A%3AIssues%3A%3AMilestones) See also: [http://developer.github.com/v3/issues/milestones/](http://developer.github.com/v3/issues/milestones/) my $milestones = Pithub->new->issues->milestones; my $milestones = Pithub::Issues->new->milestones; my $milestones = Pithub::Issues::Milestones->new; - [Pithub::Orgs](https://metacpan.org/pod/Pithub%3A%3AOrgs) See also: [http://developer.github.com/v3/orgs/](http://developer.github.com/v3/orgs/) my $orgs = Pithub->new->orgs; my $orgs = Pithub::Orgs->new; - [Pithub::Orgs::Members](https://metacpan.org/pod/Pithub%3A%3AOrgs%3A%3AMembers) See also: [http://developer.github.com/v3/orgs/members/](http://developer.github.com/v3/orgs/members/) my $members = Pithub->new->orgs->members; my $members = Pithub::Orgs->new->members; my $members = Pithub::Orgs::Members->new; - [Pithub::Orgs::Teams](https://metacpan.org/pod/Pithub%3A%3AOrgs%3A%3ATeams) See also: [http://developer.github.com/v3/orgs/teams/](http://developer.github.com/v3/orgs/teams/) my $teams = Pithub->new->orgs->teams; my $teams = Pithub::Orgs->new->teams; my $teams = Pithub::Orgs::Teams->new; - [Pithub::PullRequests](https://metacpan.org/pod/Pithub%3A%3APullRequests) See also: [http://developer.github.com/v3/pulls/](http://developer.github.com/v3/pulls/) my $pull_requests = Pithub->new->pull_requests; my $pull_requests = Pithub::PullRequests->new; - [Pithub::PullRequests::Comments](https://metacpan.org/pod/Pithub%3A%3APullRequests%3A%3AComments) See also: [http://developer.github.com/v3/pulls/comments/](http://developer.github.com/v3/pulls/comments/) my $comments = Pithub->new->pull_requests->comments; my $comments = Pithub::PullRequests->new->comments; my $comments = Pithub::PullRequests::Comments->new; - [Pithub::PullRequests::Reviewers](https://metacpan.org/pod/Pithub%3A%3APullRequests%3A%3AReviewers) See also: [https://docs.github.com/en/rest/reference/pulls#review-requests](https://docs.github.com/en/rest/reference/pulls#review-requests) my $reviewers = Pithub->new->pull_requests->reviewers; my $reviewers = Pithub::PullRequests->new->reviewers; my $reviewers = Pithub::PullRequests::Reviewers->new; - [Pithub::Repos](https://metacpan.org/pod/Pithub%3A%3ARepos) See also: [http://developer.github.com/v3/repos/](http://developer.github.com/v3/repos/) my $repos = Pithub->new->repos; my $repos = Pithub::Repos->new; - [Pithub::Repos::Collaborators](https://metacpan.org/pod/Pithub%3A%3ARepos%3A%3ACollaborators) See also: [http://developer.github.com/v3/repos/collaborators/](http://developer.github.com/v3/repos/collaborators/) my $collaborators = Pithub->new->repos->collaborators; my $collaborators = Pithub::Repos->new->collaborators; my $collaborators = Pithub::Repos::Collaborators->new; - [Pithub::Repos::Commits](https://metacpan.org/pod/Pithub%3A%3ARepos%3A%3ACommits) See also: [http://developer.github.com/v3/repos/commits/](http://developer.github.com/v3/repos/commits/) my $commits = Pithub->new->repos->commits; my $commits = Pithub::Repos->new->commits; my $commits = Pithub::Repos::Commits->new; - [Pithub::Repos::Contents](https://metacpan.org/pod/Pithub%3A%3ARepos%3A%3AContents) See also: [http://developer.github.com/v3/repos/contents/](http://developer.github.com/v3/repos/contents/) my $contents = Pithub->new->repos->contents; my $contents = Pithub::Repos->new->contents; my $contents = Pithub::Repos::Contents->new; - [Pithub::Repos::Downloads](https://metacpan.org/pod/Pithub%3A%3ARepos%3A%3ADownloads) Github says: The Downloads API (described below) was deprecated on December 11, 2012. It will be removed at a future date. We recommend using [Pithub::Repos::Releases](https://metacpan.org/pod/Pithub%3A%3ARepos%3A%3AReleases) instead. See also: [http://developer.github.com/v3/repos/downloads/](http://developer.github.com/v3/repos/downloads/) my $downloads = Pithub->new->repos->downloads; my $downloads = Pithub::Repos->new->downloads; my $downloads = Pithub::Repos::Downloads->new; - [Pithub::Repos::Forks](https://metacpan.org/pod/Pithub%3A%3ARepos%3A%3AForks) See also: [http://developer.github.com/v3/repos/forks/](http://developer.github.com/v3/repos/forks/) my $forks = Pithub->new->repos->forks; my $forks = Pithub::Repos->new->forks; my $forks = Pithub::Repos::Forks->new; - [Pithub::Repos::Keys](https://metacpan.org/pod/Pithub%3A%3ARepos%3A%3AKeys) See also: [http://developer.github.com/v3/repos/keys/](http://developer.github.com/v3/repos/keys/) my $keys = Pithub->new->repos->keys; my $keys = Pithub::Repos->new->keys; my $keys = Pithub::Repos::Keys->new; - [Pithub::Repos::Releases](https://metacpan.org/pod/Pithub%3A%3ARepos%3A%3AReleases) See also: [http://developer.github.com/v3/repos/releases/](http://developer.github.com/v3/repos/releases/) my $releases = Pithub->new->repos->releases; my $releases = Pithub::Repos->new->releases; my $releases = Pithub::Repos::Releases->new; Note that Pithub::Repos::Releases requires Boolean values for some calls. See Pithub::Repos::Releases for details. - [Pithub::Repos::Releases::Assets](https://metacpan.org/pod/Pithub%3A%3ARepos%3A%3AReleases%3A%3AAssets) See also: [http://developer.github.com/v3/repos/releases/](http://developer.github.com/v3/repos/releases/) my $assets = Pithub->new->repos->releases->assets; my $assets = Pithub::Repos->new->releases->assets; my $assets = Pithub::Repos::Releases->new->assets; my $assets = Pithub::Repos::Releases::Assets->new; - [Pithub::Repos::Stats](https://metacpan.org/pod/Pithub%3A%3ARepos%3A%3AStats) See also: [http://developer.github.com/v3/repos/statistics/](http://developer.github.com/v3/repos/statistics/) my $watching = Pithub->new->repos->stats; my $watching = Pithub::Repos->new->stats; my $watching = Pithub::Repos::Stats->new; - [Pithub::Repos::Statuses](https://metacpan.org/pod/Pithub%3A%3ARepos%3A%3AStatuses) See also: [http://developer.github.com/v3/repos/statuses/](http://developer.github.com/v3/repos/statuses/) my $watching = Pithub->new->repos->statuses; my $watching = Pithub::Repos->new->statuses; my $watching = Pithub::Repos::Statuses->new; - [Pithub::Repos::Watching](https://metacpan.org/pod/Pithub%3A%3ARepos%3A%3AWatching) See also: [http://developer.github.com/v3/repos/watching/](http://developer.github.com/v3/repos/watching/) my $watching = Pithub->new->repos->watching; my $watching = Pithub::Repos->new->watching; my $watching = Pithub::Repos::Watching->new; - [Pithub::Users](https://metacpan.org/pod/Pithub%3A%3AUsers) See also: [http://developer.github.com/v3/users/](http://developer.github.com/v3/users/) my $users = Pithub->new->users; my $users = Pithub::Users->new; - [Pithub::Users::Emails](https://metacpan.org/pod/Pithub%3A%3AUsers%3A%3AEmails) See also: [http://developer.github.com/v3/users/emails/](http://developer.github.com/v3/users/emails/) my $emails = Pithub->new->users->emails; my $emails = Pithub::Users->new->emails; my $emails = Pithub::Users::Emails->new; - [Pithub::Users::Followers](https://metacpan.org/pod/Pithub%3A%3AUsers%3A%3AFollowers) See also: [http://developer.github.com/v3/users/followers/](http://developer.github.com/v3/users/followers/) my $followers = Pithub->new->users->followers; my $followers = Pithub::Users->new->followers; my $followers = Pithub::Users::Followers->new; - [Pithub::Users::Keys](https://metacpan.org/pod/Pithub%3A%3AUsers%3A%3AKeys) See also: [http://developer.github.com/v3/users/keys/](http://developer.github.com/v3/users/keys/) my $keys = Pithub->new->users->keys; my $keys = Pithub::Users->new->keys; my $keys = Pithub::Users::Keys->new; # CONTRIBUTORS - Andreas Marienborg - Alessandro Ghedini - Michael G Schwern # AUTHOR Johannes Plunien # COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Pithub-0.01042/META.json0000644000175000017500000007145115014062322013163 0ustar olafolaf{ "abstract" : "Github v3 API", "author" : [ "Johannes Plunien " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 6.032, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "Pithub", "no_index" : { "directory" : [ "examples", "t", "xt" ] }, "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0", "perl" : "5.006" } }, "develop" : { "recommends" : { "Dist::Zilla::PluginBundle::Git::VersionManager" : "0.007" }, "requires" : { "Code::TidyAll" : "0.71", "Code::TidyAll::Plugin::SortLines::Naturally" : "0.000003", "Code::TidyAll::Plugin::Test::Vars" : "0.04", "Code::TidyAll::Plugin::UniqueLines" : "0.000003", "Parallel::ForkManager" : "1.19", "Perl::Critic" : "1.132", "Perl::Tidy" : "20180220", "Pod::Coverage::TrustPod" : "0", "Pod::Wordlist" : "0", "Test::CPAN::Changes" : "0.19", "Test::EOL" : "0", "Test::Mojibake" : "0", "Test::More" : "0.96", "Test::Pod::Coverage" : "1.08", "Test::Spelling" : "0.17", "Test::Synopsis" : "0", "Test::Vars" : "0.014", "Test::Version" : "1" } }, "runtime" : { "requires" : { "CHI" : "0", "Carp" : "0", "HTTP::Headers" : "0", "HTTP::Request" : "0", "HTTP::Request::Common" : "0", "JSON::MaybeXS" : "0", "LWP::UserAgent" : "0", "Moo" : "0", "Moo::Role" : "0", "URI" : "0", "perl" : "5.013010", "strict" : "0", "warnings" : "0" } }, "test" : { "recommends" : { "CPAN::Meta" : "2.120900" }, "requires" : { "Exporter" : "0", "ExtUtils::MakeMaker" : "0", "File::Spec" : "0", "FindBin" : "0", "HTTP::Response" : "0", "Import::Into" : "0", "MIME::Base64" : "0", "Path::Tiny" : "0", "Scalar::Util" : "0", "Test::Builder" : "0", "Test::Differences" : "0", "Test::Exception" : "0", "Test::More" : "0", "Test::Most" : "0", "Test::Needs" : "0", "lib" : "0", "perl" : "5.013010" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/plu/Pithub/issues" }, "homepage" : "https://github.com/plu/Pithub", "repository" : { "type" : "git", "url" : "https://github.com/plu/Pithub.git", "web" : "https://github.com/plu/Pithub" } }, "version" : "0.01042", "x_Dist_Zilla" : { "perl" : { "version" : "5.040000" }, "plugins" : [ { "class" : "Dist::Zilla::Plugin::PromptIfStale", "config" : { "Dist::Zilla::Plugin::PromptIfStale" : { "check_all_plugins" : 0, "check_all_prereqs" : 0, "modules" : [ "Dist::Zilla::PluginBundle::Author::OALDERS" ], "phase" : "build", "run_under_travis" : 0, "skip" : [] } }, "name" : "@Author::OALDERS/stale modules, build", "version" : "0.060" }, { "class" : "Dist::Zilla::Plugin::PromptIfStale", "config" : { "Dist::Zilla::Plugin::PromptIfStale" : { "check_all_plugins" : 1, "check_all_prereqs" : 1, "modules" : [], "phase" : "release", "run_under_travis" : 0, "skip" : [] } }, "name" : "@Author::OALDERS/stale modules, release", "version" : "0.060" }, { "class" : "Dist::Zilla::Plugin::AutoPrereqs", "name" : "@Author::OALDERS/AutoPrereqs", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::CheckChangesHasContent", "name" : "@Author::OALDERS/CheckChangesHasContent", "version" : "0.011" }, { "class" : "Dist::Zilla::Plugin::MakeMaker", "config" : { "Dist::Zilla::Role::TestRunner" : { "default_jobs" : "8" } }, "name" : "@Author::OALDERS/MakeMaker", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::CPANFile", "name" : "@Author::OALDERS/CPANFile", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::ContributorsFile", "name" : "@Author::OALDERS/ContributorsFile", "version" : "0.3.0" }, { "class" : "Dist::Zilla::Plugin::MetaJSON", "name" : "@Author::OALDERS/MetaJSON", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::MetaYAML", "name" : "@Author::OALDERS/MetaYAML", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::Manifest", "name" : "@Author::OALDERS/Manifest", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::MetaNoIndex", "name" : "@Author::OALDERS/MetaNoIndex", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::MetaConfig", "name" : "@Author::OALDERS/MetaConfig", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::MetaResources", "name" : "@Author::OALDERS/MetaResources", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::License", "name" : "@Author::OALDERS/License", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::InstallGuide", "config" : { "Dist::Zilla::Role::ModuleMetadata" : { "Module::Metadata" : "1.000038", "version" : "0.006" } }, "name" : "@Author::OALDERS/InstallGuide", "version" : "1.200014" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "develop", "type" : "requires" } }, "name" : "@Author::OALDERS/Modules for use with tidyall", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::ExecDir", "name" : "@Author::OALDERS/ExecDir", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::Test::PodSpelling", "config" : { "Dist::Zilla::Plugin::Test::PodSpelling" : { "directories" : [ "bin", "lib" ], "spell_cmd" : "", "stopwords" : [ "Alders", "Alders'", "Alessandro", "Andreas", "Ghedini", "Html", "JSONP", "LRU", "Marienborg", "Merijn", "OAuth", "SHAs", "Schwern", "Stevan", "Unfollow", "Unstar", "api", "asc", "assignees", "desc", "etag", "getLength", "getNext", "gfm", "gists", "gollum", "html", "ie", "losslessly", "md", "orgs", "params", "perlancar", "ratelimit", "readme", "repos", "sha", "submodule", "ua", "unfollow", "unstar", "zipball" ], "wordlist" : "Pod::Wordlist" } }, "name" : "@Author::OALDERS/Test::PodSpelling", "version" : "2.007006" }, { "class" : "Dist::Zilla::Plugin::MojibakeTests", "name" : "@Author::OALDERS/MojibakeTests", "version" : "0.8" }, { "class" : "Dist::Zilla::Plugin::Test::CPAN::Changes", "config" : { "Dist::Zilla::Plugin::Test::CPAN::Changes" : { "changelog" : "Changes", "filename" : "xt/release/cpan-changes.t" } }, "name" : "@Author::OALDERS/Test::CPAN::Changes", "version" : "0.013" }, { "class" : "Dist::Zilla::Plugin::Test::EOL", "config" : { "Dist::Zilla::Plugin::Test::EOL" : { "filename" : "xt/author/eol.t", "finder" : [ ":ExecFiles", ":InstallModules", ":TestFiles" ], "trailing_whitespace" : 1 } }, "name" : "@Author::OALDERS/Test::EOL", "version" : "0.19" }, { "class" : "Dist::Zilla::Plugin::Test::Pod::Coverage::Configurable", "name" : "@Author::OALDERS/Test::Pod::Coverage::Configurable", "version" : "0.07" }, { "class" : "Dist::Zilla::Plugin::TestRelease", "name" : "@Author::OALDERS/TestRelease", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::Test::ReportPrereqs", "name" : "@Author::OALDERS/Test::ReportPrereqs", "version" : "0.029" }, { "class" : "Dist::Zilla::Plugin::Test::Synopsis", "name" : "@Author::OALDERS/Test::Synopsis", "version" : "2.000007" }, { "class" : "Dist::Zilla::Plugin::Test::Version", "name" : "@Author::OALDERS/Test::Version", "version" : "1.09" }, { "class" : "Dist::Zilla::Plugin::RunExtraTests", "config" : { "Dist::Zilla::Role::TestRunner" : { "default_jobs" : "8" } }, "name" : "@Author::OALDERS/RunExtraTests", "version" : "0.029" }, { "class" : "Dist::Zilla::Plugin::MinimumPerl", "name" : "@Author::OALDERS/MinimumPerl", "version" : "1.006" }, { "class" : "Dist::Zilla::Plugin::PodWeaver", "config" : { "Dist::Zilla::Plugin::PodWeaver" : { "finder" : [ ":InstallModules", ":PerlExecFiles" ], "plugins" : [ { "class" : "Pod::Weaver::Plugin::EnsurePod5", "name" : "@CorePrep/EnsurePod5", "version" : "4.020" }, { "class" : "Pod::Weaver::Plugin::H1Nester", "name" : "@CorePrep/H1Nester", "version" : "4.020" }, { "class" : "Pod::Weaver::Plugin::SingleEncoding", "name" : "@Default/SingleEncoding", "version" : "4.020" }, { "class" : "Pod::Weaver::Section::Name", "name" : "@Default/Name", "version" : "4.020" }, { "class" : "Pod::Weaver::Section::Version", "name" : "@Default/Version", "version" : "4.020" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@Default/prelude", "version" : "4.020" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "SYNOPSIS", "version" : "4.020" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "DESCRIPTION", "version" : "4.020" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "OVERVIEW", "version" : "4.020" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "ATTRIBUTES", "version" : "4.020" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "METHODS", "version" : "4.020" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "FUNCTIONS", "version" : "4.020" }, { "class" : "Pod::Weaver::Section::Leftovers", "name" : "@Default/Leftovers", "version" : "4.020" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@Default/postlude", "version" : "4.020" }, { "class" : "Pod::Weaver::Section::Authors", "name" : "@Default/Authors", "version" : "4.020" }, { "class" : "Pod::Weaver::Section::Legal", "name" : "@Default/Legal", "version" : "4.020" } ] } }, "name" : "@Author::OALDERS/PodWeaver", "version" : "4.010" }, { "class" : "Dist::Zilla::Plugin::PruneCruft", "name" : "@Author::OALDERS/PruneCruft", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::CopyFilesFromBuild", "name" : "@Author::OALDERS/CopyFilesFromBuild", "version" : "0.170880" }, { "class" : "Dist::Zilla::Plugin::GithubMeta", "name" : "@Author::OALDERS/GithubMeta", "version" : "0.58" }, { "class" : "Dist::Zilla::Plugin::Git::GatherDir", "config" : { "Dist::Zilla::Plugin::GatherDir" : { "exclude_filename" : [ "Install", "LICENSE", "META.json", "Makefile.PL", "README.md", "cpanfile" ], "exclude_match" : [], "include_dotfiles" : 0, "prefix" : "", "prune_directory" : [], "root" : "." }, "Dist::Zilla::Plugin::Git::GatherDir" : { "include_untracked" : 0 } }, "name" : "@Author::OALDERS/Git::GatherDir", "version" : "2.051" }, { "class" : "Dist::Zilla::Plugin::CopyFilesFromRelease", "config" : { "Dist::Zilla::Plugin::CopyFilesFromRelease" : { "filename" : [ "Install" ], "match" : [] } }, "name" : "@Author::OALDERS/CopyFilesFromRelease", "version" : "0.007" }, { "class" : "Dist::Zilla::Plugin::Git::Check", "config" : { "Dist::Zilla::Plugin::Git::Check" : { "untracked_files" : "die" }, "Dist::Zilla::Role::Git::DirtyFiles" : { "allow_dirty" : [ "Changes", "Install", "LICENSE", "META.json", "Makefile.PL", "README.md", "cpanfile", "dist.ini" ], "allow_dirty_match" : [], "changelog" : "Changes" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.43.0", "repo_root" : "." } }, "name" : "@Author::OALDERS/Git::Check", "version" : "2.051" }, { "class" : "Dist::Zilla::Plugin::Git::Contributors", "config" : { "Dist::Zilla::Plugin::Git::Contributors" : { "git_version" : "2.43.0", "include_authors" : 0, "include_releaser" : 1, "order_by" : "name", "paths" : [] } }, "name" : "@Author::OALDERS/Git::Contributors", "version" : "0.038" }, { "class" : "Dist::Zilla::Plugin::ReadmeAnyFromPod", "config" : { "Dist::Zilla::Role::FileWatcher" : { "version" : "0.006" } }, "name" : "@Author::OALDERS/ReadmeMdInBuild", "version" : "0.163250" }, { "class" : "Dist::Zilla::Plugin::StaticInstall", "config" : { "Dist::Zilla::Plugin::StaticInstall" : { "dry_run" : 0, "mode" : "on" } }, "name" : "@Author::OALDERS/StaticInstall", "version" : "0.012" }, { "class" : "Dist::Zilla::Plugin::ShareDir", "name" : "@Author::OALDERS/ShareDir", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::CheckIssues", "name" : "@Author::OALDERS/CheckIssues", "version" : "0.011" }, { "class" : "Dist::Zilla::Plugin::ConfirmRelease", "name" : "@Author::OALDERS/ConfirmRelease", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::UploadToCPAN", "name" : "@Author::OALDERS/UploadToCPAN", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "develop", "type" : "recommends" } }, "name" : "@Author::OALDERS/@Git::VersionManager/pluginbundle version", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::RewriteVersion::Transitional", "config" : { "Dist::Zilla::Plugin::RewriteVersion" : { "add_tarball_name" : 0, "finders" : [ ":ExecFiles", ":InstallModules" ], "global" : 0, "skip_version_provider" : 0 }, "Dist::Zilla::Plugin::RewriteVersion::Transitional" : {} }, "name" : "@Author::OALDERS/@Git::VersionManager/RewriteVersion::Transitional", "version" : "0.009" }, { "class" : "Dist::Zilla::Plugin::MetaProvides::Update", "name" : "@Author::OALDERS/@Git::VersionManager/MetaProvides::Update", "version" : "0.007" }, { "class" : "Dist::Zilla::Plugin::CopyFilesFromRelease", "config" : { "Dist::Zilla::Plugin::CopyFilesFromRelease" : { "filename" : [ "Changes" ], "match" : [] } }, "name" : "@Author::OALDERS/@Git::VersionManager/CopyFilesFromRelease", "version" : "0.007" }, { "class" : "Dist::Zilla::Plugin::Git::Commit", "config" : { "Dist::Zilla::Plugin::Git::Commit" : { "add_files_in" : [], "commit_msg" : "v%V%n%n%c", "signoff" : 0 }, "Dist::Zilla::Role::Git::DirtyFiles" : { "allow_dirty" : [ "Changes", "Install", "LICENSE", "META.json", "Makefile.PL", "README.md", "cpanfile", "dist.ini" ], "allow_dirty_match" : [], "changelog" : "Changes" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.43.0", "repo_root" : "." }, "Dist::Zilla::Role::Git::StringFormatter" : { "time_zone" : "local" } }, "name" : "@Author::OALDERS/@Git::VersionManager/release snapshot", "version" : "2.051" }, { "class" : "Dist::Zilla::Plugin::Git::Tag", "config" : { "Dist::Zilla::Plugin::Git::Tag" : { "branch" : null, "changelog" : "Changes", "signed" : 0, "tag" : "v0.01042", "tag_format" : "v%V", "tag_message" : "v%V" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.43.0", "repo_root" : "." }, "Dist::Zilla::Role::Git::StringFormatter" : { "time_zone" : "local" } }, "name" : "@Author::OALDERS/@Git::VersionManager/Git::Tag", "version" : "2.051" }, { "class" : "Dist::Zilla::Plugin::BumpVersionAfterRelease::Transitional", "config" : { "Dist::Zilla::Plugin::BumpVersionAfterRelease" : { "finders" : [ ":ExecFiles", ":InstallModules" ], "global" : 0, "munge_makefile_pl" : 1 }, "Dist::Zilla::Plugin::BumpVersionAfterRelease::Transitional" : {} }, "name" : "@Author::OALDERS/@Git::VersionManager/BumpVersionAfterRelease::Transitional", "version" : "0.009" }, { "class" : "Dist::Zilla::Plugin::NextRelease", "name" : "@Author::OALDERS/@Git::VersionManager/NextRelease", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::Git::Commit", "config" : { "Dist::Zilla::Plugin::Git::Commit" : { "add_files_in" : [], "commit_msg" : "increment $VERSION after %v release", "signoff" : 0 }, "Dist::Zilla::Role::Git::DirtyFiles" : { "allow_dirty" : [ "Build.PL", "Changes", "Makefile.PL" ], "allow_dirty_match" : [ "(?^:^lib/.*\\.pm$)" ], "changelog" : "Changes" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.43.0", "repo_root" : "." }, "Dist::Zilla::Role::Git::StringFormatter" : { "time_zone" : "local" } }, "name" : "@Author::OALDERS/@Git::VersionManager/post-release commit", "version" : "2.051" }, { "class" : "Dist::Zilla::Plugin::Git::Push", "config" : { "Dist::Zilla::Plugin::Git::Push" : { "push_to" : [ "origin" ], "remotes_must_exist" : 1 }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.43.0", "repo_root" : "." } }, "name" : "@Author::OALDERS/Git::Push", "version" : "2.051" }, { "class" : "Dist::Zilla::Plugin::Authority", "name" : "Authority", "version" : "1.009" }, { "class" : "Dist::Zilla::Plugin::GitHubREADME::Badge", "name" : "GitHubREADME::Badge", "version" : "0.35" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":InstallModules", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":IncModules", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":TestFiles", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExtraTestFiles", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExecFiles", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":PerlExecFiles", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ShareFiles", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":MainModule", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":AllFiles", "version" : "6.032" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":NoFiles", "version" : "6.032" } ], "zilla" : { "class" : "Dist::Zilla::Dist::Builder", "config" : { "is_trial" : 0 }, "version" : "6.032" } }, "x_authority" : "cpan:PLU", "x_contributors" : [ "Alessandro Ghedini ", "Andreas Marienborg ", "Corey Farwell ", "dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>", "Florian Ragwitz ", "Graham Ollis ", "H.Merijn Brand - Tux ", "Ichinose Shogo ", "Ivan Bessarabov ", "Johannes Plunien ", "Jos\u00e9 Joaqu\u00edn Atria ", "Konboi ", "Michael G. Schwern ", "Olaf Alders ", "Randy Stauner ", "Rich Bowen ", "Roland Hu\u00df ", "SUZUKI Masashi ", "teckl ", "Thibault DUPONCHELLE ", "Timothy Legge ", "Zoffix Znet " ], "x_generated_by_perl" : "v5.40.0", "x_serialization_backend" : "Cpanel::JSON::XS version 4.39", "x_spdx_expression" : "Artistic-1.0-Perl OR GPL-1.0-or-later", "x_static_install" : 1 } Pithub-0.01042/xt/0000775000175000017500000000000015014062322012167 5ustar olafolafPithub-0.01042/xt/author/0000775000175000017500000000000015014062322013471 5ustar olafolafPithub-0.01042/xt/author/pod-coverage.t0000644000175000017500000000172015014062322016227 0ustar olafolaf#!perl # This file was automatically generated by Dist::Zilla::Plugin::Test::Pod::Coverage::Configurable 0.07. use Test::Pod::Coverage 1.08; use Test::More 0.88; BEGIN { if ( $] <= 5.008008 ) { plan skip_all => 'These tests require Pod::Coverage::TrustPod, which only works with Perl 5.8.9+'; } } use Pod::Coverage::TrustPod; my %skip = map { $_ => 1 } qw( ); my @modules; for my $module ( all_modules() ) { next if $skip{$module}; push @modules, $module; } plan skip_all => 'All the modules we found were excluded from POD coverage test.' unless @modules; plan tests => scalar @modules; my %trustme = (); my @also_private; for my $module ( sort @modules ) { pod_coverage_ok( $module, { coverage_class => 'Pod::Coverage::TrustPod', also_private => \@also_private, trustme => $trustme{$module} || [], }, "pod coverage for $module" ); } done_testing(); Pithub-0.01042/xt/author/pod-spell.t0000644000175000017500000000241515014062322015555 0ustar olafolafuse strict; use warnings; use Test::More; # generated by Dist::Zilla::Plugin::Test::PodSpelling 2.007006 use Test::Spelling 0.17; use Pod::Wordlist; add_stopwords(); all_pod_files_spelling_ok( qw( bin lib ) ); __DATA__ 49699333 Actions Alders Alders' Alessandro Andreas Assets Assignees Atria Base Bessarabov Blobs Bowen Brand Collaborators Comments Commits Contents Corey DUPONCHELLE Downloads Emails Events Farwell Florian Followers Forks Ghedini Gists GitData Graham Hooks Html Huß Ichinose Issues Ivan JSONP Joaquín Johannes José Keys Konboi LRU Labels Legge Marienborg Markdown Masashi Members Merijn Michael Milestones OAuth Olaf Ollis Orgs Pithub Plunien PullRequests Ragwitz Randy References Releases Repos Result ResultSet Reviewers Rich Roland SHAs SUZUKI Schwern Search SearchV3 SharedCache Shogo Starring Stats Statuses Stauner Stevan Tags Teams Thibault Timothy Trees Tux Unfollow Unstar Users Watching Workflows Znet Zoffix alessandro andreas api asc assignees coreyf cpan dependabot desc etag getLength getNext gfm gists gollum html ie ivan jjatria lib linux losslessly m15 md olaf orgs params perlancar plicease plu rafl randy ratelimit rbowen readme repos rhuss ryosuke schwern sha shogo82148 submodule teckl teckl1979 thibault timlegge ua unfollow unstar zipball Pithub-0.01042/xt/author/mojibake.t0000644000175000017500000000015115014062322015432 0ustar olafolaf#!perl use strict; use warnings qw(all); use Test::More; use Test::Mojibake; all_files_encoding_ok(); Pithub-0.01042/xt/author/test-version.t0000644000175000017500000000063715014062322016324 0ustar olafolafuse strict; use warnings; use Test::More; # generated by Dist::Zilla::Plugin::Test::Version 1.09 use Test::Version; my @imports = qw( version_all_ok ); my $params = { is_strict => 0, has_version => 1, multiple => 0, }; push @imports, $params if version->parse( $Test::Version::VERSION ) >= version->parse('1.002'); Test::Version->import(@imports); version_all_ok; done_testing; Pithub-0.01042/xt/author/synopsis.t0000644000175000017500000000006015014062322015537 0ustar olafolaf#!perl use Test::Synopsis; all_synopsis_ok(); Pithub-0.01042/xt/author/eol.t0000644000175000017500000000752315014062322014442 0ustar olafolafuse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::EOL 0.19 use Test::More 0.88; use Test::EOL; my @files = ( 'lib/Pithub.pm', 'lib/Pithub/Base.pm', 'lib/Pithub/Events.pm', 'lib/Pithub/Gists.pm', 'lib/Pithub/Gists/Comments.pm', 'lib/Pithub/GitData.pm', 'lib/Pithub/GitData/Blobs.pm', 'lib/Pithub/GitData/Commits.pm', 'lib/Pithub/GitData/References.pm', 'lib/Pithub/GitData/Tags.pm', 'lib/Pithub/GitData/Trees.pm', 'lib/Pithub/Issues.pm', 'lib/Pithub/Issues/Assignees.pm', 'lib/Pithub/Issues/Comments.pm', 'lib/Pithub/Issues/Events.pm', 'lib/Pithub/Issues/Labels.pm', 'lib/Pithub/Issues/Milestones.pm', 'lib/Pithub/Markdown.pm', 'lib/Pithub/Orgs.pm', 'lib/Pithub/Orgs/Members.pm', 'lib/Pithub/Orgs/Teams.pm', 'lib/Pithub/PullRequests.pm', 'lib/Pithub/PullRequests/Comments.pm', 'lib/Pithub/PullRequests/Reviewers.pm', 'lib/Pithub/Repos.pm', 'lib/Pithub/Repos/Actions.pm', 'lib/Pithub/Repos/Actions/Workflows.pm', 'lib/Pithub/Repos/Collaborators.pm', 'lib/Pithub/Repos/Commits.pm', 'lib/Pithub/Repos/Contents.pm', 'lib/Pithub/Repos/Downloads.pm', 'lib/Pithub/Repos/Forks.pm', 'lib/Pithub/Repos/Hooks.pm', 'lib/Pithub/Repos/Keys.pm', 'lib/Pithub/Repos/Releases.pm', 'lib/Pithub/Repos/Releases/Assets.pm', 'lib/Pithub/Repos/Starring.pm', 'lib/Pithub/Repos/Stats.pm', 'lib/Pithub/Repos/Statuses.pm', 'lib/Pithub/Repos/Watching.pm', 'lib/Pithub/Result.pm', 'lib/Pithub/Result/SharedCache.pm', 'lib/Pithub/ResultSet.pm', 'lib/Pithub/Search.pm', 'lib/Pithub/SearchV3.pm', 'lib/Pithub/Users.pm', 'lib/Pithub/Users/Emails.pm', 'lib/Pithub/Users/Followers.pm', 'lib/Pithub/Users/Keys.pm', 't/00-report-prereqs.dd', 't/00-report-prereqs.t', 't/basic.t', 't/encoding.t', 't/events.t', 't/gists.t', 't/git_data.t', 't/issues.t', 't/lib/Pithub/Test.pm', 't/lib/Pithub/Test/Factory.pm', 't/lib/Pithub/Test/UA.pm', 't/lib/Pithub/Test/http_response/api.github.com/error/notfound.GET', 't/lib/Pithub/Test/http_response/api.github.com/orgs/CPAN-API/repos.GET', 't/lib/Pithub/Test/http_response/api.github.com/repos/foo/bar/downloads.POST', 't/lib/Pithub/Test/http_response/api.github.com/repos/foo/bar/issues.GET', 't/lib/Pithub/Test/http_response/api.github.com/user/following/rafl.GET', 't/lib/Pithub/Test/http_response/api.github.com/users/miyagawa/followers.GET', 't/lib/Pithub/Test/http_response/api.github.com/users/miyagawa/followers.GET.page-26', 't/lib/Pithub/Test/http_response/api.github.com/users/miyagawa/followers.GET.page-3', 't/lib/Pithub/Test/http_response/api.github.com/users/miyagawa/followers.GET.per_page-1', 't/lib/Pithub/Test/http_response/api.github.com/users/plu.GET', 't/lib/Pithub/Test/http_response/api.github.com/users/plu/followers.GET.page-2.per_page-15', 't/lib/Pithub/Test/http_response/api.github.com/users/plu/followers.GET.page-3.per_page-15', 't/lib/Pithub/Test/http_response/api.github.com/users/plu/followers.GET.page-4.per_page-15', 't/lib/Pithub/Test/http_response/api.github.com/users/plu/followers.GET.per_page-15', 't/lib/Pithub/Test/http_response/api.github.com/users/plu/repos.GET', 't/lib/Pithub/Test/http_response/api.github.com/users/rwstauner.GET', 't/live/basic.t', 't/live/cache-lru.t', 't/live/cache.t', 't/live/events.t', 't/live/gists.t', 't/live/git_data.t', 't/live/issues.t', 't/live/orgs.t', 't/live/pull_requests.t', 't/live/repos.t', 't/live/repos/actions/workflows.t', 't/live/users.t', 't/multi.t', 't/orgs.t', 't/pull_requests.t', 't/repos.t', 't/search.t', 't/test.t', 't/users.t' ); eol_unix_ok($_, { trailing_whitespace => 1 }) foreach @files; done_testing; Pithub-0.01042/xt/release/0000775000175000017500000000000015014062322013607 5ustar olafolafPithub-0.01042/xt/release/cpan-changes.t0000644000175000017500000000034415014062322016322 0ustar olafolafuse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::CPAN::Changes 0.013 use Test::More 0.96 tests => 1; use Test::CPAN::Changes; subtest 'changes_ok' => sub { changes_file_ok('Changes'); }; Pithub-0.01042/META.yml0000644000175000017500000004475115014062322013016 0ustar olafolaf--- abstract: 'Github v3 API' author: - 'Johannes Plunien ' build_requires: Exporter: '0' ExtUtils::MakeMaker: '0' File::Spec: '0' FindBin: '0' HTTP::Response: '0' Import::Into: '0' MIME::Base64: '0' Path::Tiny: '0' Scalar::Util: '0' Test::Builder: '0' Test::Differences: '0' Test::Exception: '0' Test::More: '0' Test::Most: '0' Test::Needs: '0' lib: '0' perl: '5.013010' configure_requires: ExtUtils::MakeMaker: '0' perl: '5.006' dynamic_config: 0 generated_by: 'Dist::Zilla version 6.032, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Pithub no_index: directory: - examples - t - xt requires: CHI: '0' Carp: '0' HTTP::Headers: '0' HTTP::Request: '0' HTTP::Request::Common: '0' JSON::MaybeXS: '0' LWP::UserAgent: '0' Moo: '0' Moo::Role: '0' URI: '0' perl: '5.013010' strict: '0' warnings: '0' resources: bugtracker: https://github.com/plu/Pithub/issues homepage: https://github.com/plu/Pithub repository: https://github.com/plu/Pithub.git version: '0.01042' x_Dist_Zilla: perl: version: '5.040000' plugins: - class: Dist::Zilla::Plugin::PromptIfStale config: Dist::Zilla::Plugin::PromptIfStale: check_all_plugins: 0 check_all_prereqs: 0 modules: - Dist::Zilla::PluginBundle::Author::OALDERS phase: build run_under_travis: 0 skip: [] name: '@Author::OALDERS/stale modules, build' version: '0.060' - class: Dist::Zilla::Plugin::PromptIfStale config: Dist::Zilla::Plugin::PromptIfStale: check_all_plugins: 1 check_all_prereqs: 1 modules: [] phase: release run_under_travis: 0 skip: [] name: '@Author::OALDERS/stale modules, release' version: '0.060' - class: Dist::Zilla::Plugin::AutoPrereqs name: '@Author::OALDERS/AutoPrereqs' version: '6.032' - class: Dist::Zilla::Plugin::CheckChangesHasContent name: '@Author::OALDERS/CheckChangesHasContent' version: '0.011' - class: Dist::Zilla::Plugin::MakeMaker config: Dist::Zilla::Role::TestRunner: default_jobs: '8' name: '@Author::OALDERS/MakeMaker' version: '6.032' - class: Dist::Zilla::Plugin::CPANFile name: '@Author::OALDERS/CPANFile' version: '6.032' - class: Dist::Zilla::Plugin::ContributorsFile name: '@Author::OALDERS/ContributorsFile' version: 0.3.0 - class: Dist::Zilla::Plugin::MetaJSON name: '@Author::OALDERS/MetaJSON' version: '6.032' - class: Dist::Zilla::Plugin::MetaYAML name: '@Author::OALDERS/MetaYAML' version: '6.032' - class: Dist::Zilla::Plugin::Manifest name: '@Author::OALDERS/Manifest' version: '6.032' - class: Dist::Zilla::Plugin::MetaNoIndex name: '@Author::OALDERS/MetaNoIndex' version: '6.032' - class: Dist::Zilla::Plugin::MetaConfig name: '@Author::OALDERS/MetaConfig' version: '6.032' - class: Dist::Zilla::Plugin::MetaResources name: '@Author::OALDERS/MetaResources' version: '6.032' - class: Dist::Zilla::Plugin::License name: '@Author::OALDERS/License' version: '6.032' - class: Dist::Zilla::Plugin::InstallGuide config: Dist::Zilla::Role::ModuleMetadata: Module::Metadata: '1.000038' version: '0.006' name: '@Author::OALDERS/InstallGuide' version: '1.200014' - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: develop type: requires name: '@Author::OALDERS/Modules for use with tidyall' version: '6.032' - class: Dist::Zilla::Plugin::ExecDir name: '@Author::OALDERS/ExecDir' version: '6.032' - class: Dist::Zilla::Plugin::Test::PodSpelling config: Dist::Zilla::Plugin::Test::PodSpelling: directories: - bin - lib spell_cmd: '' stopwords: - Alders - "Alders'" - Alessandro - Andreas - Ghedini - Html - JSONP - LRU - Marienborg - Merijn - OAuth - SHAs - Schwern - Stevan - Unfollow - Unstar - api - asc - assignees - desc - etag - getLength - getNext - gfm - gists - gollum - html - ie - losslessly - md - orgs - params - perlancar - ratelimit - readme - repos - sha - submodule - ua - unfollow - unstar - zipball wordlist: Pod::Wordlist name: '@Author::OALDERS/Test::PodSpelling' version: '2.007006' - class: Dist::Zilla::Plugin::MojibakeTests name: '@Author::OALDERS/MojibakeTests' version: '0.8' - class: Dist::Zilla::Plugin::Test::CPAN::Changes config: Dist::Zilla::Plugin::Test::CPAN::Changes: changelog: Changes filename: xt/release/cpan-changes.t name: '@Author::OALDERS/Test::CPAN::Changes' version: '0.013' - class: Dist::Zilla::Plugin::Test::EOL config: Dist::Zilla::Plugin::Test::EOL: filename: xt/author/eol.t finder: - ':ExecFiles' - ':InstallModules' - ':TestFiles' trailing_whitespace: 1 name: '@Author::OALDERS/Test::EOL' version: '0.19' - class: Dist::Zilla::Plugin::Test::Pod::Coverage::Configurable name: '@Author::OALDERS/Test::Pod::Coverage::Configurable' version: '0.07' - class: Dist::Zilla::Plugin::TestRelease name: '@Author::OALDERS/TestRelease' version: '6.032' - class: Dist::Zilla::Plugin::Test::ReportPrereqs name: '@Author::OALDERS/Test::ReportPrereqs' version: '0.029' - class: Dist::Zilla::Plugin::Test::Synopsis name: '@Author::OALDERS/Test::Synopsis' version: '2.000007' - class: Dist::Zilla::Plugin::Test::Version name: '@Author::OALDERS/Test::Version' version: '1.09' - class: Dist::Zilla::Plugin::RunExtraTests config: Dist::Zilla::Role::TestRunner: default_jobs: '8' name: '@Author::OALDERS/RunExtraTests' version: '0.029' - class: Dist::Zilla::Plugin::MinimumPerl name: '@Author::OALDERS/MinimumPerl' version: '1.006' - class: Dist::Zilla::Plugin::PodWeaver config: Dist::Zilla::Plugin::PodWeaver: finder: - ':InstallModules' - ':PerlExecFiles' plugins: - class: Pod::Weaver::Plugin::EnsurePod5 name: '@CorePrep/EnsurePod5' version: '4.020' - class: Pod::Weaver::Plugin::H1Nester name: '@CorePrep/H1Nester' version: '4.020' - class: Pod::Weaver::Plugin::SingleEncoding name: '@Default/SingleEncoding' version: '4.020' - class: Pod::Weaver::Section::Name name: '@Default/Name' version: '4.020' - class: Pod::Weaver::Section::Version name: '@Default/Version' version: '4.020' - class: Pod::Weaver::Section::Region name: '@Default/prelude' version: '4.020' - class: Pod::Weaver::Section::Generic name: SYNOPSIS version: '4.020' - class: Pod::Weaver::Section::Generic name: DESCRIPTION version: '4.020' - class: Pod::Weaver::Section::Generic name: OVERVIEW version: '4.020' - class: Pod::Weaver::Section::Collect name: ATTRIBUTES version: '4.020' - class: Pod::Weaver::Section::Collect name: METHODS version: '4.020' - class: Pod::Weaver::Section::Collect name: FUNCTIONS version: '4.020' - class: Pod::Weaver::Section::Leftovers name: '@Default/Leftovers' version: '4.020' - class: Pod::Weaver::Section::Region name: '@Default/postlude' version: '4.020' - class: Pod::Weaver::Section::Authors name: '@Default/Authors' version: '4.020' - class: Pod::Weaver::Section::Legal name: '@Default/Legal' version: '4.020' name: '@Author::OALDERS/PodWeaver' version: '4.010' - class: Dist::Zilla::Plugin::PruneCruft name: '@Author::OALDERS/PruneCruft' version: '6.032' - class: Dist::Zilla::Plugin::CopyFilesFromBuild name: '@Author::OALDERS/CopyFilesFromBuild' version: '0.170880' - class: Dist::Zilla::Plugin::GithubMeta name: '@Author::OALDERS/GithubMeta' version: '0.58' - class: Dist::Zilla::Plugin::Git::GatherDir config: Dist::Zilla::Plugin::GatherDir: exclude_filename: - Install - LICENSE - META.json - Makefile.PL - README.md - cpanfile exclude_match: [] include_dotfiles: 0 prefix: '' prune_directory: [] root: . Dist::Zilla::Plugin::Git::GatherDir: include_untracked: 0 name: '@Author::OALDERS/Git::GatherDir' version: '2.051' - class: Dist::Zilla::Plugin::CopyFilesFromRelease config: Dist::Zilla::Plugin::CopyFilesFromRelease: filename: - Install match: [] name: '@Author::OALDERS/CopyFilesFromRelease' version: '0.007' - class: Dist::Zilla::Plugin::Git::Check config: Dist::Zilla::Plugin::Git::Check: untracked_files: die Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - Changes - Install - LICENSE - META.json - Makefile.PL - README.md - cpanfile - dist.ini allow_dirty_match: [] changelog: Changes Dist::Zilla::Role::Git::Repo: git_version: 2.43.0 repo_root: . name: '@Author::OALDERS/Git::Check' version: '2.051' - class: Dist::Zilla::Plugin::Git::Contributors config: Dist::Zilla::Plugin::Git::Contributors: git_version: 2.43.0 include_authors: 0 include_releaser: 1 order_by: name paths: [] name: '@Author::OALDERS/Git::Contributors' version: '0.038' - class: Dist::Zilla::Plugin::ReadmeAnyFromPod config: Dist::Zilla::Role::FileWatcher: version: '0.006' name: '@Author::OALDERS/ReadmeMdInBuild' version: '0.163250' - class: Dist::Zilla::Plugin::StaticInstall config: Dist::Zilla::Plugin::StaticInstall: dry_run: 0 mode: on name: '@Author::OALDERS/StaticInstall' version: '0.012' - class: Dist::Zilla::Plugin::ShareDir name: '@Author::OALDERS/ShareDir' version: '6.032' - class: Dist::Zilla::Plugin::CheckIssues name: '@Author::OALDERS/CheckIssues' version: '0.011' - class: Dist::Zilla::Plugin::ConfirmRelease name: '@Author::OALDERS/ConfirmRelease' version: '6.032' - class: Dist::Zilla::Plugin::UploadToCPAN name: '@Author::OALDERS/UploadToCPAN' version: '6.032' - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: develop type: recommends name: '@Author::OALDERS/@Git::VersionManager/pluginbundle version' version: '6.032' - class: Dist::Zilla::Plugin::RewriteVersion::Transitional config: Dist::Zilla::Plugin::RewriteVersion: add_tarball_name: 0 finders: - ':ExecFiles' - ':InstallModules' global: 0 skip_version_provider: 0 Dist::Zilla::Plugin::RewriteVersion::Transitional: {} name: '@Author::OALDERS/@Git::VersionManager/RewriteVersion::Transitional' version: '0.009' - class: Dist::Zilla::Plugin::MetaProvides::Update name: '@Author::OALDERS/@Git::VersionManager/MetaProvides::Update' version: '0.007' - class: Dist::Zilla::Plugin::CopyFilesFromRelease config: Dist::Zilla::Plugin::CopyFilesFromRelease: filename: - Changes match: [] name: '@Author::OALDERS/@Git::VersionManager/CopyFilesFromRelease' version: '0.007' - class: Dist::Zilla::Plugin::Git::Commit config: Dist::Zilla::Plugin::Git::Commit: add_files_in: [] commit_msg: v%V%n%n%c signoff: 0 Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - Changes - Install - LICENSE - META.json - Makefile.PL - README.md - cpanfile - dist.ini allow_dirty_match: [] changelog: Changes Dist::Zilla::Role::Git::Repo: git_version: 2.43.0 repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@Author::OALDERS/@Git::VersionManager/release snapshot' version: '2.051' - class: Dist::Zilla::Plugin::Git::Tag config: Dist::Zilla::Plugin::Git::Tag: branch: ~ changelog: Changes signed: 0 tag: v0.01042 tag_format: v%V tag_message: v%V Dist::Zilla::Role::Git::Repo: git_version: 2.43.0 repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@Author::OALDERS/@Git::VersionManager/Git::Tag' version: '2.051' - class: Dist::Zilla::Plugin::BumpVersionAfterRelease::Transitional config: Dist::Zilla::Plugin::BumpVersionAfterRelease: finders: - ':ExecFiles' - ':InstallModules' global: 0 munge_makefile_pl: 1 Dist::Zilla::Plugin::BumpVersionAfterRelease::Transitional: {} name: '@Author::OALDERS/@Git::VersionManager/BumpVersionAfterRelease::Transitional' version: '0.009' - class: Dist::Zilla::Plugin::NextRelease name: '@Author::OALDERS/@Git::VersionManager/NextRelease' version: '6.032' - class: Dist::Zilla::Plugin::Git::Commit config: Dist::Zilla::Plugin::Git::Commit: add_files_in: [] commit_msg: 'increment $VERSION after %v release' signoff: 0 Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - Build.PL - Changes - Makefile.PL allow_dirty_match: - (?^:^lib/.*\.pm$) changelog: Changes Dist::Zilla::Role::Git::Repo: git_version: 2.43.0 repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@Author::OALDERS/@Git::VersionManager/post-release commit' version: '2.051' - class: Dist::Zilla::Plugin::Git::Push config: Dist::Zilla::Plugin::Git::Push: push_to: - origin remotes_must_exist: 1 Dist::Zilla::Role::Git::Repo: git_version: 2.43.0 repo_root: . name: '@Author::OALDERS/Git::Push' version: '2.051' - class: Dist::Zilla::Plugin::Authority name: Authority version: '1.009' - class: Dist::Zilla::Plugin::GitHubREADME::Badge name: GitHubREADME::Badge version: '0.35' - class: Dist::Zilla::Plugin::FinderCode name: ':InstallModules' version: '6.032' - class: Dist::Zilla::Plugin::FinderCode name: ':IncModules' version: '6.032' - class: Dist::Zilla::Plugin::FinderCode name: ':TestFiles' version: '6.032' - class: Dist::Zilla::Plugin::FinderCode name: ':ExtraTestFiles' version: '6.032' - class: Dist::Zilla::Plugin::FinderCode name: ':ExecFiles' version: '6.032' - class: Dist::Zilla::Plugin::FinderCode name: ':PerlExecFiles' version: '6.032' - class: Dist::Zilla::Plugin::FinderCode name: ':ShareFiles' version: '6.032' - class: Dist::Zilla::Plugin::FinderCode name: ':MainModule' version: '6.032' - class: Dist::Zilla::Plugin::FinderCode name: ':AllFiles' version: '6.032' - class: Dist::Zilla::Plugin::FinderCode name: ':NoFiles' version: '6.032' zilla: class: Dist::Zilla::Dist::Builder config: is_trial: 0 version: '6.032' x_authority: cpan:PLU x_contributors: - 'Alessandro Ghedini ' - 'Andreas Marienborg ' - 'Corey Farwell ' - 'dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>' - 'Florian Ragwitz ' - 'Graham Ollis ' - 'H.Merijn Brand - Tux ' - 'Ichinose Shogo ' - 'Ivan Bessarabov ' - 'Johannes Plunien ' - 'José Joaquín Atria ' - 'Konboi ' - 'Michael G. Schwern ' - 'Olaf Alders ' - 'Randy Stauner ' - 'Rich Bowen ' - 'Roland Huß ' - 'SUZUKI Masashi ' - 'teckl ' - 'Thibault DUPONCHELLE ' - 'Timothy Legge ' - 'Zoffix Znet ' x_generated_by_perl: v5.40.0 x_serialization_backend: 'YAML::Tiny version 1.76' x_spdx_expression: 'Artistic-1.0-Perl OR GPL-1.0-or-later' x_static_install: 1 Pithub-0.01042/lib/0000775000175000017500000000000015014062322012302 5ustar olafolafPithub-0.01042/lib/Pithub/0000775000175000017500000000000015014062322013535 5ustar olafolafPithub-0.01042/lib/Pithub/PullRequests.pm0000644000175000017500000001606415014062322016550 0ustar olafolafpackage Pithub::PullRequests; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 Pull Requests API use Moo; use Carp qw( croak ); use Pithub::PullRequests::Comments (); use Pithub::PullRequests::Reviewers (); extends 'Pithub::Base'; sub comments { return shift->_create_instance( Pithub::PullRequests::Comments::, @_ ); } sub reviewers { return shift->_create_instance( Pithub::PullRequests::Reviewers::, @_ ); } sub commits { my ( $self, %args ) = @_; croak 'Missing key in parameters: pull_request_id' unless $args{pull_request_id}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/pulls/%s/commits', delete $args{user}, delete $args{repo}, delete $args{pull_request_id} ), %args, ); } sub create { my ( $self, %args ) = @_; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'POST', path => sprintf( '/repos/%s/%s/pulls', delete $args{user}, delete $args{repo} ), %args, ); } sub files { my ( $self, %args ) = @_; croak 'Missing key in parameters: pull_request_id' unless $args{pull_request_id}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/pulls/%s/files', delete $args{user}, delete $args{repo}, delete $args{pull_request_id} ), %args, ); } sub get { my ( $self, %args ) = @_; croak 'Missing key in parameters: pull_request_id' unless $args{pull_request_id}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/pulls/%s', delete $args{user}, delete $args{repo}, delete $args{pull_request_id} ), %args, ); } sub is_merged { my ( $self, %args ) = @_; croak 'Missing key in parameters: pull_request_id' unless $args{pull_request_id}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/pulls/%s/merge', delete $args{user}, delete $args{repo}, delete $args{pull_request_id} ), %args, ); } sub list { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/pulls', delete $args{user}, delete $args{repo} ), params => { per_page => 100, page => delete $args{page}, }, %args, ); } sub merge { my ( $self, %args ) = @_; croak 'Missing key in parameters: pull_request_id' unless $args{pull_request_id}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'PUT', path => sprintf( '/repos/%s/%s/pulls/%s/merge', delete $args{user}, delete $args{repo}, delete $args{pull_request_id} ), %args, ); } sub update { my ( $self, %args ) = @_; croak 'Missing key in parameters: pull_request_id' unless $args{pull_request_id}; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'PATCH', path => sprintf( '/repos/%s/%s/pulls/%s', delete $args{user}, delete $args{repo}, delete $args{pull_request_id} ), %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::PullRequests - Github v3 Pull Requests API =head1 VERSION version 0.01042 =head1 METHODS =head2 comments Provides access to L. =head2 reviewers Provides access to L. =head2 commits =over =item * List commits on a pull request GET /repos/:user/:repo/pulls/:id/commits Examples: my $p = Pithub::PullRequests->new; my $result = $p->commits( user => 'plu', repo => 'Pithub', pull_request_id => 1 ); =back =head2 create =over =item * Create a pull request POST /repos/:user/:repo/pulls Examples: my $p = Pithub::PullRequests->new; my $result = $p->create( user => 'plu', repo => 'Pithub', data => { base => 'master', body => 'Please pull this in!', head => 'octocat:new-feature', title => 'Amazing new feature', } ); =back =head2 files =over =item * List pull requests files GET /repos/:user/:repo/pulls/:id/files Examples: my $p = Pithub::PullRequests->new; my $result = $p->files( user => 'plu', repo => 'Pithub', pull_request_id => 1, ); =back =head2 get =over =item * Get a single pull request GET /repos/:user/:repo/pulls/:id Examples: my $p = Pithub::PullRequests->new; my $result = $p->get( user => 'plu', repo => 'Pithub', pull_request_id => 1, ); =back =head2 is_merged =over =item * Get if a pull request has been merged GET /repos/:user/:repo/pulls/:id/merge Examples: my $p = Pithub::PullRequests->new; my $result = $p->is_merged( user => 'plu', repo => 'Pithub', pull_request_id => 1, ); =back =head2 list =over =item * List pull requests GET /repos/:user/:repo/pulls Examples: my $p = Pithub::PullRequests->new; my $result = $p->list( user => 'plu', repo => 'Pithub', page => 2, # Defaults to page 1, and defaults to a limit of 100 results ); =back =head2 merge =over =item * Merge a pull request PUT /repos/:user/:repo/pulls/:id/merge Examples: my $p = Pithub::PullRequests->new; my $result = $p->merge( user => 'plu', repo => 'Pithub', pull_request_id => 1, ); =back =head2 update =over =item * Update a pull request PATCH /repos/:user/:repo/pulls/:id Examples: my $p = Pithub::PullRequests->new; my $result = $p->update( user => 'plu', repo => 'Pithub', pull_request_id => 1, data => { base => 'master', body => 'Please pull this in!', head => 'octocat:new-feature', title => 'Amazing new feature', } ); =back =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/GitData.pm0000644000175000017500000000273115014062322015411 0ustar olafolafpackage Pithub::GitData; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 Git Data API use Moo; use Pithub::GitData::Blobs (); use Pithub::GitData::Commits (); use Pithub::GitData::References (); use Pithub::GitData::Tags (); use Pithub::GitData::Trees (); extends 'Pithub::Base'; sub blobs { return shift->_create_instance( Pithub::GitData::Blobs::, @_ ); } sub commits { return shift->_create_instance( Pithub::GitData::Commits::, @_ ); } sub references { return shift->_create_instance( Pithub::GitData::References::, @_ ); } sub tags { return shift->_create_instance( Pithub::GitData::Tags::, @_ ); } sub trees { return shift->_create_instance( Pithub::GitData::Trees::, @_ ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::GitData - Github v3 Git Data API =head1 VERSION version 0.01042 =head1 METHODS =head2 blobs Provides access to L. =head2 commits Provides access to L. =head2 references Provides access to L. =head2 tags Provides access to L. =head2 trees Provides access to L. =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/Base.pm0000644000175000017500000005516015014062322014752 0ustar olafolafpackage Pithub::Base; our $AUTHORITY = 'cpan:PLU'; # ABSTRACT: Github v3 base class for all Pithub modules use Moo; our $VERSION = '0.01042'; use Carp qw( croak ); use HTTP::Headers (); use HTTP::Request (); use JSON::MaybeXS qw( JSON ); use LWP::UserAgent (); use Pithub::Result (); use URI (); with 'Pithub::Result::SharedCache'; has 'auto_pagination' => ( default => sub { 0 }, is => 'rw', ); has 'api_uri' => ( default => sub { URI->new('https://api.github.com') }, is => 'rw', trigger => sub { my ( $self, $uri ) = @_; $self->{api_uri} = URI->new("$uri"); }, ); has 'jsonp_callback' => ( clearer => 'clear_jsonp_callback', is => 'rw', predicate => 'has_jsonp_callback', required => 0, ); has 'per_page' => ( clearer => 'clear_per_page', is => 'rw', predicate => 'has_per_page', default => 100, required => 0, ); has 'prepare_request' => ( clearer => 'clear_prepare_request', is => 'rw', predicate => 'has_prepare_request', required => 0, ); has 'repo' => ( clearer => 'clear_repo', is => 'rw', predicate => 'has_repo', required => 0, ); has 'token' => ( clearer => 'clear_token', is => 'rw', predicate => '_has_token', required => 0, ); has 'ua' => ( builder => '_build_ua', is => 'ro', lazy => 1, ); has 'user' => ( clearer => 'clear_user', is => 'rw', predicate => 'has_user', required => 0, ); has 'utf8' => ( is => 'ro', default => 1, ); has '_json' => ( builder => '_build__json', is => 'ro', lazy => 1, ); my @TOKEN_REQUIRED = ( 'DELETE /user/emails', 'GET /user', 'GET /user/emails', 'GET /user/followers', 'GET /user/following', 'GET /user/keys', 'GET /user/repos', 'PATCH /user', 'POST /user/emails', 'POST /user/keys', 'POST /user/repos', ); my @TOKEN_REQUIRED_REGEXP = ( qr{^DELETE }, qr{^GET /gists/starred$}, qr{^GET /gists/[^/]+/star$}, qr{^GET /issues$}, qr{^GET /orgs/[^/]+/members/.*$}, qr{^GET /orgs/[^/]+/teams$}, qr{^GET /repos/[^/]+/[^/]+/collaborators$}, qr{^GET /repos/[^/]+/[^/]+/collaborators/.*$}, qr{^GET /repos/[^/]+/[^/]+/hooks$}, qr{^GET /repos/[^/]+/[^/]+/hooks/.*$}, qr{^GET /repos/[^/]+/[^/]+/keys$}, qr{^GET /repos/[^/]+/[^/]+/keys/.*$}, qr{^GET /teams/.*$}, qr{^GET /teams/[^/]+/members$}, qr{^GET /teams/[^/]+/members/.*$}, qr{^GET /teams/[^/]+/repos$}, qr{^GET /teams/[^/]+/repos/.*$}, qr{^GET /user/following/.*$}, qr{^GET /user/keys/.*$}, qr{^GET /user/orgs$}, qr{^GET /user/starred/[^/]+/.*$}, qr{^GET /user/watched$}, qr{^GET /user/watched/[^/]+/.*$}, qr{^GET /users/[^/]+/events/orgs/.*$}, qr{^PATCH /gists/.*$}, qr{^PATCH /gists/[^/]+/comments/.*$}, qr{^PATCH /orgs/.*$}, qr{^PATCH /repos/[^/]+/.*$}, qr{^PATCH /repos/[^/]+/[^/]+/comments/.*$}, qr{^PATCH /repos/[^/]+/[^/]+/git/refs/.*$}, qr{^PATCH /repos/[^/]+/[^/]+/hooks/.*$}, qr{^PATCH /repos/[^/]+/[^/]+/issues/.*$}, qr{^PATCH /repos/[^/]+/[^/]+/issues/comments/.*$}, qr{^PATCH /repos/[^/]+/[^/]+/keys/.*$}, qr{^PATCH /repos/[^/]+/[^/]+/labels/.*$}, qr{^PATCH /repos/[^/]+/[^/]+/milestones/.*$}, qr{^PATCH /repos/[^/]+/[^/]+/pulls/.*$}, qr{^PATCH /repos/[^/]+/[^/]+/releases/.*$}, qr{^PATCH /repos/[^/]+/[^/]+/pulls/comments/.*$}, qr{^PATCH /teams/.*$}, qr{^PATCH /user/keys/.*$}, qr{^PATCH /user/repos/.*$}, qr{^POST /repos/[^/]+/[^/]+/releases/[^/]+/assets.*$}, qr{^POST /gists/[^/]+/comments$}, qr{^POST /orgs/[^/]+/repos$}, qr{^POST /orgs/[^/]+/teams$}, qr{^POST /repos/[^/]+/[^/]+/commits/[^/]+/comments$}, qr{^POST /repos/[^/]+/[^/]+/downloads$}, qr{^POST /repos/[^/]+/[^/]+/forks}, qr{^POST /repos/[^/]+/[^/]+/git/blobs$}, qr{^POST /repos/[^/]+/[^/]+/git/commits$}, qr{^POST /repos/[^/]+/[^/]+/git/refs}, qr{^POST /repos/[^/]+/[^/]+/git/tags$}, qr{^POST /repos/[^/]+/[^/]+/git/trees$}, qr{^POST /repos/[^/]+/[^/]+/hooks$}, qr{^POST /repos/[^/]+/[^/]+/hooks/[^/]+/test$}, qr{^POST /repos/[^/]+/[^/]+/issues$}, qr{^POST /repos/[^/]+/[^/]+/issues/[^/]+/comments}, qr{^POST /repos/[^/]+/[^/]+/issues/[^/]+/labels$}, qr{^POST /repos/[^/]+/[^/]+/keys$}, qr{^POST /repos/[^/]+/[^/]+/labels$}, qr{^POST /repos/[^/]+/[^/]+/milestones$}, qr{^POST /repos/[^/]+/[^/]+/pulls$}, qr{^POST /repos/[^/]+/[^/]+/releases$}, qr{^POST /repos/[^/]+/[^/]+/pulls/[^/]+/comments$}, qr{^POST /repos/[^/]+/[^/]+/pulls/[^/]+/requested_reviewers$}, qr{^PUT /gists/[^/]+/star$}, qr{^PUT /orgs/[^/]+/public_members/.*$}, qr{^PUT /repos/[^/]+/[^/]+/collaborators/.*$}, qr{^PUT /repos/[^/]+/[^/]+/issues/[^/]+/labels$}, qr{^PUT /repos/[^/]+/[^/]+/pulls/[^/]+/merge$}, qr{^PUT /teams/[^/]+/members/.*$}, qr{^PUT /teams/[^/]+/memberships/.*$}, qr{^PUT /teams/[^/]+/repos/.*$}, qr{^PUT /user/following/.*$}, qr{^PUT /user/starred/[^/]+/.*$}, qr{^PUT /user/watched/[^/]+/.*$}, ); sub request { my ( $self, %args ) = @_; my $method = delete $args{method} || croak 'Missing mandatory key in parameters: method'; my $path = delete $args{path} || croak 'Missing mandatory key in parameters: path'; my $data = delete $args{data}; my $options = delete $args{options}; my $params = delete $args{params}; croak "Invalid method: $method" unless grep $_ eq $method, qw(DELETE GET PATCH POST PUT); my $uri = $self->_uri_for($path); if ( my $host = delete $args{host} ) { $uri->host($host); } if ( my $query = delete $args{query} ) { my %orig_query = $uri->query_form; $uri->query_form(%orig_query, %$query); } my $request = $self->_request_for( $method, $uri, $data ); if ( my $headers = delete $args{headers} ) { foreach my $header ( keys %$headers ) { $request->header( $header, $headers->{$header} ); } } if ( $self->_token_required( $method, $path ) && !$self->has_token($request) ) { croak sprintf 'Access token required for: %s %s (%s)', $method, $path, $uri; } if ($options) { croak 'The key options must be a hashref' unless ref $options eq 'HASH'; croak 'The key prepare_request in the options hashref must be a coderef' if $options->{prepare_request} && ref $options->{prepare_request} ne 'CODE'; if ( $options->{prepare_request} ) { $options->{prepare_request}->($request); } } if ($params) { croak 'The key params must be a hashref' unless ref $params eq 'HASH'; my %query = ( $request->uri->query_form, %$params ); $request->uri->query_form(%query); } my $response = $self->_make_request($request); return Pithub::Result->new( auto_pagination => $self->auto_pagination, response => $response, utf8 => $self->utf8, _request => sub { $self->request(@_) }, ); } sub _make_request { my ( $self, $request ) = @_; my $cache_key = $request->uri->as_string; if ( my $cached_response = $self->shared_cache->get($cache_key) ) { # Add the If-None-Match header from the cache's ETag # and make the request $request->header( 'If-None-Match' => $cached_response->header('ETag') ); my $response = $self->ua->request($request); # Got 304 Not Modified, cache is still valid return $cached_response if ( $response->code || 0 ) == 304; # The response changed, cache it and return it. $self->shared_cache->set( $cache_key, $response ); return $response; } my $response = $self->ua->request($request); $self->shared_cache->set( $cache_key, $response ); return $response; } sub has_token { my ( $self, $request ) = @_; # If we have one specified in the object, return true return 1 if $self->_has_token; # If no request object here, we don't have a token return 0 unless $request; return 1 if $request->header('Authorization'); return 0; } sub rate_limit { return shift->request( method => 'GET', path => '/rate_limit' ); } sub _build__json { my ($self) = @_; return JSON->new->utf8( $self->utf8 ); } sub _build_ua { my ($self) = @_; return LWP::UserAgent->new; } sub _get_user_repo_args { my ( $self, $args ) = @_; $args->{user} = $self->user unless defined $args->{user}; $args->{repo} = $self->repo unless defined $args->{repo}; return $args; } ## no critic (Subroutines::ProhibitUnusedPrivateSubroutines) sub _create_instance { my ( $self, $class, @args ) = @_; my %args = ( api_uri => $self->api_uri, auto_pagination => $self->auto_pagination, ua => $self->ua, utf8 => $self->utf8, @args, ); for my $attr (qw(repo token user per_page jsonp_callback prepare_request)) { # Allow overrides to set attributes to undef next if exists $args{$attr}; my $has_attr = "has_$attr"; $args{$attr} = $self->$attr if $self->$has_attr; } return $class->new(%args); } ## use critic sub _request_for { my ( $self, $method, $uri, $data ) = @_; my $headers = HTTP::Headers->new; if ( $self->has_token ) { $headers->header( 'Authorization' => sprintf( 'token %s', $self->token ) ); } my $request = HTTP::Request->new( $method, $uri, $headers ); if ($data) { $data = $self->_json->encode($data) if ref $data; $request->content($data); } $request->header( 'Content-Length' => length $request->content ); if ( $self->has_prepare_request ) { $self->prepare_request->($request); } return $request; } my %TOKEN_REQUIRED = map { ( $_ => 1 ) } @TOKEN_REQUIRED; sub _token_required { my ( $self, $method, $path ) = @_; my $key = "${method} ${path}"; return 1 if $TOKEN_REQUIRED{$key}; foreach my $regexp (@TOKEN_REQUIRED_REGEXP) { return 1 if $key =~ /$regexp/; } return 0; } sub _uri_for { my ( $self, $path ) = @_; my $uri = $self->api_uri->clone; my $base_path = $uri->path; $path =~ s/^$base_path//; my @parts; push @parts, split qr{/+}, $uri->path; push @parts, split qr{/+}, $path; $uri->path( join '/', grep { $_ } @parts ); if ( $self->has_per_page ) { my %query = ( $uri->query_form, per_page => $self->per_page ); $uri->query_form(%query); } if ( $self->has_jsonp_callback ) { my %query = ( $uri->query_form, callback => $self->jsonp_callback ); $uri->query_form(%query); } return $uri; } ## no critic (Subroutines::ProhibitUnusedPrivateSubroutines) sub _validate_user_repo_args { my ( $self, $args ) = @_; $args = $self->_get_user_repo_args($args); croak 'Missing key in parameters: user' unless $args->{user}; croak 'Missing key in parameters: repo' unless $args->{repo}; } ## use critic 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Base - Github v3 base class for all Pithub modules =head1 VERSION version 0.01042 =head1 DESCRIPTION All L L inherit from L, even L itself. So all L listed here can either be set in the constructor or via the setter on the objects. If any attribute is set on a L object it gets automatically set on objects that get created by a method call on the L object. This is very convenient for attributes like the L or the L and L attributes. The L and L attributes are special: They get even set on method calls that require B of them. This is to reduce verbosity, especially if you want to do a lot of things on the same repo. This also works for other objects: If you create an object of L where you set the L and L attribute in the constructor, this will also be set once you get to the L object via the C<< keys >> method. Attributes passed along from the parent can be changed in the method call. my $p = Pithub->new( per_page => 50 ); my $r1 = $p->repos; # $r->per_page == 50 my $r2 = $p->repos( per_page => 100 ); # $r->per_page == 100 Examples: # just to demonstrate the "magic" print Pithub->new( user => 'plu' )->repos->user; # plu print Pithub::Repos->new( user => 'plu' )->keys->user; # plu # and now some real use cases my $p = Pithub->new( user => 'plu', repo => 'Pithub' ); my $r = $p->repos; print $r->user; # plu print $r->repo; # pithub # usually you would do print $r->get( user => 'plu', repo => 'Pithub' )->content->{html_url}; # but since user + repo has been set already print $r->get->content->{html_url}; # of course parameters to the method take precedence print $r->get( user => 'miyagawa', repo => 'Plack' )->content->{html_url}; # it even works on other objects my $repo = Pithub::Repos->new( user => 'plu', repo => 'Pithub' ); print $repo->watching->list->first->{login}; =head1 ATTRIBUTES =head2 auto_pagination Off by default. See also: L. =head2 api_uri Defaults to L. For GitHub Enterprise, you'll likely need an URL like L. Examples: my $users = Pithub::Users->new( api_uri => 'https://api-foo.github.com' ); # ... is the same as ... my $users = Pithub::Users->new; $users->api_uri('https://api-foo.github.com'); =head2 jsonp_callback If you want to use the response directly in JavaScript for example, Github supports setting a JSONP callback parameter. See also: L. Examples: my $p = Pithub->new( jsonp_callback => 'loadGithubData' ); my $result = $p->users->get( user => 'plu' ); print $result->raw_content; The result will look like this: loadGithubData({ "meta": { "status": 200, "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4661" }, "data": { "type": "User", "location": "Dubai", "url": "https://api.github.com/users/plu", "login": "plu", "name": "Johannes Plunien", ... } }) B The L method will try to decode the JSON into a Perl data structure. This is not possible if the C<< jsonp_callback >> is set: # calling this ... print $result->content; # ... will throw an exception like this ... Runtime error: malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before "loadGithubData( ... There are two helper methods: =over =item * B: reset the jsonp_callback attribute =item * =head2 per_page Controls how many items are fetched per API call, aka "page". See also: L and L. To minimize the number of API calls to get a complete listing, this defaults to the maximum allowed by Github, which is currently 100. This may change in the future if Github changes their maximum. Examples: my $users = Pithub::Users->new( per_page => 30 ); # ... is the same as ... my $users = Pithub::Users->new; $users->per_page(30); There are two helper methods: =over =item * B: reset the per_page attribute =item * =head2 prepare_request This is a CodeRef and can be used to modify the L object on a global basis, before it's being sent to the Github API. It's useful for setting MIME types for example. See also: L. This is the right way to go if you want to modify the HTTP request of B API calls. If you just want to change a few, consider sending the C<< prepare_request >> parameter on any method call. Let's use this example from the Github docs: B C<< application/vnd.github-issue.html+json >> Return html rendered from the body's markdown. Response will include body_html. Examples: my $p = Pithub::Issues->new( prepare_request => sub { my ($request) = @_; $request->header( Accept => 'application/vnd.github-issue.html+json' ); } ); my $result = $p->get( user => 'miyagawa', repo => 'Plack', issue_id => 209, ); print $result->content->{body_html}; Please compare to the solution where you set the custom HTTP header on the method call, instead globally on the object: my $p = Pithub::Issues->new; my $result = $p->get( user => 'miyagawa', repo => 'Plack', issue_id => 209, options => { prepare_request => sub { my ($request) = @_; $request->header( Accept => 'application/vnd.github-issue.html+json' ); }, } ); print $result->content->{body_html}; =head2 repo This can be set as a default repo to use for API calls that require the repo parameter to be set. There are many of them and it can get kind of verbose to include the repo and the user for all of the calls, especially if you want to do many operations on the same user/repo. Examples: my $c = Pithub::Repos::Collaborators->new( repo => 'Pithub' ); my $result = $c->list( user => 'plu' ); There are two helper methods: =over =item * B: reset the repo attribute =item * =head2 token If the OAuth token is set, L will sent it via an HTTP header on each API request. Currently the basic authentication method is not supported. See also: L =head2 ua By default a L object, but it can be anything that implements the same interface. For example, you could also use L to cache requests on disk, so that subsequent runs of your app can run faster and be less likely to exceed rate limits. =head2 user This can be set as a default user to use for API calls that require the user parameter to be set. Examples: my $c = Pithub::Repos::Collaborators->new( user => 'plu' ); my $result = $c->list( repo => 'Pithub' ); There are two helper methods: =over =item * B: reset the user attribute =item * =head2 utf8 This can set utf8 flag. Examples: my $p = Pithub->new(utf8 => 0); # disable utf8 en/decoding my $p = Pithub->new(utf8 => 1); # enable utf8 en/decoding (default) =head1 METHODS =head2 request This method is the central point: All L are using this method for making requests to the Github. If Github adds a new API call that is not yet supported, this method can be used directly. It accepts an hash with following keys: =over =item * B: mandatory string, one of the following: =over =item * DELETE =item * GET =item * PATCH =item * POST =item * PUT =back =item * B: mandatory string of the relative path used for making the API call. =item * B: optional data reference, usually a reference to an array or hash. It must be possible to serialize this using L. This will be the HTTP request body. =item * B: optional hash reference to set additional options on the request. So far C<< prepare_request >> is supported. See more about that in the examples below. So this can be used on B method which maps directly to an API call. =item * B: optional hash reference to set additional C<< GET >> parameters. This could be achieved using the C<< prepare_request >> in the C<< options >> hashref as well, but this is shorter. It's being used in L for example. =back Usually you should not end up using this method at all. It's only available if L is missing anything from the Github v3 API. Though here are some examples how to use it: =over =item * Same as L: my $p = Pithub->new; my $result = $p->request( method => 'GET', path => '/repos/plu/Pithub/issues', params => { state => 'closed', direction => 'asc', } ); =item * Same as L: my $p = Pithub->new; my $result = $p->request( method => 'GET', path => '/users/plu', ); =item * Same as L: my $p = Pithub->new; my $method = 'POST'; my $path = '/gists'; my $data = { description => 'the description for this gist', public => 1, files => { 'file1.txt' => { content => 'String file content' } } }; my $result = $p->request( method => $method, path => $path, data => $data, ); =item * Same as L: my $p = Pithub->new; my $method = 'GET'; my $path = '/repos/miyagawa/Plack/issues/209'; my $data = undef; my $options = { prepare_request => sub { my ($request) = @_; $request->header( Accept => 'application/vnd.github-issue.html+json' ); }, }; my $result = $p->request( method => $method, path => $path, data => $data, options => $options, ); =back This method always returns a L object. =head2 has_token (?$request) This method checks if a token has been specified, or if not, and a request object is passed, then it looks for an Authorization header in the request. =head2 rate_limit Query the rate limit for the current object and authentication method. =for Pod::Coverage has_jsonp_callback B: check if the jsonp_callback attribute is set =back =for Pod::Coverage has_per_page B: check if the per_page attribute is set =back =for Pod::Coverage has_prepare_request =for Pod::Coverage has_repo B: check if the repo attribute is set =back =for Pod::Coverage has_user B: check if the user attribute is set =back It might make sense to use this together with the repo attribute: my $c = Pithub::Repos::Commits->new( user => 'plu', repo => 'Pithub' ); my $result = $c->list; my $result = $c->list_comments; my $result = $c->get('6b6127383666e8ecb41ec20a669e4f0552772363'); =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/ResultSet.pm0000644000175000017500000000415615014062322016031 0ustar olafolafpackage Pithub::ResultSet; our $AUTHORITY = 'cpan:PLU'; # Honestly stolen from Array::Iterator, removed all unused parts use strict; use warnings; our $VERSION = '0.01042'; sub new { my ( $class, @array ) = @_; my $_array = $array[0]; my $iterator = { _current_index => 0, _length => 0, _iteratee => [], _iterated => 0, }; bless $iterator => $class; $iterator->_init( scalar @{$_array}, $_array ); return $iterator; } sub _init { my ( $self, $length, $iteratee ) = @_; $self->{_current_index} = 0; $self->{_length} = $length; $self->{_iteratee} = $iteratee; } sub _get_item { my ( $self, $iteratee, $index ) = @_; return $iteratee->[$index]; } ## no critic (NamingConventions::Capitalization) sub getNext { my $self = shift; $self->{_iterated} = 1; $self->{_current_index} < $self->{_length} or return undef; return $self->_get_item( $self->{_iteratee}, $self->{_current_index}++ ); } sub getLength { my $self = shift; return $self->{_length}; } 1; =pod =encoding UTF-8 =head1 NAME Pithub::ResultSet - Iterate over the results =head1 VERSION version 0.01042 =head1 SYNOPSIS use Pithub::ResultSet (); see L =head1 DESCRIPTION Iterate over items in the result-set. =head1 METHODS =head2 B Constructor =head2 B Get length of result-set. =head2 B Get next item in the result-set. =head1 SEE ALSO =over 4 =item B =back =head1 AUTHOR H.Merijn Brand Ehmbrand@cpan.orgE =head1 ORIGINAL AUTHOR Stevan Little Estevan@iinteractive.comE perlancar Eperlancar@cpan.orgE =head1 COPYRIGHT AND LICENSE Code derived from Array::Iterator, stripped down to only what is required =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ # ABSTRACT: Iterate over the results Pithub-0.01042/lib/Pithub/Gists/0000775000175000017500000000000015014062322014626 5ustar olafolafPithub-0.01042/lib/Pithub/Gists/Comments.pm0000644000175000017500000001437315014062322016757 0ustar olafolafpackage Pithub::Gists::Comments; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 Gist Comments API use Moo; use Carp qw( croak ); extends 'Pithub::Base'; sub create { my ( $self, %args ) = @_; croak 'Missing key in parameters: gist_id' unless $args{gist_id}; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; return $self->request( method => 'POST', path => sprintf( '/gists/%s/comments', delete $args{gist_id} ), %args, ); } sub delete { my ( $self, %args ) = @_; croak 'Missing key in parameters: gist_id' unless $args{gist_id}; croak 'Missing key in parameters: comment_id' unless $args{comment_id}; return $self->request( method => 'DELETE', path => sprintf( '/gists/%s/comments/%s', delete $args{gist_id}, delete $args{comment_id} ), %args, ); } sub get { my ( $self, %args ) = @_; croak 'Missing key in parameters: gist_id' unless $args{gist_id}; croak 'Missing key in parameters: comment_id' unless $args{comment_id}; return $self->request( method => 'GET', path => sprintf( '/gists/%s/comments/%s', delete $args{gist_id}, delete $args{comment_id} ), %args, ); } sub list { my ( $self, %args ) = @_; croak 'Missing key in parameters: gist_id' unless $args{gist_id}; return $self->request( method => 'GET', path => sprintf( '/gists/%s/comments', delete $args{gist_id} ), %args, ); } sub update { my ( $self, %args ) = @_; croak 'Missing key in parameters: gist_id' unless $args{gist_id}; croak 'Missing key in parameters: comment_id' unless $args{comment_id}; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; return $self->request( method => 'PATCH', path => sprintf( '/gists/%s/comments/%s', delete $args{gist_id}, delete $args{comment_id} ), %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Gists::Comments - Github v3 Gist Comments API =head1 VERSION version 0.01042 =head1 METHODS =head2 create =over =item * Create a comment POST /gists/:gist_id/comments Parameters: =over =item * B: mandatory string =item * B: mandatory hashref, having following keys: =over =item * B: mandatory string =back =back Examples: my $c = Pithub::Gists::Comments->new; my $result = $c->create( gist_id => 'c0ff33', data => { body => 'Just commenting for the sake of commenting' }, ); Response: B { "id": 1, "url": "https://api.github.com/gists/c0ff33/comments/1", "body": "Just commenting for the sake of commenting", "user": { "login": "octocat", "id": 1, "gravatar_url": "https://github.com/images/error/octocat_happy.gif", "url": "https://api.github.com/users/octocat" }, "created_at": "2011-04-18T23:23:56Z" } =back =head2 delete =over =item * Delete a comment DELETE /gists/:gist_id/comments/:id Parameters: =over =item * B: mandatory string =item * B: mandatory integer =back Examples: my $c = Pithub::Gists::Comments->new; my $result = $c->delete( gist_id => 'c0ff33', comment_id => 1 ); Response: B =back =head2 get =over =item * Get a single comment GET /gists/:gist_id/comments/:id Parameters: =over =item * B: mandatory string =item * B: mandatory integer =back Examples: my $c = Pithub::Gists::Comments->new; my $result = $c->get( gist_id => 'c0ff33', comment_id => 1 ); Response: B { "id": 1, "url": "https://api.github.com/gists/c0ff33/comments/1", "body": "Just commenting for the sake of commenting", "user": { "login": "octocat", "id": 1, "gravatar_url": "https://github.com/images/error/octocat_happy.gif", "url": "https://api.github.com/users/octocat" }, "created_at": "2011-04-18T23:23:56Z" } =back =head2 list =over =item * List comments on a gist GET /gists/:gist_id/comments Parameters: =over =item * B: mandatory string =back Examples: my $c = Pithub::Gists::Comments->new; my $result = $c->list( gist_id => 1 ); Response: B [ { "id": 1, "url": "https://api.github.com/gists/c0ff33/comments/1", "body": "Just commenting for the sake of commenting", "user": { "login": "octocat", "id": 1, "gravatar_url": "https://github.com/images/error/octocat_happy.gif", "url": "https://api.github.com/users/octocat" }, "created_at": "2011-04-18T23:23:56Z" } ] =back =head2 update =over =item * Edit a comment PATCH /gists/:gist_id/comments/:id Parameters: =over =item * B: mandatory string =item * B: mandatory integer =item * B: mandatory hashref, having following keys: =over =item * B: mandatory string =back =back Examples: my $c = Pithub::Gists::Comments->new; my $result = $c->update( gist_id => 'c0ff33', comment_id => 1, data => { body => 'some comment' } ); Response: B { "id": 1, "url": "https://api.github.com/gists/c0ff33/comments/1", "body": "Just commenting for the sake of commenting", "user": { "login": "octocat", "id": 1, "gravatar_url": "https://github.com/images/error/octocat_happy.gif", "url": "https://api.github.com/users/octocat" }, "created_at": "2011-04-18T23:23:56Z" } =back =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/Markdown.pm0000644000175000017500000000361015014062322015653 0ustar olafolafpackage Pithub::Markdown; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 Markdown API use Moo; use Carp qw( croak ); extends 'Pithub::Base'; has [qw( mode context )] => ( is => 'rw' ); sub render { my ( $self, %args ) = @_; croak 'Missing key in parameters: data (hashref)' unless defined $args{data}; for (qw( context mode )) { $args{data}{$_} = $self->$_ if !exists $args{data}{$_} and $self->$_; } return $self->request( method => 'POST', path => '/markdown', %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Markdown - Github v3 Markdown API =head1 VERSION version 0.01042 =head1 ATTRIBUTES =head2 mode The rendering mode. Can be either: =over =item * C to render a document in plain Markdown, just like README.md files are rendered. =item * C to render a document in GitHub Flavored Markdown, which creates links for user mentions as well as references to SHA-1 hashes, issues, and pull requests. =back =head2 context The repository context to use when creating references in C mode. Omit this parameter when using C mode. =head1 METHODS =head2 render Render an arbitrary Markdown document POST /markdown Example: use Pithub::Markdown; my $response = Pithub::Markdown->new->render( data => { text => "Hello world github/linguist#1 **cool**, and #1!", context => "github/gollum", mode => "gfm", }, ); # Note that response is NOT in JSON, so ->content will die my $html = $response->raw_content; =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/Repos.pm0000644000175000017500000002763215014062322015173 0ustar olafolafpackage Pithub::Repos; our $AUTHORITY = 'cpan:PLU'; # ABSTRACT: Github v3 Repos API use Moo; our $VERSION = '0.01042'; use Carp qw( croak ); use Pithub::Issues (); use Pithub::Markdown (); use Pithub::PullRequests (); use Pithub::Repos::Actions (); use Pithub::Repos::Collaborators (); use Pithub::Repos::Commits (); use Pithub::Repos::Contents (); use Pithub::Repos::Downloads (); use Pithub::Repos::Forks (); use Pithub::Repos::Hooks (); use Pithub::Repos::Keys (); use Pithub::Repos::Releases (); use Pithub::Repos::Starring (); use Pithub::Repos::Stats (); use Pithub::Repos::Statuses (); use Pithub::Repos::Watching (); extends 'Pithub::Base'; sub actions { return shift->_create_instance( Pithub::Repos::Actions::, @_ ); } sub branch { my ( $self, %args ) = @_; croak 'Missing key in parameters: branch (string)' unless defined $args{branch}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/branches/%s', delete $args{user}, delete $args{repo}, delete $args{branch}, ), %args, ); } sub branches { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/branches', delete $args{user}, delete $args{repo} ), %args, ); } sub rename_branch { my ( $self, %args ) = @_; croak 'Missing parameters: branch' unless $args{branch}; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'POST', path => sprintf( '/repos/%s/%s/branches/%s/rename', delete $args{user}, delete $args{repo}, delete $args{branch} ), %args, ); } sub merge_branch { my ( $self, %args ) = @_; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'POST', path => sprintf( '/repos/%s/%s/merges', delete $args{user}, delete $args{repo} ), %args, ); } sub collaborators { return shift->_create_instance( Pithub::Repos::Collaborators::, @_ ); } sub commits { return shift->_create_instance( Pithub::Repos::Commits::, @_ ); } sub contents { return shift->_create_instance( Pithub::Repos::Contents::, @_ ); } sub contributors { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/contributors', delete $args{user}, delete $args{repo} ), %args, ); } sub create { my ( $self, %args ) = @_; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; if ( my $org = delete $args{org} ) { return $self->request( method => 'POST', path => sprintf( '/orgs/%s/repos', $org ), %args, ); } else { return $self->request( method => 'POST', path => '/user/repos', %args, ); } } sub delete { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'DELETE', path => sprintf( '/repos/%s/%s', delete $args{user}, delete $args{repo} ), %args, ); } sub downloads { return shift->_create_instance( Pithub::Repos::Downloads::, @_ ); } sub forks { return shift->_create_instance( Pithub::Repos::Forks::, @_ ); } sub get { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s', delete $args{user}, delete $args{repo} ), %args, ); } sub hooks { return shift->_create_instance( Pithub::Repos::Hooks::, @_ ); } sub issues { return shift->_create_instance( Pithub::Issues::, @_ ); } sub keys { return shift->_create_instance( Pithub::Repos::Keys::, @_ ); } sub languages { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/languages', delete $args{user}, delete $args{repo} ), %args, ); } sub list { my ( $self, %args ) = @_; if ( my $user = delete $args{user} ) { return $self->request( method => 'GET', path => sprintf( '/users/%s/repos', $user ), %args, ); } elsif ( my $org = delete $args{org} ) { return $self->request( method => 'GET', path => sprintf( '/orgs/%s/repos', $org ), %args ); } else { return $self->request( method => 'GET', path => '/user/repos', %args, ); } } sub markdown { my $self = shift; return $self->_create_instance( Pithub::Markdown::, mode => 'gfm', context => sprintf( '%s/%s', $self->user, $self->repo ), @_ ); } sub pull_requests { return shift->_create_instance( Pithub::PullRequests::, @_ ); } sub releases { return shift->_create_instance( Pithub::Repos::Releases::, @_ ); } sub starring { return shift->_create_instance( Pithub::Repos::Starring::, @_ ); } sub stats { return shift->_create_instance( Pithub::Repos::Stats::, @_ ); } sub statuses { return shift->_create_instance( Pithub::Repos::Statuses::, @_ ); } sub tags { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/tags', delete $args{user}, delete $args{repo} ), %args, ); } sub teams { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/teams', delete $args{user}, delete $args{repo} ), %args, ); } sub update { my ( $self, %args ) = @_; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'PATCH', path => sprintf( '/repos/%s/%s', delete $args{user}, delete $args{repo} ), %args, ); } sub watching { return shift->_create_instance( Pithub::Repos::Watching::, @_ ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Repos - Github v3 Repos API =head1 VERSION version 0.01042 =head1 METHODS =head2 actions Provides access to L. =head2 branch Get information about a single branch. GET /repos/:owner/:repo/branches/:branch Example: my $result = Pithub->new->branch( user => 'plu', repo => 'Pithub', branch => "master" ); See also L to get a list of all branches. =head2 branches =over =item * List Branches GET /repos/:user/:repo/branches Examples: my $repos = Pithub::Repos->new; my $result = $repos->branches( user => 'plu', repo => 'Pithub' ); See also L to get information about a single branch. =back =head2 rename_branch =over =item * Rename a branch POST /repos/:user/:repo/branches/:branch/rename Examples: my $b = Pithub::Repos->new; my $result = $b->rename_branch( user => 'plu', repo => 'Pithub', branch => 'travis', data => { new_name => 'travis-ci' } ); =back =head2 merge_branch =over =item * Merge a branch POST /repos/:user/:repo/merges Examples: my $b = Pithub::Repos->new; my $result = $b->rename_branch( user => 'plu', repo => 'Pithub', data => { base => 'master', head => 'travis', message => 'My commit message' } ); =back =head2 collaborators Provides access to L. =head2 commits Provides access to L. =head2 contents Provides access to L. =head2 contributors =over =item * List contributors GET /repos/:user/:repo/contributors Examples: my $repos = Pithub::Repos->new; my $result = $repos->contributors( user => 'plu', repo => 'Pithub' ); =back =head2 create =over =item * Create a new repository for the authenticated user. POST /user/repos Examples: my $repos = Pithub::Repos->new; my $result = $repos->create( data => { name => 'some-repo' } ); =item * Create a new repository in this organization. The authenticated user must be a member of this organization. POST /orgs/:org/repos Examples: my $repos = Pithub::Repos->new; my $result = $repos->create( org => 'CPAN-API', data => { name => 'some-repo' } ); =back =head2 delete Delete a repository. DELETE /repos/:owner/:repo =head2 downloads Provides access to L. =head2 forks Provides access to L. =head2 get =over =item * Get a repo GET /repos/:user/:repo Examples: my $repos = Pithub::Repos->new; my $result = $repos->get( user => 'plu', repo => 'Pithub' ); =back =head2 hooks Provides access to L. =head2 issues Provides access to L for this repo. =head2 keys Provides access to L. =head2 languages =over =item * List languages GET /repos/:user/:repo/languages Examples: my $repos = Pithub::Repos->new; my $result = $repos->languages( user => 'plu', repo => 'Pithub' ); =back =head2 list =over =item * List repositories for the authenticated user. GET /user/repos Examples: my $repos = Pithub::Repos->new; my $result = $repos->list; =item * List public repositories for the specified user. GET /users/:user/repos Examples: my $repos = Pithub::Repos->new; my $result = $repos->list( user => 'plu' ); =item * List repositories for the specified org. GET /orgs/:org/repos Examples: my $repos = Pithub::Repos->new; my $result = $repos->list( org => 'CPAN-API' ); =back =head2 markdown Provides access to L setting the current repository as the default context. This also sets the mode to default to 'gfm'. =head2 pull_requests Provides access to L. =head2 releases Provides access to L. =head2 starring Provides access to L. =head2 stats Provide access to L. =head2 statuses Provide access to L. =head2 tags =over =item * List Tags GET /repos/:user/:repo/tags Examples: my $repos = Pithub::Repos->new; my $result = $repos->tags( user => 'plu', repo => 'Pithub' ); =back =head2 teams =over =item * List Teams GET /repos/:user/:repo/teams Examples: my $repos = Pithub::Repos->new; my $result = $repos->teams( user => 'plu', repo => 'Pithub' ); =back =head2 update =over =item * Edit PATCH /repos/:user/:repo Examples: # update a repo for the authenticated user my $repos = Pithub::Repos->new; my $result = $repos->update( repo => 'Pithub', data => { description => 'Github API v3' }, ); =back =head2 watching Provides access to L. =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/Orgs.pm0000644000175000017500000000551515014062322015011 0ustar olafolafpackage Pithub::Orgs; our $AUTHORITY = 'cpan:PLU'; # ABSTRACT: Github v3 Orgs API use Moo; our $VERSION = '0.01042'; use Carp qw( croak ); use Pithub::Orgs::Members (); use Pithub::Orgs::Teams (); extends 'Pithub::Base'; sub get { my ( $self, %args ) = @_; croak 'Missing key in parameters: org' unless $args{org}; return $self->request( method => 'GET', path => sprintf( '/orgs/%s', delete $args{org} ), %args, ); } sub list { my ( $self, %args ) = @_; if ( my $user = delete $args{user} ) { return $self->request( method => 'GET', path => sprintf( '/users/%s/orgs', $user ), %args, ); } return $self->request( method => 'GET', path => '/user/orgs', %args, ); } sub members { return shift->_create_instance( Pithub::Orgs::Members::, @_ ); } sub teams { return shift->_create_instance( Pithub::Orgs::Teams::, @_ ); } sub update { my ( $self, %args ) = @_; croak 'Missing key in parameters: org' unless $args{org}; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; return $self->request( method => 'PATCH', path => sprintf( '/orgs/%s', delete $args{org} ), %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Orgs - Github v3 Orgs API =head1 VERSION version 0.01042 =head1 METHODS =head2 get =over =item * Get an organization GET /orgs/:org Examples: my $o = Pithub::Orgs->new; my $result = $o->get( org => 'CPAN-API' ); =back =head2 list =over =item * List all public organizations for a user. GET /users/:user/orgs Examples: my $o = Pithub::Orgs->new; my $result = $o->list( user => 'plu' ); =item * List public and private organizations for the authenticated user. GET /user/orgs Examples: my $o = Pithub::Orgs->new; my $result = $o->list; =back =head2 members Provides access to L. =head2 teams Provides access to L. =head2 update =over =item * Edit an organization PATCH /orgs/:org Examples: my $o = Pithub::Orgs->new; my $result = $o->update( org => 'CPAN-API', data => { billing_email => 'support@github.com', blog => 'https://github.com/blog', company => 'GitHub', email => 'support@github.com', location => 'San Francisco', name => 'github', } ); =back =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/Users.pm0000644000175000017500000000430215014062322015171 0ustar olafolafpackage Pithub::Users; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 Users API use Moo; use Carp qw( croak ); use Pithub::Users::Emails (); use Pithub::Users::Followers (); use Pithub::Users::Keys (); extends 'Pithub::Base'; sub emails { return shift->_create_instance( Pithub::Users::Emails::, @_ ); } sub followers { return shift->_create_instance( Pithub::Users::Followers::, @_ ); } sub get { my ( $self, %args ) = @_; if ( $args{user} ) { return $self->request( method => 'GET', path => sprintf( '/users/%s', delete $args{user} ), %args, ); } return $self->request( method => 'GET', path => '/user', %args, ); } sub keys { return shift->_create_instance( Pithub::Users::Keys::, @_ ); } sub update { my ( $self, %args ) = @_; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; return $self->request( method => 'PATCH', path => '/user', %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Users - Github v3 Users API =head1 VERSION version 0.01042 =head1 METHODS =head2 emails Provides access to L. =head2 followers Provides access to L. =head2 get =over =item * Get a single user GET /users/:user Examples: my $u = Pithub::Users->new; my $result = $u->get( user => 'plu'); =item * Get the authenticated user GET /user Examples: my $u = Pithub::Users->new( token => 'b3c62c6' ); my $result = $u->get; =back =head2 keys Provides access to L. =head2 update =over =item * Update the authenticated user PATCH /user Examples: my $u = Pithub::Users->new( token => 'b3c62c6' ); my $result = $u->update( data => { email => 'plu@cpan.org' } ); =back =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/Issues/0000775000175000017500000000000015014062322015010 5ustar olafolafPithub-0.01042/lib/Pithub/Issues/Comments.pm0000644000175000017500000001046315014062322017135 0ustar olafolafpackage Pithub::Issues::Comments; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 Issue Comments API use Moo; use Carp qw( croak ); extends 'Pithub::Base'; sub create { my ( $self, %args ) = @_; croak 'Missing key in parameters: issue_id' unless $args{issue_id}; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'POST', path => sprintf( '/repos/%s/%s/issues/%s/comments', delete $args{user}, delete $args{repo}, delete $args{issue_id} ), %args, ); } sub delete { my ( $self, %args ) = @_; croak 'Missing key in parameters: comment_id' unless $args{comment_id}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'DELETE', path => sprintf( '/repos/%s/%s/issues/comments/%s', delete $args{user}, delete $args{repo}, delete $args{comment_id} ), %args, ); } sub get { my ( $self, %args ) = @_; croak 'Missing key in parameters: comment_id' unless $args{comment_id}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/issues/comments/%s', delete $args{user}, delete $args{repo}, delete $args{comment_id} ), %args, ); } sub list { my ( $self, %args ) = @_; croak 'Missing key in parameters: issue_id' unless $args{issue_id}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/issues/%s/comments', delete $args{user}, delete $args{repo}, delete $args{issue_id} ), %args, ); } sub update { my ( $self, %args ) = @_; croak 'Missing key in parameters: comment_id' unless $args{comment_id}; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'PATCH', path => sprintf( '/repos/%s/%s/issues/comments/%s', delete $args{user}, delete $args{repo}, delete $args{comment_id} ), %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Issues::Comments - Github v3 Issue Comments API =head1 VERSION version 0.01042 =head1 METHODS =head2 create =over =item * Create a comment POST /repos/:user/:repo/issues/:id/comments Examples: my $c = Pithub::Issues::Comments->new; my $result = $c->create( repo => 'Pithub', user => 'plu', issue_id => 1, data => { body => 'some comment' } ); =back =head2 delete =over =item * Delete a comment DELETE /repos/:user/:repo/issues/comments/:id Examples: my $c = Pithub::Issues::Comments->new; my $result = $c->delete( repo => 'Pithub', user => 'plu', comment_id => 1, ); =back =head2 get =over =item * Get a single comment GET /repos/:user/:repo/issues/comments/:id Examples: my $c = Pithub::Issues::Comments->new; my $result = $c->get( repo => 'Pithub', user => 'plu', comment_id => 1, ); =back =head2 list =over =item * List comments on an issue GET /repos/:user/:repo/issues/:id/comments Examples: my $c = Pithub::Issues::Comments->new; my $result = $c->list( repo => 'Pithub', user => 'plu', issue_id => 1, ); =back =head2 update =over =item * Edit a comment PATCH /repos/:user/:repo/issues/comments/:id Examples: my $c = Pithub::Issues::Comments->new; my $result = $c->update( repo => 'Pithub', user => 'plu', comment_id => 1, data => { body => 'some comment' }, ); =back =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/Issues/Labels.pm0000644000175000017500000001764615014062322016564 0ustar olafolafpackage Pithub::Issues::Labels; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 Issue Labels API use Moo; use Carp qw( croak ); extends 'Pithub::Base'; sub add { my ( $self, %args ) = @_; croak 'Missing key in parameters: issue_id' unless $args{issue_id}; croak 'Missing key in parameters: data (arrayref)' unless ref $args{data} eq 'ARRAY'; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'POST', path => sprintf( '/repos/%s/%s/issues/%s/labels', delete $args{user}, delete $args{repo}, delete $args{issue_id} ), %args, ); } sub create { my ( $self, %args ) = @_; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'POST', path => sprintf( '/repos/%s/%s/labels', delete $args{user}, delete $args{repo} ), %args, ); } sub delete { my ( $self, %args ) = @_; croak 'Missing key in parameters: label' unless $args{label}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'DELETE', path => sprintf( '/repos/%s/%s/labels/%s', delete $args{user}, delete $args{repo}, delete $args{label} ), %args, ); } sub get { my ( $self, %args ) = @_; croak 'Missing key in parameters: label' unless $args{label}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/labels/%s', delete $args{user}, delete $args{repo}, delete $args{label} ), %args, ); } sub list { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); if ( my $milestone_id = delete $args{milestone_id} ) { return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/milestones/%s/labels', delete $args{user}, delete $args{repo}, $milestone_id ), %args, ); } elsif ( my $issue_id = delete $args{issue_id} ) { return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/issues/%s/labels', delete $args{user}, delete $args{repo}, $issue_id ), %args ); } return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/labels', delete $args{user}, delete $args{repo} ), %args, ); } sub remove { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); croak 'Missing key in parameters: issue_id' unless $args{issue_id}; if ( my $label = delete $args{label} ) { return $self->request( method => 'DELETE', path => sprintf( '/repos/%s/%s/issues/%s/labels/%s', delete $args{user}, delete $args{repo}, delete $args{issue_id}, $label ), %args, ); } return $self->request( method => 'DELETE', path => sprintf( '/repos/%s/%s/issues/%s/labels', delete $args{user}, delete $args{repo}, delete $args{issue_id} ), %args, ); } sub replace { my ( $self, %args ) = @_; croak 'Missing key in parameters: issue_id' unless $args{issue_id}; croak 'Missing key in parameters: data (arrayref)' unless ref $args{data} eq 'ARRAY'; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'PUT', path => sprintf( '/repos/%s/%s/issues/%s/labels', delete $args{user}, delete $args{repo}, delete $args{issue_id} ), %args, ); } sub update { my ( $self, %args ) = @_; croak 'Missing key in parameters: label' unless $args{label}; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'PATCH', path => sprintf( '/repos/%s/%s/labels/%s', delete $args{user}, delete $args{repo}, delete $args{label} ), %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Issues::Labels - Github v3 Issue Labels API =head1 VERSION version 0.01042 =head1 METHODS =head2 add =over =item * Add labels to an issue POST /repos/:user/:repo/issues/:id/labels Examples: my $l = Pithub::Issues::Labels->new; my $result = $l->add( repo => 'Pithub', user => 'plu', issue_id => 1, data => ['Label1', 'Label2'], ); =back =head2 create =over =item * Create a label POST /repos/:user/:repo/labels Examples: my $l = Pithub::Issues::Labels->new; my $result = $l->create( repo => 'Pithub', user => 'plu', data => { color => 'FFFFFF', name => 'some label', } ); =back =head2 delete =over =item * Delete a label DELETE /repos/:user/:repo/labels/:id Examples: my $l = Pithub::Issues::Labels->new; my $result = $l->delete( repo => 'Pithub', user => 'plu', label => 1, ); =back =head2 get =over =item * Get a single label GET /repos/:user/:repo/labels/:id Examples: my $l = Pithub::Issues::Labels->new; my $result = $l->get( repo => 'Pithub', user => 'plu', label => 1, ); =back =head2 list =over =item * List all labels for this repository GET /repos/:user/:repo/labels Examples: my $l = Pithub::Issues::Labels->new; my $result = $l->list( repo => 'Pithub', user => 'plu' ); =item * List labels on an issue GET /repos/:user/:repo/issues/:id/labels Examples: my $l = Pithub::Issues::Labels->new; my $result = $l->list( repo => 'Pithub', user => 'plu', issue_id => 1, ); =item * Get labels for every issue in a milestone GET /repos/:user/:repo/milestones/:id/labels Examples: my $l = Pithub::Issues::Labels->new; my $result = $l->get( repo => 'Pithub', user => 'plu', milestone_id => 1 ); =back =head2 remove =over =item * Remove a label from an issue DELETE /repos/:user/:repo/issues/:id/labels/:id Examples: my $l = Pithub::Issues::Labels->new; my $result = $l->delete( repo => 'Pithub', user => 'plu', issue_id => 1, label => 1, ); =item * Remove all labels from an issue DELETE /repos/:user/:repo/issues/:id/labels Examples: my $l = Pithub::Issues::Labels->new; my $result = $l->delete( repo => 'Pithub', user => 'plu', issue_id => 1, ); =back =head2 replace =over =item * Replace all labels for an issue PUT /repos/:user/:repo/issues/:id/labels Examples: my $l = Pithub::Issues::Labels->new; my $result = $l->replace( repo => 'Pithub', user => 'plu', issue_id => 1, data => [qw(label3 label4)], ); =back =head2 update =over =item * Update a label PATCH /repos/:user/:repo/labels/:id Examples: my $l = Pithub::Issues::Labels->new; my $result = $l->update( repo => 'Pithub', user => 'plu', label => 1, data => { color => 'FFFFFF', name => 'API', } ); =back =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/Issues/Milestones.pm0000644000175000017500000001031015014062322017461 0ustar olafolafpackage Pithub::Issues::Milestones; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 Issue Milestones API use Moo; use Carp qw( croak ); extends 'Pithub::Base'; sub create { my ( $self, %args ) = @_; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'POST', path => sprintf( '/repos/%s/%s/milestones', delete $args{user}, delete $args{repo} ), %args, ); } sub delete { my ( $self, %args ) = @_; croak 'Missing key in parameters: milestone_id' unless $args{milestone_id}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'DELETE', path => sprintf( '/repos/%s/%s/milestones/%s', delete $args{user}, delete $args{repo}, delete $args{milestone_id} ), %args, ); } sub get { my ( $self, %args ) = @_; croak 'Missing key in parameters: milestone_id' unless $args{milestone_id}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/milestones/%s', delete $args{user}, delete $args{repo}, delete $args{milestone_id} ), %args ); } sub list { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/milestones', delete $args{user}, delete $args{repo} ), %args, ); } sub update { my ( $self, %args ) = @_; croak 'Missing key in parameters: milestone_id' unless $args{milestone_id}; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'PATCH', path => sprintf( '/repos/%s/%s/milestones/%s', delete $args{user}, delete $args{repo}, delete $args{milestone_id} ), %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Issues::Milestones - Github v3 Issue Milestones API =head1 VERSION version 0.01042 =head1 METHODS =head2 create =over =item * Create a milestone POST /repos/:user/:repo/milestones Examples: my $m = Pithub::Issues::Milestones->new; my $result = $m->create( repo => 'Pithub', user => 'plu', data => { description => 'String', due_on => 'Time', state => 'open or closed', title => 'String' } ); =back =head2 delete =over =item * Delete a milestone DELETE /repos/:user/:repo/milestones/:id Examples: my $m = Pithub::Issues::Milestones->new; my $result = $m->delete( repo => 'Pithub', user => 'plu', milestone_id => 1, ); =back =head2 get =over =item * Get a single milestone GET /repos/:user/:repo/milestones/:id Examples: my $m = Pithub::Issues::Milestones->new; my $result = $m->get( repo => 'Pithub', user => 'plu', milestone_id => 1, ); =back =head2 list =over =item * List milestones for an issue GET /repos/:user/:repo/milestones Examples: my $m = Pithub::Issues::Milestones->new; my $result = $m->list( repo => 'Pithub', user => 'plu', ); =back =head2 update =over =item * Update a milestone PATCH /repos/:user/:repo/milestones/:id Examples: my $m = Pithub::Issues::Milestones->new; my $result = $m->update( repo => 'Pithub', user => 'plu', data => { description => 'String', due_on => 'Time', state => 'open or closed', title => 'String' } ); =back =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/Issues/Assignees.pm0000644000175000017500000000421315014062322017265 0ustar olafolafpackage Pithub::Issues::Assignees; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 Issue Assignees API use Moo; use Carp qw( croak ); extends 'Pithub::Base'; sub check { my ( $self, %args ) = @_; croak 'Missing key in parameters: assignee' unless $args{assignee}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/assignees/%s', delete $args{user}, delete $args{repo}, delete $args{assignee} ), %args, ); } sub list { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/assignees', delete $args{user}, delete $args{repo} ), %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Issues::Assignees - Github v3 Issue Assignees API =head1 VERSION version 0.01042 =head1 METHODS =head2 check =over =item * You may also check to see if a particular user is an assignee for a repository. GET /repos/:user/:repo/assignees/:assignee If the given assignee login belongs to an assignee for the repository, a 204 header with no content is returned. Examples: my $c = Pithub::Issues::Assignees->new; my $result = $c->check( repo => 'Pithub', user => 'plu', assignee => 'plu', ); if ( $result->success ) { print "plu is an assignee for the repo plu/Pithub.git"; } =back =head2 list =over =item * This call lists all the available assignees (owner + collaborators) to which issues may be assigned. GET /repos/:user/:repo/assignees Examples: my $c = Pithub::Issues::Assignees->new; my $result = $c->list( repo => 'Pithub', user => 'plu', ); =back =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/Issues/Events.pm0000644000175000017500000000454315014062322016616 0ustar olafolafpackage Pithub::Issues::Events; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 Issue Events API use Moo; use Carp qw( croak ); extends 'Pithub::Base'; sub get { my ( $self, %args ) = @_; croak 'Missing key in parameters: event_id' unless $args{event_id}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/issues/events/%s', delete $args{user}, delete $args{repo}, delete $args{event_id} ), %args, ); } sub list { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); if ( my $issue_id = delete $args{issue_id} ) { return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/issues/%s/events', delete $args{user}, delete $args{repo}, $issue_id ), %args, ); } return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/issues/events', delete $args{user}, delete $args{repo} ), %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Issues::Events - Github v3 Issue Events API =head1 VERSION version 0.01042 =head1 METHODS =head2 get =over =item * Get a single event GET /repos/:user/:repo/issues/events/:id Examples: my $e = Pithub::Issues::Events->new; my $result = $e->get( repo => 'Pithub', user => 'plu', event_id => 1, ); =back =head2 list =over =item * List events for an issue GET /repos/:user/:repo/issues/:issue_id/events Examples: my $e = Pithub::Issues::Events->new; my $result = $e->list( repo => 'Pithub', user => 'plu', issue_id => 1, ); =item * List events for a repository GET /repos/:user/:repo/issues/events Examples: my $e = Pithub::Issues::Events->new; my $result = $e->list( repo => 'Pithub', user => 'plu', ); =back =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/PullRequests/0000775000175000017500000000000015014062322016205 5ustar olafolafPithub-0.01042/lib/Pithub/PullRequests/Comments.pm0000644000175000017500000001116415014062322020331 0ustar olafolafpackage Pithub::PullRequests::Comments; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 Pull Request Comments API use Moo; use Carp qw( croak ); extends 'Pithub::Base'; sub create { my ( $self, %args ) = @_; croak 'Missing key in parameters: pull_request_id' unless $args{pull_request_id}; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'POST', path => sprintf( '/repos/%s/%s/pulls/%s/comments', delete $args{user}, delete $args{repo}, delete $args{pull_request_id} ), %args ); } sub delete { my ( $self, %args ) = @_; croak 'Missing key in parameters: comment_id' unless $args{comment_id}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'DELETE', path => sprintf( '/repos/%s/%s/pulls/comments/%s', delete $args{user}, delete $args{repo}, delete $args{comment_id} ), %args, ); } sub get { my ( $self, %args ) = @_; croak 'Missing key in parameters: comment_id' unless $args{comment_id}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/pulls/comments/%s', delete $args{user}, delete $args{repo}, delete $args{comment_id} ), %args, ); } sub list { my ( $self, %args ) = @_; croak 'Missing key in parameters: pull_request_id' unless $args{pull_request_id}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/pulls/%s/comments', delete $args{user}, delete $args{repo}, delete $args{pull_request_id} ), %args, ); } sub update { my ( $self, %args ) = @_; croak 'Missing key in parameters: comment_id' unless $args{comment_id}; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'PATCH', path => sprintf( '/repos/%s/%s/pulls/comments/%s', delete $args{user}, delete $args{repo}, delete $args{comment_id} ), %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::PullRequests::Comments - Github v3 Pull Request Comments API =head1 VERSION version 0.01042 =head1 METHODS =head2 create =over =item * Create a comment POST /repos/:user/:repo/pulls/:id/comments Examples: my $c = Pithub::PullRequests::Comments->new; my $result = $c->create( repo => 'Pithub', user => 'plu', pull_request_id => 1, data => { body => 'Nice change', commit_id => '6dcb09b5b57875f334f61aebed695e2e4193db5e', path => 'file1.txt', position => 4, } ); =back =head2 delete =over =item * Delete a comment DELETE /repos/:user/:repo/pulls/comments/:id Examples: my $c = Pithub::PullRequests::Comments->new; my $result = $c->delete( repo => 'Pithub', user => 'plu', comment_id => 1, ); =back =head2 get =over =item * Get a single comment GET /repos/:user/:repo/pulls/comments/:id Examples: my $c = Pithub::PullRequests::Comments->new; my $result = $c->get( repo => 'Pithub', user => 'plu', comment_id => 1, ); =back =head2 list =over =item * List comments on a pull request GET /repos/:user/:repo/pulls/:id/comments Examples: my $c = Pithub::PullRequests::Comments->new; my $result = $c->list( repo => 'Pithub', user => 'plu', pull_request_id => 1, ); =back =head2 update =over =item * Edit a comment PATCH /repos/:user/:repo/pulls/comments/:id Examples: my $c = Pithub::PullRequests::Comments->new; my $result = $c->update( repo => 'Pithub', user => 'plu', comment_id => 1, data => { body => 'some updated comment' }, ); =back =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/PullRequests/Reviewers.pm0000644000175000017500000000605315014062322020520 0ustar olafolafpackage Pithub::PullRequests::Reviewers; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 Pull Request Review Requests API use Moo; use Carp qw( croak ); extends 'Pithub::Base'; sub delete { my ( $self, %args ) = @_; croak 'Missing key in parameters: pull_request_id' unless $args{pull_request_id}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'DELETE', path => sprintf( '/repos/%s/%s/pulls/%s/requested_reviewers', delete $args{user}, delete $args{repo}, delete $args{pull_request_id} ), %args, ); } sub list { my ( $self, %args ) = @_; croak 'Missing key in parameters: pull_request_id' unless $args{pull_request_id}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/pulls/%s/requested_reviewers', delete $args{user}, delete $args{repo}, delete $args{pull_request_id} ), %args, ); } sub update { my ( $self, %args ) = @_; croak 'Missing key in parameters: pull_request_id' unless $args{pull_request_id}; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'POST', path => sprintf( '/repos/%s/%s/pulls/%s/requested_reviewers', delete $args{user}, delete $args{repo}, delete $args{pull_request_id} ), %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::PullRequests::Reviewers - Github v3 Pull Request Review Requests API =head1 VERSION version 0.01042 =head1 METHODS =head2 delete =over =item * Remove requested reviewers DELETE /repos/:user/:repo/pulls/:id/requested_reviewers Examples: my $c = Pithub::PullRequests::Reviewers->new; my $result = $c->delete( repo => 'Pithub', user => 'plu', pull_request_id => 1, ); =back =head2 list =over =item * List requested_reviewers for a pull request GET /repos/:user/:repo/pulls/:id/requested_reviewers Examples: my $c = Pithub::PullRequests::Reviewers->new; my $result = $c->list( repo => 'Pithub', user => 'plu', pull_request_id => 1, ); =back =head2 update =over =item * Request reviewers for a pull request POST /repos/:user/:repo/pulls/:id/requested_reviewers Examples: my $c = Pithub::PullRequests::Reviewers->new; my $result = $c->update( repo => 'Pithub', user => 'plu', pull_request_id => 1, data => { reviewers => ['octocat'] }, ); =back =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/Repos/0000775000175000017500000000000015014062322014625 5ustar olafolafPithub-0.01042/lib/Pithub/Repos/Stats.pm0000644000175000017500000000317015014062322016260 0ustar olafolafpackage Pithub::Repos::Stats; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 repos / stats API use Moo; extends 'Pithub::Base'; sub contributors { my ( $self, %args ) = @_; # The default is to not wait for 200 my $sleep = delete $args{wait_for_200} || 0; $self->_validate_user_repo_args( \%args ); my $req = { method => 'GET', path => sprintf( '/repos/%s/%s/stats/contributors', delete $args{user}, delete $args{repo} ), %args }; my $res = $self->request(%$req); if ($sleep) { while ( $res->response->code == 202 ) { sleep $sleep; $res = $self->request(%$req); } } return $res; } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Repos::Stats - Github v3 repos / stats API =head1 VERSION version 0.01042 =head1 METHODS =head2 contributors Extra arguments =over =item * wait_for_200 If this is set, and we receive the 202 status from github, we will sleep for this many seconds before trying the request again. We will keep trying until we get anything else than 202 status =back List contributors with stats GET /repos/:user/:repo/stats/contributors Examples: my $repos = Pithub::Repos::Stats->new; my $result = $repos->contributors( user => 'plu', repo => 'Pithub' ); =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/Repos/Actions.pm0000644000175000017500000000163715014062322016570 0ustar olafolafpackage Pithub::Repos::Actions; our $AUTHORITY = 'cpan:PLU'; # ABSTRACT: Github v3 Repo Actions API use Moo; our $VERSION = '0.01042'; use Pithub::Repos::Actions::Workflows (); extends 'Pithub::Base'; sub workflows { return shift->_create_instance( Pithub::Repos::Actions::Workflows::, @_ ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Repos::Actions - Github v3 Repo Actions API =head1 VERSION version 0.01042 =head1 DESCRIPTION This class is incomplete. Please send patches for any additional functionality you may require. =head1 METHODS =head2 workflows Provides access to L. =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/Repos/Actions/0000775000175000017500000000000015014062322016225 5ustar olafolafPithub-0.01042/lib/Pithub/Repos/Actions/Workflows.pm0000644000175000017500000000426415014062322020564 0ustar olafolafpackage Pithub::Repos::Actions::Workflows; our $AUTHORITY = 'cpan:PLU'; # ABSTRACT: Github v3 Repo Actions Workflows API use Moo; our $VERSION = '0.01042'; use Carp qw( croak ); extends 'Pithub::Base'; sub get { my ( $self, %args ) = @_; my $param_name = 'workflow_id'; my $id = delete $args{$param_name}; croak 'Missing key in parameters: ' . $param_name unless $id; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/actions/workflows/%s', delete $args{user}, delete $args{repo}, $id, ), %args, ); } sub list { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/actions/workflows', delete $args{user}, delete $args{repo} ), %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Repos::Actions::Workflows - Github v3 Repo Actions Workflows API =head1 VERSION version 0.01042 =head1 DESCRIPTION This class is incomplete. It's currently missing support for C, C and C. Please send patches for any additional functionality you may require. =head1 METHODS =head2 get =over =item * Get a single workflow. GET /repos/:owner/:repo/actions/workflows/:id Examples: my $a = Pithub::Repos::Actions::Workflows->new; my $result = $a->get( repo => 'graylog2-server', user => 'Graylog2', workflow_id => 81148, ); =back =head2 list =over =item * List workflows for a repo. GET /repos/:owner/:repo/actions/workflows Examples: my $a = Pithub::Repos::Actions::Workflows->new; my $result = $a->list( repo => 'graylog2-server', user => 'Graylog2', ); =back =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/Repos/Releases.pm0000644000175000017500000001340015014062322016722 0ustar olafolafpackage Pithub::Repos::Releases; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 Repo Releases API use Moo; use Carp qw( croak ); use Pithub::Repos::Releases::Assets (); extends 'Pithub::Base'; sub assets { return shift->_create_instance( Pithub::Repos::Releases::Assets::, @_ ); } sub list { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/releases', delete $args{user}, delete $args{repo} ), %args, ); } sub get { my ( $self, %args ) = @_; croak 'Missing key in parameters: release_id' unless $args{release_id}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/releases/%d', delete $args{user}, delete $args{repo}, delete $args{release_id} ), %args, ); } sub create { my ( $self, %args ) = @_; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'POST', path => sprintf( '/repos/%s/%s/releases', delete $args{user}, delete $args{repo} ), %args, ); } sub update { my ( $self, %args ) = @_; croak 'Missing key in parameters: release_id' unless $args{release_id}; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'PATCH', path => sprintf( '/repos/%s/%s/releases/%d', delete $args{user}, delete $args{repo}, delete $args{release_id} ), %args, ); } sub delete { my ( $self, %args ) = @_; croak 'Missing key in parameters: release_id' unless $args{release_id}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'DELETE', path => sprintf( '/repos/%s/%s/releases/%d', delete $args{user}, delete $args{repo}, delete $args{release_id} ), %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Repos::Releases - Github v3 Repo Releases API =head1 VERSION version 0.01042 =head1 METHODS =head2 assets Provides access to L. =head2 list =over =item * List releases for a repository. GET /repos/:owner/:repo/releases Examples: my $r = Pithub::Repos::Releases->new; my $result = $r->get( repo => 'Pithub', user => 'plu', ); =back =head2 get =over =item * Get a single release. GET /repos/:owner/:repo/releases/:id Examples: my $r = Pithub::Repos::Releases->new; my $result = $r->get( repo => 'Pithub', user => 'plu', release_id => 1, ); =back =head2 create =over =item * Create a release. POST /repos/:user/:repo/releases Examples: my $r = Pithub::Repos::Releases->new; my $result = $r->create( user => 'plu', repo => 'Pithub', data => { tag_name => 'v1.0.0', target_commitish => 'master', name => 'v1.0.0', body => 'Description of the release', draft => JSON::MaybeXS::false(), # or alternative below prerelease => JSON::MaybeXS::false(), # or alternative below generate_release_notes => JSON::MaybeXS::false(), # or alternative below } ); Booleans: Several of the attributes B boolean values in the request that is sent to GitHub. Zero (0) and one (1) are integers and will not be encoded correctly in the JSON encoded request. There are numerous options for your call to Pithub::Repos::Releases->create. =over =item JSON::MaybeXS Add the following to your code before the call to Pithub::Repos::Releases->create. require JSON::MaybeXS; Then use the following values for the booleans: JSON::MaybeXS::true() JSON::MaybeXS::false() =item Cpanel::JSON::XS Add the following to your code before the call to Pithub::Repos::Releases->create. require Cpanel::JSON::XS; Then use the following values for the booleans: Cpanel::JSON::XS::true Cpanel::JSON::XS::false =item JSON::PP Add the following to your code before the call to Pithub::Repos::Releases->create. require JSON::PP; Then use the following values for the booleans: $JSON::PP::true $JSON::PP::false =back =back =head2 update =over =item * Edit a release. PATCH /repos/:user/:repo/releases/:id Examples: my $r = Pithub::Repos::Releases->new; my $result = $r->update( user => 'plu', repo => 'Pithub', release_id => 1, data => { tag_name => 'v1.0.0', target_commitish => 'master', name => 'v1.0.0', body => 'Description of the release', draft => 0, prerelease => 0, } ); =back =head2 delete =over =item * Delete a release. DELETE /repos/:user/:repo/releases:id Examples: my $r = Pithub::Repos::Releases->new; my $result = $r->delete( user => 'plu', repo => 'Pithub', release_id => 1, ); =back =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/Repos/Starring.pm0000644000175000017500000000701315014062322016753 0ustar olafolafpackage Pithub::Repos::Starring; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 Repo Starring API use Moo; extends 'Pithub::Base'; sub has_starred { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/user/starred/%s/%s', delete $args{user}, delete $args{repo} ), %args, ); } sub list { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/stargazers', delete $args{user}, delete $args{repo} ), %args, ); } sub list_repos { my ( $self, %args ) = @_; if ( my $user = delete $args{user} ) { return $self->request( method => 'GET', path => sprintf( '/users/%s/starred', $user ), %args, ); } return $self->request( method => 'GET', path => '/user/starred', %args, ); } sub star { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'PUT', path => sprintf( '/user/starred/%s/%s', delete $args{user}, delete $args{repo} ), %args, ); } sub unstar { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'DELETE', path => sprintf( '/user/starred/%s/%s', delete $args{user}, delete $args{repo} ), %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Repos::Starring - Github v3 Repo Starring API =head1 VERSION version 0.01042 =head1 METHODS =head2 has_starred =over =item * Check if you are starring a repository. Requires for the user to be authenticated. GET /user/starred/:user/:repo Examples: my $s = Pithub::Repos::Starring->new; my $result = $s->has_starred( repo => 'Pithub', user => 'plu', ); =back =head2 list =over =item * List all stargazers of a repository GET /repos/:user/:repo/stargazers Examples: my $s = Pithub::Repos::Starring->new; my $result = $s->list( repo => 'Pithub', user => 'plu', ); =back =head2 list_repos =over =item * List repositories being starred by a user. GET /users/:user/starred Examples: my $s = Pithub::Repos::Starring->new; my $result = $s->list_repos( user => 'plu', ); =item * List repos being starred by the authenticated user GET /user/starred Examples: my $s = Pithub::Repos::Starring->new; my $result = $s->list_repos; =back =head2 star =over =item * Star a repository. Requires for the user to be authenticated. PUT /user/starred/:user/:repo Examples: my $s = Pithub::Repos::Starring->new; my $result = $s->star( repo => 'Pithub', user => 'plu', ); =back =head2 unstar =over =item * Unstar a repository. Requires for the user to be authenticated. DELETE /user/starred/:user/:repo Examples: my $s = Pithub::Repos::Starring->new; my $result = $s->unstar( repo => 'Pithub', user => 'plu', ); =back =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/Repos/Collaborators.pm0000644000175000017500000000674115014062322017777 0ustar olafolafpackage Pithub::Repos::Collaborators; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 Repo Collaborators API use Moo; use Carp qw( croak ); extends 'Pithub::Base'; sub add { my ( $self, %args ) = @_; croak 'Missing key in parameters: collaborator' unless $args{collaborator}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'PUT', path => sprintf( '/repos/%s/%s/collaborators/%s', delete $args{user}, delete $args{repo}, delete $args{collaborator} ), %args, ); } sub is_collaborator { my ( $self, %args ) = @_; croak 'Missing key in parameters: collaborator' unless $args{collaborator}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/collaborators/%s', delete $args{user}, delete $args{repo}, delete $args{collaborator} ), %args, ); } sub list { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/collaborators', delete $args{user}, delete $args{repo} ), %args, ); } sub remove { my ( $self, %args ) = @_; croak 'Missing key in parameters: collaborator' unless $args{collaborator}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'DELETE', path => sprintf( '/repos/%s/%s/collaborators/%s', delete $args{user}, delete $args{repo}, delete $args{collaborator} ), %args ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Repos::Collaborators - Github v3 Repo Collaborators API =head1 VERSION version 0.01042 =head1 METHODS =head2 add =over =item * Add collaborator PUT /repos/:user/:repo/collaborators/:user Examples: my $c = Pithub::Repos::Collaborators->new; my $result = $c->add( user => 'plu', repo => 'Pithub', collaborator => 'rbo', ); =back =head2 is_collaborator =over =item * Get GET /repos/:user/:repo/collaborators/:user Examples: my $c = Pithub::Repos::Collaborators->new; my $result = $c->is_collaborator( user => 'plu', repo => 'Pithub', collaborator => 'rbo', ); if ( $result->is_success ) { print "rbo is added as collaborator to Pithub\n"; } elsif ( $result->code == 404 ) { print "rbo is not added as collaborator to Pithub\n"; } =back =head2 list =over =item * List GET /repos/:user/:repo/collaborators Examples: my $c = Pithub::Repos::Collaborators->new; my $result = $c->list( user => 'plu', repo => 'Pithub', ); =back =head2 remove =over =item * Remove collaborator DELETE /repos/:user/:repo/collaborators/:user Examples: my $c = Pithub::Repos::Collaborators->new; my $result = $c->remove( user => 'plu', repo => 'Pithub', collaborator => 'rbo', ); =back =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/Repos/Commits.pm0000644000175000017500000001552215014062322016601 0ustar olafolafpackage Pithub::Repos::Commits; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 Repo Commits API use Moo; use Carp qw( croak ); extends 'Pithub::Base'; sub compare { my ( $self, %args ) = @_; croak 'Missing key in parameters: base' unless $args{base}; croak 'Missing key in parameters: head' unless $args{head}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/compare/%s...%s', delete $args{user}, delete $args{repo}, delete $args{base}, delete $args{head} ), %args, ); } sub create_comment { my ( $self, %args ) = @_; croak 'Missing key in parameters: sha' unless $args{sha}; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'POST', path => sprintf( '/repos/%s/%s/commits/%s/comments', delete $args{user}, delete $args{repo}, delete $args{sha} ), %args, ); } sub delete_comment { my ( $self, %args ) = @_; croak 'Missing key in parameters: comment_id' unless $args{comment_id}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'DELETE', path => sprintf( '/repos/%s/%s/comments/%s', delete $args{user}, delete $args{repo}, delete $args{comment_id} ), %args, ); } sub get { my ( $self, %args ) = @_; croak 'Missing key in parameters: sha' unless $args{sha}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/commits/%s', delete $args{user}, delete $args{repo}, delete $args{sha} ), %args, ); } sub get_comment { my ( $self, %args ) = @_; croak 'Missing key in parameters: comment_id' unless $args{comment_id}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/comments/%s', delete $args{user}, delete $args{repo}, delete $args{comment_id} ), %args, ); } sub list { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/commits', delete $args{user}, delete $args{repo} ), %args, ); } sub list_comments { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); if ( my $sha = delete $args{sha} ) { return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/commits/%s/comments', delete $args{user}, delete $args{repo}, $sha ), %args, ); } return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/comments', delete $args{user}, delete $args{repo} ), %args, ); } sub update_comment { my ( $self, %args ) = @_; croak 'Missing key in parameters: comment_id' unless $args{comment_id}; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'PATCH', path => sprintf( '/repos/%s/%s/comments/%s', delete $args{user}, delete $args{repo}, delete $args{comment_id} ), %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Repos::Commits - Github v3 Repo Commits API =head1 VERSION version 0.01042 =head1 METHODS =head2 compare =over =item * Compare two commits GET /repos/:user/:repo/compare/:base...:head Examples: my $c = Pithub::Repos::Commits->new; my $result = $c->compare( user => 'plu', repo => 'Pithub', base => 'v0.01008', head => ' master ', ); =back =head2 create_comment =over =item * Create a commit comment POST /repos/:user/:repo/commits/:sha/comments Examples: my $c = Pithub::Repos::Commits->new; my $result = $c->create_comment( user => 'plu', repo => 'Pithub', sha => 'df21b2660fb6', data => { body => 'some comment' }, ); =back =head2 delete_comment =over =item * Delete a commit comment DELETE /repos/:user/:repo/comments/:id Examples: my $c = Pithub::Repos::Commits->new; my $result = $c->delete_comment( user => 'plu', repo => 'Pithub', comment_id => 1, ); =back =head2 get =over =item * Get a single commit GET /repos/:user/:repo/commits/:sha Examples: my $c = Pithub::Repos::Commits->new; my $result = $c->get( user => 'plu', repo => 'Pithub', sha => 'df21b2660fb6', ); =back =head2 get_comment =over =item * Get a single commit comment GET /repos/:user/:repo/comments/:id Examples: my $c = Pithub::Repos::Commits->new; my $result = $c->get_comment( user => 'plu', repo => 'Pithub', comment_id => 1, ); =back =head2 list =over =item * List commits on a repository GET /repos/:user/:repo/commits Examples: my $c = Pithub::Repos::Commits->new; my $result = $c->list( user => 'plu', repo => 'Pithub', ); =back =head2 list_comments =over =item * List commit comments for a repository Commit Comments leverage these custom mime types. You can read more about the use of mimes types in the API here. See also: L. GET /repos/:user/:repo/comments Examples: my $c = Pithub::Repos::Commits->new; my $result = $c->list_comments( user => 'plu', repo => 'Pithub', ); =item * List comments for a single commit GET /repos/:user/:repo/commits/:sha/comments Examples: my $c = Pithub::Repos::Commits->new; my $result = $c->list_comments( user => 'plu', repo => 'Pithub', sha => 'df21b2660fb6', ); =back =head2 update_comment =over =item * Update a commit comment PATCH /repos/:user/:repo/comments/:id Examples: my $c = Pithub::Repos::Commits->new; my $result = $c->update_comment( user => 'plu', repo => 'Pithub', comment_id => 1, data => { body => 'updated comment' }, ); =back =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/Repos/Forks.pm0000644000175000017500000000400415014062322016243 0ustar olafolafpackage Pithub::Repos::Forks; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 Repo Forks API use Moo; extends 'Pithub::Base'; sub create { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); if ( my $org = delete $args{org} ) { return $self->request( method => 'POST', path => sprintf( '/repos/%s/%s/forks', delete $args{user}, delete $args{repo} ), data => { organization => $org }, %args, ); } return $self->request( method => 'POST', path => sprintf( '/repos/%s/%s/forks', delete $args{user}, delete $args{repo} ), %args, ); } sub list { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/forks', delete $args{user}, delete $args{repo} ), %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Repos::Forks - Github v3 Repo Forks API =head1 VERSION version 0.01042 =head1 METHODS =head2 create =over =item * Create a fork for the authenticated user. POST /repos/:user/:repo/forks Examples: my $f = Pithub::Repos::Forks->new; my $result = $f->create( user => 'plu', repo => 'Pithub', ); # or fork to an org my $result = $f->create( user => 'plu', repo => 'Pithub', org => 'CPAN-API', ); =back =head2 list =over =item * List forks GET /repos/:user/:repo/forks Examples: my $f = Pithub::Repos::Forks->new; my $result = $f->list( user => 'plu', repo => 'Pithub', ); =back =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/Repos/Watching.pm0000644000175000017500000000657615014062322016743 0ustar olafolafpackage Pithub::Repos::Watching; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 Repo Watching API use Moo; extends 'Pithub::Base'; sub is_watching { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/user/watched/%s/%s', delete $args{user}, delete $args{repo} ), %args, ); } sub list_repos { my ( $self, %args ) = @_; if ( my $user = delete $args{user} ) { return $self->request( method => 'GET', path => sprintf( '/users/%s/watched', $user ), %args, ); } return $self->request( method => 'GET', path => '/user/watched', %args, ); } sub list { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/watchers', delete $args{user}, delete $args{repo} ), %args, ); } sub start_watching { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'PUT', path => sprintf( '/user/watched/%s/%s', delete $args{user}, delete $args{repo} ), %args, ); } sub stop_watching { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'DELETE', path => sprintf( '/user/watched/%s/%s', delete $args{user}, delete $args{repo} ), %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Repos::Watching - Github v3 Repo Watching API =head1 VERSION version 0.01042 =head1 METHODS =head2 is_watching =over =item * Check if you are watching a repo GET /user/watched/:user/:repo Examples: my $w = Pithub::Repos::Watching->new; my $result = $w->is_watching( repo => 'Pithub', user => 'plu', ); =back =head2 list_repos =over =item * List repos being watched by a user GET /users/:user/watched Examples: my $w = Pithub::Repos::Watching->new; my $result = $w->list_repos( user => 'plu' ); =item * List repos being watched by the authenticated user GET /user/watched Examples: my $w = Pithub::Repos::Watching->new; my $result = $w->list_repos; =back =head2 list =over =item * List watchers GET /repos/:user/:repo/watchers Examples: my $w = Pithub::Repos::Watching->new; my $result = $w->list( user => 'plu', repo => 'Pithub', ); =back =head2 start_watching =over =item * Watch a repo PUT /user/watched/:user/:repo Examples: my $w = Pithub::Repos::Watching->new; my $result = $w->start_watching( user => 'plu', repo => 'Pithub', ); =back =head2 stop_watching =over =item * Stop watching a repo DELETE /user/watched/:user/:repo Examples: my $w = Pithub::Repos::Watching->new; my $result = $w->stop_watching( user => 'plu', repo => 'Pithub', ); =back =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/Repos/Releases/0000775000175000017500000000000015014062322016370 5ustar olafolafPithub-0.01042/lib/Pithub/Repos/Releases/Assets.pm0000644000175000017500000001170215014062322020167 0ustar olafolafpackage Pithub::Repos::Releases::Assets; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 Repo Releases Assets API use Moo; use Carp qw( croak ); extends 'Pithub::Base'; sub create { my ( $self, %args ) = @_; croak 'Missing key in parameters: name' unless $args{name}; croak 'Missing key in parameters: release_id' unless $args{release_id}; croak 'Missing key in parameters: data' unless $args{data}; croak 'Missing key in parameters: content_type' unless $args{content_type}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'POST', path => sprintf( '/repos/%s/%s/releases/%s/assets', delete $args{user}, delete $args{repo}, delete $args{release_id} ), host => 'uploads.github.com', query => { name => delete $args{name} }, headers => { 'Content-Type' => delete $args{content_type}, }, %args, ); } sub delete { my ( $self, %args ) = @_; croak 'Missing key in parameters: asset_id' unless $args{asset_id}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'DELETE', path => sprintf( '/repos/%s/%s/releases/assets/%s', delete $args{user}, delete $args{repo}, delete $args{asset_id} ), %args, ); } sub get { my ( $self, %args ) = @_; croak 'Missing key in parameters: asset_id' unless $args{asset_id}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/releases/assets/%s', delete $args{user}, delete $args{repo}, delete $args{asset_id} ), %args, ); } sub list { my ( $self, %args ) = @_; croak 'Missing key in parameters: release_id' unless $args{release_id}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/releases/%s/assets', delete $args{user}, delete $args{repo}, delete $args{release_id} ), %args, ); } sub update { my ( $self, %args ) = @_; croak 'Missing key in parameters: asset_id' unless $args{asset_id}; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'PATCH', path => sprintf( '/repos/%s/%s/releases/assets/%s', delete $args{user}, delete $args{repo}, delete $args{asset_id} ), %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Repos::Releases::Assets - Github v3 Repo Releases Assets API =head1 VERSION version 0.01042 =head1 METHODS =head2 create =over =item * Upload a release asset. POST https://uploads.github.com/repos/:owner/:repo/releases/:id/assets?name=foo.zip Examples: my $a = Pithub::Repos::Releases::Assets->new; my $result = $a->create( repo => 'graylog2-server', user => 'Graylog2', release_id => 81148, name => 'Some Asset', data => 'the asset data', content_type => 'text/plain', ); =back =head2 delete =over =item * Delete a release asset. DELETE /repos/:owner/:repo/releases/assets/:id Examples: my $a = Pithub::Repos::Releases::Assets->new; my $result = $a->delete( repo => 'graylog2-server', user => 'Graylog2', asset_id => 81148, ); =back =head2 get =over =item * Get a single release asset. GET /repos/:owner/:repo/releases/assets/:id Examples: my $a = Pithub::Repos::Releases::Assets->new; my $result = $a->get( repo => 'graylog2-server', user => 'Graylog2', asset_id => 81148, ); =back =head2 list =over =item * List assets for a release. GET /repos/:owner/:repo/releases/:id/assets Examples: my $a = Pithub::Repos::Releases::Assets->new; my $result = $a->list( repo => 'graylog2-server', user => 'Graylog2', release_id => 198110, ); =back =head2 update =over =item * Edit a release asset. PATCH /repos/:owner/:repo/releases/assets/:id Examples: my $a = Pithub::Repos::Releases::Assets->new; my $result = $a->update( repo => 'graylog2-server', user => 'Graylog2', asset_id => 81148, data => { name => 'Some Name', label => 'Some Label', } ); =back =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/Repos/Downloads.pm0000644000175000017500000001263415014062322017121 0ustar olafolafpackage Pithub::Repos::Downloads; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 Repo Downloads API use Moo; use Carp qw( croak ); use HTTP::Request::Common qw( POST ); extends 'Pithub::Base'; sub create { my ( $self, %args ) = @_; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'POST', path => sprintf( '/repos/%s/%s/downloads', delete $args{user}, delete $args{repo} ), %args, ); } sub delete { my ( $self, %args ) = @_; croak 'Missing key in parameters: download_id' unless $args{download_id}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'DELETE', path => sprintf( '/repos/%s/%s/downloads/%s', delete $args{user}, delete $args{repo}, delete $args{download_id} ), %args, ); } sub get { my ( $self, %args ) = @_; croak 'Missing key in parameters: download_id' unless $args{download_id}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/downloads/%s', delete $args{user}, delete $args{repo}, delete $args{download_id} ), %args, ); } sub list { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/downloads', delete $args{user}, delete $args{repo} ), %args, ); } sub upload { my ( $self, %args ) = @_; croak 'Missing key in parameters: result (Pithub::Result object)' unless ref $args{result} eq 'Pithub::Result'; croak 'Missing key in parameters: file' unless $args{file}; my $result = $args{result}->content; foreach my $key (qw(path acl name accesskeyid policy signature mime_type)) { croak "Missing key in Pithub::Result content: ${key}" unless grep $_ eq $key, keys %$result; } my %data = ( Content_Type => 'form-data', Content => [ 'key' => $result->{path}, 'acl' => $result->{acl}, 'success_action_status' => 201, 'Filename' => $result->{name}, 'AWSAccessKeyId' => $result->{accesskeyid}, 'Policy' => $result->{policy}, 'Signature' => $result->{signature}, 'Content-Type' => $result->{mime_type}, 'file' => [ $args{file} ], ], ); my $request = POST $result->{s3_url}, %data; return $self->ua->request($request); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Repos::Downloads - Github v3 Repo Downloads API =head1 VERSION version 0.01042 =head1 METHODS =head2 create =over =item * Creating a new download is a two step process. You must first create a new download resource using this call here. After that you take the return L object and call L to upload the file to Amazon S3. POST /repos/:user/:repo/downloads Examples: my $d = Pithub::Repos::Downloads->new; my $result = $d->create( user => 'plu', repo => 'Pithub', data => { name => 'new_file.jpg', size => 114034, description => 'Latest release', content_type => 'text/plain', }, ); $d->upload( result => $result, file => '/path/to/file', ); =back =head2 delete =over =item * Delete a download DELETE /repos/:user/:repo/downloads/:id Examples: my $d = Pithub::Repos::Downloads->new; my $result = $d->delete( user => 'plu', repo => 'Pithub', download_id => 1, ); =back =head2 get =over =item * Get a single download GET /repos/:user/:repo/downloads/:id Examples: my $d = Pithub::Repos::Downloads->new; my $result = $d->get( user => 'plu', repo => 'Pithub', download_id => 1, ); =back =head2 list =over =item * List downloads for a repository GET /repos/:user/:repo/downloads Examples: my $d = Pithub::Repos::Downloads->new; my $result = $d->list( user => 'plu', repo => 'Pithub', ); =back =head2 upload =over =item * Upload a file to Amazon S3. See also: L. This will use the C<< ua >> attribute's C<< request >> method to do a POST request to Amazon S3. It requires the L object of a L call to get the necessary data for S3 API call. This method returns an L object directly, not a L object (like all other methods do)! If the upload was successful the status will be C<< 201 >>. =back =head1 NOTE Github says: The Downloads API (described below) was deprecated on December 11, 2012. It will be removed at a future date. We recommend using L instead. =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/Repos/Keys.pm0000644000175000017500000000571515014062322016104 0ustar olafolafpackage Pithub::Repos::Keys; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 Repo Keys API use Moo; use Carp qw( croak ); extends 'Pithub::Base'; sub create { my ( $self, %args ) = @_; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'POST', path => sprintf( '/repos/%s/%s/keys', delete $args{user}, delete $args{repo} ), %args, ); } sub delete { my ( $self, %args ) = @_; croak 'Missing key in parameters: key_id' unless $args{key_id}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'DELETE', path => sprintf( '/repos/%s/%s/keys/%s', delete $args{user}, delete $args{repo}, delete $args{key_id} ), %args, ); } sub get { my ( $self, %args ) = @_; croak 'Missing key in parameters: key_id' unless $args{key_id}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/keys/%s', delete $args{user}, delete $args{repo}, delete $args{key_id} ), %args, ); } sub list { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/keys', delete $args{user}, delete $args{repo} ), %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Repos::Keys - Github v3 Repo Keys API =head1 VERSION version 0.01042 =head1 METHODS =head2 create =over =item * Create POST /repos/:user/:repo/keys Examples: my $k = Pithub::Repos::Keys->new; my $result = $k->create( user => 'plu', repo => 'Pithub', data => { title => 'some key', key => 'ssh-rsa AAA...', }, ); =back =head2 delete =over =item * Delete DELETE /repos/:user/:repo/keys/:id Examples: my $k = Pithub::Repos::Keys->new; my $result = $k->delete( user => 'plu', repo => 'Pithub', key_id => 1, ); =back =head2 get =over =item * Get GET /repos/:user/:repo/keys/:id Examples: my $k = Pithub::Repos::Keys->new; my $result = $k->get( user => 'plu', repo => 'Pithub', key_id => 1, ); =back =head2 list =over =item * List GET /repos/:user/:repo/keys Examples: my $k = Pithub::Repos::Keys->new; my $result = $k->list( user => 'plu', repo => 'Pithub', ); =back =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/Repos/Statuses.pm0000644000175000017500000000521115014062322016773 0ustar olafolafpackage Pithub::Repos::Statuses; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 repos / statuses API use Moo; use Carp qw( croak ); extends 'Pithub::Base'; sub list { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); my $req = { method => 'GET', path => sprintf( '/repos/%s/%s/statuses/%s', delete $args{user}, delete $args{repo}, delete $args{ref} ), %args }; return $self->request(%$req); } sub create { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); croak 'Missing state paramenter. Must be one of pending, success, error or failure' unless $args{data}->{state}; unless ( $args{data}->{state} =~ m/^(?:pending|success|error|failure)$/ ) { croak 'state param must be one of pending, success, error, failure. Was ' . $args{data}->{state}; } my $req = { method => 'POST', path => sprintf( '/repos/%s/%s/statuses/%s', delete $args{user}, delete $args{repo}, delete $args{sha}, ), %args }; return $self->request(%$req); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Repos::Statuses - Github v3 repos / statuses API =head1 VERSION version 0.01042 =head1 METHODS =head2 list Extra arguments =over =item * ref The SHA, branch, or tag-name to get statuses for =back List statuses for a ref GET /repos/:user/:repo/statuses/:ref Examples: my $statuses = Pithub::Repos::Statuses->new; my $result = $statuses->list( ref => 'master' ); =head2 create Extra arguments =over =item state (required) The state of the status. Can be one of 'pending', 'success', 'error' or 'failure'. =item target_url This URL will be used to link from the status to some related page, for instance the build result for this specific SHA. =item description A short description of the status =back Add a status to a SHA. POST /repos/:user/:repo/statuses/:sha Examples: my $statuses = Pithub::Repos::Statuses->new; my $result = $statuses->create( user => 'plu', repo => 'Pithub', sha => '0123456', data => { state => 'error', description => 'Build failed', target_url => 'https://travis-ci.org/some/url/0123456', }, ); =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/Repos/Hooks.pm0000644000175000017500000001343515014062322016252 0ustar olafolafpackage Pithub::Repos::Hooks; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 Repo Hooks API use Moo; use Carp qw( croak ); extends 'Pithub::Base'; sub create { my ( $self, %args ) = @_; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'POST', path => sprintf( '/repos/%s/%s/hooks', delete $args{user}, delete $args{repo} ), %args, ); } sub delete { my ( $self, %args ) = @_; croak 'Missing key in parameters: hook_id' unless $args{hook_id}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'DELETE', path => sprintf( '/repos/%s/%s/hooks/%d', delete $args{user}, delete $args{repo}, delete $args{hook_id} ), %args, ); } sub get { my ( $self, %args ) = @_; croak 'Missing key in parameters: hook_id' unless $args{hook_id}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/hooks/%d', delete $args{user}, delete $args{repo}, delete $args{hook_id} ), %args, ); } sub list { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/hooks', delete $args{user}, delete $args{repo} ), %args, ); } sub test { my ( $self, %args ) = @_; croak 'Missing key in parameters: hook_id' unless $args{hook_id}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'POST', path => sprintf( '/repos/%s/%s/hooks/%d/test', delete $args{user}, delete $args{repo}, delete $args{hook_id} ), %args, ); } sub update { my ( $self, %args ) = @_; croak 'Missing key in parameters: hook_id' unless $args{hook_id}; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'PATCH', path => sprintf( '/repos/%s/%s/hooks/%d', delete $args{user}, delete $args{repo}, delete $args{hook_id} ), %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Repos::Hooks - Github v3 Repo Hooks API =head1 VERSION version 0.01042 =head1 METHODS =head2 create =over =item * Create a hook POST /repos/:user/:repo/hooks Examples: my $hooks = Pithub::Repos::Hooks->new; my $result = $hooks->create( user => 'plu', repo => 'Pithub', data => { name => 'irc', active => 1, config => { server => 'irc.perl.org', port => 6667, room => 'pithub', }, }, ); =back =head2 delete =over =item * Delete a hook DELETE /repos/:user/:repo/hooks/:id Examples: my $hooks = Pithub::Repos::Hooks->new; my $result = $hooks->delete( user => 'plu', repo => 'Pithub', hook_id => 5, ); =back =head2 get =over =item * Get single hook GET /repos/:user/:repo/hooks/:id Examples: my $hooks = Pithub::Repos::Hooks->new; my $result = $hooks->get( user => 'plu', repo => 'Pithub', hook_id => 5, ); =back =head2 list =over =item * List Hooks GET /repos/:user/:repo/hooks Examples: my $hooks = Pithub::Repos::Hooks->new; my $result = $hooks->tags( user => 'plu', repo => 'Pithub' ); =back =head2 test =over =item * Get single hook POST /repos/:user/:repo/hooks/:id/test Examples: my $hooks = Pithub::Repos::Hooks->new; my $result = $hooks->test( user => 'plu', repo => 'Pithub', hook_id => 5, ); =back =head2 update =over =item * Update/edit a hook PATCH /repos/:user/:repo/hooks/:id Examples: my $hooks = Pithub::Repos::Hooks->new; my $result = $hooks->update( user => 'plu', repo => 'Pithub', hook_id => 5, data => { name => 'irc', active => 1, config => { server => 'irc.freenode.net', port => 6667, room => 'pithub', }, }, ); =back =head1 EVENTS Active hooks can be configured to trigger for one or more events. The default event is push. The available events are: =over =item * commit_comment - Any time a Commit is commented on. =item * download - Any time a Download is added to the Repository. =item * fork - Any time a Repository is forked. =item * fork_apply - Any time a patch is applied to the Repository from the Fork Queue. =item * gollum - Any time a Wiki page is updated. =item * issues - Any time an Issue is opened or closed. =item * issue_comment - Any time an Issue is commented on. =item * member - Any time a User is added as a collaborator to a non-Organization Repository. =item * public - Any time a Repository changes from private to public. =item * pull_request - Any time a Pull Request is opened, closed, or synchronized (updated due to a new push in the branch that the pull request is tracking). =item * push - Any git push to a Repository. =item * watch - Any time a User watches the Repository. =back =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/Repos/Contents.pm0000644000175000017500000001021315014062322016753 0ustar olafolafpackage Pithub::Repos::Contents; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 Repo Contents API use Moo; use Carp qw( croak ); extends 'Pithub::Base'; sub archive { my ( $self, %args ) = @_; croak 'Missing key in parameters: archive_format' unless $args{archive_format}; croak 'Invalid archive_format. Valid formats: tarball, zipball' unless grep $args{archive_format} eq $_, qw(tarball zipball); $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/%s/%s', delete $args{user}, delete $args{repo}, delete $args{archive_format}, delete $args{ref} || q{} ), %args, ); } sub get { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); if ( my $path = delete $args{path} ) { return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/contents/%s', delete $args{user}, delete $args{repo}, $path ), %args, ); } return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/contents', delete $args{user}, delete $args{repo} ), %args, ); } sub readme { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/readme', delete $args{user}, delete $args{repo} ), %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Repos::Contents - Github v3 Repo Contents API =head1 VERSION version 0.01042 =head1 METHODS =head2 archive =over =item * This method will return a C<< 302 >> to a URL to download a tarball or zipball archive for a repository. Note: For private repositories, these links are temporary and expire quickly. GET /repos/:user/:repo/:archive_format/:ref The C<< ref >> parameter is optional and will default to C<< master >>. Examples: use Path::Tiny; my $c = Pithub::Repos::Contents->new( repo => 'Pithub', user => 'plu' ); my $result = $c->archive( archive_format => 'tarball' ); if ( $result->success ) { path('Pithub-master.tgz')->spew($result->raw_content); } $result = $c->archive( archive_format => 'tarball', ref => 'other_branch' ); if ( $result->success ) { path('Pithub-other_branch.tgz')->spew($result->raw_content); } =back =head2 get =over =item * This method returns the contents of any file or directory in a repository. GET /repos/:user/:repo/contents/:path Optional Parameters: =over =item * B: Optional string - The String name of the Commit/Branch/Tag. Defaults to C<< master >>. =back Examples: my $c = Pithub::Repos::Contents->new( repo => 'Pithub', user => 'plu' ); # List all files/directories in the repo root my $result = $c->get; if ( $result->success ) { say $_->{name} for @{ $result->content }; } # Get the Pithub.pm file $result = $c->get( path => 'lib/Pithub.pm' ); print Dumper $result->content if $result->success; =back =head2 readme =over =item * This method returns the preferred README for a repository. GET /repos/:user/:repo/readme Optional Parameters: =over =item * B: Optional string - The String name of the Commit/Branch/Tag. Defaults to C<< master >>. =back Examples: my $c = Pithub::Repos::Contents->new( repo => 'dotfiles', user => 'plu' ); my $result = $c->readme; if ( $result->success ) { print Dumper $result->content; } # Get the readme of branch 'other_branch' $result = $c->readme( params => { ref => 'other_branch' } ); print Dumper $result->content if $result->success; =back =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/Users/0000775000175000017500000000000015014062322014636 5ustar olafolafPithub-0.01042/lib/Pithub/Users/Emails.pm0000644000175000017500000000360315014062322016406 0ustar olafolafpackage Pithub::Users::Emails; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 User Emails API use Moo; use Carp qw( croak ); extends 'Pithub::Base'; sub add { my ( $self, %args ) = @_; croak 'Missing key in parameters: data (arrayref)' unless ref $args{data} eq 'ARRAY'; return $self->request( method => 'POST', path => '/user/emails', %args, ); } sub delete { my ( $self, %args ) = @_; croak 'Missing key in parameters: data (arrayref)' unless ref $args{data} eq 'ARRAY'; return $self->request( method => 'DELETE', path => '/user/emails', %args, ); } sub list { my ( $self, %args ) = @_; return $self->request( method => 'GET', path => '/user/emails', %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Users::Emails - Github v3 User Emails API =head1 VERSION version 0.01042 =head1 METHODS =head2 add =over =item * Add email address(es) POST /user/emails Examples: my $e = Pithub::Users::Emails->new( token => 'b3c62c6' ); my $result = $e->add( data => [ 'plu@cpan.org', 'plu@pqpq.de' ] ); =back =head2 delete =over =item * Delete email address(es) DELETE /user/emails Examples: my $e = Pithub::Users::Emails->new( token => 'b3c62c6' ); my $result = $e->delete( data => [ 'plu@cpan.org', 'plu@pqpq.de' ] ); =back =head2 list =over =item * List email addresses for a user GET /user/emails Examples: my $e = Pithub::Users::Emails->new( token => 'b3c62c6' ); my $result = $e->list; =back =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/Users/Followers.pm0000644000175000017500000000723515014062322017155 0ustar olafolafpackage Pithub::Users::Followers; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 User Followers API use Moo; use Carp qw( croak ); extends 'Pithub::Base'; sub follow { my ( $self, %args ) = @_; croak 'Missing key in parameters: user' unless $args{user}; return $self->request( method => 'PUT', path => sprintf( '/user/following/%s', delete $args{user} ), %args, ); } sub is_following { my ( $self, %args ) = @_; croak 'Missing key in parameters: user' unless $args{user}; return $self->request( method => 'GET', path => sprintf( '/user/following/%s', delete $args{user} ), %args, ); } sub list { my ( $self, %args ) = @_; if ( $args{user} ) { return $self->request( method => 'GET', path => sprintf( '/users/%s/followers', delete $args{user} ), %args, ); } return $self->request( method => 'GET', path => '/user/followers', %args, ); } sub list_following { my ( $self, %args ) = @_; if ( $args{user} ) { return $self->request( method => 'GET', path => sprintf( '/users/%s/following', delete $args{user} ), %args, ); } return $self->request( method => 'GET', path => '/user/following', %args, ); } sub unfollow { my ( $self, %args ) = @_; croak 'Missing key in parameters: user' unless $args{user}; return $self->request( method => 'DELETE', path => sprintf( '/user/following/%s', delete $args{user} ), %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Users::Followers - Github v3 User Followers API =head1 VERSION version 0.01042 =head1 METHODS =head2 follow =over =item * Follow a user PUT /user/following/:user Examples: my $f = Pithub::Users::Followers->new( token => 'b3c62c6' ); my $result = $f->follow( user => 'plu' ); =back =head2 is_following =over =item * Check if the authenticated user is following another given user GET /user/following/:user Examples: my $f = Pithub::Users::Followers->new( token => 'b3c62c6' ); my $result = $f->is_following( user => 'rafl' ); if ( $result->is_success ) { print "plu is following rafl\n"; } elsif ( $result->code == 404 ) { print "plu is not following rafl\n"; } =back =head2 list =over =item * List a user's followers: GET /users/:user/followers Examples: my $f = Pithub::Users::Followers->new; my $result = $f->list( user => 'plu' ); =item * List the authenticated user's followers: GET /user/followers Examples: my $f = Pithub::Users::Followers->new( token => 'b3c62c6' ); my $result = $f->list; =back =head2 list_following =over =item * List who a user is following: GET /users/:user/following Examples: my $f = Pithub::Users::Followers->new; my $result = $f->list_following( user => 'plu' ); =item * List who the authenticated user is following: GET /user/following Examples: my $f = Pithub::Users::Followers->new( token => 'b3c62c6' ); my $result = $f->list_following; =back =head2 unfollow =over =item * Unfollow a user DELETE /user/following/:user Examples: my $f = Pithub::Users::Followers->new; my $result = $f->unfollow( user => 'plu' ); =back =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/Users/Keys.pm0000644000175000017500000000453315014062322016112 0ustar olafolafpackage Pithub::Users::Keys; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 User Keys API use Moo; use Carp qw( croak ); extends 'Pithub::Base'; sub create { my ( $self, %args ) = @_; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; return $self->request( method => 'POST', path => '/user/keys', %args, ); } sub delete { my ( $self, %args ) = @_; croak 'Missing key in parameters: key_id' unless $args{key_id}; return $self->request( method => 'DELETE', path => sprintf( '/user/keys/%s', delete $args{key_id} ), %args, ); } sub get { my ( $self, %args ) = @_; croak 'Missing key in parameters: key_id' unless $args{key_id}; return $self->request( method => 'GET', path => sprintf( '/user/keys/%s', delete $args{key_id} ), %args, ); } sub list { my ( $self, %args ) = @_; return $self->request( method => 'GET', path => '/user/keys', %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Users::Keys - Github v3 User Keys API =head1 VERSION version 0.01042 =head1 METHODS =head2 create =over =item * Create a public key POST /user/keys Examples: my $k = Pithub::Users::Keys->new( token => 'b3c62c6' ); my $result = $k->create( data => { title => 'plu@localhost', key => 'ssh-rsa AAA...', } ); =back =head2 delete =over =item * Delete a public key DELETE /user/keys/:id Examples: my $k = Pithub::Users::Keys->new( token => 'b3c62c6' ); my $result = $k->delete( key_id => 123 ); =back =head2 get =over =item * Get a single public key GET /user/keys/:id Examples: my $k = Pithub::Users::Keys->new( token => 'b3c62c6' ); my $result = $k->get( key_id => 123 ); =back =head2 list =over =item * List public keys for a user GET /user/keys Examples: my $k = Pithub::Users::Keys->new( token => 'b3c62c6' ); my $result = $k->list; =back =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/Result/0000775000175000017500000000000015014062322015013 5ustar olafolafPithub-0.01042/lib/Pithub/Result/SharedCache.pm0000644000175000017500000000237115014062322017504 0ustar olafolafpackage Pithub::Result::SharedCache; our $AUTHORITY = 'cpan:PLU'; use Moo::Role; our $VERSION = '0.01042'; # ABSTRACT: A role to share the LRU cache with all Pithub objects use CHI (); my $store = {}; my $Shared_Cache = CHI->new( datastore => $store, driver => 'RawMemory', max_size => 200, size => 200, ); sub shared_cache { return $Shared_Cache; } sub set_shared_cache { my ( $self, $cache ) = @_; $Shared_Cache = $cache; return; } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Result::SharedCache - A role to share the LRU cache with all Pithub objects =head1 VERSION version 0.01042 =head1 DESCRIPTION A role to share the least recently used cache with all Pithub objects. =head1 METHODS =head2 shared_cache Returns the L object shared by all Pithub objects. =head2 set_shared_cache Sets the CHI object shared by all Pithub objects. This should only be necessary for testing or to change the size of the cache. =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/SearchV3.pm0000644000175000017500000000443315014062322015513 0ustar olafolafpackage Pithub::SearchV3; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 Search API use Moo; use Carp qw( croak ); extends 'Pithub::Base'; sub issues { my $self = shift; return $self->_search( 'issues', @_ ); } sub repos { my $self = shift; return $self->_search( 'repositories', @_ ); } sub users { my $self = shift; return $self->_search( 'users', @_ ); } sub code { my $self = shift; return $self->_search( 'code', @_ ); } sub _search { my ( $self, $thing_to_search, %args ) = @_; croak 'Missing key in parameters: q' unless exists $args{q}; return $self->request( method => 'GET', path => '/search/' . $thing_to_search, query => { q => delete $args{q}, ( exists $args{sort} ? ( sort => delete $args{sort} ) : () ), ( exists $args{order} ? ( order => delete $args{order} ) : () ), ( exists $args{per_page} ? ( per_page => delete $args{per_page} ) : () ), }, %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::SearchV3 - Github v3 Search API =head1 VERSION version 0.01042 =head1 METHODS =head2 issues =over =item * Find issues by state and keyword. GET /search/issues Examples: my $search = Pithub::Search->new; my $result = $search->issues( q => 'some keyword', ); =back =head2 repos =over =item * Find repositories by keyword. GET /search/repositories Examples: my $search = Pithub::SearchV3->new; my $result = $search->repos( q => 'github language:Perl', ); =back =head2 users =over =item * Find users by keyword. GET /search/users Examples: my $search = Pithub::SearchV3->new; my $result = $search->users( q => 'plu', ); =back =head2 code =over =item * Search code by keyword. GET /search/code Examples: my $search = Pithub::SearchV3->new; my $result = $search->code( q => 'addClass repo:jquery/jquery', ); =back =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/Search.pm0000644000175000017500000000626615014062322015310 0ustar olafolafpackage Pithub::Search; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github legacy Search API use Moo; use Carp qw( croak ); extends 'Pithub::Base'; sub email { my ( $self, %args ) = @_; croak 'Missing key in parameters: email' unless $args{email}; return $self->request( method => 'GET', path => sprintf( '/legacy/user/email/%s', delete $args{email} ), %args, ); } sub issues { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); croak 'Missing key in parameters: state' unless $args{state}; croak 'Missing key in parameters: keyword' unless $args{keyword}; return $self->request( method => 'GET', path => sprintf( '/legacy/issues/search/%s/%s/%s/%s', delete $args{user}, delete $args{repo}, delete $args{state}, delete $args{keyword} ), %args, ); } sub repos { my ( $self, %args ) = @_; croak 'Missing key in parameters: keyword' unless $args{keyword}; return $self->request( method => 'GET', path => sprintf( '/legacy/repos/search/%s', delete $args{keyword} ), %args, ); } sub users { my ( $self, %args ) = @_; croak 'Missing key in parameters: keyword' unless $args{keyword}; return $self->request( method => 'GET', path => sprintf( '/legacy/user/search/%s', delete $args{keyword} ), %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Search - Github legacy Search API =head1 VERSION version 0.01042 =head1 METHODS =head2 email =over =item * This API call is added for compatibility reasons only. There's no guarantee that full email searches will always be available. GET /legacy/user/email/:email Examples: my $search = Pithub::Search->new; my $result = $search->email( email => 'plu@pqpq.de', ); =back =head2 issues =over =item * Find issues by state and keyword. GET /legacy/issues/search/:owner/:repository/:state/:keyword Examples: my $search = Pithub::Search->new; my $result = $search->issues( user => 'plu', repo => 'Pithub', state => 'open', keyword => 'some keyword', ); =back =head2 repos =over =item * Find repositories by keyword. Note, this legacy method does not follow the v3 pagination pattern. This method returns up to 100 results per page and pages can be fetched using the start_page parameter. GET /legacy/repos/search/:keyword Examples: my $search = Pithub::Search->new; my $result = $search->repos( keyword => 'github', params => { language => 'Perl', start_page => 0, } ); =back =head2 users =over =item * Find users by keyword. GET /legacy/user/search/:keyword Examples: my $search = Pithub::Search->new; my $result = $search->users( keyword => 'plu', ); =back =head1 AUTHOR Johannes Plunien =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Pithub-0.01042/lib/Pithub/Issues.pm0000644000175000017500000004127015014062322015350 0ustar olafolafpackage Pithub::Issues; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 Issues API use Moo; use Carp qw( croak ); use Pithub::Issues::Assignees (); use Pithub::Issues::Comments (); use Pithub::Issues::Events (); use Pithub::Issues::Labels (); use Pithub::Issues::Milestones (); extends 'Pithub::Base'; sub assignees { return shift->_create_instance( Pithub::Issues::Assignees::, @_ ); } sub comments { return shift->_create_instance( Pithub::Issues::Comments::, @_ ); } sub create { my ( $self, %args ) = @_; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'POST', path => sprintf( '/repos/%s/%s/issues', delete $args{user}, delete $args{repo} ), %args, ); } sub events { return shift->_create_instance( Pithub::Issues::Events::, @_ ); } sub get { my ( $self, %args ) = @_; croak 'Missing key in parameters: issue_id' unless $args{issue_id}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/issues/%s', delete $args{user}, delete $args{repo}, delete $args{issue_id} ), %args, ); } sub labels { return shift->_create_instance( Pithub::Issues::Labels::, @_ ); } sub list { my ( $self, %args ) = @_; $self->_get_user_repo_args( \%args ); if ( $args{user} && $args{repo} ) { return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/issues', delete $args{user}, delete $args{repo} ), %args, ); } return $self->request( method => 'GET', path => sprintf('/issues'), %args, ); } sub milestones { return shift->_create_instance( Pithub::Issues::Milestones::, @_ ); } sub update { my ( $self, %args ) = @_; croak 'Missing key in parameters: issue_id' unless $args{issue_id}; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'PATCH', path => sprintf( '/repos/%s/%s/issues/%s', delete $args{user}, delete $args{repo}, delete $args{issue_id} ), %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Issues - Github v3 Issues API =head1 VERSION version 0.01042 =head1 METHODS =head2 assignees Provides access to L. =head2 comments Provides access to L. =head2 create =over =item * Create an issue POST /repos/:user/:repo/issues Parameters: =over =item * B: mandatory string =item * B: mandatory string =item * B: mandatory hashref, having following keys: =over =item * B: mandatory string =item * B<body>: optional string =item * B<assignee>: optional string - Login for the user that this issue should be assigned to. =item * B<milestone>: optional number - Milestone to associate this issue with. =item * B<labels>: optional arrayref of strings - Labels to associate with this issue. =back =back Examples: my $i = Pithub::Issues->new; my $result = $i->create( user => 'plu', repo => 'Pithub', data => { assignee => 'octocat', body => "I'm having a problem with this.", labels => [ 'Label1', 'Label2' ], milestone => 1, title => 'Found a bug' } ); Response: B<Status: 201 Created> { "url": "https://api.github.com/repos/octocat/Hello-World/issues/1", "html_url": "https://github.com/octocat/Hello-World/issues/1", "number": 1347, "state": "open", "title": "Found a bug", "body": "I'm having a problem with this.", "user": { "login": "octocat", "id": 1, "gravatar_url": "https://github.com/images/error/octocat_happy.gif", "url": "https://api.github.com/users/octocat" }, "labels": [ { "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug", "name": "bug", "color": "f29513" } ], "assignee": { "login": "octocat", "id": 1, "gravatar_url": "https://github.com/images/error/octocat_happy.gif", "url": "https://api.github.com/users/octocat" }, "milestone": { "url": "https://api.github.com/repos/octocat/Hello-World/milestones/1", "number": 1, "state": "open", "title": "v1.0", "description": "", "creator": { "login": "octocat", "id": 1, "gravatar_url": "https://github.com/images/error/octocat_happy.gif", "url": "https://api.github.com/users/octocat" }, "open_issues": 4, "closed_issues": 8, "created_at": "2011-04-10T20:09:31Z", "due_on": null }, "comments": 0, "pull_request": { "html_url": "https://github.com/octocat/Hello-World/issues/1", "diff_url": "https://github.com/octocat/Hello-World/issues/1.diff", "patch_url": "https://github.com/octocat/Hello-World/issues/1.patch" }, "closed_at": null, "created_at": "2011-04-22T13:33:48Z", "updated_at": "2011-04-22T13:33:48Z" } =back =head2 events Provides access to L<Pithub::Issues::Events>. =head2 get =over =item * Get a single issue GET /repos/:user/:repo/issues/:id Parameters: =over =item * B<user>: mandatory string =item * B<repo>: mandatory string =item * B<issue_id>: mandatory integer =back Examples: my $i = Pithub::Issues->new; my $result = $i->get( user => 'plu', repo => 'Pithub', issue_id => 1, ); Response: B<Status: 200 OK> { "url": "https://api.github.com/repos/octocat/Hello-World/issues/1", "html_url": "https://github.com/octocat/Hello-World/issues/1", "number": 1347, "state": "open", "title": "Found a bug", "body": "I'm having a problem with this.", "user": { "login": "octocat", "id": 1, "gravatar_url": "https://github.com/images/error/octocat_happy.gif", "url": "https://api.github.com/users/octocat" }, "labels": [ { "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug", "name": "bug", "color": "f29513" } ], "assignee": { "login": "octocat", "id": 1, "gravatar_url": "https://github.com/images/error/octocat_happy.gif", "url": "https://api.github.com/users/octocat" }, "milestone": { "url": "https://api.github.com/repos/octocat/Hello-World/milestones/1", "number": 1, "state": "open", "title": "v1.0", "description": "", "creator": { "login": "octocat", "id": 1, "gravatar_url": "https://github.com/images/error/octocat_happy.gif", "url": "https://api.github.com/users/octocat" }, "open_issues": 4, "closed_issues": 8, "created_at": "2011-04-10T20:09:31Z", "due_on": null }, "comments": 0, "pull_request": { "html_url": "https://github.com/octocat/Hello-World/issues/1", "diff_url": "https://github.com/octocat/Hello-World/issues/1.diff", "patch_url": "https://github.com/octocat/Hello-World/issues/1.patch" }, "closed_at": null, "created_at": "2011-04-22T13:33:48Z", "updated_at": "2011-04-22T13:33:48Z" } =back =head2 labels Provides access to L<Pithub::Issues::Labels>. =head2 list =over =item * List the issues of the authenticated user GET /issues This API call can be influenced via the C<< params >> hashref with following parameters: =over =item * B<filter>: one of the following: =over =item * B<assigned>: Issues assigned to you (default) =item * B<created>: Issues created by you =item * B<mentioned>: Issues mentioning you =item * B<subscribed>: Issues you're subscribed to updates for =back =item * B<state>: one of the following: =over =item * B<open> (default) =item * B<closed> =back =item * B<labels>: String list of comma separated Label names. Example: C<< bug,ui,@high >> =item * B<sort>: one of the following: =over =item * B<created> (default) =item * B<updated> =item * B<comments> =back =item * B<direction>: one of the following: =over =item * B<asc> =item * B<desc> (default) =back =item * B<since>: optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ =back Examples: my $i = Pithub::Issues->new; my $result = $i->list( params => { filter => 'assigned', state => 'open', labels => 'bug', sort => 'updated', direction => 'asc', } ); Response: B<Status: 200 OK> [ { "url": "https://api.github.com/repos/octocat/Hello-World/issues/1", "html_url": "https://github.com/octocat/Hello-World/issues/1", "number": 1347, "state": "open", "title": "Found a bug", "body": "I'm having a problem with this.", "user": { "login": "octocat", "id": 1, "gravatar_url": "https://github.com/images/error/octocat_happy.gif", "url": "https://api.github.com/users/octocat" }, "labels": [ { "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug", "name": "bug", "color": "f29513" } ], "assignee": { "login": "octocat", "id": 1, "gravatar_url": "https://github.com/images/error/octocat_happy.gif", "url": "https://api.github.com/users/octocat" }, "milestone": { "url": "https://api.github.com/repos/octocat/Hello-World/milestones/1", "number": 1, "state": "open", "title": "v1.0", "description": "", "creator": { "login": "octocat", "id": 1, "gravatar_url": "https://github.com/images/error/octocat_happy.gif", "url": "https://api.github.com/users/octocat" }, "open_issues": 4, "closed_issues": 8, "created_at": "2011-04-10T20:09:31Z", "due_on": null }, "comments": 0, "pull_request": { "html_url": "https://github.com/octocat/Hello-World/issues/1", "diff_url": "https://github.com/octocat/Hello-World/issues/1.diff", "patch_url": "https://github.com/octocat/Hello-World/issues/1.patch" }, "closed_at": null, "created_at": "2011-04-22T13:33:48Z", "updated_at": "2011-04-22T13:33:48Z" } ] =item * List issues for a repository GET /repos/:user/:repo/issues Parameters: =over =item * B<user>: mandatory string =item * B<repo>: mandatory string =back This API call can be influenced via the C<< params >> hashref with following parameters: =over =item * B<milestone>: one of the following: =over =item * C<< Integer >> Milestone number =item * C<< none >> for Issues with no Milestone =item * C<< * >> for Issues with any Milestone =back =item * B<state>: one of the following: =over =item * B<open> (default) =item * B<closed> =back =item * B<assignee>: one of the following: =over =item * C<< String >> User login =item * C<< none >> for Issues with no assigned User =item * C<< * >> for Issues with any assigned User =back =item * B<mentioned>: String User login =item * B<labels>: String list of comma separated Label names. Example: C<< bug,ui,@high >> =item * B<sort>: one of the following: =over =item * B<created> (default) =item * B<updated> =item * B<comments> =back =item * B<direction>: one of the following: =over =item * B<asc> =item * B<desc> (default) =back =item * B<since>: optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ =back Examples: my $i = Pithub::Issues->new; my $result = $i->list( user => 'plu', repo => 'Pithub', params => { milestone => 42, state => 'open', labels => 'bug', sort => 'updated', direction => 'asc', } ); Response: B<Status: 200 OK> [ { "url": "https://api.github.com/repos/octocat/Hello-World/issues/1", "html_url": "https://github.com/octocat/Hello-World/issues/1", "number": 1347, "state": "open", "title": "Found a bug", "body": "I'm having a problem with this.", "user": { "login": "octocat", "id": 1, "gravatar_url": "https://github.com/images/error/octocat_happy.gif", "url": "https://api.github.com/users/octocat" }, "labels": [ { "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug", "name": "bug", "color": "f29513" } ], "assignee": { "login": "octocat", "id": 1, "gravatar_url": "https://github.com/images/error/octocat_happy.gif", "url": "https://api.github.com/users/octocat" }, "milestone": { "url": "https://api.github.com/repos/octocat/Hello-World/milestones/1", "number": 1, "state": "open", "title": "v1.0", "description": "", "creator": { "login": "octocat", "id": 1, "gravatar_url": "https://github.com/images/error/octocat_happy.gif", "url": "https://api.github.com/users/octocat" }, "open_issues": 4, "closed_issues": 8, "created_at": "2011-04-10T20:09:31Z", "due_on": null }, "comments": 0, "pull_request": { "html_url": "https://github.com/octocat/Hello-World/issues/1", "diff_url": "https://github.com/octocat/Hello-World/issues/1.diff", "patch_url": "https://github.com/octocat/Hello-World/issues/1.patch" }, "closed_at": null, "created_at": "2011-04-22T13:33:48Z", "updated_at": "2011-04-22T13:33:48Z" } ] =back =head2 milestones Provides access to L<Pithub::Issues::Milestones>. =head2 update =over =item * Edit an issue PATCH /repos/:user/:repo/issues/:id Parameters: =over =item * B<user>: mandatory string =item * B<repo>: mandatory string =item * B<data>: mandatory hashref, having following keys: =over =item * B<title>: mandatory string =item * B<body>: optional string =item * B<assignee>: optional string - Login for the user that this issue should be assigned to. =item * B<milestone>: optional number - Milestone to associate this issue with. =item * B<labels>: optional arrayref of strings - Labels to associate with this issue. Pass one or more Labels to replace the set of Labels on this Issue. Send an empty arrayref (C<< [] >>) to clear all Labels from the Issue. =back =back Examples: my $i = Pithub::Issues->new; my $result = $i->update( user => 'plu', repo => 'Pithub', issue_id => 1, data => { assignee => 'octocat', body => "I'm having a problem with this.", labels => [ 'Label1', 'Label2' ], milestone => 1, state => 'open', title => 'Found a bug' } ); =back =head1 AUTHOR Johannes Plunien <plu@cpan.org> =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Pithub-0.01042/lib/Pithub/Result.pm�����������������������������������������������������������������0000644�0001750�0001750�00000030560�15014062322�015353� 0����������������������������������������������������������������������������������������������������ustar �olaf����������������������������olaf�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������package Pithub::Result; our $AUTHORITY = 'cpan:PLU'; # ABSTRACT: Github v3 result object use Moo; our $VERSION = '0.01042'; use Pithub::ResultSet (); use JSON::MaybeXS qw( JSON ); use URI (); use Carp qw( confess croak ); sub _isa_isa_maker { my $class = shift; return sub { confess "must be an instance of $class but isn't a reference" if !ref $_[0]; confess "must be an instance of $class, but is a " . ref $_[0] unless eval { $_[0]->isa($class) }; }; } has 'auto_pagination' => ( default => sub { 0 }, is => 'rw', ); has 'content' => ( builder => '_build_content', clearer => 'clear_content', is => 'ro', lazy => 1, ); has 'first_page_uri' => ( builder => '_build_first_page_uri', clearer => 'clear_first_page_uri', is => 'ro', lazy => 1, ); has 'last_page_uri' => ( builder => '_build_last_page_uri', clearer => 'clear_last_page_uri', is => 'ro', lazy => 1, ); has 'next_page_uri' => ( builder => '_build_next_page_uri', clearer => 'clear_next_page_uri', is => 'ro', lazy => 1, ); has 'prev_page_uri' => ( builder => '_build_prev_page_uri', clearer => 'clear_prev_page_uri', is => 'ro', lazy => 1, ); has 'response' => ( handles => { code => 'code', raw_content => 'content', request => 'request', success => 'is_success', }, is => 'ro', isa => _isa_isa_maker('HTTP::Response'), required => 1, ); # required for next_page etc has '_request' => ( is => 'ro', isa => sub { croak 'must be a coderef, but is ' . ref $_[0] unless ref $_[0] eq 'CODE'; }, required => 1, ); # required for next has '_iterator' => ( builder => '_build__iterator', clearer => '_clear_iterator', is => 'ro', isa => _isa_isa_maker(Pithub::ResultSet::), lazy => 1, ); has 'utf8' => ( is => 'ro', default => 1, ); has '_json' => ( builder => '_build__json', is => 'ro', isa => sub { confess "$_[0] is not a suitable JSON object" unless eval { $_[0]->can('decode') }; }, lazy => 1, ); sub count { my ($self) = @_; return 0 unless $self->success; my $content = $self->content; if ( ref $content eq 'HASH' && scalar keys %$content == 0 ) { return 0; } return $self->_iterator->getLength; } sub first { my ($self) = @_; my $content = $self->content; if ( ref $content eq 'ARRAY' ) { return $content->[0]; } return $content; } sub first_page { my ($self) = @_; return unless $self->first_page_uri; return $self->_paginate( $self->first_page_uri ); } sub get_page { my ( $self, $page ) = @_; # First we need to get an URI we can work with and replace # the page GET parameter properly with the given value. If # we cannot get the first or last page URI, then there is # only one page. my $uri_str = $self->first_page_uri || $self->last_page_uri; return unless $uri_str; my $uri = URI->new($uri_str); my %query = $uri->query_form; $query{page} = $page; my $options = { prepare_request => sub { my ($request) = @_; %query = ( $request->uri->query_form, %query ); $request->uri->query_form(%query); }, }; return $self->_request->( method => 'GET', path => $uri->path, options => $options, ); } sub last_page { my ($self) = @_; return unless $self->last_page_uri; return $self->_paginate( $self->last_page_uri ); } ## no critic (Subroutines::ProhibitBuiltinHomonyms) sub next { my ($self) = @_; my $row = $self->_iterator->getNext; return $row if $row; if ( $self->auto_pagination ) { my $result = $self->next_page; return unless $result; $self->_reset; $self->{response} = $result->response; return $self->_iterator->getNext; } return; } ## use critic sub next_page { my ($self) = @_; return unless $self->next_page_uri; return $self->_paginate( $self->next_page_uri ); } sub prev_page { my ($self) = @_; return unless $self->prev_page_uri; return $self->_paginate( $self->prev_page_uri ); } sub etag { my ($self) = @_; return $self->response->header('ETag'); } sub ratelimit { my ($self) = @_; return $self->response->header('X-RateLimit-Limit'); } sub ratelimit_remaining { my ($self) = @_; return $self->response->header('X-RateLimit-Remaining'); } sub _build_content { my ($self) = @_; if ( $self->raw_content ) { return $self->_json->decode( $self->raw_content ); } return {}; } sub _build_first_page_uri { return shift->_get_link_header('first'); } sub _build__iterator { my ($self) = @_; my $content = $self->content; $content = [$content] unless ref $content eq 'ARRAY'; return Pithub::ResultSet->new($content); } sub _build_last_page_uri { return shift->_get_link_header('last'); } sub _build_next_page_uri { return shift->_get_link_header('next'); } sub _build_prev_page_uri { return shift->_get_link_header('prev'); } sub _build__json { my ($self) = @_; return JSON->new->utf8( $self->utf8 ); } sub _get_link_header { my ( $self, $type ) = @_; return $self->{_get_link_header}{$type} if $self->{_get_link_header}{$type}; my $link = $self->response->header('Link'); return unless $link; return unless $link =~ /(next|first|last|prev)/; foreach my $item ( split /,/, $link ) { my @result = $item =~ /<([^>]+)>; rel="([^"]+)"/g; next if !$result[1] || !$result[0]; $self->{_get_link_header}{ $result[1] } = $result[0]; } return $self->{_get_link_header}{$type}; } sub _paginate { my ( $self, $uri_str ) = @_; my $uri = URI->new($uri_str); my $options = { prepare_request => sub { my ($request) = @_; my %query = ( $request->uri->query_form, $uri->query_form ); $request->uri->query_form(%query); }, }; return $self->_request->( method => 'GET', path => $uri->path, options => $options, ); } sub _reset { my ($self) = @_; $self->clear_content; $self->clear_first_page_uri; $self->clear_last_page_uri; $self->clear_next_page_uri; $self->clear_prev_page_uri; $self->_clear_iterator; delete $self->{_get_link_header}; } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Result - Github v3 result object =head1 VERSION version 0.01042 =head1 DESCRIPTION Every method call which maps directly to a Github API call returns a L<Pithub::Result> object. Once you got the result object, you can set L<attributes|/ATTRIBUTES> on them or call L<methods|/METHODS>. =head1 ATTRIBUTES =head2 auto_pagination If you set this to true and use the L</next> method to iterate over the result rows, it will call automatically L</next_page> for you until you got all the results. Be careful using this feature, if there are 100 pages, this will make 100 API calls. By default it's off. Instead of setting it per L<Pithub::Result> you can also set it directly on any of the L<Pithub> API objects. Examples: my $r = Pithub::Repos->new; my $result = $r->list( user => 'rjbs' ); # This would just show the first 30 by default while ( my $row = $result->next ) { printf "%s: %s\n", $row->{name}, $row->{description}; } # Let's do the same thing using auto_pagination to fetch all $result = $r->list( user => 'rjbs' ); $result->auto_pagination(1); while ( my $row = $result->next ) { printf "%s: %s\n", $row->{name}, $row->{description}; } # Turn auto_pagination on for all L<Pithub::Result> objects my $p = Pithub::Repos->new( auto_pagination => 1 ); my $result = $p->list( user => 'rjbs' ); while ( my $row = $result->next ) { printf "%s: %s\n", $row->{name}, $row->{description}; } =head2 content The decoded JSON response. May be an arrayref or hashref, depending on the API call. For some calls there is no content at all. =head2 first_page_uri The extracted value from the C<< Link >> header for the first page. This can return undef. =head2 last_page_uri The extracted value from the C<< Link >> header for the last page. This can return undef. =head2 next_page_uri The extracted value from the C<< Link >> header for the next page. This can return undef. =head2 prev_page_uri The extracted value from the C<< Link >> header for the previous page. This can return undef. =head2 response The L<HTTP::Response> object. =head2 utf8 This can set utf8 flag. =head1 METHODS =head2 raw_content Returns the content of the API response as a string, it will probably be JSON. =head2 request Returns the L<HTTP::Request> object used to make the API call. =head2 code Returns the HTTP code from the API call. =head2 success Returns whether the API call was successful. =head2 count Returns the count of the elements in L</content>. If the result is not an arrayref but a hashref, it will still return C<< 1 >>. Some calls return an empty hashref, for those calls it returns C<< 0 >>. =head2 first Return the first element from L</content> if L</content> is an arrayref. If it's a hashref, it returns just that. =head2 first_page Get the L<Pithub::Result> of the first page. Returns undef if there is no first page (if you're on the first page already or if there is no pages at all). =head2 get_page Get the L<Pithub::Result> for a specific page. The parameter is not validated, if you hit a page that does not exist, the Github API will tell you so. If there is only one page, this method will return undef, no matter which page you ask for, even for page 1. =head2 last_page Get the L<Pithub::Result> of the last page. Returns undef if there is no last page (if you're on the last page already or if there is only one page or no pages at all). =head2 next Most of the results returned by the Github API calls are arrayrefs of hashrefs. The data structures can be retrieved directly by calling L</content>. Besides that it's possible to iterate over the results using this method. Examples: my $r = Pithub::Repos->new; my $result = $r->list( user => 'rjbs' ); while ( my $row = $result->next ) { printf "%s: %s\n", $row->{name}, $row->{description}; } =head2 next_page Get the L<Pithub::Result> of the next page. Returns undef if there is no next page (there's only one page at all). Examples: =over =item * List all followers in order, from the first one on the first page to the last one on the last page. See also L</auto_pagination>. my $followers = Pithub->new->users->followers; my $result = $followers->list( user => 'rjbs' ); do { if ( $result->success ) { while ( my $row = $result->next ) { printf "%s\n", $row->{login}; } } } while $result = $result->next_page; The nature of the implementation requires you here to do a C<< do { ... } while ... >> loop. If you're going to fetch all results of all pages, I suggest to use the L</auto_pagination> feature, it's much more convenient. =back =head2 prev_page Get the L<Pithub::Result> of the previous page. Returns undef if there is no previous page (you're on the first page). Examples: =over =item * List all followers in reverse order, from the last one on the last page to the first one on the first page. See also L</auto_pagination>. my $followers = Pithub->new->users->followers; my $result = $followers->list( user => 'rjbs' )->last_page; # this makes two requests! do { if ( $result->success ) { while ( my $row = $result->next ) { printf "%s\n", $row->{login}; } } } while $result = $result->prev_page; =back =head2 etag Returns the value of the C<< ETag >> http header. =head2 ratelimit Returns the value of the C<< X-Ratelimit-Limit >> http header. =head2 ratelimit_remaining Returns the value of the C<< X-Ratelimit-Remaining >> http header. =head1 AUTHOR Johannes Plunien <plu@cpan.org> =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut ������������������������������������������������������������������������������������������������������������������������������������������������Pithub-0.01042/lib/Pithub/Gists.pm������������������������������������������������������������������0000644�0001750�0001750�00000037327�15014062322�015176� 0����������������������������������������������������������������������������������������������������ustar �olaf����������������������������olaf�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������package Pithub::Gists; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 Gists API use Moo; use Carp qw( croak ); use Pithub::Gists::Comments (); extends 'Pithub::Base'; sub comments { return shift->_create_instance( Pithub::Gists::Comments::, @_ ); } sub create { my ( $self, %args ) = @_; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; return $self->request( method => 'POST', path => '/gists', %args, ); } sub delete { my ( $self, %args ) = @_; croak 'Missing key in parameters: gist_id' unless $args{gist_id}; return $self->request( method => 'DELETE', path => sprintf( '/gists/%s', delete $args{gist_id} ), %args, ); } sub fork { my ( $self, %args ) = @_; croak 'Missing key in parameters: gist_id' unless $args{gist_id}; return $self->request( method => 'POST', path => sprintf( '/gists/%s/forks', delete $args{gist_id} ), %args, ); } sub get { my ( $self, %args ) = @_; croak 'Missing key in parameters: gist_id' unless $args{gist_id}; return $self->request( method => 'GET', path => sprintf( '/gists/%s', delete $args{gist_id} ), %args, ); } sub is_starred { my ( $self, %args ) = @_; croak 'Missing key in parameters: gist_id' unless $args{gist_id}; return $self->request( method => 'GET', path => sprintf( '/gists/%s/star', delete $args{gist_id} ), %args, ); } sub list { my ( $self, %args ) = @_; if ( my $user = delete $args{user} ) { return $self->request( method => 'GET', path => sprintf( '/users/%s/gists', $user ), %args, ); } elsif ( delete $args{starred} ) { return $self->request( method => 'GET', path => '/gists/starred', %args, ); } elsif ( delete $args{public} ) { return $self->request( method => 'GET', path => '/gists/public', %args, ); } return $self->request( method => 'GET', path => '/gists', %args, ); } sub star { my ( $self, %args ) = @_; croak 'Missing key in parameters: gist_id' unless $args{gist_id}; return $self->request( method => 'PUT', path => sprintf( '/gists/%s/star', delete $args{gist_id} ), %args, ); } sub unstar { my ( $self, %args ) = @_; croak 'Missing key in parameters: gist_id' unless $args{gist_id}; return $self->request( method => 'DELETE', path => sprintf( '/gists/%s/star', delete $args{gist_id} ), %args, ); } sub update { my ( $self, %args ) = @_; croak 'Missing key in parameters: gist_id' unless $args{gist_id}; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; return $self->request( method => 'PATCH', path => sprintf( '/gists/%s', delete $args{gist_id} ), %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Gists - Github v3 Gists API =head1 VERSION version 0.01042 =head1 METHODS =head2 comments Provides access to L<Pithub::Gists::Comments>. =head2 create =over =item * Create a gist POST /gists Parameters: =over =item * B<data>: mandatory hashref, having following keys: =over =item * B<description>: optional string =item * B<public>: mandatory boolean =item * B<files>: mandatory hashref, please see examples section below =back =back Examples: my $g = Pithub::Gists->new; my $result = $g->create( data => { description => 'the description for this gist', public => 1, files => { 'file1.txt' => { content => 'String file content' } } } ); if ( $result->success ) { printf "The new gist is available at %s\n", $result->content->{html_url}; } Response: B<Status: 201 Created> { "url": "https://api.github.com/gists/1", "id": "1", "description": "description of gist", "public": true, "user": { "login": "octocat", "id": 1, "gravatar_url": "https://github.com/images/error/octocat_happy.gif", "url": "https://api.github.com/users/octocat" }, "files": { "ring.erl": { "size": 932, "filename": "ring.erl", "raw_url": "https://gist.github.com/raw/365370/8c4d2d43d178df44f4c03a7f2ac0ff512853564e/ring.erl", "content": "contents of gist" } }, "comments": 0, "git_pull_url": "git://gist.github.com/1.git", "git_push_url": "git@gist.github.com:1.git", "created_at": "2010-04-14T02:15:15Z", "forks": [ { "user": { "login": "octocat", "id": 1, "gravatar_url": "https://github.com/images/error/octocat_happy.gif", "url": "https://api.github.com/users/octocat" }, "url": "https://api.github.com/gists/5", "created_at": "2011-04-14T16:00:49Z" } ], "history": [ { "url": "https://api.github.com/gists/1/57a7f021a713b1c5a6a199b54cc514735d2d462f", "version": "57a7f021a713b1c5a6a199b54cc514735d2d462f", "user": { "login": "octocat", "id": 1, "gravatar_url": "https://github.com/images/error/octocat_happy.gif", "url": "https://api.github.com/users/octocat" }, "change_status": { "deletions": 0, "additions": 180, "total": 180 }, "committed_at": "2010-04-14T02:15:15Z" } ] } =back =head2 delete =over =item * Delete a gist DELETE /gists/:id Parameters: =over =item * B<gist_id>: mandatory integer =back Examples: my $g = Pithub::Gists->new; my $result = $g->delete( gist_id => 784612 ); if ( $result->success ) { print "The gist 784612 has been deleted\n"; } Response: B<Status: 204 No Content> =back =head2 fork =over =item * Fork a gist POST /gists/:id/forks Parameters: =over =item * B<gist_id>: mandatory integer =back Examples: my $g = Pithub::Gists->new; my $result = $g->fork( gist_id => 784612 ); if ( $result->success ) { printf "The gist 784612 has been forked: %s\n", $result->content->{html_url}; } Response: B<Status: 201 Created> { "url": "https://api.github.com/gists/1", "id": "1", "description": "description of gist", "public": true, "user": { "login": "octocat", "id": 1, "gravatar_url": "https://github.com/images/error/octocat_happy.gif", "url": "https://api.github.com/users/octocat" }, "files": { "ring.erl": { "size": 932, "filename": "ring.erl", "raw_url": "https://gist.github.com/raw/365370/8c4d2d43d178df44f4c03a7f2ac0ff512853564e/ring.erl", "content": "contents of gist" } }, "comments": 0, "git_pull_url": "git://gist.github.com/1.git", "git_push_url": "git@gist.github.com:1.git", "created_at": "2010-04-14T02:15:15Z" } =back =head2 get =over =item * Get a single gist GET /gists/:id Parameters: =over =item * B<gist_id>: mandatory integer =back Examples: my $g = Pithub::Gists->new; my $result = $g->get( gist_id => 784612 ); if ( $result->success ) { print $result->content->{html_url}; } Response: B<Status: 200 OK> { "url": "https://api.github.com/gists/1", "id": "1", "description": "description of gist", "public": true, "user": { "login": "octocat", "id": 1, "gravatar_url": "https://github.com/images/error/octocat_happy.gif", "url": "https://api.github.com/users/octocat" }, "files": { "ring.erl": { "size": 932, "filename": "ring.erl", "raw_url": "https://gist.github.com/raw/365370/8c4d2d43d178df44f4c03a7f2ac0ff512853564e/ring.erl", "content": "contents of gist" } }, "comments": 0, "git_pull_url": "git://gist.github.com/1.git", "git_push_url": "git@gist.github.com:1.git", "created_at": "2010-04-14T02:15:15Z", "forks": [ { "user": { "login": "octocat", "id": 1, "gravatar_url": "https://github.com/images/error/octocat_happy.gif", "url": "https://api.github.com/users/octocat" }, "url": "https://api.github.com/gists/5", "created_at": "2011-04-14T16:00:49Z" } ], "history": [ { "url": "https://api.github.com/gists/1/57a7f021a713b1c5a6a199b54cc514735d2d462f", "version": "57a7f021a713b1c5a6a199b54cc514735d2d462f", "user": { "login": "octocat", "id": 1, "gravatar_url": "https://github.com/images/error/octocat_happy.gif", "url": "https://api.github.com/users/octocat" }, "change_status": { "deletions": 0, "additions": 180, "total": 180 }, "committed_at": "2010-04-14T02:15:15Z" } ] } =back =head2 is_starred =over =item * Check if a gist is starred GET /gists/:id/star Parameters: =over =item * B<gist_id>: mandatory integer =back Examples: my $g = Pithub::Gists->new; my $result = $g->is_starred( gist_id => 784612 ); Response: B<Status: 204 No Content> / C<< Status: 404 Not Found >> =back =head2 list =over =item * List a user's gists: GET /users/:user/gists Parameters: =over =item * B<user>: string =back Examples: my $g = Pithub::Gists->new; my $result = $g->list( user => 'miyagawa' ); if ( $result->success ) { while ( my $row = $result->next ) { printf "%s => %s\n", $row->{html_url}, $row->{description} || 'no description'; } } =item * List the authenticated user's gists or if called anonymously, this will returns all public gists: GET /gists Examples: my $g = Pithub::Gists->new; my $result = $g->list; =item * List all public gists: GET /gists/public Parameters: =over =item * B<public>: boolean =back Examples: my $g = Pithub::Gists->new; my $result = $g->list( public => 1 ); =item * List the authenticated user's starred gists: GET /gists/starred Parameters: =over =item * B<starred>: boolean =back Examples: my $g = Pithub::Gists->new; my $result = $g->list( starred => 1 ); Response: B<Status: 200 OK> [ { "url": "https://api.github.com/gists/1", "id": "1", "description": "description of gist", "public": true, "user": { "login": "octocat", "id": 1, "gravatar_url": "https://github.com/images/error/octocat_happy.gif", "url": "https://api.github.com/users/octocat" }, "files": { "ring.erl": { "size": 932, "filename": "ring.erl", "raw_url": "https://gist.github.com/raw/365370/8c4d2d43d178df44f4c03a7f2ac0ff512853564e/ring.erl", "content": "contents of gist" } }, "comments": 0, "git_pull_url": "git://gist.github.com/1.git", "git_push_url": "git@gist.github.com:1.git", "created_at": "2010-04-14T02:15:15Z" } ] =back =head2 star =over =item * Star a gist PUT /gists/:id/star Parameters: =over =item * B<gist_id>: mandatory integer =back Examples: my $g = Pithub::Gists->new; my $result = $g->star( gist_id => 784612 ); Response: B<Status: 204 No Content> =back =head2 unstar =over =item * Unstar a gist DELETE /gists/:id/star Parameters: =over =item * B<gist_id>: mandatory integer =back Examples: my $g = Pithub::Gists->new; my $result = $g->unstar( gist_id => 784612 ); Response: B<Status: 204 No Content> =back =head2 update =over =item * Edit a gist PATCH /gists/:id Parameters: =over =item * B<gist_id>: mandatory integer =item * B<data>: mandatory hashref, having following keys: =over =item * B<description>: optional string =item * B<public>: mandatory boolean =item * B<files>: mandatory hashref, please see examples section below NOTE: All files from the previous version of the gist are carried over by default if not included in the hash. Deletes can be performed by including the filename with a null hash. =back =back Examples: my $g = Pithub::Gists->new; my $result = $g->update( gist_id => 784612, data => { description => 'the description for this gist', files => { 'file1.txt' => { content => 'updated file contents' }, 'old_name.txt' => { filename => 'new_name.txt', content => 'modified contents' }, 'new_file.txt' => { content => 'a new file' }, 'delete_this_file.txt' => undef } } ); Response: B<Status: 200 OK> { "url": "https://api.github.com/gists/1", "id": "1", "description": "description of gist", "public": true, "user": { "login": "octocat", "id": 1, "gravatar_url": "https://github.com/images/error/octocat_happy.gif", "url": "https://api.github.com/users/octocat" }, "files": { "ring.erl": { "size": 932, "filename": "ring.erl", "raw_url": "https://gist.github.com/raw/365370/8c4d2d43d178df44f4c03a7f2ac0ff512853564e/ring.erl", "content": "contents of gist" } }, "comments": 0, "git_pull_url": "git://gist.github.com/1.git", "git_push_url": "git@gist.github.com:1.git", "created_at": "2010-04-14T02:15:15Z", "forks": [ { "user": { "login": "octocat", "id": 1, "gravatar_url": "https://github.com/images/error/octocat_happy.gif", "url": "https://api.github.com/users/octocat" }, "url": "https://api.github.com/gists/5", "created_at": "2011-04-14T16:00:49Z" } ], "history": [ { "url": "https://api.github.com/gists/1/57a7f021a713b1c5a6a199b54cc514735d2d462f", "version": "57a7f021a713b1c5a6a199b54cc514735d2d462f", "user": { "login": "octocat", "id": 1, "gravatar_url": "https://github.com/images/error/octocat_happy.gif", "url": "https://api.github.com/users/octocat" }, "change_status": { "deletions": 0, "additions": 180, "total": 180 }, "committed_at": "2010-04-14T02:15:15Z" } ] } =back =head1 AUTHOR Johannes Plunien <plu@cpan.org> =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Pithub-0.01042/lib/Pithub/GitData/������������������������������������������������������������������0000775�0001750�0001750�00000000000�15014062322�015052� 5����������������������������������������������������������������������������������������������������ustar �olaf����������������������������olaf�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Pithub-0.01042/lib/Pithub/GitData/References.pm�����������������������������������������������������0000644�0001750�0001750�00000016563�15014062322�017502� 0����������������������������������������������������������������������������������������������������ustar �olaf����������������������������olaf�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������package Pithub::GitData::References; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 Git Data References API use Moo; use Carp qw( croak ); extends 'Pithub::Base'; sub create { my ( $self, %args ) = @_; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'POST', path => sprintf( '/repos/%s/%s/git/refs', delete $args{user}, delete $args{repo} ), %args, ); } sub get { my ( $self, %args ) = @_; croak 'Missing key in parameters: ref' unless $args{ref}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/git/refs/%s', delete $args{user}, delete $args{repo}, delete $args{ref} ), %args, ); } sub list { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); if ( my $ref = $args{ref} ) { return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/git/refs/%s', delete $args{user}, delete $args{repo}, delete $args{ref} ), %args, ); } return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/git/refs', delete $args{user}, delete $args{repo} ), %args, ); } sub update { my ( $self, %args ) = @_; croak 'Missing key in parameters: ref' unless $args{ref}; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'PATCH', path => sprintf( '/repos/%s/%s/git/refs/%s', delete $args{user}, delete $args{repo}, delete $args{ref} ), %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::GitData::References - Github v3 Git Data References API =head1 VERSION version 0.01042 =head1 METHODS =head2 create =over =item * Create a Reference POST /repos/:user/:repo/git/refs Parameters: =over =item * B<user>: mandatory string =item * B<repo>: mandatory string =item * B<data>: mandatory hashref, having following keys: =over =item * B<ref>: mandatory string of the name of the fully qualified reference (ie: refs/heads/master). If it doesn't start with 'refs' and have at least two slashes, it will be rejected. =item * B<sha>: mandatory string of the SHA1 value to set this reference to. =back =back Examples: my $r = Pithub::GitData::References->new; my $result = $r->create( user => 'plu', repo => 'Pithub', data => { ref => 'refs/heads/master', sha => '827efc6d56897b048c772eb4087f854f46256132' . } ); =back =head2 get =over =item * Get a Reference GET /repos/:user/:repo/git/refs/:ref Parameters: =over =item * B<user>: mandatory string =item * B<repo>: mandatory string =item * B<ref>: mandatory string The key B<ref> must be formatted as C<< heads/branch >>, not just C<< branch >>. For example, the call to get the data for a branch named C<< sc/featureA >> would be: C<< heads/sc/featureA >> =back Examples: my $r = Pithub::GitData::References->new; my $result = $r->get( user => 'plu', repo => 'Pithub', ref => 'heads/master' ); Response: B<Status: 200 OK> { "ref": "refs/heads/sc/featureA", "url": "https://api.github.com/repos/octocat/Hello-World/git/refs/heads/sc/featureA", "object": { "type": "commit", "sha": "aa218f56b14c9653891f9e74264a383fa43fefbd", "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd" } } =back =head2 list =over =item * Get all References GET /repos/:user/:repo/git/refs This will return an array of all the references on the system, including things like notes and stashes if they exist on the server. Anything in the namespace, not just heads and tags, though that would be the most common. Parameters: =over =item * B<user>: mandatory string =item * B<repo>: mandatory string =back Examples: my $r = Pithub::GitData::References->new; my $result = $r->list( user => 'plu', repo => 'Pithub', ); =item * You can also request a sub-namespace. For example, to get all the tag references, you can call: GET /repos/:user/:repo/git/refs/tags Parameters: =over =item * B<user>: mandatory string =item * B<repo>: mandatory string =item * B<ref>: mandatory string =back Examples: my $r = Pithub::GitData::References->new; my $result = $r->list( user => 'plu', repo => 'Pithub', ref => 'tags', ); Response: B<Status: 200 OK> [ { "object": { "type": "commit", "sha": "1c5230f42d6d3e376162591f223fc4130d671937", "url": "https://api.github.com/repos/plu/Pithub/git/commits/1c5230f42d6d3e376162591f223fc4130d671937" }, "ref": "refs/tags/v0.01000", "url": "https://api.github.com/repos/plu/Pithub/git/refs/tags/v0.01000" }, { "object": { "type": "tag", "sha": "ef328a0679a992bd2c0ac537cf19d379f1c8d177", "url": "https://api.github.com/repos/plu/Pithub/git/tags/ef328a0679a992bd2c0ac537cf19d379f1c8d177" }, "ref": "refs/tags/v0.01001", "url": "https://api.github.com/repos/plu/Pithub/git/refs/tags/v0.01001" } ] =back =head2 update =over =item * Update a Reference PATCH /repos/:user/:repo/git/refs/:ref Parameters: =over =item * B<user>: mandatory string =item * B<repo>: mandatory string =item * B<ref>: mandatory string =item * B<data>: mandatory hashref, having following keys: =over =item * B<sha>: mandatory string of the SHA1 value to set this reference to. =item * B<force>: optional boolean indicating whether to force the update or to make sure the update is a fast-forward update. The default is C<< false >> so leaving this out or setting it to C<< false >> will make sure you're not overwriting work. =back =back Examples: my $r = Pithub::GitData::References->new; my $result = $r->update( user => 'plu', repo => 'Pithub', ref => 'tags/v1.0', data => { force => 1, sha => 'aa218f56b14c9653891f9e74264a383fa43fefbd', } ); Response: B<Status: 200 OK> [ { "ref": "refs/heads/sc/featureA", "url": "https://api.github.com/repos/octocat/Hello-World/git/refs/heads/sc/featureA", "object": { "type": "commit", "sha": "aa218f56b14c9653891f9e74264a383fa43fefbd", "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd" } } ] =back =head1 AUTHOR Johannes Plunien <plu@cpan.org> =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut ���������������������������������������������������������������������������������������������������������������������������������������������Pithub-0.01042/lib/Pithub/GitData/Blobs.pm����������������������������������������������������������0000644�0001750�0001750�00000005535�15014062322�016457� 0����������������������������������������������������������������������������������������������������ustar �olaf����������������������������olaf�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������package Pithub::GitData::Blobs; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 Git Data Blobs API use Moo; use Carp qw( croak ); extends 'Pithub::Base'; sub create { my ( $self, %args ) = @_; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'POST', path => sprintf( '/repos/%s/%s/git/blobs', delete $args{user}, delete $args{repo} ), %args, ); } sub get { my ( $self, %args ) = @_; croak 'Missing key in parameters: sha' unless $args{sha}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/git/blobs/%s', delete $args{user}, delete $args{repo}, delete $args{sha} ), %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::GitData::Blobs - Github v3 Git Data Blobs API =head1 VERSION version 0.01042 =head1 DESCRIPTION Since blobs can be any arbitrary binary data, the input and responses for the blob api takes an encoding parameter that can be either C<< utf-8 >> or C<< base64 >>. If your data cannot be losslessly sent as a UTF-8 string, you can base64 encode it. =head1 METHODS =head2 create =over =item * Create a Blob POST /repos/:user/:repo/git/blobs Parameters: =over =item * B<user>: mandatory string =item * B<repo>: mandatory string =item * B<data>: mandatory hashref, having following keys: =over =item * B<content>: mandatory string =item * B<encoding>: mandatory string, C<< utf-8 >> or C<< base64 >> =back =back Examples: my $b = Pithub::GitData::Blobs->new; my $result = $b->create( user => 'plu', repo => 'Pithub', data => { content => 'Content of the blob', encoding => 'utf-8', } ); Response: B<Status: 201 Created> { "sha": "3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15" } =back =head2 get =over =item * Get a Blob GET /repos/:user/:repo/git/blobs/:sha Parameters: =over =item * B<user>: mandatory string =item * B<repo>: mandatory string =item * B<sha>: mandatory string =back Examples: my $b = Pithub::GitData::Blobs->new; my $result = $b->get( user => 'plu', repo => 'Pithub', sha => 'b7cdea6830e128bc16c2b75efd99842d971666e2', ); Response: B<Status: 200 OK> { "content": "Content of the blob", "encoding": "utf-8" } =back =head1 AUTHOR Johannes Plunien <plu@cpan.org> =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut �������������������������������������������������������������������������������������������������������������������������������������������������������������������Pithub-0.01042/lib/Pithub/GitData/Trees.pm����������������������������������������������������������0000644�0001750�0001750�00000014435�15014062322�016477� 0����������������������������������������������������������������������������������������������������ustar �olaf����������������������������olaf�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������package Pithub::GitData::Trees; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 Git Data Trees API use Moo; use Carp qw( croak ); extends 'Pithub::Base'; sub create { my ( $self, %args ) = @_; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'POST', path => sprintf( '/repos/%s/%s/git/trees', delete $args{user}, delete $args{repo} ), %args, ); } sub get { my ( $self, %args ) = @_; croak 'Missing key in parameters: sha' unless $args{sha}; $self->_validate_user_repo_args( \%args ); my $path = sprintf( '/repos/%s/%s/git/trees/%s', $args{user}, $args{repo}, $args{sha} ); my %params = (); if ( $args{recursive} ) { $params{recursive} = 1; } return $self->request( method => 'GET', path => $path, params => \%params, %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::GitData::Trees - Github v3 Git Data Trees API =head1 VERSION version 0.01042 =head1 METHODS =head2 create The tree creation API will take nested entries as well. If both a tree and a nested path modifying that tree are specified, it will overwrite the contents of that tree with the new path contents and write a new tree out. =over =item * Create a Tree POST /repos/:user/:repo/git/trees Parameters: =over =item * B<user>: mandatory string =item * B<repo>: mandatory string =item * B<data>: mandatory hashref, having following keys: =over =item * B<base_tree>: optional String of the SHA1 of the tree you want to update with new data. =item * B<tree>: mandatory arrayref of hashrefs, having following keys: =over =item * B<path>: mandatory string of the file referenced in the tree. =item * B<mode>: mandatory string of the file mode - one of C<< 100644 >> for file (blob), C<< 100755 >> for executable (blob), C<< 040000 >> for subdirectory (tree), C<< 160000 >> for submodule (commit) or C<< 120000 >> for a blob that specifies the path of a symlink. =item * B<type>: mandatory string of C<< blob >>, C<< tree >>, C<< commit >>. =item * B<sha>: mandatory string of SHA1 checksum ID of the object in the tree. =item * B<content>: String of content you want this file to have - GitHub will write this blob out and use that SHA for this entry. Use either this or C<< tree.sha >>. =back =back =back Examples: my $t = Pithub::GitData::Trees->new; my $result = $t->create( user => 'octocat', repo => 'Hello-World', data => { tree => [ { path => 'file.rb', mode => '100644', type => 'blob', sha => '7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b', } ] } ); Response: B<Status: 201 Created> { "sha": "cd8274d15fa3ae2ab983129fb037999f264ba9a7", "url": "https://api.github.com/repo/octocat/Hello-World/trees/cd8274d15fa3ae2ab983129fb037999f264ba9a7", "tree": [ { "path": "file.rb", "mode": "100644", "type": "blob", "size": 132, "sha": "7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b", "url": "https://api.github.com/octocat/Hello-World/git/blobs/7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b" } ] } =back =head2 get =over =item * Get a Tree GET /repos/:user/:repo/git/trees/:sha Parameters: =over =item * B<user>: mandatory string =item * B<repo>: mandatory string =item * B<sha>: mandatory string =item * B<recursive>: optional boolean =back Examples: my $t = Pithub::GitData::Trees->new; my $result = $t->get( user => 'plu', repo => 'Pithub', sha => 'df21b2660fb6' ); Response: B<Status: 200 OK> { "sha": "9fb037999f264ba9a7fc6274d15fa3ae2ab98312", "url": "https://api.github.com/repo/octocat/Hello-World/trees/9fb037999f264ba9a7fc6274d15fa3ae2ab98312", "tree": [ { "path": "file.rb", "mode": "100644", "type": "blob", "size": 30, "sha": "44b4fc6d56897b048c772eb4087f854f46256132", "url": "https://api.github.com/octocat/Hello-World/git/blobs/44b4fc6d56897b048c772eb4087f854f46256132" }, { "path": "subdir", "mode": "040000", "type": "tree", "sha": "f484d249c660418515fb01c2b9662073663c242e", "url": "https://api.github.com/octocat/Hello-World/git/blobs/f484d249c660418515fb01c2b9662073663c242e" }, { "path": "exec_file", "mode": "100755", "type": "blob", "size": 75, "sha": "45b983be36b73c0788dc9cbcb76cbb80fc7bb057", "url": "https://api.github.com/octocat/Hello-World/git/blobs/45b983be36b73c0788dc9cbcb76cbb80fc7bb057" } ] } =item * Get a Tree Recursively GET /repos/:user/:repo/git/trees/:sha?recursive=1 Parameters: =over =item * B<user>: mandatory string =item * B<repo>: mandatory string =item * B<sha>: mandatory string =item * B<recursive>: optional boolean =back Examples: my $t = Pithub::GitData::Trees->new; my $result = $t->get( user => 'plu', repo => 'Pithub', sha => 'df21b2660fb6', recursive => 1, ); Response: B<Status: 200 OK> { "sha": "fc6274d15fa3ae2ab983129fb037999f264ba9a7", "url": "https://api.github.com/repo/octocat/Hello-World/trees/fc6274d15fa3ae2ab983129fb037999f264ba9a7", "tree": [ { "path": "subdir/file.txt", "mode": "100644", "type": "blob", "size": 132, "sha": "7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b", "url": "https://api.github.com/octocat/Hello-World/git/7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b" } ] } =back =head1 AUTHOR Johannes Plunien <plu@cpan.org> =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Pithub-0.01042/lib/Pithub/GitData/Commits.pm��������������������������������������������������������0000644�0001750�0001750�00000013520�15014062322�017022� 0����������������������������������������������������������������������������������������������������ustar �olaf����������������������������olaf�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������package Pithub::GitData::Commits; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 Git Data Commits API use Moo; use Carp qw( croak ); extends 'Pithub::Base'; sub create { my ( $self, %args ) = @_; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'POST', path => sprintf( '/repos/%s/%s/git/commits', delete $args{user}, delete $args{repo} ), %args, ); } sub get { my ( $self, %args ) = @_; croak 'Missing key in parameters: sha' unless $args{sha}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/git/commits/%s', delete $args{user}, delete $args{repo}, delete $args{sha} ), %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::GitData::Commits - Github v3 Git Data Commits API =head1 VERSION version 0.01042 =head1 METHODS =head2 create =over =item * Create a Commit POST /repos/:user/:repo/git/commits Parameters: =over =item * B<user>: mandatory string =item * B<repo>: mandatory string =item * B<data>: mandatory hashref, having following keys: =over =item * B<message>: mandatory string, the commit message =item * B<tree>: mandatory string, the SHA of the tree object this commit points to =item * B<parents>: mandatory arrayref of the SHAs of the commits that were the parents of this commit. If omitted or empty, the commit will be written as a root commit. For a single parent, an array of one SHA should be provided, for a merge commit, an array of more than one should be provided points to. =back Optional Parameters in the C<< data >> hashref: The committer section is optional and will be filled with the author data if omitted. If the author section is omitted, it will be filled in with the authenticated users information and the current date. =over =item * B<author>: hashref, having following keys: =over =item * B<name>: string of the name of the author of the commit =item * B<email>: string of the email of the author of the commit =item * B<date>: timestamp of when this commit was authored =back =item * B<committer>: hashref, having following keys: =over =item * B<name>: string of the name of the committer of the commit =item * B<email>: string of the email of the committer of the commit =item * B<date>: timestamp of when this commit was committed =back =back =back Examples: my $c = Pithub::GitData::Commits->new; my $result = $c->create( user => 'plu', repo => 'Pithub', data => { author => { date => '2008-07-09T16:13:30+12:00', email => 'schacon@gmail.com', name => 'Scott Chacon', }, message => 'my commit message', parents => ['7d1b31e74ee336d15cbd21741bc88a537ed063a0'], tree => '827efc6d56897b048c772eb4087f854f46256132', } ); Response: B<Status: 201 Created> { "sha": "7638417db6d59f3c431d3e1f261cc637155684cd", "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/7638417db6d59f3c431d3e1f261cc637155684cd", "author": { "date": "2008-07-09T16:13:30+12:00", "name": "Scott Chacon", "email": "schacon@gmail.com" }, "committer": { "date": "2008-07-09T16:13:30+12:00", "name": "Scott Chacon", "email": "schacon@gmail.com" }, "message": "my commit message", "tree": { "url": "https://api.github.com/repos/octocat/Hello-World/git/trees/827efc6d56897b048c772eb4087f854f46256132", "sha": "827efc6d56897b048c772eb4087f854f46256132" }, "parents": [ { "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/7d1b31e74ee336d15cbd21741bc88a537ed063a0", "sha": "7d1b31e74ee336d15cbd21741bc88a537ed063a0" } ] } =back =head2 get =over =item * Get a Commit GET /repos/:user/:repo/git/commits/:sha Parameters: =over =item * B<user>: mandatory string =item * B<repo>: mandatory string =item * B<sha>: mandatory string =back Examples: my $c = Pithub::GitData::Commits->new; my $result = $c->get( user => 'plu', repo => 'Pithub', sha => 'b7cdea6830e128bc16c2b75efd99842d971666e2', ); Response: B<Status: 200 OK> { "sha": "7638417db6d59f3c431d3e1f261cc637155684cd", "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/7638417db6d59f3c431d3e1f261cc637155684cd", "author": { "date": "2010-04-10T14:10:01-07:00", "name": "Scott Chacon", "email": "schacon@gmail.com" }, "committer": { "date": "2010-04-10T14:10:01-07:00", "name": "Scott Chacon", "email": "schacon@gmail.com" }, "message": "added readme, because im a good github citizen\n", "tree": { "url": "https://api.github.com/repos/octocat/Hello-World/git/trees/691272480426f78a0138979dd3ce63b77f706feb", "sha": "691272480426f78a0138979dd3ce63b77f706feb" }, "parents": [ { "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/1acc419d4d6a9ce985db7be48c6349a0475975b5", "sha": "1acc419d4d6a9ce985db7be48c6349a0475975b5" } ] } =back =head1 AUTHOR Johannes Plunien <plu@cpan.org> =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Pithub-0.01042/lib/Pithub/GitData/Tags.pm�����������������������������������������������������������0000644�0001750�0001750�00000011612�15014062322�016305� 0����������������������������������������������������������������������������������������������������ustar �olaf����������������������������olaf�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������package Pithub::GitData::Tags; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 Git Data Tags API use Moo; use Carp qw( croak ); extends 'Pithub::Base'; sub create { my ( $self, %args ) = @_; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'POST', path => sprintf( '/repos/%s/%s/git/tags', delete $args{user}, delete $args{repo} ), %args, ); } sub get { my ( $self, %args ) = @_; croak 'Missing key in parameters: sha' unless $args{sha}; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/git/tags/%s', delete $args{user}, delete $args{repo}, delete $args{sha} ), %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::GitData::Tags - Github v3 Git Data Tags API =head1 VERSION version 0.01042 =head1 DESCRIPTION This tags api only deals with tag objects - so only annotated tags, not lightweight tags. =head1 METHODS =head2 create =over =item * Create a Tag Note that creating a tag object does not create the reference that makes a tag in Git. If you want to create an annotated tag in Git, you have to do this call to create the tag object, and then create the C<< refs/tags/[tag] >> reference. If you want to create a lightweight tag, you simply have to create the reference - this call would be unnecessary. POST /repos/:user/:repo/git/tags Parameters: =over =item * B<user>: mandatory string =item * B<repo>: mandatory string =item * B<data>: mandatory hashref, having following keys: =over =item * B<tag>: mandatory string of the tag =item * B<message>: mandatory string of the tag message =item * B<object>: mandatory string of the SHA of the git object this is tagging =item * B<type>: mandatory string of the type of the object we're tagging. Normally this is a C<< commit >> but it can also be a C<< tree >> or a C<< blob >>. =item * B<tagger>: mandatory hashref, having following keys: =over =item * B<name>: string of the name of the author of the tag =item * B<email>: string of the email of the author of the tag =item * B<date>: timestamp of when this commit was tagged =back =back =back Examples: my $t = Pithub::GitData::Tags->new; my $result = $t->create( user => 'plu', repo => 'Pithub', data => { tagger => { date => '2011-06-17T14:53:35-07:00', email => 'schacon@gmail.com', name => 'Scott Chacon', }, message => 'initial version', object => 'c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c', tag => 'v0.0.1', type => 'commit', } ); Response: B<Status: 201 Created> { "tag": "v0.0.1", "sha": "940bd336248efae0f9ee5bc7b2d5c985887b16ac", "url": "https://api.github.com/repos/octocat/Hello-World/git/tags/940bd336248efae0f9ee5bc7b2d5c985887b16ac", "message": "initial version\n", "tagger": { "name": "Scott Chacon", "email": "schacon@gmail.com", "date": "2011-06-17T14:53:35-07:00" }, "object": { "type": "commit", "sha": "c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c", "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c" } } =back =head2 get =over =item * Get a Tag GET /repos/:user/:repo/git/tags/:sha Parameters: =over =item * B<user>: mandatory string =item * B<repo>: mandatory string =item * B<sha>: mandatory string =back Examples: my $t = Pithub::GitData::Tags->new; my $result = $t->get( user => 'plu', repo => 'Pithub', sha => 'df21b2660fb6', ); Response: B<Status: 200 OK> { "tag": "v0.0.1", "sha": "940bd336248efae0f9ee5bc7b2d5c985887b16ac", "url": "https://api.github.com/repos/octocat/Hello-World/git/tags/940bd336248efae0f9ee5bc7b2d5c985887b16ac", "message": "initial version\n", "tagger": { "name": "Scott Chacon", "email": "schacon@gmail.com", "date": "2011-06-17T14:53:35-07:00" }, "object": { "type": "commit", "sha": "c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c", "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c" } } =back =head1 AUTHOR Johannes Plunien <plu@cpan.org> =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut ����������������������������������������������������������������������������������������������������������������������Pithub-0.01042/lib/Pithub/Orgs/���������������������������������������������������������������������0000775�0001750�0001750�00000000000�15014062322�014447� 5����������������������������������������������������������������������������������������������������ustar �olaf����������������������������olaf�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Pithub-0.01042/lib/Pithub/Orgs/Members.pm�����������������������������������������������������������0000644�0001750�0001750�00000011745�15014062322�016405� 0����������������������������������������������������������������������������������������������������ustar �olaf����������������������������olaf�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������package Pithub::Orgs::Members; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 Org Members API use Moo; use Carp qw( croak ); extends 'Pithub::Base'; sub conceal { my ( $self, %args ) = @_; croak 'Missing key in parameters: org' unless $args{org}; croak 'Missing key in parameters: user' unless $args{user}; return $self->request( method => 'DELETE', path => sprintf( '/orgs/%s/public_members/%s', delete $args{org}, delete $args{user} ), %args, ); } sub delete { my ( $self, %args ) = @_; croak 'Missing key in parameters: org' unless $args{org}; croak 'Missing key in parameters: user' unless $args{user}; return $self->request( method => 'DELETE', path => sprintf( '/orgs/%s/members/%s', delete $args{org}, delete $args{user} ), %args, ); } sub is_member { my ( $self, %args ) = @_; croak 'Missing key in parameters: org' unless $args{org}; croak 'Missing key in parameters: user' unless $args{user}; return $self->request( method => 'GET', path => sprintf( '/orgs/%s/members/%s', delete $args{org}, delete $args{user} ), %args, ); } sub is_public { my ( $self, %args ) = @_; croak 'Missing key in parameters: org' unless $args{org}; croak 'Missing key in parameters: user' unless $args{user}; return $self->request( method => 'GET', path => sprintf( '/orgs/%s/public_members/%s', delete $args{org}, delete $args{user} ), %args, ); } sub list { my ( $self, %args ) = @_; croak 'Missing key in parameters: org' unless $args{org}; return $self->request( method => 'GET', path => sprintf( '/orgs/%s/members', delete $args{org} ), %args, ); } sub list_public { my ( $self, %args ) = @_; croak 'Missing key in parameters: org' unless $args{org}; return $self->request( method => 'GET', path => sprintf( '/orgs/%s/public_members', delete $args{org} ), %args, ); } sub publicize { my ( $self, %args ) = @_; croak 'Missing key in parameters: org' unless $args{org}; croak 'Missing key in parameters: user' unless $args{user}; return $self->request( method => 'PUT', path => sprintf( '/orgs/%s/public_members/%s', delete $args{org}, delete $args{user} ), %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Orgs::Members - Github v3 Org Members API =head1 VERSION version 0.01042 =head1 METHODS =head2 conceal =over =item * Conceal a user's membership DELETE /orgs/:org/public_members/:user Examples: my $m = Pithub::Orgs::Members->new; my $result = $m->conceal( org => 'CPAN-API', user => 'plu', ); =back =head2 delete =over =item * Removing a user from this list will remove them from all teams and they will no longer have any access to the organization's repositories. DELETE /orgs/:org/members/:user Examples: my $m = Pithub::Orgs::Members->new; my $result = $m->delete( org => 'CPAN-API', user => 'plu', ); =back =head2 is_member =over =item * Check if a user is a member of an organization GET /orgs/:org/members/:user Examples: my $m = Pithub::Orgs::Members->new; my $result = $m->is_member( org => 'CPAN-API', user => 'plu', ); =back =head2 is_public =over =item * Get if a user is a public member GET /orgs/:org/public_members/:user Examples: my $m = Pithub::Orgs::Members->new; my $result = $m->is_public( org => 'CPAN-API', user => 'plu', ); =back =head2 list =over =item * List all users who are members of an organization. A member is a user that belongs to at least 1 team in the organization. If the authenticated user is also a member of this organization then both concealed and public members will be returned. Otherwise only public members are returned. GET /orgs/:org/members Examples: my $m = Pithub::Orgs::Members->new; my $result = $m->list( org => 'CPAN-API' ); =back =head2 list_public =over =item * Members of an organization can choose to have their membership publicized or not. GET /orgs/:org/public_members Examples: my $m = Pithub::Orgs::Members->new; my $result = $m->list_public( org => 'CPAN-API' ); =back =head2 publicize =over =item * Publicize a user's membership PUT /orgs/:org/public_members/:user Examples: my $m = Pithub::Orgs::Members->new; my $result = $m->publicize( org => 'CPAN-API', user => 'plu', ); =back =head1 AUTHOR Johannes Plunien <plu@cpan.org> =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut ���������������������������Pithub-0.01042/lib/Pithub/Orgs/Teams.pm�������������������������������������������������������������0000644�0001750�0001750�00000026311�15014062322�016057� 0����������������������������������������������������������������������������������������������������ustar �olaf����������������������������olaf�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������package Pithub::Orgs::Teams; our $AUTHORITY = 'cpan:PLU'; # ABSTRACT: Github v3 Org Teams API use Moo; our $VERSION = '0.01042'; use Carp qw( carp croak ); extends 'Pithub::Base'; sub add_member { my ( $self, %args ) = @_; croak 'Missing key in parameters: team_id' unless $args{team_id}; croak 'Missing key in parameters: user' unless $args{user}; carp q{"Add team member" API is deprecated. Use add_membership method.}; return $self->request( method => 'PUT', path => sprintf( '/teams/%s/members/%s', delete $args{team_id}, delete $args{user} ), %args, ); } sub add_membership { my ( $self, %args ) = @_; croak 'Missing key in parameters: team_id' unless $args{team_id}; croak 'Missing key in parameters: user' unless $args{user}; croak 'Missing key in parameters: data' unless $args{data}; return $self->request( method => 'PUT', path => sprintf( '/teams/%s/memberships/%s', delete $args{team_id}, delete $args{user} ), %args, ); } sub add_repo { my ( $self, %args ) = @_; croak 'Missing key in parameters: team_id' unless $args{team_id}; croak 'Missing key in parameters: repo' unless $args{repo}; croak 'Missing key in parameters: org' unless $args{org}; return $self->request( method => 'PUT', path => sprintf( '/teams/%s/repos/%s/%s', delete $args{team_id}, delete $args{org}, delete $args{repo} ), %args, ); } sub create { my ( $self, %args ) = @_; croak 'Missing key in parameters: org' unless $args{org}; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; return $self->request( method => 'POST', path => sprintf( '/orgs/%s/teams', delete $args{org} ), %args, ); } ## no critic (Subroutines::ProhibitBuiltinHomonyms) sub delete { my ( $self, %args ) = @_; croak 'Missing key in parameters: team_id' unless $args{team_id}; return $self->request( method => 'DELETE', path => sprintf( '/teams/%s', delete $args{team_id} ), %args, ); } ## use critic sub get { my ( $self, %args ) = @_; croak 'Missing key in parameters: team_id' unless $args{team_id}; return $self->request( method => 'GET', path => sprintf( '/teams/%s', delete $args{team_id} ), %args, ); } sub has_repo { my ( $self, %args ) = @_; croak 'Missing key in parameters: team_id' unless $args{team_id}; croak 'Missing key in parameters: repo' unless $args{repo}; return $self->request( method => 'GET', path => sprintf( '/teams/%s/repos/%s', delete $args{team_id}, delete $args{repo} ), %args, ); } sub is_member { my ( $self, %args ) = @_; croak 'Missing key in parameters: team_id' unless $args{team_id}; croak 'Missing key in parameters: user' unless $args{user}; return $self->request( method => 'GET', path => sprintf( '/teams/%s/members/%s', delete $args{team_id}, delete $args{user} ), %args, ); } sub list { my ( $self, %args ) = @_; croak 'Missing key in parameters: org' unless $args{org}; return $self->request( method => 'GET', path => sprintf( '/orgs/%s/teams', delete $args{org} ), %args, ); } sub list_members { my ( $self, %args ) = @_; croak 'Missing key in parameters: team_id' unless $args{team_id}; return $self->request( method => 'GET', path => sprintf( '/teams/%s/members', delete $args{team_id} ), %args, ); } sub list_repos { my ( $self, %args ) = @_; croak 'Missing key in parameters: team_id' unless $args{team_id}; return $self->request( method => 'GET', path => sprintf( '/teams/%s/repos', delete $args{team_id} ), %args, ); } sub remove_member { my ( $self, %args ) = @_; croak 'Missing key in parameters: team_id' unless $args{team_id}; croak 'Missing key in parameters: user' unless $args{user}; carp q{"Remove team member" API is deprecated. Use remove_membership method.}; return $self->request( method => 'DELETE', path => sprintf( '/teams/%s/members/%s', delete $args{team_id}, delete $args{user} ), %args, ); } sub remove_membership { my ( $self, %args ) = @_; croak 'Missing key in parameters: team_id' unless $args{team_id}; croak 'Missing key in parameters: user' unless $args{user}; return $self->request( method => 'DELETE', path => sprintf( '/teams/%s/memberships/%s', delete $args{team_id}, delete $args{user} ), %args, ); } sub remove_repo { my ( $self, %args ) = @_; croak 'Missing key in parameters: team_id' unless $args{team_id}; croak 'Missing key in parameters: repo' unless $args{repo}; return $self->request( method => 'DELETE', path => sprintf( '/teams/%s/repos/%s', delete $args{team_id}, delete $args{repo} ), %args, ); } sub update { my ( $self, %args ) = @_; croak 'Missing key in parameters: team_id' unless $args{team_id}; croak 'Missing key in parameters: data (hashref)' unless ref $args{data} eq 'HASH'; return $self->request( method => 'PATCH', path => sprintf( '/teams/%s', delete $args{team_id} ), %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Orgs::Teams - Github v3 Org Teams API =head1 VERSION version 0.01042 =head1 METHODS =head2 add_member =over The "Add team member" API (described below) is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Add team membership API instead. It allows you to invite new organization members to your teams. In order to add a user to a team, the authenticated user must have 'admin' permissions to the team or be an owner of the org that the team is associated with. PUT /teams/:id/members/:user Examples: my $t = Pithub::Orgs::Teams->new; my $result = $t->add_member( team_id => 1, user => 'plu', ); =back =head2 add_membership =over If the user is already a member of the team's organization, this endpoint will add the user to the team. In order to add a membership between an organization member and a team, the authenticated user must be an organization owner or a maintainer of the team. PUT /teams/:id/memberships/:user Examples: my $t = Pithub::Orgs::Teams->new; my $result = $t->add_membership( team_id => 1, user => 'plu', data => { role => 'member', } ); =back =head2 add_repo =over In order to add a repo to a team, the authenticated user must be an owner of the org that the team is associated with. PUT /teams/:id/repos/:repo Examples: my $t = Pithub::Orgs::Teams->new; my $result = $t->add_repo( team_id => 1, repo => 'some_repo', org => 'our_organization', ); =back =head2 create =over In order to create a team, the authenticated user must be an owner of the given organization. POST /orgs/:org/teams Examples: my $t = Pithub::Orgs::Teams->new; my $result = $t->create( org => 'CPAN-API', data => { name => 'new team', permission => 'push', repo_names => ['github/dotfiles'] } ); =back =head2 delete =over In order to delete a team, the authenticated user must be an owner of the org that the team is associated with. DELETE /teams/:id Examples: my $t = Pithub::Orgs::Teams->new; my $result = $t->delete( team_id => 1 ); =back =head2 get =over Get team GET /teams/:id Examples: my $t = Pithub::Orgs::Teams->new; my $result = $t->get( team_id => 1 ); =back =head2 has_repo =over Get team repo GET /teams/:id/repos/:repo Examples: my $t = Pithub::Orgs::Teams->new; my $result = $t->has_repo( team_id => 1, repo => 'some_repo', ); =back =head2 is_member =over In order to get if a user is a member of a team, the authenticated user must be a member of the team. GET /teams/:id/members/:user Examples: my $t = Pithub::Orgs::Teams->new; my $result = $t->is_member( team_id => 1, user => 'plu', ); =back =head2 list =over List teams GET /orgs/:org/teams Examples: my $t = Pithub::Orgs::Teams->new; my $result = $t->list( org => 'CPAN-API' ); =back =head2 list_members =over In order to list members in a team, the authenticated user must be a member of the team. GET /teams/:id/members Examples: my $t = Pithub::Orgs::Teams->new; my $result = $t->list_members( team_id => 1 ); =back =head2 list_repos =over List team repos GET /teams/:id/repos Examples: my $t = Pithub::Orgs::Teams->new; my $result = $t->list_repos( team_id => 1 ); =back =head2 remove_member =over The "Remove team member" API (described below) is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Remove team membership API instead. It allows you to remove both active and pending memberships. In order to remove a user from a team, the authenticated user must have 'admin' permissions to the team or be an owner of the org that the team is associated with. NOTE: This does not delete the user, it just remove them from the team. DELETE /teams/:id/members/:user Examples: my $t = Pithub::Orgs::Teams->new; my $result = $t->remove_member( team_id => 1, user => 'plu', ); =back =head2 remove_membership =over In order to remove a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with. NOTE: This does not delete the user, it just removes their membership from the team. DELETE /teams/:id/memberships/:user Examples: my $t = Pithub::Orgs::Teams->new; my $result = $t->remove_membership( team_id => 1, user => 'plu', ); =back =head2 remove_repo =over In order to remove a repo from a team, the authenticated user must be an owner of the org that the team is associated with. DELETE /teams/:id/repos/:repo Examples: my $t = Pithub::Orgs::Teams->new; my $result = $t->remove_repo( team_id => 1, repo => 'some_repo', ); =back =head2 update =over In order to edit a team, the authenticated user must be an owner of the org that the team is associated with. PATCH /teams/:id Examples: my $t = Pithub::Orgs::Teams->new; my $result = $t->update( team_id => 1, data => { name => 'new team name', permission => 'push', } ); =back =head1 AUTHOR Johannes Plunien <plu@cpan.org> =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Pithub-0.01042/lib/Pithub/Events.pm�����������������������������������������������������������������0000644�0001750�0001750�00000012331�15014062322�015335� 0����������������������������������������������������������������������������������������������������ustar �olaf����������������������������olaf�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������package Pithub::Events; our $AUTHORITY = 'cpan:PLU'; our $VERSION = '0.01042'; # ABSTRACT: Github v3 Events API use Moo; use Carp qw( croak ); extends 'Pithub::Base'; sub issue { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/issues/events', delete $args{user}, delete $args{repo} ), %args, ); } sub network { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/networks/%s/%s/events', delete $args{user}, delete $args{repo} ), %args, ); } sub org { my ( $self, %args ) = @_; croak 'Missing key in parameters: org' unless $args{org}; return $self->request( method => 'GET', path => sprintf( '/orgs/%s/events', delete $args{org} ), %args, ); } sub org_for_user { my ( $self, %args ) = @_; croak 'Missing key in parameters: org' unless $args{org}; croak 'Missing key in parameters: user' unless $args{user}; return $self->request( method => 'GET', path => sprintf( '/users/%s/events/orgs/%s', delete $args{user}, delete $args{org} ), %args, ); } sub public { my ( $self, %args ) = @_; return $self->request( method => 'GET', path => '/events', %args, ); } sub repos { my ( $self, %args ) = @_; $self->_validate_user_repo_args( \%args ); return $self->request( method => 'GET', path => sprintf( '/repos/%s/%s/events', delete $args{user}, delete $args{repo} ), %args, ); } sub user_performed { my ( $self, %args ) = @_; croak 'Missing key in parameters: user' unless $args{user}; my $path = sprintf( '/users/%s/events', delete $args{user} ); if ( $args{public} ) { $path .= '/public'; } return $self->request( method => 'GET', path => $path, %args, ); } sub user_received { my ( $self, %args ) = @_; croak 'Missing key in parameters: user' unless $args{user}; my $path = sprintf( '/users/%s/received_events', delete $args{user} ); if ( $args{public} ) { $path .= '/public'; } return $self->request( method => 'GET', path => $path, %args, ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub::Events - Github v3 Events API =head1 VERSION version 0.01042 =head1 METHODS =head2 issue =over =item * List issue events for a repository GET /repos/:user/:repo/issues/events Examples: my $e = Pithub::Events->new; my $result = $e->issue( user => 'plu', repo => 'Pithub', ); =back =head2 network =over =item * List public events for a network of repositories GET /networks/:user/:repo/events Examples: my $e = Pithub::Events->new; my $result = $e->network( user => 'plu', repo => 'Pithub', ); =back =head2 org =over =item * List public events for an organization GET /orgs/:org/events Examples: my $e = Pithub::Events->new; my $result = $e->org( org => 'CPAN-API' ); =back =head2 org_for_user =over =item * List events for an organization GET /users/:user/events/orgs/:org Examples: my $e = Pithub::Events->new; my $result = $e->org( org => 'CPAN-API', user => 'plu', ); =back =head2 public =over =item * List public events GET /events Examples: my $e = Pithub::Events->new; my $result = $e->public; =back =head2 repos =over =item * List repository events GET /repos/:user/:repo/events Examples: my $e = Pithub::Events->new; my $result = $e->repos( user => 'plu', repo => 'Pithub', ); =back =head2 user_performed =over =item * List events performed by a user GET /users/:user/events If you are authenticated as the given user, you will see your private events. Otherwise, you'll only see public events. Examples: my $e = Pithub::Events->new; my $result = $e->user_performed( user => 'plu' ); # List public events performed by a user my $e = Pithub::Events->new; my $result = $e->user_performed( user => 'plu', public => 1, ); =back =head2 user_received =over =item * List events that a user has received GET /users/:user/received_events These are events that you've received by watching repos and following users. If you are authenticated as the given user, you will see private events. Otherwise, you'll only see public events. Examples: my $e = Pithub::Events->new; my $result = $e->user_received( user => 'plu' ); # List public events that a user has received my $e = Pithub::Events->new; my $result = $e->user_received( user => 'plu', public => 1, ); =back =head1 AUTHOR Johannes Plunien <plu@cpan.org> =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Pithub-0.01042/lib/Pithub.pm������������������������������������������������������������������������0000644�0001750�0001750�00000040325�15014062322�014075� 0����������������������������������������������������������������������������������������������������ustar �olaf����������������������������olaf�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������package Pithub; our $AUTHORITY = 'cpan:PLU'; # ABSTRACT: Github v3 API use Moo; our $VERSION = '0.01042'; use Carp qw( croak ); use Pithub::Events (); use Pithub::Gists (); use Pithub::GitData (); use Pithub::Issues (); use Pithub::Orgs (); use Pithub::PullRequests (); use Pithub::Markdown (); use Pithub::Repos (); use Pithub::Search (); use Pithub::SearchV3 (); use Pithub::Users (); extends 'Pithub::Base'; sub _validate_search_api { my %search_apis = map { $_ => 1 } qw(legacy v3); croak "unknown search api '$_[0]'" unless exists $search_apis{ $_[0] }; } has search_api => ( is => 'ro', isa => \&_validate_search_api, default => 'legacy', ); sub _search_class { my ( $self, $search_api ) = @_; _validate_search_api($search_api); return $search_api eq 'legacy' ? Pithub::Search:: : Pithub::SearchV3::; } sub events { return shift->_create_instance( Pithub::Events::, @_ ); } sub gists { return shift->_create_instance( Pithub::Gists::, @_ ); } sub git_data { return shift->_create_instance( Pithub::GitData::, @_ ); } sub issues { return shift->_create_instance( Pithub::Issues::, @_ ); } sub markdown { return shift->_create_instance( Pithub::Markdown::, @_ ); } sub orgs { return shift->_create_instance( Pithub::Orgs::, @_ ); } sub pull_requests { return shift->_create_instance( Pithub::PullRequests::, @_ ); } sub repos { return shift->_create_instance( Pithub::Repos::, @_ ); } sub search { my ( $self, %args ) = @_; my $class = $self->_search_class( exists $args{search_api} ? delete $args{search_api} : $self->search_api, ); return shift->_create_instance( $class, @_ ); } sub users { return shift->_create_instance( Pithub::Users::, @_ ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME Pithub - Github v3 API =head1 VERSION version 0.01042 =head1 SYNOPSIS use Pithub (); my $p = Pithub->new; # my $p = Pithub->new(utf8 => 0); # enable compatibility options for version 0.01029 or lower my $repo = $p->repos->get( user => 'plu', repo => 'Pithub' ); # $repo->content is either an arrayref or an hashref # depending on the API call that has been made printf "%s\n", $repo->content->{html_url}; # prints https://github.com/plu/Pithub printf "%s\n", $repo->content->{clone_url}; # prints https://github.com/plu/Pithub.git # if the result is an arrayref, you can use the result iterator my $repos = $p->repos->list( user => 'plu' ); while ( my $row = $repos->next ) { printf "%s\n", $row->{name}; } # Connect to your local GitHub Enterprise instance my $ghe_p = Pithub->new( api_uri => 'https://github.yourdomain.com/api/v3/' ); # No need to provide user/repo to each module: my $pit = Pithub->new( user => 'plu', repo => 'pithub', token => 'my_oauth_token', ); $pit->repos->get; $pit->repos->commits->list; # Use a caching UserAgent use CHI (); use Pithub::Repos (); use WWW::Mechanize::Cached (); my $cache = CHI->new( driver => 'File', root_dir => '/tmp/pithub-example' ); my $mech = WWW::Mechanize::Cached->new( cache => $cache ); my $cached_pithub = Pithub::Repos->new( auto_pagination => 1, per_page => 100, ua => $mech, ); =head1 DESCRIPTION L<Pithub> (B<P>erl + GB<ithub>) provides a set of modules to access the L<Github v3 API|http://developer.github.com/v3/> in an object oriented way. There is also L<Net::GitHub> which does the same for all the versions (v1, v2, v3) of the Github API. L<Pithub> supports all API calls so far, but only for v3. =head1 ATTRIBUTES =head2 search_api my $p = Pithub->new({ search_api => 'v3' }); my $search = $p->search; # $search->isa('Pithub::SearchV3'); This attribute allows the default for the API to use for searches to be specified. The two accepted values are C<v3> and C<legacy>. For compatibility reasons the default is C<legacy>. =head1 METHODS =head2 events Provides access to L<Pithub::Events>. =head2 gists Provides access to L<Pithub::Gists>. =head2 git_data Provides access to L<Pithub::GitData>. =head2 issues Provides access to L<Pithub::Issues>. =head2 markdown Provides access to L<Pithub::Markdown>. =head2 orgs Provides access to L<Pithub::Orgs>. =head2 pull_requests Provides access to L<Pithub::PullRequests>. =head2 repos Provides access to L<Pithub::Repos>. =head2 search my $legacy_search = $p->search(search_api => 'legacy'); my $v3_search = $p->search(search_api => 'v3'); my $default_search = $p->search; Provides access to L<Pithub::Search> and L<Pithub::SearchV3>. When no C<search_api> option is given, the value provided by the C<search_api> attribute is used. =head2 users Provides access to L<Pithub::Users>. =head1 DOCUMENTATION Quite a lot of the L<Pithub> documentation has been taken directly from the great API documentation at L<Github|http://developer.github.com/v3/>. Please also read the documentation there, since it might be more complete and more up-to-date. L<Pithub::Base> contains documentation for attributes inherited by all Pithub modules. =head1 WARNING L<Pithub> as well as the L<Github v3 API|http://developer.github.com/v3/> are still under development. So there might be things broken on both sides. Besides that it's possible that the API will change. This applies to L<Pithub> itself as well as the L<Github v3 API|http://developer.github.com/v3/>. =head1 CONTRIBUTE This module is hosted on L<Github|https://github.com/plu/Pithub>, so feel free to fork it and send pull requests. There are two different kinds of test suites, one is just checking the HTTP requests that are created by the method calls, without actually sending them. The second one is sending real requests to the Github API. If you want to contribute to this project, I highly recommend to run the live tests on a test account, because it will generate a lot of activity. =head1 MODULES There are different ways of using the Pithub library. You can either use the main module L<Pithub> to get access to all other modules, like L<Pithub::Repos> for example. Or you can use L<Pithub::Repos> directly and create an instance of it. All modules accept the same L<attributes|Pithub::Base/ATTRIBUTES>, either in the constructor or later by calling the setters. Besides that there are other modules involved. Every method call which maps directly to a Github API call returns a L<Pithub::Result> object. This contains everything interesting about the response returned from the API call. L<Pithub::Base> might be interesting for two reasons: =over =item * The list of L<attributes|Pithub::Base/ATTRIBUTES> which all modules accept. =item * The L<request|Pithub::Base/request> method: In case Github adds a new API call which is not supported yet by L<Pithub> the L<request|Pithub::Base/request> method can be used directly to perform this new API call, there's some documentation on how to use it. =over =item * L<Pithub::Events> See also: L<http://developer.github.com/v3/events/> my $events = Pithub->new->events; my $events = Pithub::Events->new; =item * L<Pithub::Gists> See also: L<http://developer.github.com/v3/gists/> my $gists = Pithub->new->gists; my $gists = Pithub::Gists->new; =over =item * L<Pithub::Gists::Comments> See also: L<http://developer.github.com/v3/gists/comments/> my $comments = Pithub->new->gists->comments; my $comments = Pithub::Gists->new->comments; my $comments = Pithub::Gists::Comments->new; =back =back =over =item * L<Pithub::GitData> See also: L<http://developer.github.com/v3/git/> my $git_data = Pithub->new->git_data; my $git_data = Pithub::GitData->new; =over =item * L<Pithub::GitData::Blobs> See also: L<http://developer.github.com/v3/git/blobs/> my $blobs = Pithub->new->git_data->blobs; my $blobs = Pithub::GitData->new->blobs; my $blobs = Pithub::GitData::Blobs->new; =item * L<Pithub::GitData::Commits> See also: L<http://developer.github.com/v3/git/commits/> my $commits = Pithub->new->git_data->commits; my $commits = Pithub::GitData->new->commits; my $commits = Pithub::GitData::Commits->new; =item * L<Pithub::GitData::References> See also: L<http://developer.github.com/v3/git/refs/> my $references = Pithub->new->git_data->references; my $references = Pithub::GitData->new->references; my $references = Pithub::GitData::References->new; =item * L<Pithub::GitData::Tags> See also: L<http://developer.github.com/v3/git/tags/> my $tags = Pithub->new->git_data->tags; my $tags = Pithub::GitData->new->tags; my $tags = Pithub::GitData::Tags->new; =item * L<Pithub::GitData::Trees> See also: L<http://developer.github.com/v3/git/trees/> my $trees = Pithub->new->git_data->trees; my $trees = Pithub::GitData->new->trees; my $trees = Pithub::GitData::Trees->new; =back =back =over =item * L<Pithub::Issues> See also: L<http://developer.github.com/v3/issues/> my $issues = Pithub->new->issues; my $issues = Pithub::Issues->new; =over =item * L<Pithub::Issues::Assignees> See also: L<http://developer.github.com/v3/issues/assignees/> my $assignees = Pithub->new->issues->assignees; my $assignees = Pithub::Issues->new->assignees; my $assignees = Pithub::Issues::Assignees->new; =item * L<Pithub::Issues::Comments> See also: L<http://developer.github.com/v3/issues/comments/> my $comments = Pithub->new->issues->comments; my $comments = Pithub::Issues->new->comments; my $comments = Pithub::Issues::Comments->new; =item * L<Pithub::Issues::Events> See also: L<http://developer.github.com/v3/issues/events/> my $events = Pithub->new->issues->events; my $events = Pithub::Issues->new->events; my $events = Pithub::Issues::Events->new; =item * L<Pithub::Issues::Labels> See also: L<http://developer.github.com/v3/issues/labels/> my $labels = Pithub->new->issues->labels; my $labels = Pithub::Issues->new->labels; my $labels = Pithub::Issues::Labels->new; =item * L<Pithub::Issues::Milestones> See also: L<http://developer.github.com/v3/issues/milestones/> my $milestones = Pithub->new->issues->milestones; my $milestones = Pithub::Issues->new->milestones; my $milestones = Pithub::Issues::Milestones->new; =back =back =over =item * L<Pithub::Orgs> See also: L<http://developer.github.com/v3/orgs/> my $orgs = Pithub->new->orgs; my $orgs = Pithub::Orgs->new; =over =item * L<Pithub::Orgs::Members> See also: L<http://developer.github.com/v3/orgs/members/> my $members = Pithub->new->orgs->members; my $members = Pithub::Orgs->new->members; my $members = Pithub::Orgs::Members->new; =item * L<Pithub::Orgs::Teams> See also: L<http://developer.github.com/v3/orgs/teams/> my $teams = Pithub->new->orgs->teams; my $teams = Pithub::Orgs->new->teams; my $teams = Pithub::Orgs::Teams->new; =back =back =over =item * L<Pithub::PullRequests> See also: L<http://developer.github.com/v3/pulls/> my $pull_requests = Pithub->new->pull_requests; my $pull_requests = Pithub::PullRequests->new; =over =item * L<Pithub::PullRequests::Comments> See also: L<http://developer.github.com/v3/pulls/comments/> my $comments = Pithub->new->pull_requests->comments; my $comments = Pithub::PullRequests->new->comments; my $comments = Pithub::PullRequests::Comments->new; =item * L<Pithub::PullRequests::Reviewers> See also: L<https://docs.github.com/en/rest/reference/pulls#review-requests> my $reviewers = Pithub->new->pull_requests->reviewers; my $reviewers = Pithub::PullRequests->new->reviewers; my $reviewers = Pithub::PullRequests::Reviewers->new; =back =back =over =item * L<Pithub::Repos> See also: L<http://developer.github.com/v3/repos/> my $repos = Pithub->new->repos; my $repos = Pithub::Repos->new; =over =item * L<Pithub::Repos::Collaborators> See also: L<http://developer.github.com/v3/repos/collaborators/> my $collaborators = Pithub->new->repos->collaborators; my $collaborators = Pithub::Repos->new->collaborators; my $collaborators = Pithub::Repos::Collaborators->new; =item * L<Pithub::Repos::Commits> See also: L<http://developer.github.com/v3/repos/commits/> my $commits = Pithub->new->repos->commits; my $commits = Pithub::Repos->new->commits; my $commits = Pithub::Repos::Commits->new; =item * L<Pithub::Repos::Contents> See also: L<http://developer.github.com/v3/repos/contents/> my $contents = Pithub->new->repos->contents; my $contents = Pithub::Repos->new->contents; my $contents = Pithub::Repos::Contents->new; =item * L<Pithub::Repos::Downloads> Github says: The Downloads API (described below) was deprecated on December 11, 2012. It will be removed at a future date. We recommend using L<Pithub::Repos::Releases> instead. See also: L<http://developer.github.com/v3/repos/downloads/> my $downloads = Pithub->new->repos->downloads; my $downloads = Pithub::Repos->new->downloads; my $downloads = Pithub::Repos::Downloads->new; =item * L<Pithub::Repos::Forks> See also: L<http://developer.github.com/v3/repos/forks/> my $forks = Pithub->new->repos->forks; my $forks = Pithub::Repos->new->forks; my $forks = Pithub::Repos::Forks->new; =item * L<Pithub::Repos::Keys> See also: L<http://developer.github.com/v3/repos/keys/> my $keys = Pithub->new->repos->keys; my $keys = Pithub::Repos->new->keys; my $keys = Pithub::Repos::Keys->new; =item * L<Pithub::Repos::Releases> See also: L<http://developer.github.com/v3/repos/releases/> my $releases = Pithub->new->repos->releases; my $releases = Pithub::Repos->new->releases; my $releases = Pithub::Repos::Releases->new; Note that Pithub::Repos::Releases requires Boolean values for some calls. See Pithub::Repos::Releases for details. =over =item * L<Pithub::Repos::Releases::Assets> See also: L<http://developer.github.com/v3/repos/releases/> my $assets = Pithub->new->repos->releases->assets; my $assets = Pithub::Repos->new->releases->assets; my $assets = Pithub::Repos::Releases->new->assets; my $assets = Pithub::Repos::Releases::Assets->new; =back =item * L<Pithub::Repos::Stats> See also: L<http://developer.github.com/v3/repos/statistics/> my $watching = Pithub->new->repos->stats; my $watching = Pithub::Repos->new->stats; my $watching = Pithub::Repos::Stats->new; =item * L<Pithub::Repos::Statuses> See also: L<http://developer.github.com/v3/repos/statuses/> my $watching = Pithub->new->repos->statuses; my $watching = Pithub::Repos->new->statuses; my $watching = Pithub::Repos::Statuses->new; =item * L<Pithub::Repos::Watching> See also: L<http://developer.github.com/v3/repos/watching/> my $watching = Pithub->new->repos->watching; my $watching = Pithub::Repos->new->watching; my $watching = Pithub::Repos::Watching->new; =back =back =over =item * L<Pithub::Users> See also: L<http://developer.github.com/v3/users/> my $users = Pithub->new->users; my $users = Pithub::Users->new; =over =item * L<Pithub::Users::Emails> See also: L<http://developer.github.com/v3/users/emails/> my $emails = Pithub->new->users->emails; my $emails = Pithub::Users->new->emails; my $emails = Pithub::Users::Emails->new; =item * L<Pithub::Users::Followers> See also: L<http://developer.github.com/v3/users/followers/> my $followers = Pithub->new->users->followers; my $followers = Pithub::Users->new->followers; my $followers = Pithub::Users::Followers->new; =item * L<Pithub::Users::Keys> See also: L<http://developer.github.com/v3/users/keys/> my $keys = Pithub->new->users->keys; my $keys = Pithub::Users->new->keys; my $keys = Pithub::Users::Keys->new; =back =back =back =head1 CONTRIBUTORS =over =item * Andreas Marienborg =item * Alessandro Ghedini =item * Michael G Schwern =back =head1 AUTHOR Johannes Plunien <plu@cpan.org> =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Johannes Plunien. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Pithub-0.01042/Changes������������������������������������������������������������������������������0000644�0001750�0001750�00000017331�15014062322�013032� 0����������������������������������������������������������������������������������������������������ustar �olaf����������������������������olaf�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Revision history for Pithub 0.01042 2025-05-23 12:06:16Z - Allow fetching additional pages of pull requests (GH#236) (Rich Bowen) - Fix that `per_page` parameter is sent if a query_form is set (GH#230) (Roland Hu) 0.01041 2023-08-24 18:12:33Z - Boolean documentation updates (GH#233) (Timothy Legge) 0.01040 2022-09-23 21:39:46Z - Add Pithub::Repos::Actions::Workflows class which has methods to get and list repository workflows (GH#227) (Olaf Alders) 0.01039 2022-08-08 21:00:15Z - Use CHI for caching (GH#224) (Olaf Alders) - Update docs, tidy imports and make Perl::Critic happier (GH#226) (Olaf Alders) 0.01038 2022-08-03 17:26:08Z - Replace external Array::Iterator with internal Pithub::ResultSet (GH#222) (H.Merijn Brand and Olaf Alders) - Internal stylistic changes (GH#223) (Olaf Alders) 0.01037 2022-07-20 01:12:07Z - Add rename_branch() and merge_branch() branch to Repos class (GH#220) (thibaultduponchelle) - Tidy some tests (GH#218) (Olaf Alders) 0.01036 2021-02-08 02:47:17Z - Add pull request review requests (GH#217) (Shigeki SUGAI) - Tidy module imports (GH#216) (Olaf Alders) 0.01035 2019-11-23 16:59:49Z - fix error in example (GH#211) (Graham✈️✈️) 0.01034 2018-02-21 16:03:21Z - Add support for the Github markdown API (GH#205) (JosJoaqu Atria) - Add .mailmap file (GH#206) (JosJoaqu Atria) - Add issues() and pull_requestions() methods to Pithub::Repos. (GH#201) (JosJoaqu Atria) - Add a rate_limit method to base (GH#204) (JosJoaqu Atria) - CPANTS fixes (PRC) (GH#200) (JosJoaqu Atria) 0.01033 2016-01-22 17:54:52-05:00 America/Toronto - Bump minimum version of JSON::MaybeXS to 1.003003 (Slaven Rezić and Zoffix Znet) 0.01032 2016-01-13 22:21:12-05:00 America/Toronto - Pass utf8 option to child instances (Ichinose Shogo) 0.01031 2016-01-11 23:35:23-05:00 America/Toronto - Add disabling utf8 as a constructor option (Ichinose Shogo) - Pod fixes (Ivan Bessarabov and Zoffix Znet) 0.01030 2015-10-18 21:32:29-04:00 America/Toronto - Add add/remove team membership API (SUZUKI Masashi) - Handle unicode when en/de-coding json (Randy Stauner) 0.01029 2015-07-07 10:35:24-04:00 America/Toronto - Document the URL required for connecting to a GitHub Enterprise instance. - Add Pithub::SearchV3, which gives you the option to use the v3 search rather than the current default of legacy (Florian Ragwitz) 0.01028 2014-11-19 16:50:32-08:00 America/Los_Angeles - #178 Fixed the minimum version of Moo. - #176 Using JSON::MaybeXS instead of JSON to allow alternatives to JSON::XS such as Cpanel::JSON::XS. - #177 Using Path::Tiny instead of File::Slurp to simplify file access and avoid File::Slurp unicode bugs. - #175 Now using Github for issue tracking. 0.01027 2014-11-04 10:55:03-08:00 America/Los_Angeles - Forgot to update the change log last release. 0.01026 2014-11-04 10:28:22-08:00 America/Los_Angeles - #173 Document Pithub::Result->code, raw_content, request, etag and success. - #171 Add Pithub::Repos->branch to get information about a branch. - #169 Add Pithub::Repos->delete to delete a repository. - #168 Allow inherited attributes to be changed when making a sub-object. $p->repos( per_page => 100 ) - #163 The default per_page is now 100, the maximum allowed by Github, for more efficient pagination. - #162 Requests are now cached (aka Conditional Requests) for more efficient use of the API. - Pithub::Repos::Keys->update and Pithub::Users::Keys->update have been removed. Deploy and public keys are immutable. removed. If you need to update a key, remove it and create a new one. - Gist comments have been fixed. 0.01025 2014-05-18 16:16:38+02:00 Europe/Berlin - Fix #159 - forking repo into organization 0.01024 2014-04-06 09:59:51+02:00 Europe/Berlin - No changes. 0.01023 2014-04-04 16:55:58+02:00 Europe/Berlin - Add Pithub::Repos::Releases::Assets (Johannes Plunien) 0.01022 2014-03-27 13:59:44+01:00 Europe/Oslo - Add Pithub::Repos::Releases (Johannes Plunien) - Missing accessors and docs, typos (Johannes Plunien) 0.01021 2014-01-15 15:14:43 Asia/Bangkok - Add Pithub::Repos::Statuses->list and ->create (Andreas Marienborg) 0.01020 2013-08-09 17:21:22 Asia/Bangkok - Add Pithub::Repos::Stats->contributors (Andreas Marienborg) 0.01019 2013-06-23 07:47:53 Europe/Berlin - Replace JSON::Any with JSON (Alessandro Ghedini) 0.01018 2013-03-13 11:24:16 Europe/Berlin - Support setting Authorization in prepare_request (Andreas Marienborg) 0.01017 2012-12-15 10:34:03 Europe/Berlin - Fix tests on 5.17.x 0.01016 2012-09-24 19:55:04 Europe/Berlin - Implement search api #RT-79819 0.01015 2012-09-23 09:55:40 Europe/Berlin - Implement new repo starring api - Fix usage on a Github:FI or Github:Enterprise installation 0.01014 2012-08-09 08:24:42 Europe/Berlin - Implement new issues assignee api - Implement new repos contents api 0.01013 2012-07-13 14:00:13 Europe/Berlin - Fix wrong usage of Moo 0.01012 2011-12-29 13:18:02 Europe/Berlin - The /gists/:id/fork action becomes /gists/:id/forks 0.01011 2011-11-04 12:00:07 Asia/Dubai - Tiny POD fixes 0.01010 2011-11-02 18:35:10 Asia/Dubai - Support new Events API 0.01009 2011-10-29 09:50:12 Asia/Dubai - Implement Pithub::Repos::Commits->compare 0.01008 2011-10-21 14:46:39 Asia/Dubai - Mention Net::Github supporting v3 now 0.01007 2011-10-21 10:13:23 Asia/Dubai - Implement new repos hooks API 0.01006 2011-08-13 13:22:39 Asia/Dubai - Fix bug in link header parser 0.01005 2011-07-20 14:28:59 Asia/Dubai - replace Moose with Moo 0.01004 2011-07-15 14:43:34 Asia/Dubai - change "label_id" key to "label" everywhere since [!!!] it's not really an id, but just a label - fix Pithub::Users->list_following - fix Pithub::Repos->update - rename Orgs->Teams->get_repo to ->has_repo [!!!] - make access to response headers easier - remove Pithub::Request and Pithub::Response [!!!] - replace prepare_uri with more flexible prepare_request [!!!] - prepare_request is now available globally and can be set on any object to modify all HTTP requests 0.01003 2011-07-06 19:54:52 Asia/Dubai - add some more tests to live.t - implement $result->count - implement Downloads create and upload - change Repos->create and Repos->update interface - set content-length (fix PUT request without body) - implement $result->first 0.01002 2011-06-30 17:05:58 Asia/Dubai - implement $result->getpage(n) - add per_age parameter/attribute - be less restrictive building api urls using sprintf - implement jsonp_callback - implement $result->next - auto_pagination - sanitize tests which loaded an HTTP response from file 0.01001 2011-06-28 08:59:16 Asia/Dubai - minor POD changes 0.01000 2011-06-27 12:36:44 Asia/Dubai - first release ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������