octokit 3.1.0 → 3.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fe2687efdf727fedcb991105d4a5c9e7eb60d0d1
4
- data.tar.gz: 16621b1aea7885ca2b4d1f7b508c815bcbaa717e
3
+ metadata.gz: 9f72cdeb9fbffb817b2077f5bfde2c2c58e1dcbb
4
+ data.tar.gz: a3d4f0d9868bf8b4d7fbcd9474165e1c20b6a549
5
5
  SHA512:
6
- metadata.gz: dba5add3cb06441c097b1e02f74cecc55d0502d6a9d726680e3d61fb95d5a13d1d41f82203454abb2b42df7cf6588f26917c45d6a2b7d370e467df223f7a4d1d
7
- data.tar.gz: aed860c22d4e46ed8b24c721231cd087d0ff497c36f91182091fa2145730e2c4b56504fd27a06abe83d1503fe7b7c44cb1a767f127690339706bad84c4ee3f05
6
+ metadata.gz: 5c307f0ae66aab040bb0a404f358dc7f49ae948c3f1a07a463870f62c9bd182fec340bffeb534e2e5c6ea680887456d7395e5e93349f975e1ce8906961b77401
7
+ data.tar.gz: 2b6e8309bb74397136462e0d3528d05485c672389cda723ac19de02fa6797817ed582e6d48d10dbdc3e010ac23c830175bcf16a8806187b6d15c981d27f6aa21
data/README.md CHANGED
@@ -33,7 +33,7 @@ Install via Rubygems
33
33
 
34
34
  ... or add to your Gemfile
35
35
 
36
- gem "octokit", "~> 2.0"
36
+ gem "octokit", "~> 3.0"
37
37
 
38
38
  ### Making requests
39
39
 
@@ -111,7 +111,7 @@ user = client.user
111
111
  user.login
112
112
  # => "defunkt"
113
113
  ```
114
- While Basic Authentication makes it easy to get started quickly, OAuth access
114
+ While Basic Authentication allows you to get started quickly, OAuth access
115
115
  tokens are the preferred way to authenticate on behalf of users.
116
116
 
117
117
  ### OAuth access tokens
@@ -119,14 +119,14 @@ tokens are the preferred way to authenticate on behalf of users.
119
119
  [OAuth access tokens][oauth] provide two main benefits over using your username
120
120
  and password:
121
121
 
122
- * **Revokable access**. Access tokens can be revoked, removing access for just
122
+ * **Revokable access**. Access tokens can be revoked, removing access for only
123
123
  that token without having to change your password everywhere.
124
124
  * **Limited access**. Access tokens have [access scopes][] which allow for more
125
125
  granular access to API resources. For instance, you can grant a third party
126
126
  access to your gists but not your private repositories.
127
127
 
128
- To use an access token with the Octokit client, just pass it in lieu of your
129
- username and password:
128
+ To use an access token with the Octokit client, pass your token in the
129
+ `:access_token` options parameter in lieu of your username and password:
130
130
 
131
131
  ```ruby
132
132
  client = Octokit::Client.new(:access_token => "<your 40 char token>")
@@ -136,8 +136,17 @@ user.login
136
136
  # => "defunkt"
137
137
  ```
138
138
 
139
- You can use `.create_authorization` to create a token using Basic Authorization
140
- that you can use for subsequent calls.
139
+ You can [create access tokens through your GitHub Account Settings](https://help.github.com/articles/creating-an-access-token-for-command-line-use)
140
+ or with a basic authenticated Octokit client:
141
+
142
+ ```ruby
143
+ client = Octokit::Client.new \
144
+ :login => 'defunkt',
145
+ :password => 'c0d3b4ssssss!'
146
+
147
+ client.create_authorization(:scopes => ["user"], :note => "Name of token")
148
+ # => <your new oauth token>
149
+ ```
141
150
 
142
151
  ### Two-Factor Authentication
143
152
 
@@ -160,7 +169,8 @@ client = Octokit::Client.new \
160
169
  :login => 'defunkt',
161
170
  :password => 'c0d3b4ssssss!'
162
171
 
163
- client.create_authorization(:scopes => ["user"], :headers => { "X-GitHub-OTP" => "<your 2FA token>" })
172
+ client.create_authorization(:scopes => ["user"], :note => "Name of token",
173
+ :headers => { "X-GitHub-OTP" => "<your 2FA token>" })
164
174
  # => <your new oauth token>
165
175
  ```
166
176
 
@@ -208,8 +218,6 @@ client = Octokit::Client.new \
208
218
  user = client.user 'defunkt'
209
219
  ```
210
220
 
211
-
212
-
213
221
  [auth]: http://developer.github.com/v3/#authentication
214
222
  [oauth]: http://developer.github.com/v3/oauth/
215
223
  [access scopes]: http://developer.github.com/v3/oauth/#scopes
@@ -326,10 +334,10 @@ rel = repo.rels[:issues]
326
334
  # => #<Sawyer::Relation: issues: get https://api.github.com/repos/pengwynn/pingwynn/issues{/number}>
327
335
 
328
336
  # Get a page of issues
329
- repo.rels[:issues].get.data
337
+ rel.get.data
330
338
 
331
339
  # Get issue #2
332
- repo.rels[:issues].get(:uri => {:number => 2}).data
340
+ rel.get(:uri => {:number => 2}).data
333
341
  ```
334
342
 
335
343
  ### The Full Hypermedia Experience™
@@ -378,8 +386,9 @@ extended via middleware.
378
386
 
379
387
  ### Debugging
380
388
 
381
- Often, it helps to know what Octokit is doing under the hood. Faraday makes it
382
- easy to peek into the underlying HTTP traffic:
389
+ Often, it helps to know what Octokit is doing under the hood. You can add a
390
+ logger to the middleware that enables you to peek into the underlying HTTP
391
+ traffic:
383
392
 
384
393
  ```ruby
385
394
  stack = Faraday::RackBuilder.new do |builder|
@@ -440,7 +449,7 @@ resource. See the [project README][cache] for advanced usage.
440
449
  ## Hacking on Octokit.rb
441
450
 
442
451
  If you want to hack on Octokit locally, we try to make [bootstrapping the
443
- project][bootstrapping] as painless as possible. Just clone and run:
452
+ project][bootstrapping] as painless as possible. To start hacking, clone and run:
444
453
 
445
454
  script/bootstrap
446
455
 
@@ -455,12 +464,29 @@ console`, etc. ensures your dependencies are up-to-date.
455
464
  ### Running and writing new tests
456
465
 
457
466
  Octokit uses [VCR][] for recording and playing back API fixtures during test
