Sha256: 181ca984718f9e97647301ce9b4b811f1d9e12757bfbccf13115b2be117e9030

Contents?: true

Size: 809 Bytes

Versions: 6

Compression:

Stored size: 809 Bytes

Contents

class Kaui::AuditLog < Kaui::Base
  define_attr :change_date
  define_attr :change_type
  define_attr :changed_by
  define_attr :comments
  define_attr :reason_code

  def initialize(data = {})
    super(:change_date => data['changeDate'],
          :change_type => data['changeType'],
          :changed_by => data['changedBy'],
          :comments => data['comments'],
          :reason_code => data['reasonCode'])
  end

  def description
    if changed_by.present?
      changed_str = "Performed by #{changed_by} on #{ActionController::Base.helpers.format_date(change_date)}"
      if reason_code.blank? && comments.blank?
        changed_str
      elsif reason_code.blank?
        "#{changed_str}: #{comments}"
      else
        "#{changed_str} (#{reason_code} #{comments})"
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
kaui-0.2.5 app/models/kaui/audit_log.rb
kaui-0.2.4 app/models/kaui/audit_log.rb
kaui-0.2.3 app/models/kaui/audit_log.rb
kaui-0.2.2 app/models/kaui/audit_log.rb
kaui-0.2.1 app/models/kaui/audit_log.rb
kaui-0.2.0 app/models/kaui/audit_log.rb