conjur-api 4.9.2 → 4.10.0

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: 40b8b3e33ac15bc66d3663948bb3d7da081615d6
4
- data.tar.gz: 1c79f61e8e87c94089cd9439833e1b118fc68e68
3
+ metadata.gz: 433c76ede7475ca9af07431734069c9692ace125
4
+ data.tar.gz: 842baac408d16a623dc0539dbb312d970040eafc
5
5
  SHA512:
6
- metadata.gz: 1e2b831d564b9cf0f9df2f55bfcd50a138b0c607a513de45e2974b9f6ed4ee9637a7ae3c4e5c6b6024d1445ec8bcddd1741d646b1d8dacc078838935be9c3ca3
7
- data.tar.gz: 2d400fc3541fd4235bfb445a66a6112cfff95c5e962a6ca21de94ec68a824b8e1d4823cd7f88b71a3921163fd44c14d9dcfa004e4b02986531ceff9d819c30a4
6
+ metadata.gz: beb95d37603ab34b37f33e297d1c8ba5efb90d800432def027f110a895782d6e5eb730d220ac02430d95320ad684b0edb3d3ff76d0b04c799dc75ec309ad6458
7
+ data.tar.gz: 115862f1080d52472f0cae83359f86526d6166668af11fa603cc0b38170c0f23a6fe6646c90eb62965839f789b51aefa624111212403174c4304386191da3e21
@@ -20,6 +20,6 @@
20
20
  #
21
21
  module Conjur
22
22
  class API
23
- VERSION = "4.9.2"
23
+ VERSION = "4.10.0"
24
24
  end
25
25
  end
@@ -29,5 +29,9 @@ module Conjur
29
29
  def user login
30
30
  standard_show Conjur::Core::API.host, :user, login
31
31
  end
32
+
33
+ def find_users options
34
+ JSON.parse( RestClient::Resource.new(Conjur::Core::API.host, credentials)["users/search?#{options.to_query}"].get )
35
+ end
32
36
  end
33
- end
37
+ end
data/lib/conjur/user.rb CHANGED
@@ -27,5 +27,9 @@ module Conjur
27
27
  include ActsAsUser
28
28
 
29
29
  alias login id
30
+
31
+ def update options
32
+ self.put(options)
33
+ end
30
34
  end
31
- end
35
+ end
@@ -8,6 +8,40 @@ describe Conjur::API, api: :dummy do
8
8
  end
9
9
  end
10
10
 
11
+ describe 'user#update' do
12
+ let(:userid) { "alice@wonderland" }
13
+ it "PUTs to /users/:id?uidnumber=:uidnumber" do
14
+ RestClient::Request.should_receive(:execute).with(
15
+ method: :put,
16
+ url: "#{core_host}/users/#{api.fully_escape(userid)}",
17
+ headers: credentials[:headers],
18
+ payload: { uidnumber: 12345 }
19
+ )
20
+ api.user(userid).update(uidnumber: 12345)
21
+ end
22
+
23
+ end
24
+
25
+ describe "find_users" do
26
+
27
+ let(:search_parameters) { {uidnumber: 12345} }
28
+ let(:search_result) { ["someuser"].to_json }
29
+
30
+ it "GETs /users/search with appropriate options, and returns parsed JSON response" do
31
+ RestClient::Request.should_receive(:execute).with(
32
+ method: :get,
33
+ url: "#{core_host}/users/search?uidnumber=12345",
34
+ headers: credentials[:headers]
35
+ ).and_return search_result
36
+
37
+ parsed = double()
38
+
39
+ JSON.should_receive(:parse).with(search_result).and_return(parsed)
40
+
41
+ api.find_users(search_parameters).should == parsed
42
+ end
43
+ end
44
+
11
45
  describe '#user' do
12
46
  it_should_behave_like 'standard_show with', :user, :login do
13
47
  let(:invoke) { api.user :login }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conjur-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.9.2
4
+ version: 4.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rafał Rzepecki
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-08-05 00:00:00.000000000 Z
12
+ date: 2014-08-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client