Class: Rack::GithubWebhooks
- Inherits:
-
Object
- Object
- Rack::GithubWebhooks
- Defined in:
- lib/rack/github_webhooks.rb,
lib/rack/github_webhooks/version.rb
Constant Summary collapse
- HMAC_DIGEST =
OpenSSL::Digest.new('sha1')
- VERSION =
'0.1.0'
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#secret ⇒ Object
readonly
Returns the value of attribute secret.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, opts = {}) ⇒ GithubWebhooks
constructor
A new instance of GithubWebhooks.
Constructor Details
#initialize(app, opts = {}) ⇒ GithubWebhooks
Returns a new instance of GithubWebhooks.
13 14 15 16 |
# File 'lib/rack/github_webhooks.rb', line 13 def initialize(app, opts = {}) @app = app @secret = opts[:secret] end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
9 10 11 |
# File 'lib/rack/github_webhooks.rb', line 9 def app @app end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
11 12 13 |
# File 'lib/rack/github_webhooks.rb', line 11 def request @request end |
#secret ⇒ Object (readonly)
Returns the value of attribute secret.
10 11 12 |
# File 'lib/rack/github_webhooks.rb', line 10 def secret @secret end |
Instance Method Details
#call(env) ⇒ Object
18 19 20 21 22 |
# File 'lib/rack/github_webhooks.rb', line 18 def call(env) @request = Rack::Request.new(env) return [400, {}, ["Signatures didn't match!"]] unless signature_valid? app.call(env) end |