au_pair 1.0.6 → 1.0.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6132273432d2b633bfe1f03cf3ff82c3f0fd587f
4
- data.tar.gz: 0e86cfcd8fd1806384d2c18af4d1bc9a01e5b557
3
+ metadata.gz: 8d788499eea88ae11eb57b5b5a7103b806a03ccd
4
+ data.tar.gz: 9d3c9d5d5563c27c7d316a0f5ac1c2ef3c598b24
5
5
  SHA512:
6
- metadata.gz: 997c4de50d3dd0a7a4f220cffb7363e81549c0c1ce7bfde53ba1c695b86cebe8e805326b90007fdaaff6e790030977a950cd536e95b9d78dd551bf34fc330fc5
7
- data.tar.gz: c39be5642949d26f5f56c084c5fad9dd0f001304f9263699bc02715126842680abaf71912b7559b13da9037a8f5182a383c55f9adabaa015771a81cae558f181
6
+ metadata.gz: 1b476e3b4bff35b30003c7014be362fb0090733ea1238bd9d7172d3449cb2a200bbd2d265436b3fcaf749a18082bedb8227b38f5079250e3fdd67b29d330ab12
7
+ data.tar.gz: b3d61c6cd4af2384e5e473ebba2c69aeb4bff9f17c94e80dff964cf2224f14581844f9f22866b671c02740c11c66c2186f051a02c1ea6ee25db2319f38941c56
@@ -6,7 +6,7 @@ require 'au_pair/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "au_pair"
8
8
  spec.version = AuPair::VERSION
9
- spec.authors = ["Corey Ehmke"]
9
+ spec.authors = ["Corey Ehmke", "Jay Wengrow"]
10
10
  spec.email = ["cehmke@apartments.com"]
11
11
  spec.description = %q{AuPair provides token-based authentication and versioning for Rails API applications.}
12
12
  spec.summary = %q{API versioning and token authentication}
@@ -3,7 +3,7 @@ require "au_pair/authentication_token"
3
3
  require "au_pair/authenticates"
4
4
  require 'au_pair/api_constraint'
5
5
 
6
- module AuPair
6
+ module AuPair
7
7
 
8
8
  def self.configure(&block)
9
9
  @config = Configuration.new
@@ -18,8 +18,12 @@ module AuPair
18
18
  config.tokens
19
19
  end
20
20
 
21
+ def self.authentication_disabled?
22
+ config.authentication_disabled
23
+ end
24
+
21
25
  class Configuration
22
- attr_accessor :tokens
26
+ attr_accessor :tokens, :authentication_disabled
23
27
  end
24
28
 
25
29
  end
@@ -1,6 +1,7 @@
1
1
  class AuPair::AuthenticationToken
2
2
 
3
3
  def self.valid?(key, vendor)
4
+ return true if AuPair.authentication_disabled?
4
5
  return false unless key
5
6
  AuPair.tokens[vendor] == key
6
7
  end
@@ -1,3 +1,3 @@
1
1
  module AuPair
2
- VERSION = "1.0.6"
2
+ VERSION = "1.0.7"
3
3
  end
@@ -30,4 +30,16 @@ describe AuPair::AuthenticationToken do
30
30
 
31
31
  end
32
32
 
33
+ context 'when authentication is disabled' do
34
+
35
+ before do
36
+ AuPair.configure{ |config| config.authentication_disabled = true}
37
+ end
38
+
39
+ it 'should authenticate request even when no token is provided' do
40
+ expect(AuPair::AuthenticationToken.valid?(nil, nil)).to be_true
41
+ end
42
+
43
+ end
44
+
33
45
  end
@@ -8,4 +8,9 @@ describe AuPair do
8
8
  expect(AuPair.config.tokens).to eq tokens
9
9
  end
10
10
 
11
+ it 'accepts an option to disable authentication as part of its configuration' do
12
+ AuPair.configure{ |config| config.authentication_disabled = true }
13
+ expect(AuPair.authentication_disabled?).to be_true
14
+ end
15
+
11
16
  end
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: au_pair
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Corey Ehmke
8
+ - Jay Wengrow
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-02-09 00:00:00.000000000 Z
12
+ date: 2014-02-12 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bundler