module Delighted::Operations::Update

Public Class Methods

included(klass) click to toggle source
# File lib/delighted/operations/update.rb, line 4
def self.included(klass)
  unless klass.singleton_resource?
    klass.extend(Pluralton::ClassMethods)
  end
end

Public Instance Methods

save(client = Delighted.shared_client) click to toggle source
# File lib/delighted/operations/update.rb, line 10
def save(client = Delighted.shared_client)
  params = Utils.hash_without_key(to_hash, :id)
  params = params.merge(:expand => expanded_attribute_names) unless expanded_attribute_names.empty?
  params = Utils.serialize_values(params)
  json = client.put_json(self.class.path(id), params)
  self.class.new(json)
end