conjur-api 4.6.0 → 4.6.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,6 +20,6 @@
20
20
  #
21
21
  module Conjur
22
22
  class API
23
- VERSION = "4.6.0"
23
+ VERSION = "4.6.1"
24
24
  end
25
25
  end
@@ -28,11 +28,8 @@ module Conjur
28
28
  end
29
29
  end
30
30
 
31
- def resource identifier
32
- paths = path_escape(identifier).split(':')
33
- raise ArgumentError, "Expected at least 3 tokens in resource identifier '#{identifier}'" if paths.length < 3
34
- path = [ paths[0], 'resources', paths[1], paths[2..-1].join(':') ].flatten.join('/')
35
- Resource.new(Conjur::Authz::API.host, credentials)[path]
31
+ def resource resource
32
+ Resource.new(Conjur::Authz::API.host, credentials)[self.class.parse_resource_id(resource).join('/')]
36
33
  end
37
34
 
38
35
  # Return all visible resources.
@@ -139,7 +139,7 @@ module Conjur
139
139
  URI.join(appliance_url + '/', service_name).to_s
140
140
  else
141
141
  case env
142
- when 'test', 'development'
142
+ when 'test', 'development', 'appliance'
143
143
  "http://localhost:#{service_base_port + service_port_offset}"
144
144
  else
145
145
  "https://#{service_name}-#{stack}-conjur.herokuapp.com"
@@ -152,7 +152,7 @@ module Conjur
152
152
  URI.join(appliance_url + '/', service_name).to_s
153
153
  else
154
154
  case env
155
- when 'test', 'development'
155
+ when 'test', 'development', 'appliance'
156
156
  "http://localhost:#{service_base_port + service_port_offset}"
157
157
  else
158
158
  "https://#{service_name}-#{account}-conjur.herokuapp.com"
@@ -15,6 +15,13 @@ describe Conjur::API, api: :dummy do
15
15
  res = api.resource "some-account:a-kind:the-id"
16
16
  res.url.should == "#{authz_host}/some-account/resources/a-kind/the-id"
17
17
  end
18
+ it "accepts an account-less resource" do
19
+ res = api.resource "a-kind:the-id"
20
+ res.url.should == "#{authz_host}/#{account}/resources/a-kind/the-id"
21
+ end
22
+ it "rejects an underspecified resource" do
23
+ expect { api.resource "the-id" }.to raise_error(/at least two tokens in the-id/)
24
+ end
18
25
  end
19
26
 
20
27
  describe '.resources' do
@@ -162,6 +162,14 @@ describe Conjur::API do
162
162
  should == "https://authz-v4-conjur.herokuapp.com"
163
163
  end
164
164
  end
165
+ context "in appliance" do
166
+ before(:each) do
167
+ Conjur::Configuration.any_instance.stub(:env).and_return "appliance"
168
+ end
169
+ its "host" do
170
+ should == "http://localhost:5100"
171
+ end
172
+ end
165
173
  context "in named production version" do
166
174
  before(:each) do
167
175
  Conjur::Configuration.any_instance.stub(:env).and_return "production"
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.6.0
4
+ version: 4.6.1
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: 2014-01-11 00:00:00.000000000 Z
13
+ date: 2014-02-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rest-client
@@ -304,7 +304,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
304
304
  version: '0'
305
305
  segments:
306
306
  - 0
307
- hash: -3859174285940063267
307
+ hash: -564295811495519523
308
308
  requirements: []
309
309
  rubyforge_project:
310
310
  rubygems_version: 1.8.25