@@ -1,5 +1,19 @@
Revision history for Pithub
+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)
@@ -89,3 +103,4 @@ Revision history for Pithub
0.01000 2011-06-27 12:36:44 Asia/Dubai
- first release
+
@@ -22,7 +22,7 @@ This is free software, licensed under:
Version 1, February 1989
Copyright (C) 1989 Free Software Foundation, Inc.
- 51 Franklin St, Suite 500, Boston, MA 02110-1335 USA
+ 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.
@@ -1,3 +1,4 @@
+# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.015.
Changes
LICENSE
MANIFEST
@@ -6,9 +7,10 @@ META.yml
Makefile.PL
README
dist.ini
-examples/create_download.pl
+examples/create_release.pl
examples/gitdata_commit.pl
examples/list_repos.pl
+examples/releases.pl
examples/show_commit.pl
lib/Pithub.pm
lib/Pithub/Base.pm
@@ -40,8 +42,11 @@ 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/Search.pm
@@ -4,7 +4,7 @@
"Johannes Plunien <plu@cpan.org>"
],
"dynamic_config" : 0,
- "generated_by" : "Dist::Zilla version 4.300035, CPAN::Meta::Converter version 2.131560",
+ "generated_by" : "Dist::Zilla version 5.015, CPAN::Meta::Converter version 2.140640",
"license" : [
"perl_5"
],
@@ -51,136 +51,236 @@
"web" : "https://github.com/plu/Pithub"
}
},
- "version" : "0.01020",
+ "version" : "0.01024",
"x_Dist_Zilla" : {
"perl" : {
- "version" : "5.016003"
+ "version" : "5.018002"
},
"plugins" : [
{
"class" : "Dist::Zilla::Plugin::GatherDir",
"name" : "@Basic/GatherDir",
- "version" : "4.300035"
+ "version" : "5.015"
},
{
"class" : "Dist::Zilla::Plugin::PruneCruft",
"name" : "@Basic/PruneCruft",
- "version" : "4.300035"
+ "version" : "5.015"
},
{
"class" : "Dist::Zilla::Plugin::ManifestSkip",
"name" : "@Basic/ManifestSkip",
- "version" : "4.300035"
+ "version" : "5.015"
},
{
"class" : "Dist::Zilla::Plugin::MetaYAML",
"name" : "@Basic/MetaYAML",
- "version" : "4.300035"
+ "version" : "5.015"
},
{
"class" : "Dist::Zilla::Plugin::License",
"name" : "@Basic/License",
- "version" : "4.300035"
+ "version" : "5.015"
},
{
"class" : "Dist::Zilla::Plugin::Readme",
"name" : "@Basic/Readme",
- "version" : "4.300035"
+ "version" : "5.015"
},
{
"class" : "Dist::Zilla::Plugin::ExtraTests",
"name" : "@Basic/ExtraTests",
- "version" : "4.300035"
+ "version" : "5.015"
},
{
"class" : "Dist::Zilla::Plugin::ExecDir",
"name" : "@Basic/ExecDir",
- "version" : "4.300035"
+ "version" : "5.015"
},
{
"class" : "Dist::Zilla::Plugin::ShareDir",
"name" : "@Basic/ShareDir",
- "version" : "4.300035"
+ "version" : "5.015"
},
{
"class" : "Dist::Zilla::Plugin::MakeMaker",
+ "config" : {
+ "Dist::Zilla::Role::TestRunner" : {
+ "default_jobs" : 1
+ }
+ },
"name" : "@Basic/MakeMaker",
- "version" : "4.300035"
+ "version" : "5.015"
},
{
"class" : "Dist::Zilla::Plugin::Manifest",
"name" : "@Basic/Manifest",
- "version" : "4.300035"
+ "version" : "5.015"
},
{
"class" : "Dist::Zilla::Plugin::TestRelease",
"name" : "@Basic/TestRelease",
- "version" : "4.300035"
+ "version" : "5.015"
},
{
"class" : "Dist::Zilla::Plugin::ConfirmRelease",
"name" : "@Basic/ConfirmRelease",
- "version" : "4.300035"
+ "version" : "5.015"
},
{
"class" : "Dist::Zilla::Plugin::UploadToCPAN",
"name" : "@Basic/UploadToCPAN",
- "version" : "4.300035"
+ "version" : "5.015"
},
{
"class" : "Dist::Zilla::Plugin::MetaConfig",
"name" : "MetaConfig",
- "version" : "4.300035"
+ "version" : "5.015"
},
{
"class" : "Dist::Zilla::Plugin::MetaJSON",
"name" : "MetaJSON",
- "version" : "4.300035"
+ "version" : "5.015"
},
{
"class" : "Dist::Zilla::Plugin::NextRelease",
"name" : "NextRelease",
- "version" : "4.300035"
+ "version" : "5.015"
},
{
"class" : "Dist::Zilla::Plugin::PkgVersion",
"name" : "PkgVersion",
- "version" : "4.300035"
+ "version" : "5.015"
},
{
"class" : "Dist::Zilla::Plugin::PodSyntaxTests",
"name" : "PodSyntaxTests",
- "version" : "4.300035"
+ "version" : "5.015"
},
{
"class" : "Dist::Zilla::Plugin::PodWeaver",
+ "config" : {
+ "Dist::Zilla::Plugin::PodWeaver" : {
+ "finder" : [
+ ":InstallModules",
+ ":ExecFiles"
+ ],
+ "plugins" : [
+ {
+ "class" : "Pod::Weaver::Plugin::EnsurePod5",
+ "name" : "@CorePrep/EnsurePod5",
+ "version" : "4.006"
+ },
+ {
+ "class" : "Pod::Weaver::Plugin::H1Nester",
+ "name" : "@CorePrep/H1Nester",
+ "version" : "4.006"
+ },
+ {
+ "class" : "Pod::Weaver::Plugin::SingleEncoding",
+ "name" : "@Default/SingleEncoding",
+ "version" : "4.006"
+ },
+ {
+ "class" : "Pod::Weaver::Section::Name",
+ "name" : "@Default/Name",
+ "version" : "4.006"
+ },
+ {
+ "class" : "Pod::Weaver::Section::Version",
+ "name" : "@Default/Version",
+ "version" : "4.006"
+ },
+ {
+ "class" : "Pod::Weaver::Section::Region",
+ "name" : "@Default/prelude",
+ "version" : "4.006"
+ },
+ {
+ "class" : "Pod::Weaver::Section::Generic",
+ "name" : "SYNOPSIS",
+ "version" : "4.006"
+ },
+ {
+ "class" : "Pod::Weaver::Section::Generic",
+ "name" : "DESCRIPTION",
+ "version" : "4.006"
+ },
+ {
+ "class" : "Pod::Weaver::Section::Generic",
+ "name" : "OVERVIEW",
+ "version" : "4.006"
+ },
+ {
+ "class" : "Pod::Weaver::Section::Collect",
+ "name" : "ATTRIBUTES",
+ "version" : "4.006"
+ },
+ {
+ "class" : "Pod::Weaver::Section::Collect",
+ "name" : "METHODS",
+ "version" : "4.006"
+ },
+ {
+ "class" : "Pod::Weaver::Section::Collect",
+ "name" : "FUNCTIONS",
+ "version" : "4.006"
+ },
+ {
+ "class" : "Pod::Weaver::Section::Leftovers",
+ "name" : "@Default/Leftovers",
+ "version" : "4.006"
+ },
+ {
+ "class" : "Pod::Weaver::Section::Region",
+ "name" : "@Default/postlude",
+ "version" : "4.006"
+ },
+ {
+ "class" : "Pod::Weaver::Section::Authors",
+ "name" : "@Default/Authors",
+ "version" : "4.006"
+ },
+ {
+ "class" : "Pod::Weaver::Section::Legal",
+ "name" : "@Default/Legal",
+ "version" : "4.006"
+ }
+ ]
+ }
+ },
"name" : "PodWeaver",
- "version" : "3.101641"
+ "version" : "4.005"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::ReadmeAnyFromPod",
+ "name" : "ReadmeAnyFromPod",
+ "version" : "0.133360"
},
{
"class" : "Dist::Zilla::Plugin::GithubMeta",
"name" : "GithubMeta",
- "version" : "0.28"
+ "version" : "0.42"
},
{
"class" : "Dist::Zilla::Plugin::Git::NextVersion",
"name" : "Git::NextVersion",
- "version" : "2.014"
+ "version" : "2.020"
},
{
"class" : "Dist::Zilla::Plugin::Git::Check",
"name" : "Git::Check",
- "version" : "2.014"
+ "version" : "2.020"
},
{
"class" : "Dist::Zilla::Plugin::Git::Commit",
"name" : "Git::Commit",
- "version" : "2.014"
+ "version" : "2.020"
},
{
"class" : "Dist::Zilla::Plugin::Git::Tag",
"name" : "Git::Tag",
- "version" : "2.014"
+ "version" : "2.020"
},
{
"class" : "Dist::Zilla::Plugin::Prereqs",
@@ -191,7 +291,7 @@
}
},
"name" : "TestRequires",
- "version" : "4.300035"
+ "version" : "5.015"
},
{
"class" : "Dist::Zilla::Plugin::Prereqs",
@@ -202,37 +302,47 @@
}
},
"name" : "Prereqs",
- "version" : "4.300035"
+ "version" : "5.015"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":InstallModules",
- "version" : "4.300035"
+ "version" : "5.015"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":IncModules",
- "version" : "4.300035"
+ "version" : "5.015"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":TestFiles",
- "version" : "4.300035"
+ "version" : "5.015"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":ExecFiles",
- "version" : "4.300035"
+ "version" : "5.015"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":ShareFiles",
- "version" : "4.300035"
+ "version" : "5.015"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":MainModule",
- "version" : "4.300035"
+ "version" : "5.015"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::FinderCode",
+ "name" : ":AllFiles",
+ "version" : "5.015"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::FinderCode",
+ "name" : ":NoFiles",
+ "version" : "5.015"
}
],
"zilla" : {
@@ -240,7 +350,7 @@
"config" : {
"is_trial" : "0"
},
- "version" : "4.300035"
+ "version" : "5.015"
}
}
}
@@ -3,133 +3,210 @@ abstract: 'Github v3 API'
author:
- 'Johannes Plunien <plu@cpan.org>'
build_requires:
- File::Slurp: 0
- MIME::Base64: 0
- Test::Most: 0
+ File::Slurp: '0'
+ MIME::Base64: '0'
+ Test::Most: '0'
configure_requires:
- ExtUtils::MakeMaker: 6.30
+ ExtUtils::MakeMaker: '6.30'
dynamic_config: 0
-generated_by: 'Dist::Zilla version 4.300035, CPAN::Meta::Converter version 2.131560'
+generated_by: 'Dist::Zilla version 5.015, CPAN::Meta::Converter version 2.140640'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
- version: 1.4
+ version: '1.4'
name: Pithub
requires:
- Array::Iterator: 0
- HTTP::Message: 0
- JSON: 0
- LWP::Protocol::https: 0
- LWP::UserAgent: 0
- Moo: 0
+ Array::Iterator: '0'
+ HTTP::Message: '0'
+ JSON: '0'
+ LWP::Protocol::https: '0'
+ LWP::UserAgent: '0'
+ Moo: '0'
resources:
homepage: https://github.com/plu/Pithub
repository: https://github.com/plu/Pithub.git
-version: 0.01020
+version: '0.01024'
x_Dist_Zilla:
perl:
- version: 5.016003
+ version: '5.018002'
plugins:
-
class: Dist::Zilla::Plugin::GatherDir
name: '@Basic/GatherDir'
- version: 4.300035
+ version: '5.015'
-
class: Dist::Zilla::Plugin::PruneCruft
name: '@Basic/PruneCruft'
- version: 4.300035
+ version: '5.015'
-
class: Dist::Zilla::Plugin::ManifestSkip
name: '@Basic/ManifestSkip'
- version: 4.300035
+ version: '5.015'
-
class: Dist::Zilla::Plugin::MetaYAML
name: '@Basic/MetaYAML'
- version: 4.300035
+ version: '5.015'
-
class: Dist::Zilla::Plugin::License
name: '@Basic/License'
- version: 4.300035
+ version: '5.015'
-
class: Dist::Zilla::Plugin::Readme
name: '@Basic/Readme'
- version: 4.300035
+ version: '5.015'
-
class: Dist::Zilla::Plugin::ExtraTests
name: '@Basic/ExtraTests'
- version: 4.300035
+ version: '5.015'
-
class: Dist::Zilla::Plugin::ExecDir
name: '@Basic/ExecDir'
- version: 4.300035
+ version: '5.015'
-
class: Dist::Zilla::Plugin::ShareDir
name: '@Basic/ShareDir'
- version: 4.300035
+ version: '5.015'
-
class: Dist::Zilla::Plugin::MakeMaker
+ config:
+ Dist::Zilla::Role::TestRunner:
+ default_jobs: 1
name: '@Basic/MakeMaker'
- version: 4.300035
+ version: '5.015'
-
class: Dist::Zilla::Plugin::Manifest
name: '@Basic/Manifest'
- version: 4.300035
+ version: '5.015'
-
class: Dist::Zilla::Plugin::TestRelease
name: '@Basic/TestRelease'
- version: 4.300035
+ version: '5.015'
-
class: Dist::Zilla::Plugin::ConfirmRelease
name: '@Basic/ConfirmRelease'
- version: 4.300035
+ version: '5.015'
-
class: Dist::Zilla::Plugin::UploadToCPAN
name: '@Basic/UploadToCPAN'
- version: 4.300035
+ version: '5.015'
-
class: Dist::Zilla::Plugin::MetaConfig
name: MetaConfig
- version: 4.300035
+ version: '5.015'
-
class: Dist::Zilla::Plugin::MetaJSON
name: MetaJSON
- version: 4.300035
+ version: '5.015'
-
class: Dist::Zilla::Plugin::NextRelease
name: NextRelease
- version: 4.300035
+ version: '5.015'
-
class: Dist::Zilla::Plugin::PkgVersion
name: PkgVersion
- version: 4.300035
+ version: '5.015'
-
class: Dist::Zilla::Plugin::PodSyntaxTests
name: PodSyntaxTests
- version: 4.300035
+ version: '5.015'
-
class: Dist::Zilla::Plugin::PodWeaver
+ config:
+ Dist::Zilla::Plugin::PodWeaver:
+ finder:
+ - ':InstallModules'
+ - ':ExecFiles'
+ plugins:
+ -
+ class: Pod::Weaver::Plugin::EnsurePod5
+ name: '@CorePrep/EnsurePod5'
+ version: '4.006'
+ -
+ class: Pod::Weaver::Plugin::H1Nester
+ name: '@CorePrep/H1Nester'
+ version: '4.006'
+ -
+ class: Pod::Weaver::Plugin::SingleEncoding
+ name: '@Default/SingleEncoding'
+ version: '4.006'
+ -
+ class: Pod::Weaver::Section::Name
+ name: '@Default/Name'
+ version: '4.006'
+ -
+ class: Pod::Weaver::Section::Version
+ name: '@Default/Version'
+ version: '4.006'
+ -
+ class: Pod::Weaver::Section::Region
+ name: '@Default/prelude'
+ version: '4.006'
+ -
+ class: Pod::Weaver::Section::Generic
+ name: SYNOPSIS
+ version: '4.006'
+ -
+ class: Pod::Weaver::Section::Generic
+ name: DESCRIPTION
+ version: '4.006'
+ -
+ class: Pod::Weaver::Section::Generic
+ name: OVERVIEW
+ version: '4.006'
+ -
+ class: Pod::Weaver::Section::Collect
+ name: ATTRIBUTES
+ version: '4.006'
+ -
+ class: Pod::Weaver::Section::Collect
+ name: METHODS
+ version: '4.006'
+ -
+ class: Pod::Weaver::Section::Collect
+ name: FUNCTIONS
+ version: '4.006'
+ -
+ class: Pod::Weaver::Section::Leftovers
+ name: '@Default/Leftovers'
+ version: '4.006'
+ -
+ class: Pod::Weaver::Section::Region
+ name: '@Default/postlude'
+ version: '4.006'
+ -
+ class: Pod::Weaver::Section::Authors
+ name: '@Default/Authors'
+ version: '4.006'
+ -
+ class: Pod::Weaver::Section::Legal
+ name: '@Default/Legal'
+ version: '4.006'
name: PodWeaver
- version: 3.101641
+ version: '4.005'
+ -
+ class: Dist::Zilla::Plugin::ReadmeAnyFromPod
+ name: ReadmeAnyFromPod
+ version: '0.133360'
-
class: Dist::Zilla::Plugin::GithubMeta
name: GithubMeta
- version: 0.28
+ version: '0.42'
-
class: Dist::Zilla::Plugin::Git::NextVersion
name: Git::NextVersion
- version: 2.014
+ version: '2.020'
-
class: Dist::Zilla::Plugin::Git::Check
name: Git::Check
- version: 2.014
+ version: '2.020'
-
class: Dist::Zilla::Plugin::Git::Commit
name: Git::Commit
- version: 2.014
+ version: '2.020'
-
class: Dist::Zilla::Plugin::Git::Tag
name: Git::Tag
- version: 2.014
+ version: '2.020'
-
class: Dist::Zilla::Plugin::Prereqs
config:
@@ -137,7 +214,7 @@ x_Dist_Zilla:
phase: test
type: requires
name: TestRequires
- version: 4.300035
+ version: '5.015'
-
class: Dist::Zilla::Plugin::Prereqs
config:
@@ -145,33 +222,41 @@ x_Dist_Zilla:
phase: runtime
type: requires
name: Prereqs
- version: 4.300035
+ version: '5.015'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':InstallModules'
- version: 4.300035
+ version: '5.015'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':IncModules'
- version: 4.300035
+ version: '5.015'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':TestFiles'
- version: 4.300035
+ version: '5.015'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':ExecFiles'
- version: 4.300035
+ version: '5.015'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':ShareFiles'
- version: 4.300035
+ version: '5.015'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':MainModule'
- version: 4.300035
+ version: '5.015'
+ -
+ class: Dist::Zilla::Plugin::FinderCode
+ name: ':AllFiles'
+ version: '5.015'
+ -
+ class: Dist::Zilla::Plugin::FinderCode
+ name: ':NoFiles'
+ version: '5.015'
zilla:
class: Dist::Zilla::Dist::Builder
config:
- is_trial: 0
- version: 4.300035
+ is_trial: '0'
+ version: '5.015'
@@ -1,4 +1,5 @@
+# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.015.
use strict;
use warnings;
@@ -32,37 +33,30 @@ my %WriteMakefileArgs = (
"MIME::Base64" => 0,
"Test::Most" => 0
},
- "VERSION" => "0.01020",
+ "VERSION" => "0.01024",
"test" => {
"TESTS" => "t/*.t t/live/*.t"
}
);
-unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
- my $tr = delete $WriteMakefileArgs{TEST_REQUIRES};
- my $br = $WriteMakefileArgs{BUILD_REQUIRES};
- for my $mod ( keys %$tr ) {
- if ( exists $br->{$mod} ) {
- $br->{$mod} = $tr->{$mod} if $tr->{$mod} > $br->{$mod};
- }
- else {
- $br->{$mod} = $tr->{$mod};
- }
- }
-}
+my %FallbackPrereqs = (
+ "Array::Iterator" => 0,
+ "File::Slurp" => 0,
+ "HTTP::Message" => 0,
+ "JSON" => 0,
+ "LWP::Protocol::https" => 0,
+ "LWP::UserAgent" => 0,
+ "MIME::Base64" => 0,
+ "Moo" => 0,
+ "Test::Most" => 0
+);
-unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) {
- my $br = delete $WriteMakefileArgs{BUILD_REQUIRES};
- my $pp = $WriteMakefileArgs{PREREQ_PM};
- for my $mod ( keys %$br ) {
- if ( exists $pp->{$mod} ) {
- $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod};
- }
- else {
- $pp->{$mod} = $br->{$mod};
- }
- }
+
+unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
+ delete $WriteMakefileArgs{TEST_REQUIRES};
+ delete $WriteMakefileArgs{BUILD_REQUIRES};
+ $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs;
}
delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
@@ -1,7 +1,7 @@
This archive contains the distribution Pithub,
-version 0.01020:
+version 0.01024:
Github v3 API
@@ -11,3 +11,5 @@ This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
+This README file was generated by Dist::Zilla::Plugin::Readme v5.015.
+
@@ -13,6 +13,10 @@ name = Pithub
[PodSyntaxTests]
[PodWeaver]
+[ReadmeAnyFromPod]
+type = markdown
+location = root
+
[GithubMeta]
user = plu
remote = origin
@@ -1,14 +0,0 @@
-#!/usr/bin/env perl
-use strict;
-use warnings;
-use Pithub::Issues::Assignees;
-
-my $assignees = Pithub::Issues::Assignees->new(
- repo => 'Pithub',
- token => $ENV{GITHUB_TOKEN},
- user => 'plu',
-);
-
-use Data::Dumper;
-
-warn Dumper $assignees->list->content;
@@ -0,0 +1,36 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Data::Dumper;
+use Pithub::Repos::Releases;
+
+my $releases = Pithub::Repos::Releases->new(
+ repo => 'buhtip-repo',
+ token => $ENV{GITHUB_TOKEN},
+ user => 'buhtip',
+);
+
+my $release = $releases->create(
+ data => {
+ name => "v1.0.$$",
+ tag_name => "v1.0.$$",
+ target_commitisih => 'master',
+ }
+);
+
+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;
@@ -0,0 +1,20 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Pithub::Repos::Releases;
+use Data::Dumper;
+
+# 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};
+}
@@ -1,8 +1,5 @@
package Pithub::Base;
-{
- $Pithub::Base::VERSION = '0.01020';
-}
-
+$Pithub::Base::VERSION = '0.01024';
# ABSTRACT: Github v3 base class for all Pithub modules
use Moo;
@@ -122,6 +119,8 @@ my @TOKEN_REQUIRED_REGEXP = (
qr{^DELETE /repos/[^/]+/[^/]+/labels/.*?$},
qr{^DELETE /repos/[^/]+/[^/]+/milestones/.*?$},
qr{^DELETE /repos/[^/]+/[^/]+/pulls/comments/.*?$},
+ qr{^DELETE /repos/[^/]+/[^/]+/releases/.*?$},
+ qr{^DELETE /repos/[^/]+/[^/]+/releases/assets/.*?$},
qr{^DELETE /teams/.*?$},
qr{^DELETE /teams/[^/]+/members/.*?$},
qr{^DELETE /teams/[^/]+/repos/.*?$},
@@ -165,10 +164,12 @@ my @TOKEN_REQUIRED_REGEXP = (
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$},
@@ -189,6 +190,7 @@ my @TOKEN_REQUIRED_REGEXP = (
qr{^POST /repos/[^/]+/[^/]+/labels$},
qr{^POST /repos/[^/]+/[^/]+/milestones$},
qr{^POST /repos/[^/]+/[^/]+/pulls$},
+ qr{^POST /repos/[^/]+/[^/]+/releases$},
qr{^POST /repos/[^/]+/[^/]+/pulls/[^/]+/comments$},
qr{^PUT /gists/[^/]+/star$},
qr{^PUT /orgs/[^/]+/public_members/.*?$},
@@ -206,9 +208,9 @@ my @TOKEN_REQUIRED_REGEXP = (
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 $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};
@@ -216,13 +218,26 @@ sub request {
my $uri = $self->_uri_for($path);
+ if (my $host = delete $args{host}) {
+ $uri->host($host);
+ }
+
+ if (my $query = delete $args{query}) {
+ $uri->query_form(%$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';
@@ -316,8 +331,8 @@ sub _request_for {
my $request = HTTP::Request->new( $method, $uri, $headers );
if ($data) {
- my $json = $self->_json->encode($data);
- $request->content($json);
+ $data = $self->_json->encode($data) if ref $data;
+ $request->content($data);
}
$request->header( 'Content-Length' => length $request->content );
@@ -375,13 +390,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::Base - Github v3 base class for all Pithub modules
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 DESCRIPTION
@@ -1,8 +1,5 @@
package Pithub::Events;
-{
- $Pithub::Events::VERSION = '0.01020';
-}
-
+$Pithub::Events::VERSION = '0.01024';
# ABSTRACT: Github v3 Events API
use Moo;
@@ -111,13 +108,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::Events - Github v3 Events API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -1,8 +1,5 @@
package Pithub::Gists::Comments;
-{
- $Pithub::Gists::Comments::VERSION = '0.01020';
-}
-
+$Pithub::Gists::Comments::VERSION = '0.01024';
# ABSTRACT: Github v3 Gist Comments API
use Moo;
@@ -72,13 +69,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::Gists::Comments - Github v3 Gist Comments API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -1,8 +1,5 @@
package Pithub::Gists;
-{
- $Pithub::Gists::VERSION = '0.01020';
-}
-
+$Pithub::Gists::VERSION = '0.01024';
# ABSTRACT: Github v3 Gists API
use Moo;
@@ -141,13 +138,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::Gists - Github v3 Gists API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -1,8 +1,5 @@
package Pithub::GitData::Blobs;
-{
- $Pithub::GitData::Blobs::VERSION = '0.01020';
-}
-
+$Pithub::GitData::Blobs::VERSION = '0.01024';
# ABSTRACT: Github v3 Git Data Blobs API
use Moo;
@@ -39,13 +36,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::GitData::Blobs - Github v3 Git Data Blobs API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 DESCRIPTION
@@ -1,8 +1,5 @@
package Pithub::GitData::Commits;
-{
- $Pithub::GitData::Commits::VERSION = '0.01020';
-}
-
+$Pithub::GitData::Commits::VERSION = '0.01024';
# ABSTRACT: Github v3 Git Data Commits API
use Moo;
@@ -39,13 +36,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::GitData::Commits - Github v3 Git Data Commits API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -1,8 +1,5 @@
package Pithub::GitData::References;
-{
- $Pithub::GitData::References::VERSION = '0.01020';
-}
-
+$Pithub::GitData::References::VERSION = '0.01024';
# ABSTRACT: Github v3 Git Data References API
use Moo;
@@ -70,13 +67,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::GitData::References - Github v3 Git Data References API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -1,8 +1,5 @@
package Pithub::GitData::Tags;
-{
- $Pithub::GitData::Tags::VERSION = '0.01020';
-}
-
+$Pithub::GitData::Tags::VERSION = '0.01024';
# ABSTRACT: Github v3 Git Data Tags API
use Moo;
@@ -39,13 +36,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::GitData::Tags - Github v3 Git Data Tags API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 DESCRIPTION
@@ -1,8 +1,5 @@
package Pithub::GitData::Trees;
-{
- $Pithub::GitData::Trees::VERSION = '0.01020';
-}
-
+$Pithub::GitData::Trees::VERSION = '0.01024';
# ABSTRACT: Github v3 Git Data Trees API
use Moo;
@@ -45,13 +42,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::GitData::Trees - Github v3 Git Data Trees API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -1,8 +1,5 @@
package Pithub::GitData;
-{
- $Pithub::GitData::VERSION = '0.01020';
-}
-
+$Pithub::GitData::VERSION = '0.01024';
# ABSTRACT: Github v3 Git Data API
use Moo;
@@ -45,13 +42,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::GitData - Github v3 Git Data API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -1,8 +1,5 @@
package Pithub::Issues::Assignees;
-{
- $Pithub::Issues::Assignees::VERSION = '0.01020';
-}
-
+$Pithub::Issues::Assignees::VERSION = '0.01024';
# ABSTRACT: Github v3 Issue Assignees API
use Moo;
@@ -38,13 +35,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::Issues::Assignees - Github v3 Issue Assignees API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -1,8 +1,5 @@
package Pithub::Issues::Comments;
-{
- $Pithub::Issues::Comments::VERSION = '0.01020';
-}
-
+$Pithub::Issues::Comments::VERSION = '0.01024';
# ABSTRACT: Github v3 Issue Comments API
use Moo;
@@ -77,13 +74,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::Issues::Comments - Github v3 Issue Comments API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -1,8 +1,5 @@
package Pithub::Issues::Events;
-{
- $Pithub::Issues::Events::VERSION = '0.01020';
-}
-
+$Pithub::Issues::Events::VERSION = '0.01024';
# ABSTRACT: Github v3 Issue Events API
use Moo;
@@ -45,13 +42,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::Issues::Events - Github v3 Issue Events API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -1,8 +1,5 @@
package Pithub::Issues::Labels;
-{
- $Pithub::Issues::Labels::VERSION = '0.01020';
-}
-
+$Pithub::Issues::Labels::VERSION = '0.01024';
# ABSTRACT: Github v3 Issue Labels API
use Moo;
@@ -134,13 +131,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::Issues::Labels - Github v3 Issue Labels API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -1,8 +1,5 @@
package Pithub::Issues::Milestones;
-{
- $Pithub::Issues::Milestones::VERSION = '0.01020';
-}
-
+$Pithub::Issues::Milestones::VERSION = '0.01024';
# ABSTRACT: Github v3 Issue Milestones API
use Moo;
@@ -75,13 +72,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::Issues::Milestones - Github v3 Issue Milestones API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -1,8 +1,5 @@
package Pithub::Issues;
-{
- $Pithub::Issues::VERSION = '0.01020';
-}
-
+$Pithub::Issues::VERSION = '0.01024';
# ABSTRACT: Github v3 Issues API
use Moo;
@@ -100,13 +97,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::Issues - Github v3 Issues API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -1,8 +1,5 @@
package Pithub::Orgs::Members;
-{
- $Pithub::Orgs::Members::VERSION = '0.01020';
-}
-
+$Pithub::Orgs::Members::VERSION = '0.01024';
# ABSTRACT: Github v3 Org Members API
use Moo;
@@ -97,13 +94,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::Orgs::Members - Github v3 Org Members API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -1,8 +1,5 @@
package Pithub::Orgs::Teams;
-{
- $Pithub::Orgs::Teams::VERSION = '0.01020';
-}
-
+$Pithub::Orgs::Teams::VERSION = '0.01024';
# ABSTRACT: Github v3 Org Teams API
use Moo;
@@ -26,9 +23,13 @@ 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', delete $args{team_id}, delete $args{repo} ),
+ path => sprintf( '/teams/%s/repos/%s/%s',
+ delete $args{team_id},
+ delete $args{org},
+ delete $args{repo} ),
%args,
);
}
@@ -166,13 +167,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::Orgs::Teams - Github v3 Org Teams API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -211,6 +214,7 @@ Examples:
my $result = $t->add_repo(
team_id => 1,
repo => 'some_repo',
+ org => 'our_organization',
);
=back
@@ -1,8 +1,5 @@
package Pithub::Orgs;
-{
- $Pithub::Orgs::VERSION = '0.01020';
-}
-
+$Pithub::Orgs::VERSION = '0.01024';
# ABSTRACT: Github v3 Orgs API
use Moo;
@@ -67,13 +64,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::Orgs - Github v3 Orgs API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -1,8 +1,5 @@
package Pithub::PullRequests::Comments;
-{
- $Pithub::PullRequests::Comments::VERSION = '0.01020';
-}
-
+$Pithub::PullRequests::Comments::VERSION = '0.01024';
# ABSTRACT: Github v3 Pull Request Comments API
use Moo;
@@ -77,13 +74,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::PullRequests::Comments - Github v3 Pull Request Comments API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -1,8 +1,5 @@
package Pithub::PullRequests;
-{
- $Pithub::PullRequests::VERSION = '0.01020';
-}
-
+$Pithub::PullRequests::VERSION = '0.01024';
# ABSTRACT: Github v3 Pull Requests API
use Moo;
@@ -117,13 +114,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::PullRequests - Github v3 Pull Requests API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -1,8 +1,5 @@
package Pithub::Repos::Collaborators;
-{
- $Pithub::Repos::Collaborators::VERSION = '0.01020';
-}
-
+$Pithub::Repos::Collaborators::VERSION = '0.01024';
# ABSTRACT: Github v3 Repo Collaborators API
use Moo;
@@ -62,13 +59,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::Repos::Collaborators - Github v3 Repo Collaborators API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -1,8 +1,5 @@
package Pithub::Repos::Commits;
-{
- $Pithub::Repos::Commits::VERSION = '0.01020';
-}
-
+$Pithub::Repos::Commits::VERSION = '0.01024';
# ABSTRACT: Github v3 Repo Commits API
use Moo;
@@ -119,13 +116,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::Repos::Commits - Github v3 Repo Commits API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -1,8 +1,5 @@
package Pithub::Repos::Contents;
-{
- $Pithub::Repos::Contents::VERSION = '0.01020';
-}
-
+$Pithub::Repos::Contents::VERSION = '0.01024';
# ABSTRACT: Github v3 Repo Contents API
use Moo;
@@ -57,13 +54,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::Repos::Contents - Github v3 Repo Contents API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -1,8 +1,5 @@
package Pithub::Repos::Downloads;
-{
- $Pithub::Repos::Downloads::VERSION = '0.01020';
-}
-
+$Pithub::Repos::Downloads::VERSION = '0.01024';
# ABSTRACT: Github v3 Repo Downloads API
use Moo;
@@ -90,13 +87,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::Repos::Downloads - Github v3 Repo Downloads API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -212,6 +211,12 @@ 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<Pithub::Repos::Releases> instead.
+
=head1 AUTHOR
Johannes Plunien <plu@cpan.org>
@@ -1,8 +1,5 @@
package Pithub::Repos::Forks;
-{
- $Pithub::Repos::Forks::VERSION = '0.01020';
-}
-
+$Pithub::Repos::Forks::VERSION = '0.01024';
# ABSTRACT: Github v3 Repo Forks API
use Moo;
@@ -45,13 +42,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::Repos::Forks - Github v3 Repo Forks API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -1,8 +1,5 @@
package Pithub::Repos::Hooks;
-{
- $Pithub::Repos::Hooks::VERSION = '0.01020';
-}
-
+$Pithub::Repos::Hooks::VERSION = '0.01024';
# ABSTRACT: Github v3 Repo Hooks API
use Moo;
@@ -87,13 +84,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::Repos::Hooks - Github v3 Repo Hooks API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -1,8 +1,5 @@
package Pithub::Repos::Keys;
-{
- $Pithub::Repos::Keys::VERSION = '0.01020';
-}
-
+$Pithub::Repos::Keys::VERSION = '0.01024';
# ABSTRACT: Github v3 Repo Keys API
use Moo;
@@ -75,13 +72,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::Repos::Keys - Github v3 Repo Keys API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -0,0 +1,219 @@
+package Pithub::Repos::Releases::Assets;
+$Pithub::Repos::Releases::Assets::VERSION = '0.01024';
+# 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.01024
+
+=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 <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
@@ -0,0 +1,227 @@
+package Pithub::Repos::Releases;
+$Pithub::Repos::Releases::VERSION = '0.01024';
+# 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.01024
+
+=head1 METHODS
+
+=head2 assets
+
+Provides access to L<Pithub::Repos::Releases::Assets>.
+
+=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 => 0,
+ prerelease => 0,
+ }
+ );
+
+=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 <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
@@ -1,8 +1,5 @@
package Pithub::Repos::Starring;
-{
- $Pithub::Repos::Starring::VERSION = '0.01020';
-}
-
+$Pithub::Repos::Starring::VERSION = '0.01024';
# ABSTRACT: Github v3 Repo Starring API
use Moo;
@@ -76,13 +73,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::Repos::Starring - Github v3 Repo Starring API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -1,8 +1,5 @@
package Pithub::Repos::Stats;
-{
- $Pithub::Repos::Stats::VERSION = '0.01020';
-}
-
+$Pithub::Repos::Stats::VERSION = '0.01024';
# ABSTRACT: Github v3 repos / stats API
use Moo;
@@ -44,13 +41,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::Repos::Stats - Github v3 repos / stats API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -0,0 +1,138 @@
+package Pithub::Repos::Statuses;
+$Pithub::Repos::Statuses::VERSION = '0.01024';
+# 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.01024
+
+=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 => {
+ status => 'error',
+ description => 'Build failed',
+ target_url => 'https://travis-ci.org/some/url/0123456',
+ },
+ );
+
+=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
@@ -1,8 +1,5 @@
package Pithub::Repos::Watching;
-{
- $Pithub::Repos::Watching::VERSION = '0.01020';
-}
-
+$Pithub::Repos::Watching::VERSION = '0.01024';
# ABSTRACT: Github v3 Repo Watching API
use Moo;
@@ -76,13 +73,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::Repos::Watching - Github v3 Repo Watching API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -1,8 +1,5 @@
package Pithub::Repos;
-{
- $Pithub::Repos::VERSION = '0.01020';
-}
-
+$Pithub::Repos::VERSION = '0.01024';
# ABSTRACT: Github v3 Repos API
use Moo;
@@ -14,7 +11,10 @@ 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';
@@ -86,11 +86,6 @@ sub forks {
}
-sub stats {
- return shift->_create_instance('Pitbub::Repos::Stats');
-}
-
-
sub get {
my ( $self, %args ) = @_;
$self->_validate_user_repo_args( \%args );
@@ -149,11 +144,26 @@ sub list {
}
+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 );
@@ -198,13 +208,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::Repos - Github v3 Repos API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -294,10 +306,6 @@ Provides access to L<Pithub::Repos::Downloads>.
Provides access to L<Pithub::Repos::Forks>.
-=head2 stats
-
-Provide access to L<Pithub::Repos::Stats>.
-
=head2 get
=over
@@ -379,10 +387,22 @@ Examples:
=back
+=head2 releases
+
+Provides access to L<Pithub::Repos::Releases>.
+
=head2 starring
Provides access to L<Pithub::Repos::Starring>.
+=head2 stats
+
+Provide access to L<Pithub::Repos::Stats>.
+
+=head2 statuses
+
+Provide access to L<Pithub::Repos::Statuses>.
+
=head2 tags
=over
@@ -1,8 +1,5 @@
package Pithub::Result;
-{
- $Pithub::Result::VERSION = '0.01020';
-}
-
+$Pithub::Result::VERSION = '0.01024';
# ABSTRACT: Github v3 result object
use Moo;
@@ -283,13 +280,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::Result - Github v3 result object
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 DESCRIPTION
@@ -1,8 +1,5 @@
package Pithub::Search;
-{
- $Pithub::Search::VERSION = '0.01020';
-}
-
+$Pithub::Search::VERSION = '0.01024';
# ABSTRACT: Github v3 Search API
use Moo;
@@ -61,13 +58,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::Search - Github v3 Search API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -1,8 +1,5 @@
package Pithub::Users::Emails;
-{
- $Pithub::Users::Emails::VERSION = '0.01020';
-}
-
+$Pithub::Users::Emails::VERSION = '0.01024';
# ABSTRACT: Github v3 User Emails API
use Moo;
@@ -47,13 +44,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::Users::Emails - Github v3 User Emails API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -1,8 +1,5 @@
package Pithub::Users::Followers;
-{
- $Pithub::Users::Followers::VERSION = '0.01020';
-}
-
+$Pithub::Users::Followers::VERSION = '0.01024';
# ABSTRACT: Github v3 User Followers API
use Moo;
@@ -82,13 +79,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::Users::Followers - Github v3 User Followers API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -1,8 +1,5 @@
package Pithub::Users::Keys;
-{
- $Pithub::Users::Keys::VERSION = '0.01020';
-}
-
+$Pithub::Users::Keys::VERSION = '0.01024';
# ABSTRACT: Github v3 User Keys API
use Moo;
@@ -70,13 +67,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::Users::Keys - Github v3 User Keys API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -1,8 +1,5 @@
package Pithub::Users;
-{
- $Pithub::Users::VERSION = '0.01020';
-}
-
+$Pithub::Users::VERSION = '0.01024';
# ABSTRACT: Github v3 Users API
use Moo;
@@ -61,13 +58,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub::Users - Github v3 Users API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 METHODS
@@ -1,8 +1,5 @@
package Pithub;
-{
- $Pithub::VERSION = '0.01020';
-}
-
+$Pithub::VERSION = '0.01024';
# ABSTRACT: Github v3 API
use Moo;
@@ -70,13 +67,15 @@ __END__
=pod
+=encoding UTF-8
+
=head1 NAME
Pithub - Github v3 API
=head1 VERSION
-version 0.01020
+version 0.01024
=head1 SYNOPSIS
@@ -483,6 +482,10 @@ See also: L<http://developer.github.com/v3/repos/contents/>
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;
@@ -511,6 +514,51 @@ See also: L<http://developer.github.com/v3/repos/keys/>
=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;
+
+=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/>
@@ -162,11 +162,33 @@ my @tree = (
methods => [qw(create delete get list 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)],
@@ -257,7 +279,7 @@ sub validate_tree {
next if $node->{isa} eq 'Pithub::Repos::Downloads' and $method eq 'upload';
my $result;
- my $data = {};
+ my $data = {state => 'pending'};
# unfortunately the API expects arrayrefs on a very few calls
$data = []
@@ -267,9 +289,11 @@ sub validate_tree {
lives_ok {
$result = $obj->$accessor->$method(
archive_format => 'tarball',
+ asset_id => 1,
assignee => 'john',
collaborator => 1,
comment_id => 1,
+ content_type => 'text/plain',
data => $data,
download_id => 1,
email => 'foo',
@@ -281,6 +305,7 @@ sub validate_tree {
keyword => 'foo',
label => 1,
milestone_id => 1,
+ name => 'foo',
options => {
prepare_request => sub {
shift->header( 'Accept' => 'foo.bar' );
@@ -289,6 +314,7 @@ sub validate_tree {
org => 1,
pull_request_id => 1,
ref => 1,
+ release_id => 1,
repo => 1,
sha => 1,
state => 'open',
@@ -284,14 +284,15 @@ BEGIN {
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{Access token required for: PUT /teams/123/repos/bar\s+}, 'Token required';
+ 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' );
+ 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/bar', 'HTTP path';
+ is $result->request->uri->path, '/teams/123/repos/myorg/bar', 'HTTP path';
my $http_request = $result->request;
is $http_request->content, '', 'HTTP body';
}
@@ -7,9 +7,8 @@ BEGIN {
}
}
+# This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests.
use Test::More;
-
-eval "use Test::Pod 1.41";
-plan skip_all => "Test::Pod 1.41 required for testing POD" if $@;
+use Test::Pod 1.41;
all_pod_files_ok();
@@ -12,9 +12,12 @@ BEGIN {
use_ok('Pithub::Repos::Forks');
use_ok('Pithub::Repos::Hooks');
use_ok('Pithub::Repos::Keys');
- use_ok('Pithub::Repos::Watching');
+ 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
@@ -573,6 +576,201 @@ BEGIN {
}
}
+# Pithub::Repos::Releases->list
+{
+ my $obj = Pithub::Test->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, '', 'HTTP body';
+ }
+}
+
+# Pithub::Repos::Releases->get
+{
+ my $obj = Pithub::Test->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, '', 'HTTP body';
+ }
+}
+
+# Pithub::Repos::Releases->create
+{
+ my $obj = Pithub::Test->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->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->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, '', 'HTTP body';
+ }
+}
+
+# Pithub::Repos::Releases::Assets->create
+{
+ my $obj = Pithub::Test->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, '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->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, '', 'HTTP body';
+ }
+}
+
+# Pithub::Repos::Releases::Assets->get
+{
+ my $obj = Pithub::Test->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, '', 'HTTP body';
+ }
+}
+
+# Pithub::Repos::Releases::Assets->list
+{
+ my $obj = Pithub::Test->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, '', 'HTTP body';
+ }
+}
+
+# Pithub::Repos::Releases::Assets->update
+{
+ my $json = JSON->new;
+ my $obj = Pithub::Test->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->create( 'Pithub::Repos::Starring', user => 'foo', repo => 'bar' );
@@ -874,4 +1072,29 @@ BEGIN {
}
}
+# Pithub::Repos::Statuses->list
+#
+# Pithub::Repos::Statuses->create
+#
+{
+ my $obj = Pithub::Test->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, '', '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';
+ }
+}
+
done_testing;