Class: Crm::Core::Mixins::ChangeLoggable::Change

Inherits:
Object
  • Object
show all
Includes:
AttributeProvider
Defined in:
lib/crm/core/mixins/change_loggable.rb

Overview

Change represents a single change log entry contained in item.changes. See ChangeLoggable for details.

Defined Under Namespace

Classes: Detail

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from AttributeProvider

#[], #attributes, #method_missing, #methods, #raw, #respond_to_missing?

Constructor Details

#initialize(raw_change) ⇒ Change

Returns a new instance of Change.



42
43
44
45
46
47
48
# File 'lib/crm/core/mixins/change_loggable.rb', line 42

def initialize(raw_change)
  change = raw_change.dup
  change['details'] = change['details'].each_with_object({}) do |(attr_name, detail), hash|
    hash[attr_name] = Detail.new(detail)
  end
  super(change)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Crm::Core::Mixins::AttributeProvider

Instance Attribute Details

#changed_atTime (readonly)

Returns the timestamp of the change to the item.

Returns:

  • (Time)


# File 'lib/crm/core/mixins/change_loggable.rb', line 50

#changed_byString (readonly)

Returns the login of the API user who made the change.

Returns:

  • (String)


# File 'lib/crm/core/mixins/change_loggable.rb', line 55

#detailsArray<Detail> (readonly)

Returns the details of the change (i.e. before and after of every changed attribute)

Returns:



# File 'lib/crm/core/mixins/change_loggable.rb', line 60