Class: Mautic::Event
- Defined in:
- app/models/mautic/event.rb
Instance Attribute Summary
Attributes inherited from Model
#changed, #connection, #errors
Instance Method Summary collapse
- #event_label ⇒ Object
-
#initialize(connection, hash = nil) ⇒ Event
constructor
A new instance of Event.
- #label ⇒ Object
- #source_url ⇒ Object
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_label ⇒ Object
10 11 12 |
# File 'app/models/mautic/event.rb', line 10 def event_label eventLabel end |
#label ⇒ Object
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_url ⇒ Object
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 |