module ChartMogul::API::Actions::Update::ClassMethods

Public Instance Methods

update!(uuid, attributes = {}) click to toggle source
# File lib/chartmogul/api/actions/update.rb, line 25
def update!(uuid, attributes = {})
  resource = new(attributes)

  resp = handling_errors do
    connection.patch("#{resource_path.apply(attributes)}/#{uuid}") do |req|
      req.headers['Content-Type'] = 'application/json'
      req.body = JSON.dump(resource.serialize_for_write)
    end
  end
  json = ChartMogul::Utils::JSONParser.parse(resp.body, immutable_keys: immutable_keys)

  new_from_json(json)
end