Slide 1

Slide 1 text

GitHub API VersionEye

Slide 2

Slide 2 text

http://developer.github.com/

Slide 3

Slide 3 text

Use Cases • Login • Fetching Repositories / Files • Crawling Licenses / Change logs and more • Fetching commit dates from tags (release dates)

Slide 4

Slide 4 text

Authentication • Application Authentication • User Authentication (OAuth - user token)

Slide 5

Slide 5 text

Rate Limit • 50 per Hour for unauthenticated requests • 5000 per Hour for authenticated requests

Slide 6

Slide 6 text

Example: Fetching a user

Slide 7

Slide 7 text

url = "https://api.github.com/user"

Slide 8

Slide 8 text

Don’t do that! ! Use Octokit!

Slide 9

Slide 9 text

https://www.versioneye.com/ruby/octokit/2.6.3 Octokit - Ruby client for the GitHub API

Slide 10

Slide 10 text

client = Octokit::Client.new( :access_token => token ) client.user.to_json

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

TESTING

Slide 13

Slide 13 text

https://www.versioneye.com/ruby/vcr/2.8.0 VCR

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

Prepare for failure!

Slide 16

Slide 16 text

Exceptions • GitHub API can be down • Tokens can be revoked • Rate limit can exceed faster then you think • The API can change

Slide 17

Slide 17 text

Q / A @RobertReiz