rack-auditor 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MDI3YjVkNDA3OTI1MjdhODZhM2QyM2M5M2ZkMjc5ZmVhOWY2NDI1OQ==
4
+ YWMwOGQ5NjU5ZWJlNWFlYWU1OWI0MTczZTYzODYzOGJkN2Q2ODZhZg==
5
5
  data.tar.gz: !binary |-
6
- Njc2YTQ3MDllNGNkMzViMmE0NDU1YjdmY2M4OWU2OGE1MTY0NzQ4Ng==
6
+ MzQxNjI5OTA3NjcxZWU2NDg3ZGU1YWI2MDczMjUzNjg0YjJkZDEwNQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZDA1YmExNzMzNjZmMDYxYmY5NzU1NjJlMzYwZjhmYTdlMWViM2I4MjQxNjlj
10
- ZjE1OTJmNDVmMjg2NjI3N2VlYWY1ZTczNDZkOWVlYjU5MDkxMzM5YWJlNWNi
11
- NDM1NjVhOThhZDk3ZTkzNDFmMGZjZmQxOTM1YTc0M2ZlMjc3Yjc=
9
+ Mzk2M2M0Y2NhMjhlZjdjODY0NzA2YWEyY2E2MWY0YTcyOTc2Mzg5MWQwZWU0
10
+ ZGExNzU5YTUyYzk4N2ZhYjFlZDhmZjI0NTM2ZmFlMzQ2Mzk2MGNiYjIzYzY2
11
+ OTA5MWM0YzZhYjgzYWUzN2Y3ZjBhNjUwMjQ5MDZkMzk5Nzc5NzA=
12
12
  data.tar.gz: !binary |-
13
- OWI3ODUzNDE3YmZiYmExN2IwMGUxMWUwYzdjM2JmN2ZkYTg2MTU4MjU0ZDNj
14
- NGVmZWUwOWNkNzQ0MzY3NmNlODU2ZDg5NGU5ZDFiYjhhMzMwZWUxNTA4NmE4
15
- YzQ2NTIyMTYwYjBhNDE2NDRhYWI5Mjg4YmM1NTgyOTNkYmRhMzE=
13
+ MjI4MDU2MmRlODExMjkzNzJlYWNkYWE4ZWVhYjEyYmZkODU5ZjY4MTVjMmE3
14
+ OGU0NDQxYTAwYjA4ZjlmNDBiZGJmNzJjZDRjMzc1MDNiNjFmNGNlNDkwMDYy
15
+ ZTU3YmY5ZGU2NjkxZTk5MmVjNWU0NzgxNzdlNzMxMDkxYzMxYTk=
data/lib/rack/auditor.rb CHANGED
@@ -2,13 +2,19 @@ require 'httparty'
2
2
 
3
3
  module Rack
4
4
  class Auditor
5
- ROOT_URL = 'http://icis-identity-example.herokuapp.com/api/v1/verify.json'
6
-
7
- def initialize(app, root_uri = 'http://snowflake.dev/')
8
- @app, @root_uri = app, root_uri
5
+ def initialize(app, options = {})
6
+ @app = app
7
+ @root_uri = options[:root_uri] || 'http://snowflake.dev/'
8
+ @dev_mode = options[:dev_mode] || false
9
9
  end
10
10
 
11
11
  def call(env)
12
+ audit(env) unless @dev_mode
13
+
14
+ @app.call(env)
15
+ end
16
+
17
+ def audit(env)
12
18
  key = env['HTTP_X_API_KEY']
13
19
  secret = env['HTTP_X_API_SECRET']
14
20
 
@@ -28,8 +34,6 @@ module Rack
28
34
  when 504
29
35
  error_code(504, 'System Down')
30
36
  end
31
-
32
- @app.call(env)
33
37
  end
34
38
 
35
39
  private
data/rack-auditor.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "rack-auditor"
3
- s.version = "0.1.0"
3
+ s.version = "0.2.0"
4
4
 
5
5
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
6
  s.authors = ["Patrick Robertson"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-auditor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Robertson