module HyperTrack::ApiOperations::Common::Patch

Public Instance Methods

patch(params={}) click to toggle source
# File lib/hypertrack/api_operations/common/patch.rb, line 6
def patch(params={})
  api_path = "#{self.class::API_BASE_PATH}#{self.id}/"
  result = HyperTrack::ApiClient.patch(api_path, params)
  update_attributes_in_object(result)
end

Private Instance Methods

update_attributes_in_object(result) click to toggle source
# File lib/hypertrack/api_operations/common/patch.rb, line 14
def update_attributes_in_object(result)
  result = Util.symbolize_keys(result)

  self_keys = self.keys

  result.each do |key, value|
    if self_keys.include?(key) && self[key] != value
      self[key] = value
    end
  end

  self
end