Method: Mautic::Model#initialize

Defined in:
lib/mautic/model.rb

#initialize(connection, hash = nil) ⇒ Model

Returns a new instance of Model.

Parameters:



48
49
50
51
52
53
54
# File 'lib/mautic/model.rb', line 48

def initialize(connection, hash = nil)
  @connection = connection
  @table = MauticHash.new
  self.attributes = { id: hash['id'], created_at: hash['dateAdded']&.to_time, updated_at: hash['dateModified']&.to_time } if hash
  assign_attributes(hash)
  clear_changes
end