From f1198341cb5ec5eccd1ec7465d707318ef9b9830 Mon Sep 17 00:00:00 2001 From: Ian MacLennan Date: Sat, 26 Nov 2011 15:41:06 -0500 Subject: [PATCH] Adding documentation for the Github package. --- docs/manual/book.xml | 2 + docs/manual/chapters/github.xml | 100 ++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 docs/manual/chapters/github.xml diff --git a/docs/manual/book.xml b/docs/manual/book.xml index a317e7f59b..9ad0ca41cf 100644 --- a/docs/manual/book.xml +++ b/docs/manual/book.xml @@ -6,6 +6,8 @@ + + diff --git a/docs/manual/chapters/github.xml b/docs/manual/chapters/github.xml new file mode 100644 index 0000000000..2acf3afa97 --- /dev/null +++ b/docs/manual/chapters/github.xml @@ -0,0 +1,100 @@ + + + JGithub + +
+ Using the Github Package + + The Github package is designed to be a straightforward interace for + working with Github. It is based on version 3 of the Github API. You can + find documentation on the API at http://developer.github.com/v3/. + + JGithub is built upon the JHttp package which provides an easy way + to consume URLs and web services in a transport independent way. JHttp + currently supports streams, sockets and CURL. It is possible to create a + custom context and inject it into the JGithub class if one so + desires. + + + +
+ Instantiating JGithub + + Instantiating JGithub is easy: + + $github = new JGithub; + + This creates a basic JGithub object that can be used to access + publically availabe resources on github.com. + + Sometimes it is necessary to specify additional options. This can + be done by injecting in a JRegistry object with your preferred + options:$options = new JRegistry; +$options->set('api.username', 'github_username'); +$options->set('api.password', 'github_password'); + +$github = new JGithub($options); +
+ +
+ Accessing the JGithub APIs + + The Github package is still incomplete, but there are four object + APIs that have currently been implemented: + Gists + + Issues + + References + + Pull Requests + + + Once a JGithub object has been created, it is simple to use it to + access Github:$pullRequests = $github->pulls->getList('joomla', 'joomla-platform');This + will retrieve a list of all open pull requests in the specified + repository. +
+ +
+ A More Complete Example + + See below for an example demonstrating more of the JGithub + package:$options = new JRegistry; +$options->set('api.username', 'github_username'); +$options->set('api.password', 'github_password'); +$options->set('api.url', 'http://myhostedgithub.example.com'); + +$github = new JGithub($options); + +// get a list of all the user's issues +$issues = $github->issues->getList(); + +$issueSummary = array(); + +foreach ($issues AS $issue) +{ + $issueSummary[] = '+ ' . $issue->title; +} + +$summary = implode("\n", $issueSummary); + +$github->gists->create(array('issue_summary.txt' => $summary)); +
+ +
+ More Information + + The following resources contain more information: + Joomla! API + Reference + + Github API + Reference + +
+
+