Method: Mautic::Model#initialize

Defined in:
lib/mautic/model.rb

#initialize(connection, hash = nil) ⇒ Model

Returns a new instance of Model.

Parameters:



43
44
45
46
47
48
49
# File 'lib/mautic/model.rb', line 43

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