module Dhis2::Api::Updatable

Public Instance Methods

update() click to toggle source
# File lib/dhis2/api/updatable.rb, line 17
def update
  client.put(
    path: "#{self.class.resource_name}/#{id}",
    payload: update_args
  ).tap do |response|
    validate_instance_update(response)
  end
end
update_attributes(attributes) click to toggle source
# File lib/dhis2/api/updatable.rb, line 6
def update_attributes(attributes)
  client.patch(
    path: "#{self.class.resource_name}/#{id}",
    payload: attributes
  )
  attributes.each do |key, value|
    public_send("#{key}=", value)
  end
  self
end

Private Instance Methods

update_args() click to toggle source
# File lib/dhis2/api/updatable.rb, line 28
def update_args
  to_h.reject { |k, _| k == :client }
end