Class: Mautic::Event

Inherits:
Model
  • Object
show all
Defined in:
app/models/mautic/event.rb

Instance Attribute Summary

Attributes inherited from Model

#changed, #connection, #errors

Instance Method Summary collapse

Methods inherited from Model

#attributes, #attributes=, #changed?, #changes, #create, #destroy, endpoint, in, #mautic_id, #save, #to_mautic, #update, #update_columns

Constructor Details

#initialize(connection, hash = nil) ⇒ Event

Returns a new instance of Event.



4
5
6
7
8
# File 'app/models/mautic/event.rb', line 4

def initialize(connection, hash = nil)
  hash["id"] ||= hash["eventId"]
  hash["dateAdded"] ||= hash["timestamp"]&.to_time
  super
end

Instance Method Details

#event_labelObject



10
11
12
# File 'app/models/mautic/event.rb', line 10

def event_label
  eventLabel
end

#labelObject



14
15
16
# File 'app/models/mautic/event.rb', line 14

def label
  event_label.is_a?(Hash) && event_label["label"] || event_label.to_s
end

#source_urlObject



18
19
20
# File 'app/models/mautic/event.rb', line 18

def source_url
  event_label.is_a?(Hash) ? "#{connection.url}#{event_label["href"]}" : nil
end