module Besepa::ApiCalls::Update

Public Instance Methods

save(filters={}) click to toggle source
# File lib/besepa/api_calls/update.rb, line 4
def save(filters={})
  h = self.to_hash
  # id and status should not be send back to the server
  h.delete(:status)
  h.delete(:id)
  # remove all nil values. Not updated.
  h.delete_if {|key, value| value.nil? unless allowed_nils.include?(key)}
  payload = {}
  payload[self.class.klass_name] = h
  response = put "/#{self.class.api_path(filters)}/#{id}", payload
  process_attributes(response['response'])
  self
end