summaryrefslogtreecommitdiff
path: root/lib/chef/org.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2017-02-13 09:52:10 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2017-02-13 09:52:10 -0800
commit404a9bc88be538769c6c80b3b31f39a6582991d2 (patch)
tree2f8795e5f64153440c22a522d669c235a627f289 /lib/chef/org.rb
parentb949a48acc21d4b64869bd7b834708d5232b1f2a (diff)
downloadchef-404a9bc88be538769c6c80b3b31f39a6582991d2.tar.gz
fix specs: RedundantReturn, RedundantSelf, RedundantBegin
department of redundancy department Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/org.rb')
-rw-r--r--lib/chef/org.rb22
1 files changed, 10 insertions, 12 deletions
diff --git a/lib/chef/org.rb b/lib/chef/org.rb
index cf6f605370..bed5600920 100644
--- a/lib/chef/org.rb
+++ b/lib/chef/org.rb
@@ -73,15 +73,15 @@ class Chef
end
def create
- payload = { :name => self.name, :full_name => self.full_name }
+ payload = { :name => name, :full_name => full_name }
new_org = chef_rest.post("organizations", payload)
- Chef::Org.from_hash(self.to_hash.merge(new_org))
+ Chef::Org.from_hash(to_hash.merge(new_org))
end
def update
- payload = { :name => self.name, :full_name => self.full_name }
+ payload = { :name => name, :full_name => full_name }
new_org = chef_rest.put("organizations/#{name}", payload)
- Chef::Org.from_hash(self.to_hash.merge(new_org))
+ Chef::Org.from_hash(to_hash.merge(new_org))
end
def destroy
@@ -89,14 +89,12 @@ class Chef
end
def save
- begin
- create
- rescue Net::HTTPServerException => e
- if e.response.code == "409"
- update
- else
- raise e
- end
+ create
+ rescue Net::HTTPServerException => e
+ if e.response.code == "409"
+ update
+ else
+ raise e
end
end