lib/chord.rb in chord-0.0.8 vs lib/chord.rb in chord-0.0.9

- old
+ new

@@ -123,12 +123,17 @@ @id = id @attributes = attributes end def update(new_attributes) - self.attributes = self.class.patch(base_url + "#{base_path}/#{id}", + response = self.class.patch(base_url + "#{base_path}/#{id}", http_options.merge(body: new_attributes.to_json) ).parsed_response + if response.include?('error') + raise APIError, "Chord API error (status #{response['status']}): #{response['error']}" + else + self.attributes = response + end end def delete self.class.delete(base_url + "#{base_path}/#{id}", http_options).parsed_response end