monban 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 608af56fdd4c89a460ac08545532bc6a39d47cd6
4
- data.tar.gz: 8e41b690802c8cbec996c27937db68b351eaa2a5
3
+ metadata.gz: 5c8d75fe9becef4e85c00188afc6bd4ce6cc2add
4
+ data.tar.gz: 0a017b45d82756152678e35a3cbb0cd5c6caf362
5
5
  SHA512:
6
- metadata.gz: 8245fdd7c1bf279332dec0314ade04e10f2ef9e7ff27d7d194c7d651c4608a5157ef4a26bc1e19dcaf83e3cafc49eb2e93e8631e4a2a394431ad74b25b308184
7
- data.tar.gz: e582bf6d7de38f0d25f0f0a0d583439706707685e18bf79433a2157604d16d32756b177d3ef120d5991cf0677b68807aa064387335c65de6103a141fd2399324
6
+ metadata.gz: 86de815a9526d7f46a6af686918164ae081319ce596e0ab1f753113aeb43106169eb8c6b3f230b28218ced996bd5099f650d06460dc8c69fc007386fff4fd37b
7
+ data.tar.gz: 36865675f616268e793634a71e73a7243827a152d14de39ebf7a971b580439a8bd5435f4fdf7acf7f6ea5bcd348652e183ecde6a63e3bb76cab03eb006a453bf
data/NEWS.rdoc CHANGED
@@ -1,3 +1,6 @@
1
+ == 0.3.1
2
+ * Extend private interface for services
3
+
1
4
  == 0.3.0
2
5
  * Warden serialization is now configurable
3
6
 
@@ -18,7 +18,7 @@ module Monban
18
18
  # @return [false] if authentication fails
19
19
  def perform
20
20
  if authenticated?
21
- @user
21
+ user
22
22
  else
23
23
  false
24
24
  end
@@ -26,8 +26,10 @@ module Monban
26
26
 
27
27
  private
28
28
 
29
+ attr_reader :user, :undigested_token
30
+
29
31
  def authenticated?
30
- @user && Monban.compare_token(@user.send(token_store_field), @undigested_token)
32
+ user && Monban.compare_token(user.send(token_store_field), undigested_token)
31
33
  end
32
34
 
33
35
  def token_store_field
@@ -15,9 +15,13 @@ module Monban
15
15
  # Perform the service.
16
16
  def perform
17
17
  field = Monban.config.user_token_store_field
18
- digested_password = Monban.hash_token(@new_password)
19
- @user[field] = digested_password
18
+ digested_password = Monban.hash_token(new_password)
19
+ user[field] = digested_password
20
20
  end
21
+
22
+ private
23
+
24
+ attr_reader :user, :new_password
21
25
  end
22
26
  end
23
27
  end
@@ -14,8 +14,12 @@ module Monban
14
14
 
15
15
  # Perform the service
16
16
  def perform
17
- @warden.set_user(@user)
17
+ warden.set_user(user)
18
18
  end
19
+
20
+ private
21
+
22
+ attr_reader :warden, :user
19
23
  end
20
24
  end
21
25
  end
@@ -8,12 +8,17 @@ module Monban
8
8
  # @param warden [Warden] warden
9
9
  def initialize warden
10
10
  @warden = warden
11
+ @user = warden.user
11
12
  end
12
13
 
13
14
  # Perform the service
14
15
  def perform
15
- @warden.logout
16
+ warden.logout
16
17
  end
18
+
19
+ private
20
+
21
+ attr_reader :warden, :user
17
22
  end
18
23
  end
19
24
  end
@@ -16,11 +16,13 @@ module Monban
16
16
  # Performs the service
17
17
  # @see Monban::Configuration.default_creation_method
18
18
  def perform
19
- Monban.config.creation_method.call(@user_params.to_hash)
19
+ Monban.config.creation_method.call(user_params.to_hash)
20
20
  end
21
21
 
22
22
  private
23
23
 
24
+ attr_reader :user_params
25
+
24
26
  def token_digest(user_params)
25
27
  undigested_token = user_params[token_field]
26
28
  unless undigested_token.blank?
@@ -1,4 +1,4 @@
1
1
  module Monban
2
- # 0.3.0
3
- VERSION = "0.3.0"
2
+ # 0.3.1
3
+ VERSION = "0.3.1"
4
4
  end
@@ -5,6 +5,7 @@ describe Monban::Services::SignOut, '#perform' do
5
5
  it 'signs out the user' do
6
6
  warden = double()
7
7
  allow(warden).to receive(:logout)
8
+ allow(warden).to receive(:user).and_return(double())
8
9
 
9
10
  Monban::Services::SignOut.new(warden).perform
10
11
  expect(warden).to have_received(:logout)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: monban
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - halogenandtoast