Class: Mautic::Event
- Inherits:
-
Model
- Object
- OpenStruct
- Model
- Mautic::Event
show all
- Defined in:
- app/models/mautic/event.rb
Instance Attribute Summary
Attributes inherited from Model
#connection
Instance Method Summary
collapse
Methods inherited from Model
#attributes, #attributes=, #changes, #create, #destroy, endpoint, in, #mautic_id, #save, #update
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
|