conjur-api 2.1.5 → 2.1.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module Conjur
2
2
  class API
3
- VERSION = "2.1.5"
3
+ VERSION = "2.1.6"
4
4
  end
5
5
  end
@@ -11,7 +11,7 @@ module Conjur
11
11
  when 'test', 'development'
12
12
  "http://localhost:#{Conjur.service_base_port}"
13
13
  else
14
- "https://authn-#{Conjur.stack}-conjur.herokuapp.com"
14
+ "https://authn-#{Conjur.account}-conjur.herokuapp.com"
15
15
  end
16
16
  end
17
17
  end
@@ -19,7 +19,7 @@ module Conjur
19
19
  when 'test', 'development'
20
20
  "http://localhost:#{Conjur.service_base_port + 200}"
21
21
  else
22
- "https://core-#{Conjur.stack}-conjur.herokuapp.com"
22
+ "https://core-#{Conjur.account}-conjur.herokuapp.com"
23
23
  end
24
24
  end
25
25
  end
@@ -47,7 +47,7 @@ module Conjur
47
47
  end
48
48
  end
49
49
 
50
- self["?grant&privilege=#{query_escape p}&role=#{query_escape role}"].post(options)
50
+ self["?permit&privilege=#{query_escape p}&role=#{query_escape role}"].post(options)
51
51
  end
52
52
  end
53
53
 
@@ -59,7 +59,7 @@ module Conjur
59
59
  logger << " with options #{options.to_json}"
60
60
  end
61
61
  end
62
- self["?revoke&privilege=#{query_escape p}&role=#{query_escape role}"].post(options)
62
+ self["?deny&privilege=#{query_escape p}&role=#{query_escape role}"].post(options)
63
63
  end
64
64
  end
65
65
 
@@ -26,7 +26,7 @@ module Conjur
26
26
  end
27
27
 
28
28
  def standard_show(host, type, id)
29
- "Conjur::#{type.to_s.classify}".constantize.new(host, credentials)[ [type.to_s.pluralize, path_escape(id)].join('/') ]
29
+ "Conjur::#{type.to_s.classify}".constantize.new(host, credentials)[ [type.to_s.pluralize, fully_escape(id)].join('/') ]
30
30
  end
31
31
  end
32
32
  end
data/spec/lib/api_spec.rb CHANGED
@@ -13,37 +13,25 @@ shared_examples_for "API endpoint" do
13
13
  should == "http://localhost:#{Conjur.service_base_port + port_offset}"
14
14
  end
15
15
  end
16
- context "in stage" do
17
- before(:each) do
18
- Conjur.stub(:env).and_return "stage"
19
- end
20
- its "default_host" do
21
- should == "https://#{service_name}-stage-conjur.herokuapp.com"
22
- end
23
- end
24
- context "in ci" do
25
- before(:each) do
26
- Conjur.stub(:env).and_return "ci"
27
- end
28
- its "default_host" do
29
- should == "https://#{service_name}-ci-conjur.herokuapp.com"
30
- end
31
- end
32
- context "in production" do
33
- before(:each) do
34
- Conjur.stub(:env).and_return "production"
35
- end
36
- its "default_host" do
37
- should == "https://#{service_name}-v3-conjur.herokuapp.com"
38
- end
39
- end
40
- context "in named production version" do
41
- before(:each) do
42
- Conjur.stub(:env).and_return "production"
43
- Conjur.stub(:stack).and_return "waffle"
16
+ context "'ci' account" do
17
+ before {
18
+ Conjur.stub(:account).and_return 'ci'
19
+ }
20
+ context "in stage" do
21
+ before(:each) do
22
+ Conjur.stub(:env).and_return "stage"
23
+ end
24
+ its "default_host" do
25
+ should == "https://#{service_name}-ci-conjur.herokuapp.com"
26
+ end
44
27
  end
45
- its "default_host" do
46
- should == "https://#{service_name}-waffle-conjur.herokuapp.com"
28
+ context "in ci" do
29
+ before(:each) do
30
+ Conjur.stub(:env).and_return "ci"
31
+ end
32
+ its "default_host" do
33
+ should == "https://#{service_name}-ci-conjur.herokuapp.com"
34
+ end
47
35
  end
48
36
  end
49
37
  end
@@ -58,7 +46,45 @@ describe Conjur::API do
58
46
  context "of authz service" do
59
47
  let(:port_offset) { 100 }
60
48
  let(:api) { Conjur::Authz::API }
61
- it_should_behave_like "API endpoint"
49
+ subject { api }
50
+ context "'ci' account" do
51
+ before {
52
+ Conjur.stub(:account).and_return 'ci'
53
+ }
54
+ context "in stage" do
55
+ before(:each) do
56
+ Conjur.stub(:env).and_return "stage"
57
+ end
58
+ its "default_host" do
59
+ should == "https://authz-stage-conjur.herokuapp.com"
60
+ end
61
+ end
62
+ context "in ci" do
63
+ before(:each) do
64
+ Conjur.stub(:env).and_return "ci"
65
+ end
66
+ its "default_host" do
67
+ should == "https://authz-ci-conjur.herokuapp.com"
68
+ end
69
+ end
70
+ end
71
+ context "in production" do
72
+ before(:each) do
73
+ Conjur.stub(:env).and_return "production"
74
+ end
75
+ its "default_host" do
76
+ should == "https://authz-v3-conjur.herokuapp.com"
77
+ end
78
+ end
79
+ context "in named production version" do
80
+ before(:each) do
81
+ Conjur.stub(:env).and_return "production"
82
+ Conjur.stub(:stack).and_return "waffle"
83
+ end
84
+ its "default_host" do
85
+ should == "https://authz-waffle-conjur.herokuapp.com"
86
+ end
87
+ end
62
88
  end
63
89
  context "of core service" do
64
90
  let(:port_offset) { 200 }
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: 2.1.5
4
+ version: 2.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-04-24 00:00:00.000000000 Z
13
+ date: 2013-04-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rest-client
@@ -206,7 +206,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
206
206
  version: '0'
207
207
  segments:
208
208
  - 0
209
- hash: -713472322401587532
209
+ hash: 294077507062460443
210
210
  required_rubygems_version: !ruby/object:Gem::Requirement
211
211
  none: false
212
212
  requirements:
@@ -215,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
215
215
  version: '0'
216
216
  segments:
217
217
  - 0
218
- hash: -713472322401587532
218
+ hash: 294077507062460443
219
219
  requirements: []
220
220
  rubyforge_project:
221
221
  rubygems_version: 1.8.24