summaryrefslogtreecommitdiff
path: root/lib/chef/org.rb
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2015-12-02 12:19:33 +0000
committerThom May <thom@chef.io>2016-01-11 15:40:42 +0000
commitd99e306a41b1402209d320cb7119b12a3bbb962f (patch)
treef65940702826deb991e6198967d3e9e96cb2857a /lib/chef/org.rb
parent1b71aeb423b009f6d1a44215c89e9976957b47e9 (diff)
downloadchef-d99e306a41b1402209d320cb7119b12a3bbb962f.tar.gz
Convert all uses of Chef::REST to Chef::ServerAPItm/no_more_rest
In the process, stop auto-expanding JSON in the HTTP client, and let individual classes control that themselves. Fixes #2737, Fixes #3518
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)