Module: Octokit::Authentication
- Included in:
- Client
- Defined in:
- lib/octokit/authentication.rb
Instance Method Summary collapse
- #authenticated? ⇒ Boolean
- #authentication ⇒ Object
- #login_and_password_from_netrc(rc = false) ⇒ Object
- #oauthed? ⇒ Boolean
- #unauthed_rate_limit_params ⇒ Object
- #unauthed_rate_limited? ⇒ Boolean
Instance Method Details
#authenticated? ⇒ Boolean
11 12 13 |
# File 'lib/octokit/authentication.rb', line 11 def authenticated? !authentication.empty? end |
#authentication ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/octokit/authentication.rb', line 3 def authentication if login && password {:login => login, :password => password} else {} end end |
#login_and_password_from_netrc(rc = false) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/octokit/authentication.rb', line 30 def login_and_password_from_netrc(rc = false) return unless rc info = case rc when TrueClass Netrc.read when String Netrc.read rc end netrc_host = URI.parse(api_endpoint).host creds = info[netrc_host] self.login = creds.shift self.password = creds.shift end |
#oauthed? ⇒ Boolean
15 16 17 |
# File 'lib/octokit/authentication.rb', line 15 def oauthed? !oauth_token.nil? end |
#unauthed_rate_limit_params ⇒ Object
23 24 25 26 27 28 |
# File 'lib/octokit/authentication.rb', line 23 def unauthed_rate_limit_params { :client_id => client_id, :client_secret => client_secret } end |
#unauthed_rate_limited? ⇒ Boolean
19 20 21 |
# File 'lib/octokit/authentication.rb', line 19 def unauthed_rate_limited? client_id && client_secret end |