octokit 2.6.1 → 2.6.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 +4 -4
- data/README.md +26 -0
- data/lib/octokit/authentication.rb +7 -2
- data/lib/octokit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d501342977b5c061cadcfe483245d3f4535820b5
|
4
|
+
data.tar.gz: ce8a16b2304afa8eaa682a023c6565f4d89dce06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11300e8d520fafe59f0bdcce6fbe94eaeca44d881d38c81a7a48a91f2ab7ea2a5753f7e22519c44357e0408689385b48d43eb9c6510731ebab0269f37b09dcd0
|
7
|
+
data.tar.gz: caa1e5acff94403434da51e0a2f3c02bf28888668dfd5070e604619c7647982e5408133bcfdee5d198a9979e3c7a16698da4e224e1ca52f1ed66fb9d75300261
|
data/README.md
CHANGED
@@ -139,6 +139,31 @@ user.login
|
|
139
139
|
You can use `.create_authorization` to create a token using Basic Authorization
|
140
140
|
that you can use for subsequent calls.
|
141
141
|
|
142
|
+
### Two-Factor Authentication
|
143
|
+
|
144
|
+
[Two-Factor Authentication](https://help.github.com/articles/about-two-factor-authentication) brings added security to the account by requiring more information to login.
|
145
|
+
|
146
|
+
Using two-factor authentication for API calls is as simple as adding the [required header](http://developer.github.com/v3/auth/#working-with-two-factor-authentication) as an option:
|
147
|
+
|
148
|
+
```ruby
|
149
|
+
client = Octokit::Client.new \
|
150
|
+
:login => 'defunkt',
|
151
|
+
:password => 'c0d3b4ssssss!'
|
152
|
+
|
153
|
+
user = client.user("defunkt", :headers => { "X-GitHub-OTP" => "<your 2FA token>" })
|
154
|
+
```
|
155
|
+
|
156
|
+
As you can imagine, this gets annoying quick since two-factor auth tokens are very short lived. So it is recommended to create an oauth token for the user to communicate with the API:
|
157
|
+
|
158
|
+
```ruby
|
159
|
+
client = Octokit::Client.new \
|
160
|
+
:login => 'defunkt',
|
161
|
+
:password => 'c0d3b4ssssss!'
|
162
|
+
|
163
|
+
client.create_authorization(:scopes => ["user"], :headers => { "X-GitHub-OTP" => "<your 2FA token>" })
|
164
|
+
# => <your new oauth token>
|
165
|
+
```
|
166
|
+
|
142
167
|
### Using a .netrc file
|
143
168
|
|
144
169
|
Octokit supports reading credentials from a netrc file (defaulting to
|
@@ -337,6 +362,7 @@ include:
|
|
337
362
|
* The `search_*` methods from v1.x are now found at `legacy_search_*`
|
338
363
|
* Support for netrc requires including the [netrc gem][] in your Gemfile or
|
339
364
|
gemspec.
|
365
|
+
* DateTime fields are now proper `DateTime` objects. Previous versions outputted DateTime fields as 'String' objects.
|
340
366
|
|
341
367
|
[netrc gem]: https://rubygems.org/gems/netrc
|
342
368
|
|
@@ -58,8 +58,13 @@ module Octokit
|
|
58
58
|
info = Netrc.read netrc_file
|
59
59
|
netrc_host = URI.parse(api_endpoint).host
|
60
60
|
creds = info[netrc_host]
|
61
|
-
|
62
|
-
|
61
|
+
if creds.nil?
|
62
|
+
# creds will be nil if there is no netrc for this end point
|
63
|
+
warn "Error loading credentials from netrc file for #{api_endpoint}"
|
64
|
+
else
|
65
|
+
self.login = creds.shift
|
66
|
+
self.password = creds.shift
|
67
|
+
end
|
63
68
|
rescue LoadError
|
64
69
|
warn "Please install netrc gem for .netrc support"
|
65
70
|
end
|
data/lib/octokit/version.rb
CHANGED
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: 2.6.
|
4
|
+
version: 2.6.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: 2013-
|
13
|
+
date: 2013-12-03 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|