Skip to content

Commit 0603af9

Browse files
committed
Continue updating and rewriting documentation.
1 parent 2afc440 commit 0603af9

1 file changed

Lines changed: 33 additions & 41 deletions

File tree

README.md

Lines changed: 33 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@ Supports all the API methods. It's built in a modular way. You can either instan
2121

2222
## Features
2323

24-
* Intuitive GitHub API interface navigation. [usage](#1-usage)
25-
* Modular design allows for working with parts of API. [api](#12-api-navigation)
26-
* Fully customizable including advanced middleware stack construction. [config](#3-advanced-configuration)
24+
* Intuitive GitHub API interface navigation.
2725
* It's comprehensive. You can request all GitHub API resources.
28-
* Supports OAuth2 authorization. [oauth](#42-application-oauth-access)
29-
* Flexible argument parsing. You can write expressive and natural queries. [params](#2-arguments--parameters)
30-
* Requests pagination with convenient DSL and automatic options. [pagination](#10-pagination)
31-
* Easy error handling split for client and server type errors. [error](#13-error-handling)
26+
* Modular design allows for working with parts of API.
27+
* Fully customizable including advanced middleware stack construction.
28+
* Supports OAuth2 authorization.
29+
* Flexible argument parsing. You can write expressive and natural queries.
30+
* Requests pagination with convenient DSL and automatic options.
31+
* Easy error handling split for client and server type errors.
3232
* Supports multithreaded environment.
33-
* Custom media type specification through the 'media' parameter. [media](#7-media-types)
34-
* Request results caching (Status: TODO)
35-
* Fully tested with test coverage above 90% with over 1,700 specs and 1200 feature tests. [testing](#16-testing)
33+
* Custom media type specification through the 'media' parameter.
34+
* Request results caching
35+
* Fully tested with unit and feature tests hitting the live api.
3636

3737
## Installation
3838

@@ -94,25 +94,40 @@ github.repos.list user: 'peter-murach'
9494

9595
### 1.1 API Navigation
9696

97-
This gem closely mirrors the GitHub API hierarchy i.e. if you want to create a download resource, look up the GitHub API spec and issue the request as in `github.repos.downloads.create`
97+
The **github_api** closely mirrors the [GitHub API](https://developer.github.com/v3/) hierarchy. For example, if you want to create a new file in a repository, look up the GitHub API spec. In there you will find contents sub category underneath the repository category. This would translte to the request:
9898

99-
For example to interact with GitHub Repositories API, issue the following calls that correspond directly to the GitHub API hierarchy
99+
```ruby
100+
github = Github.new
101+
github.repos.contents.create 'peter-murach', 'finite_machine', 'hello.rb',
102+
path: 'hello.rb',
103+
content: "puts 'hello ruby'"
104+
```
105+
106+
The whole library reflects the same api navigation. Therefore, if you need to list releases for a repository do:
100107

101108
```ruby
102-
github.repos.commits.all 'user-name', 'repo-name'
103-
github.repos.hooks.create 'user-name', 'repo-name', name: "web", active: true
104-
github.repos.keys.get 'user-name', 'repo-name'
109+
github.repos.releases.list 'peter-murach', 'finite_machine'
105110
```
106111

112+
or to list a user's followers:
113+
114+
```ruby
115+
github.users.followers.list 'peter-murach'
116+
```
117+
118+
The code base has been extensively documented with examples of how to use each method. Please refer to the [documentation](http://rubydoc.info/github/peter-murach/github/master/frames) under the `Github::Client` class name.
119+
107120
### 1.2 Modularity
108121

109-
The code base is modular and allows for you to work specifically with a given part of GitHub API e.g. blobs
122+
The code base is modular. This means that you can work specifically with a given part of GitHub API. If you want to only work with activity starring API do the following:
110123

111124
```ruby
112-
blobs = Github::Client::GitData::Blobs.new
113-
blobs.create 'peter-murach', 'github', content: 'Blob content'
125+
starring = Github::Client::Activity::Starring.new
126+
starring.star 'peter-murach', 'github'
114127
```
115128

129+
Please refer to the [documentation](http://rubydoc.info/github/peter-murach/github/master/frames) and look under `Github::Client` to see all avilable classes.
130+
116131
### 1.3 Response Querying
117132
The response is of type [Github::ResponseWrapper] which allows traversing all the json response attributes like method calls i.e.
118133

@@ -458,29 +473,6 @@ github.issues.get 'peter-murach', 'github', 108, accept: 'application/vnd.github
458473

459474
TODO
460475

461-
## 9 Configuration
462-
463-
Certain methods require authentication. To get your GitHub OAuth v2 credentials,
464-
register an app at https://github.com/settings/applications/
465-
You will need to be logged in to register the application.
466-
467-
```ruby
468-
Github.configure do |config|
469-
config.oauth_token = YOUR_OAUTH_ACCESS_TOKEN
470-
config.basic_auth = 'login:password'
471-
end
472-
473-
or
474-
475-
Github.new(:oauth_token => YOUR_OAUTH_TOKEN)
476-
Github.new(:basic_auth => 'login:password')
477-
```
478-
479-
All parameters can be overwritten each method call by passing a parameters hash.
480-
481-
482-
By default, no caching will be performed. In order to set the cache do... If no cache type is provided, a default memoization is done.
483-
484476
## 10 Pagination
485477

486478
Any request that returns multiple items will be paginated to 30 items by default. You can specify custom `page` and `per_page` query parameters to alter default behavior. For instance:

0 commit comments

Comments
 (0)