sheffield_ldap_lookup 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f1fb61d37a5823114d379ab1a345d184b1c35b17
4
+ data.tar.gz: 86156649e10b28a2ff876a165a86eb15ca25b97c
5
+ SHA512:
6
+ metadata.gz: 080c9715362eb34846ec609100cfc7ba7936caa346d8ad99f6a0d9d45d03823a171b245d03f1646a3e3417b7d28ac3feff62d3976e9a889f7ed718950ea33051
7
+ data.tar.gz: 0116b41bd5caa1e52ced95c481721c1641669af4838b76207ba581a1d5234b725db5e0fc709568f2fa6f592b280cc5c8665d082e365d2935944f5f76f586023f
@@ -33,7 +33,23 @@ module SheffieldLdapLookup
33
33
  end
34
34
 
35
35
  def connection(ldap_class = Net::LDAP)
36
- @connection ||= ldap_class.new(host: ldap_config["#{@config_prefix}host"], port: ldap_config["#{@config_prefix}port"], base: ldap_config["#{@config_prefix}base"])
36
+ @connection ||= ldap_class.new(connection_settings)
37
37
  end
38
+
39
+ def connection_settings
40
+ base_settings = {
41
+ host: ldap_config["#{@config_prefix}host"], port: ldap_config["#{@config_prefix}port"], base: ldap_config["#{@config_prefix}base"]
42
+ }
43
+
44
+ if ldap_config.key?("#{@config_prefix}username") && ldap_config.key?("#{@config_prefix}password")
45
+ base_settings[:auth] = {
46
+ method: :simple,
47
+ username: ldap_config["#{@config_prefix}username"],
48
+ password: ldap_config["#{@config_prefix}password"]
49
+ }
50
+ end
51
+ base_settings
52
+ end
53
+
38
54
  end
39
55
  end
@@ -1,3 +1,3 @@
1
1
  module SheffieldLdapLookup
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
10
10
  gem.email = ["s.chen@epigenesys.co.uk"]
11
11
  gem.description = "A gem to fetch information from University of Sheffield LDAP server based on username or email address."
12
12
  gem.summary = "LDAP lookup"
13
- gem.homepage = "http://www.epigenesys.co.uk"
13
+ gem.homepage = "http://www.epigenesys.org.uk"
14
14
 
15
15
  gem.files = `git ls-files`.split($/)
16
16
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
@@ -20,6 +20,6 @@ Gem::Specification.new do |gem|
20
20
  gem.add_dependency('net-ldap')
21
21
 
22
22
  gem.add_development_dependency('rake')
23
- gem.add_development_dependency('rails', '~> 3.2')
23
+ gem.add_development_dependency('rails', '>= 3.2')
24
24
  gem.add_development_dependency('rspec')
25
25
  end
@@ -6,7 +6,7 @@ describe SheffieldLdapLookup::LdapFinder do
6
6
  describe "#connection" do
7
7
  it "should create a new LDAP connection" do
8
8
  subject.stub(ldap_config: LDAP_CONFIG)
9
- ldap_class = mock
9
+ ldap_class = double
10
10
  ldap_class.should_receive(:new).with(host: LDAP_CONFIG['host'], port: LDAP_CONFIG['port'], base: LDAP_CONFIG['base'])
11
11
  subject.connection(ldap_class)
12
12
  end
@@ -37,7 +37,7 @@ describe SheffieldLdapLookup::LdapFinder do
37
37
  it "should create a LDAP filter for the attribute and keyword" do
38
38
  finder = SheffieldLdapLookup::LdapFinder.new('username')
39
39
  finder.stub(search_attribute: 'uid')
40
- filter_class = mock
40
+ filter_class = double
41
41
  filter_class.should_receive(:eq).with('uid', 'username')
42
42
  finder.ldap_filter filter_class
43
43
  end
@@ -45,8 +45,8 @@ describe SheffieldLdapLookup::LdapFinder do
45
45
 
46
46
  describe "#lookup" do
47
47
  describe "use the LDAP filter to search for the entity and return the first result" do
48
- let(:ldap_filter) { mock }
49
- let(:connection) { mock }
48
+ let(:ldap_filter) { double }
49
+ let(:connection) { double }
50
50
  before { subject.stub(ldap_filter: ldap_filter, connection: connection) }
51
51
 
52
52
  it "should search the LDAP connection using the filter" do
@@ -55,7 +55,7 @@ describe SheffieldLdapLookup::LdapFinder do
55
55
  end
56
56
 
57
57
  it "should return the first result" do
58
- result = mock
58
+ result = double
59
59
  connection.stub(search: [result])
60
60
  subject.lookup.should == result
61
61
  end
metadata CHANGED
@@ -1,78 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sheffield_ldap_lookup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
5
- prerelease:
4
+ version: 0.0.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Shuo Chen
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-05 00:00:00.000000000 Z
11
+ date: 2014-07-31 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: net-ldap
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rails
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ~>
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '3.2'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ~>
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '3.2'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rspec
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  description: A gem to fetch information from University of Sheffield LDAP server based
@@ -97,35 +88,28 @@ files:
97
88
  - sheffield_ldap_lookup.gemspec
98
89
  - spec/lib/ldap_finder_spec.rb
99
90
  - spec/spec_helper.rb
100
- homepage: http://www.epigenesys.co.uk
91
+ homepage: http://www.epigenesys.org.uk
101
92
  licenses: []
93
+ metadata: {}
102
94
  post_install_message:
103
95
  rdoc_options: []
104
96
  require_paths:
105
97
  - lib
106
98
  required_ruby_version: !ruby/object:Gem::Requirement
107
- none: false
108
99
  requirements:
109
- - - ! '>='
100
+ - - '>='
110
101
  - !ruby/object:Gem::Version
111
102
  version: '0'
112
- segments:
113
- - 0
114
- hash: -2227935076351519590
115
103
  required_rubygems_version: !ruby/object:Gem::Requirement
116
- none: false
117
104
  requirements:
118
- - - ! '>='
105
+ - - '>='
119
106
  - !ruby/object:Gem::Version
120
107
  version: '0'
121
- segments:
122
- - 0
123
- hash: -2227935076351519590
124
108
  requirements: []
125
109
  rubyforge_project:
126
- rubygems_version: 1.8.23
110
+ rubygems_version: 2.2.2
127
111
  signing_key:
128
- specification_version: 3
112
+ specification_version: 4
129
113
  summary: LDAP lookup
130
114
  test_files:
131
115
  - spec/lib/ldap_finder_spec.rb