Module: ChartMogul::API::Actions::Update

Included in:
Customer, Enrichment::DeprecatedCustomer, Plan
Defined in:
lib/chartmogul/api/actions/update.rb

Instance Method Summary collapse

Instance Method Details

#update!Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/chartmogul/api/actions/update.rb', line 5

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

  assign_all_attributes(json)
end