ez_auth 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -33,7 +33,7 @@ end
33
33
 
34
34
  Add your API token to your request header on your client:
35
35
 
36
- $ curl --header "HTTP_X_API_TOKEN: your_api_token" api.yourservice.com
36
+ $ curl --header "X_API_TOKEN: your_api_token" api.yourservice.com
37
37
 
38
38
  ## Contributing
39
39
 
@@ -1,3 +1,3 @@
1
1
  module EasyAuth
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/easy_auth.rb CHANGED
@@ -16,7 +16,7 @@ module EasyAuth
16
16
  end
17
17
 
18
18
  def request_auth_token
19
- request.headers['HTTP_X_API_TOKEN'] || request.env['HTTP_X_API_TOKEN'] || params[:api_token]
19
+ request.headers.env['HTTP_X_API_TOKEN'] || request.env['HTTP_X_API_TOKEN'] || params[:api_token]
20
20
  end
21
21
 
22
22
  def authentication_token
@@ -13,20 +13,19 @@ class FakeController < ActionController::Base
13
13
 
14
14
  end
15
15
 
16
+ class FakeHeaders < Struct.new(:env);end
17
+
16
18
  class FakeRequest
17
19
 
18
- attr_accessor :token
20
+ attr_accessor :token, :headers
19
21
 
20
22
  def initialize token
21
23
  @token = token
24
+ @headers = FakeHeaders.new({'HTTP_X_API_TOKEN' => token})
22
25
  end
23
26
 
24
27
  def env
25
28
  {'HTTP_X_API_TOKEN' => token}
26
29
  end
27
30
 
28
- def headers
29
- {'HTTP_X_API_TOKEN' => token}
30
- end
31
-
32
31
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ez_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: