ez_auth 0.0.4 → 0.0.5

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/.gitignore CHANGED
@@ -16,4 +16,5 @@ test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
18
 
19
- .rbenv*
19
+ .ruby-version
20
+ .rbenv*
data/lib/easy_auth.rb CHANGED
@@ -22,4 +22,16 @@ module EasyAuth
22
22
  def authentication_token
23
23
  ENV.fetch('API_TOKEN') { 'DEV_TOKEN' }
24
24
  end
25
+
26
+ def self.authenticated_request? request
27
+ # this is used as a convenience method to be able to use this in a routes.rb file.
28
+
29
+ [
30
+ request.headers.env['HTTP_X_API_TOKEN'],
31
+ request.env['HTTP_X_API_TOKEN'],
32
+ request.params[:api_token]
33
+ ].include? ENV.fetch('API_TOKEN') { 'DEV_TOKEN' }
34
+
35
+ end
36
+
25
37
  end
@@ -1,3 +1,3 @@
1
1
  module EasyAuth
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  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.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-12-13 00:00:00.000000000 Z
12
+ date: 2014-01-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -124,12 +124,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
124
124
  - - ! '>='
125
125
  - !ruby/object:Gem::Version
126
126
  version: '0'
127
+ segments:
128
+ - 0
129
+ hash: -3432875557689140732
127
130
  required_rubygems_version: !ruby/object:Gem::Requirement
128
131
  none: false
129
132
  requirements:
130
133
  - - ! '>='
131
134
  - !ruby/object:Gem::Version
132
135
  version: '0'
136
+ segments:
137
+ - 0
138
+ hash: -3432875557689140732
133
139
  requirements: []
134
140
  rubyforge_project:
135
141
  rubygems_version: 1.8.23