summaryrefslogtreecommitdiff
path: root/lib/chef/org.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/org.rb')
-rw-r--r--lib/chef/org.rb20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/chef/org.rb b/lib/chef/org.rb
index 41d74b6186..81eca6a991 100644
--- a/lib/chef/org.rb
+++ b/lib/chef/org.rb
@@ -18,7 +18,7 @@
require 'chef/json_compat'
require 'chef/mixin/params_validate'
-require 'chef/rest'
+require 'chef/server_api'
class Chef
class Org
@@ -35,7 +35,7 @@ class Chef
end
def chef_rest
- @chef_rest ||= Chef::REST.new(Chef::Config[:chef_server_root])
+ @chef_rest ||= Chef::ServerAPI.new(Chef::Config[:chef_server_root])
end
def name(arg=nil)
@@ -74,18 +74,18 @@ class Chef
def create
payload = {:name => self.name, :full_name => self.full_name}
- new_org = chef_rest.post_rest("organizations", payload)
+ new_org = chef_rest.post("organizations", payload)
Chef::Org.from_hash(self.to_hash.merge(new_org))
end
def update
payload = {:name => self.name, :full_name => self.full_name}
- new_org = chef_rest.put_rest("organizations/#{name}", payload)
+ new_org = chef_rest.put("organizations/#{name}", payload)
Chef::Org.from_hash(self.to_hash.merge(new_org))
end
def destroy
- chef_rest.delete_rest("organizations/#{@name}")
+ chef_rest.delete("organizations/#{@name}")
end
def save
@@ -102,13 +102,13 @@ class Chef
def associate_user(username)
request_body = {:user => username}
- response = chef_rest.post_rest "organizations/#{@name}/association_requests", request_body
+ response = chef_rest.post "organizations/#{@name}/association_requests", request_body
association_id = response["uri"].split("/").last
- chef_rest.put_rest "users/#{username}/association_requests/#{association_id}", { :response => 'accept' }
+ chef_rest.put "users/#{username}/association_requests/#{association_id}", { :response => 'accept' }
end
def dissociate_user(username)
- chef_rest.delete_rest "organizations/#{name}/users/#{username}"
+ chef_rest.delete "organizations/#{name}/users/#{username}"
end
# Class methods
@@ -129,12 +129,12 @@ class Chef
end
def self.load(org_name)
- response = Chef::REST.new(Chef::Config[:chef_server_root]).get_rest("organizations/#{org_name}")
+ response = Chef::ServerAPI.new(Chef::Config[:chef_server_root]).get("organizations/#{org_name}")
Chef::Org.from_hash(response)
end
def self.list(inflate=false)
- orgs = Chef::REST.new(Chef::Config[:chef_server_root]).get_rest('organizations')
+ orgs = Chef::ServerAPI.new(Chef::Config[:chef_server_root]).get('organizations')
if inflate
orgs.inject({}) do |org_map, (name, _url)|
org_map[name] = Chef::Org.load(name)