Method: Mautic::Model#initialize

Defined in:
lib/mautic/model.rb

#initialize(connection, hash = nil) ⇒ Model

Returns a new instance of Model.



30
31
32
33
34
35
36
# File 'lib/mautic/model.rb', line 30

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