Module: Delighted::Operations::Update

Included in:
SurveyResponse
Defined in:
lib/delighted/operations/update.rb

Defined Under Namespace

Modules: Pluralton

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



4
5
6
7
8
# File 'lib/delighted/operations/update.rb', line 4

def self.included(klass)
  unless klass.singleton_resource?
    klass.extend(Pluralton::ClassMethods)
  end
end

Instance Method Details

#save(client = Delighted.shared_client) ⇒ Object



10
11
12
13
14
15
16
# 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