module ChartMogul::API::Actions::Update

Public Class Methods

included(base) click to toggle source
# File lib/chartmogul/api/actions/update.rb, line 7
def self.included(base)
  base.extend ClassMethods
end

Public Instance Methods

update!() click to toggle source
# File lib/chartmogul/api/actions/update.rb, line 11
def update!
  resp = handling_errors do
    connection.patch("#{resource_path.apply(instance_attributes)}/#{uuid}") do |req|
      req.headers['Content-Type'] = 'application/json'
      req.body = JSON.dump(serialize_for_write)
    end
  end

  json = ChartMogul::Utils::JSONParser.parse(resp.body, immutable_keys: self.class.immutable_keys)

  assign_all_attributes(json)
end