ridley 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -92,6 +92,10 @@ module Ridley
92
92
  uri_hash[:port] = (uri_hash[:scheme] == "https" ? 443 : 80)
93
93
  end
94
94
 
95
+ if org_match = options[:server_url].match(/.*\/organizations\/(.*)/)
96
+ @organization ||= org_match[1]
97
+ end
98
+
95
99
  unless organization.nil?
96
100
  uri_hash[:path] = "/organizations/#{organization}"
97
101
  end
@@ -1,3 +1,3 @@
1
1
  module Ridley
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -62,6 +62,29 @@ describe Ridley::Connection do
62
62
  end
63
63
  end
64
64
 
65
+ describe "with a server_url containing an organization" do
66
+ before(:each) do
67
+ @conn = subject.new(
68
+ server_url: "#{server_url}/organizations/#{organization}",
69
+ client_name: client_name,
70
+ client_key: client_key
71
+ )
72
+ end
73
+
74
+ it "gets the host data from the server_url" do
75
+ @conn.host.should eql("api.opscode.com")
76
+ @conn.scheme.should eql("https")
77
+ end
78
+
79
+ it "assigns the value of the 'organization' option to an 'organization' attribute" do
80
+ @conn.organization.should eql(organization)
81
+ end
82
+
83
+ it "sets the 'path_prefix' of the connection the organization sub URI" do
84
+ @conn.path_prefix.should eql("/organizations/#{organization}")
85
+ end
86
+ end
87
+
65
88
  it "raises 'ArgumentError' if a value for server_url is not given" do
66
89
  lambda {
67
90
  subject.new(
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ridley
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-15 00:00:00.000000000 Z
12
+ date: 2012-10-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chozo
@@ -434,7 +434,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
434
434
  version: '0'
435
435
  segments:
436
436
  - 0
437
- hash: -1603548164029238966
437
+ hash: -754146470047240925
438
438
  requirements: []
439
439
  rubyforge_project:
440
440
  rubygems_version: 1.8.23