A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://rubydoc.info/github/piotrmurach/github/master/Github/Validations/Token below:

Token – Documentation for piotrmurach/github (master) – RubyDoc.info

Module: Github::Validations::Token Constant Summary collapse
TOKEN_REQUIRED =
[
  'get /user',
  'get /user/emails',
  'get /user/followers',
  'get /user/following',
  'get /user/keys',
  'get /user/repos',
  'patch /user',
  'post /user/emails',
  'post /user/keys',
  'post /user/repos'
]
TOKEN_REQUIRED_REGEXP =
[
  /repos\/.*\/.*\/comments/,
]
Instance Method Summary collapse Instance Method Details #validates_token_for(method, path) ⇒ Object

Ensures that required authentication token is present before request is sent.

27
28
29
30
31
32
33
34
35
36
37
# File 'lib/github_api/validations/token.rb', line 27

def validates_token_for(method, path)
  return true unless TOKEN_REQUIRED.grep("#{method} #{path}").empty?

  token_required = false
  TOKEN_REQUIRED_REGEXP.each do |regex|
    if "#{method} #{path}" =~ regex
      token_required = true
    end
  end
  return token_required
end

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4