458
- runs. These fixtures are part of the Git project in the `spec/cassettes`
459
- folder. For the most part, tests use an authenticated client, using a token
460
- stored in `ENV['OCTOKIT_TEST_GITHUB_TOKEN']`. If you're not recording new
461
- cassettes, you don't need to have this set. If you do need to record new
462
- cassettes, this token can be any GitHub API token because the test suite strips
463
- the actual token from the cassette output before storing to disk.
467
+ runs. These cassettes (fixtures) are part of the Git project in the `spec/cassettes`
468
+ folder. If you're not recording new cassettes you can run the specs with existing
469
+ cassettes with:
470
+
471
+ script/test
472
+
473
+ Octokit uses environmental variables for storing credentials used in testing.
474
+ If you are testing an API endpoint that doesn't require authentication, you
475
+ can get away without any additional configuration. For the most part, tests
476
+ use an authenticated client, using a token stored in `ENV['OCTOKIT_TEST_GITHUB_TOKEN']`.
477
+ There are several different authenticating method's used accross the api.
478
+ Here is the full list of configurable environmental variables for testing
479
+ Octokit:
480
+
481
+ ENV Variable | Description |
482
+ :-------------------|:-----------------|
483
+ `OCTOKIT_TEST_GITHUB_LOGIN`| GitHub login name (preferably one created specifically for testing against).
484
+ `OCTOKIT_TEST_GITHUB_PASSWORD`| Password for the test GitHub login.
485
+ `OCTOKIT_TEST_GITHUB_TOKEN` | [Personal Access Token](https://github.com/blog/1509-personal-api-tokens) for the test GitHub login.
486
+ `OCTOKIT_TEST_GITHUB_CLIENT_ID` | Test OAuth application client id.
487
+ `OCTOKIT_TEST_GITHUB_CLIENT_SECRET` | Test OAuth application client secret.
488
+ `OCTOKIT_TEST_GITHUB_REPOSITORY` | Test repository to perform destructive actions against, this should not be set to any repository of importance. **Automatically created by the test suite if nonexistent** Default: `api-sandbox`
489
+ `OCTOKIT_TEST_GITHUB_ORGANIZATION` | Test organization.
464
490
 
465
491
  Since we periodically refresh our cassettes, please keep some points in mind
466
492
  when writing new specs.
@@ -491,7 +517,7 @@ implementations:
491
517
  If something doesn't work on one of these Ruby versions, it's a bug.
492
518
 
493
519
  This library may inadvertently work (or seem to work) on other Ruby
494
- implementations, however support will only be provided for the versions listed
520
+ implementations, but support will only be provided for the versions listed
495
521
  above.
496
522
 
497
523
  If you would like this library to support another Ruby version, you may
@@ -514,7 +540,7 @@ introduced with new major versions. As a result of this policy, you can (and
514
540
  should) specify a dependency on this gem using the [Pessimistic Version
515
541
  Constraint][pvc] with two digits of precision. For example:
516
542
 
517
- spec.add_dependency 'octokit', '~> 2.0'
543
+ spec.add_dependency 'octokit', '~> 3.0'
518
544
 
519
545
  [semver]: http://semver.org/
520
546
  [pvc]: http://docs.rubygems.org/read/chapter/16#page74
@@ -308,6 +308,16 @@ module Octokit
308
308
  @client_secret = value
309
309
  end
310
310
 
311
+ # Wrapper around Kernel#warn to print warnings unless
312
+ # OCTOKIT_SILENT is set to true.
313
+ #
314
+ # @return [nil]
315
+ def octokit_warn(*message)
316
+ unless ENV['OCTOKIT_SILENT']
317
+ warn message
318
+ end
319
+ end
320
+
311
321
  private
312
322
 
313
323
  def reset_agent
@@ -364,15 +374,5 @@ module Octokit
364
374
 
365
375
  opts
366
376
  end
367
-
368
- # Wrapper around Kernel#warn to print warnings unless
369
- # OCTOKIT_SILENT is set to true.
370
- #
371
- # @return [nil]
372
- def octokit_warn(*message)
373
- unless ENV['OCTOKIT_SILENT']
374
- warn message
375
- end
376
- end
377
377
  end
378
378
  end
@@ -234,12 +234,10 @@ module Octokit
234
234
 
235
235
  # Get list of public keys for user.
236
236
  #
237
- # Requires authenticated client.
238
- #
239
237
  # @return [Array<Sawyer::Resource>] Array of hashes representing public keys.
240
238
  # @see https://developer.github.com/v3/users/keys/#list-public-keys-for-a-user
241
239
  # @example
242
- # @client.user_keys('pengwynn'
240
+ # @client.user_keys('pengwynn')
243
241
  def user_keys(user, options = {})
244
242
  # TODO: Roll this into .keys
245
243
  paginate "users/#{user}/keys", options
@@ -7,14 +7,11 @@ module Octokit
7
7
  # Parses RSS and Atom feed responses.
8
8
  class FeedParser < Faraday::Response::Middleware
9
9
 
10
- dependency do
11
- require 'rss'
12
- end
13
-
14
10
  private
15
11
 
16
12
  def on_complete(env)
17
13
  if env[:response_headers]["content-type"] =~ /(\batom|\brss)/
14
+ require 'rss'
18
15
  env[:body] = RSS::Parser.parse env[:body]
19
16
  end
20
17
  end
@@ -2,6 +2,6 @@ module Octokit
2
2
 
3
3
  # Current version
4
4
  # @return [String]
5
- VERSION = "3.1.0".freeze
5
+ VERSION = "3.1.2".freeze
6
6
 
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octokit
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wynn Netherland
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-04-18 00:00:00.000000000 Z
13
+ date: 2014-06-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -129,4 +129,3 @@ signing_key:
129
129
  specification_version: 4
130
130
  summary: Ruby toolkit for working with the GitHub API
131
131
  test_files: []
132
- has_rdoc: