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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6d44855c0b13d2ddb541a71260a87b83f6f0b946
4
- data.tar.gz: dbadd6111fea871f5d64f219a5b2cc28bd322a4b
3
+ metadata.gz: d501342977b5c061cadcfe483245d3f4535820b5
4
+ data.tar.gz: ce8a16b2304afa8eaa682a023c6565f4d89dce06
5
5
  SHA512:
6
- metadata.gz: 17d82fe3cb2e713167702f9ec433e838f192763234c541389df9fb8946c58273453112c371868ae91ca1ff893804f14bd40f448862e189307b84de49c7699164
7
- data.tar.gz: 052cf9fe17d0ea1b3fc51b3a4e73f532352da3288bd978195568068691d4e9f4ecc89114fab5491fc24acdc52f1490850cca63a48d3f1649596a8c150992db49
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
- self.login = creds.shift
62
- self.password = creds.shift
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
@@ -2,6 +2,6 @@ module Octokit
2
2
 
3
3
  # Current version
4
4
  # @return [String]
5
- VERSION = "2.6.1".freeze
5
+ VERSION = "2.6.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: 2.6.1
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-11-21 00:00:00.000000000 Z
13
+ date: 2013-12-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler