Class: Rack::Auth::TravisWebhook
- Inherits:
-
Object
- Object
- Rack::Auth::TravisWebhook
- Defined in:
- lib/rack/auth/travis_webhook.rb,
lib/rack/auth/travis_webhook/version.rb
Constant Summary collapse
- TRAVIS_CONFIG_URL =
'https://api.travis-ci.org/config'.freeze
- VERSION =
'1.0.0'.freeze
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ TravisWebhook
constructor
A new instance of TravisWebhook.
Constructor Details
#initialize(app) ⇒ TravisWebhook
Returns a new instance of TravisWebhook.
12 13 14 15 |
# File 'lib/rack/auth/travis_webhook.rb', line 12 def initialize(app) @app = app @public_key = fetch_public_key end |
Instance Method Details
#call(env) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/rack/auth/travis_webhook.rb', line 17 def call(env) return status(405) unless request(env).post? return status(401) unless signature(env) return status(400) unless payload(env) return status(403) unless verify(env) @app.call(env) end |