auth_manager 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.
- checksums.yaml +4 -4
- data/.autotest +2 -0
- data/.rspec +2 -0
- data/lib/auth_manager/adder/adder.rb +1 -1
- data/lib/auth_manager/base.rb +25 -27
- data/lib/auth_manager/deleter/deleter.rb +2 -2
- data/lib/auth_manager/finder/finder.rb +1 -1
- data/lib/auth_manager/updater/updater.rb +3 -3
- data/lib/auth_manager/version.rb +1 -1
- data/lib/auth_manager.rb +18 -0
- data/{specs → spec}/adder_spec.rb +2 -2
- data/{specs → spec}/deleter_spec.rb +2 -2
- data/{specs → spec}/finder_spec.rb +2 -2
- data/{specs → spec}/updater_spec.rb +2 -2
- metadata +19 -10
- /data/{specs → spec}/feed/populate.rb +0 -0
- /data/{specs → spec}/fixtures/environment.rb +0 -0
- /data/{specs → spec}/spec_helper.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8faa6b3f0fdf2d60a4a7ecc95080c850d1601cd
|
4
|
+
data.tar.gz: 39626c404ac227c2af04a9a7af5c435e2f89f58c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 836948b28449525bafa205b4162b5ea7a2b5d8150599c80c0f71c00554f2f37f12fe7494bc19b01371c3e1df58f506f6c2d26eb920b7c040d7432b8e6703307e
|
7
|
+
data.tar.gz: 7b2e8d23a673dc4bf13e9422dc40225812ef22b107704209de29880e4f629fc7216f5eba0d13986cd17ea608a9d8ec7e55d4308ae8d4b58ad2418125ca019366
|
data/.autotest
ADDED
data/.rspec
ADDED
data/lib/auth_manager/base.rb
CHANGED
@@ -1,39 +1,37 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
attr_accessor :redis
|
1
|
+
class AuthManager::Base
|
2
|
+
attr_accessor :redis
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
def initialize
|
9
|
-
@redis = Redis.current
|
10
|
-
end
|
4
|
+
USERS = 'users'
|
5
|
+
APPS = 'applications'
|
11
6
|
|
7
|
+
def initialize
|
8
|
+
@redis = Redis.current
|
12
9
|
end
|
13
10
|
|
14
|
-
|
11
|
+
end
|
15
12
|
|
16
|
-
|
17
|
-
validate_option(option, user, app)
|
18
|
-
valid_param = JSON.parse(param)
|
19
|
-
option[:user] ? user_as_param(valid_param) : app_as_param(valid_param)
|
20
|
-
end
|
13
|
+
class AuthManager::Validation < AuthManager::Base
|
21
14
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
15
|
+
def validate_param(param, option, user, app)
|
16
|
+
validate_option(option, user, app)
|
17
|
+
valid_param = JSON.parse(param)
|
18
|
+
option[:user] ? user_as_param(valid_param) : app_as_param(valid_param)
|
19
|
+
end
|
27
20
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
end
|
21
|
+
def user_as_param(valid_param)
|
22
|
+
if (valid_param['login'] && valid_param['login'].empty?) || (valid_param['password'] && valid_param['password'].empty?)
|
23
|
+
false
|
32
24
|
end
|
25
|
+
end
|
33
26
|
|
34
|
-
|
35
|
-
|
36
|
-
false
|
27
|
+
def app_as_param(valid_param)
|
28
|
+
if valid_param['api_key'] && valid_param['api_key'].empty?
|
29
|
+
false
|
37
30
|
end
|
38
31
|
end
|
32
|
+
|
33
|
+
def validate_option(option, user, app)
|
34
|
+
false unless option.instance_of?(Hash)
|
35
|
+
false if (user && app)
|
36
|
+
end
|
39
37
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
require 'redis'
|
3
3
|
require_relative '../base'
|
4
4
|
|
5
|
-
class Deleter < AuthManager::Base
|
5
|
+
class AuthManager::Deleter < AuthManager::Base
|
6
6
|
|
7
7
|
def delete?(obj_to_del, option)
|
8
8
|
new_obj = format_new_obj(obj_to_del)
|
@@ -12,7 +12,7 @@ class Deleter < AuthManager::Base
|
|
12
12
|
private
|
13
13
|
|
14
14
|
def fake_delete?(obj_to_del, new_obj, option)
|
15
|
-
updater = Updater.new
|
15
|
+
updater = AuthManager::Updater.new
|
16
16
|
updater.update(obj_to_del, new_obj, option)
|
17
17
|
end
|
18
18
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
require 'redis'
|
3
3
|
require_relative '../base'
|
4
4
|
|
5
|
-
class Updater < AuthManager::Base
|
5
|
+
class AuthManager::Updater < AuthManager::Base
|
6
6
|
|
7
7
|
def update(old_obj, new_obj, option)
|
8
8
|
existing_obj?(old_obj, option)
|
@@ -13,7 +13,7 @@ class Updater < AuthManager::Base
|
|
13
13
|
private ###########################
|
14
14
|
|
15
15
|
def existing_obj?(old_obj, option)
|
16
|
-
finder = Finder.new
|
16
|
+
finder = AuthManager::Finder.new
|
17
17
|
finder.find_object?(old_obj, option)
|
18
18
|
end
|
19
19
|
|
@@ -24,7 +24,7 @@ class Updater < AuthManager::Base
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def write_new_info?(new_obj, option)
|
27
|
-
adder = Adder.new
|
27
|
+
adder = AuthManager::Adder.new
|
28
28
|
adder.save?(new_obj, option)
|
29
29
|
end
|
30
30
|
|
data/lib/auth_manager/version.rb
CHANGED
data/lib/auth_manager.rb
CHANGED
@@ -6,4 +6,22 @@ require 'auth_manager/deleter/deleter'
|
|
6
6
|
|
7
7
|
module AuthManager
|
8
8
|
# Your code goes here...
|
9
|
+
class Base
|
10
|
+
end
|
11
|
+
|
12
|
+
class Validation
|
13
|
+
end
|
14
|
+
|
15
|
+
class Adder
|
16
|
+
end
|
17
|
+
|
18
|
+
class Finder
|
19
|
+
end
|
20
|
+
|
21
|
+
class Updater
|
22
|
+
end
|
23
|
+
|
24
|
+
class Deleter
|
25
|
+
end
|
26
|
+
|
9
27
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative 'spec_helper'
|
2
2
|
|
3
|
-
describe Adder do
|
4
|
-
let(:adder) { Adder.new }
|
3
|
+
describe AuthManager::Adder do
|
4
|
+
let(:adder) { AuthManager::Adder.new }
|
5
5
|
let(:user) { { login: 'nano', password: 'password' } }
|
6
6
|
let(:app) { { api_key: 'api_key' } }
|
7
7
|
let(:opt) { {user: false, app: false} }
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative 'spec_helper'
|
2
2
|
|
3
|
-
describe Deleter do
|
4
|
-
let(:deleter) { Deleter.new }
|
3
|
+
describe AuthManager::Deleter do
|
4
|
+
let(:deleter) { AuthManager::Deleter.new }
|
5
5
|
let(:user) { {login: 'login', password: 'password'} }
|
6
6
|
let(:app) { {api_key: 'api_key'} }
|
7
7
|
let(:opt) { { user: false, app: true } }
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative 'spec_helper'
|
2
2
|
|
3
|
-
describe Finder do
|
4
|
-
let(:finder) { Finder.new }
|
3
|
+
describe AuthManager::Finder do
|
4
|
+
let(:finder) { AuthManager::Finder.new }
|
5
5
|
let(:user) { { login: 'login', password: 'password' }}
|
6
6
|
let(:app) { { api_key: 'api_key' } }
|
7
7
|
let(:opt) { { user: true, app: false } }
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
require_relative 'spec_helper'
|
3
3
|
|
4
|
-
describe Updater do
|
5
|
-
let(:updater) { Updater.new }
|
4
|
+
describe AuthManager::Updater do
|
5
|
+
let(:updater) { AuthManager::Updater.new }
|
6
6
|
let(:app) { { api_key: 'api_key' } }
|
7
7
|
let(:user) { { login: 'login', password: 'password' }}
|
8
8
|
let(:opt) { { user: true, app: false } }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: auth_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- atacraft && fabira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -79,7 +79,9 @@ executables: []
|
|
79
79
|
extensions: []
|
80
80
|
extra_rdoc_files: []
|
81
81
|
files:
|
82
|
+
- ".autotest"
|
82
83
|
- ".gitignore"
|
84
|
+
- ".rspec"
|
83
85
|
- Gemfile
|
84
86
|
- LICENSE.txt
|
85
87
|
- README.md
|
@@ -93,13 +95,13 @@ files:
|
|
93
95
|
- lib/auth_manager/finder/finder.rb
|
94
96
|
- lib/auth_manager/updater/updater.rb
|
95
97
|
- lib/auth_manager/version.rb
|
96
|
-
-
|
97
|
-
-
|
98
|
-
-
|
99
|
-
-
|
100
|
-
-
|
101
|
-
-
|
102
|
-
-
|
98
|
+
- spec/adder_spec.rb
|
99
|
+
- spec/deleter_spec.rb
|
100
|
+
- spec/feed/populate.rb
|
101
|
+
- spec/finder_spec.rb
|
102
|
+
- spec/fixtures/environment.rb
|
103
|
+
- spec/spec_helper.rb
|
104
|
+
- spec/updater_spec.rb
|
103
105
|
homepage: ''
|
104
106
|
licenses:
|
105
107
|
- MIT
|
@@ -124,4 +126,11 @@ rubygems_version: 2.2.2
|
|
124
126
|
signing_key:
|
125
127
|
specification_version: 4
|
126
128
|
summary: '"Module auth_manager"'
|
127
|
-
test_files:
|
129
|
+
test_files:
|
130
|
+
- spec/adder_spec.rb
|
131
|
+
- spec/deleter_spec.rb
|
132
|
+
- spec/feed/populate.rb
|
133
|
+
- spec/finder_spec.rb
|
134
|
+
- spec/fixtures/environment.rb
|
135
|
+
- spec/spec_helper.rb
|
136
|
+
- spec/updater_spec.rb
|
File without changes
|
File without changes
|
File without changes
|