Module: GitHubBub

Defined in:
lib/git_hub_bub.rb,
lib/git_hub_bub/request.rb,
lib/git_hub_bub/version.rb,
lib/git_hub_bub/response.rb

Defined Under Namespace

Classes: Request, RequestError, Response

Constant Summary collapse

VERSION =
"1.0.1"

Class Method Summary collapse

Class Method Details

.delete(*args) ⇒ Object



49
50
51
# File 'lib/git_hub_bub.rb', line 49

def delete(*args)
  Request.delete(*args)
end

.get(*args) ⇒ Object



33
34
35
# File 'lib/git_hub_bub.rb', line 33

def get(*args)
  Request.get(*args)
end

.head(*args) ⇒ Object



29
30
31
# File 'lib/git_hub_bub.rb', line 29

def head(*args)
  Request.head(*args)
end

.patch(*args) ⇒ Object



45
46
47
# File 'lib/git_hub_bub.rb', line 45

def patch(*args)
  Request.patch(*args)
end

.post(*args) ⇒ Object



37
38
39
# File 'lib/git_hub_bub.rb', line 37

def post(*args)
  Request.post(*args)
end

.put(*args) ⇒ Object



41
42
43
# File 'lib/git_hub_bub.rb', line 41

def put(*args)
  Request.put(*args)
end

.valid_token?(token) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
20
21
22
23
24
25
26
27
# File 'lib/git_hub_bub.rb', line 17

def valid_token?(token)
  response = Request.get("https://#{ENV['GITHUB_APP_ID']}:#{ENV['GITHUB_APP_SECRET']}@api.github.com/applications/#{ENV['GITHUB_APP_ID']}/tokens/#{token}", {}, {skip_token: true})
  return response if response.success?
  return false if response.status == 404
rescue GitHubBub::RequestError => e
  if Request::RAISE_ON_FAIL
    return false
  else
    raise e
  end
end