26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/chartmogul/api/actions/update.rb', line 26
def update!(uuid, attributes = {})
resource = new(attributes)
resp = handling_errors do
connection.patch("#{resource_path.apply(attributes)}/#{uuid}") do |req|
req.['Content-Type'] = 'application/json'
req.body = JSON.dump(resource.serialize_for_write)
end
end
parsed_body = resp.body.empty? ? '{}' : resp.body
json = ChartMogul::Utils::JSONParser.parse(parsed_body, immutable_keys: immutable_keys)
new_from_json(json)
end
|