Sha256: 1e8ecb538ad70d249b3d913b0564eae8104b6b949218610e8043e44d4eb4eb34

Contents?: true

Size: 454 Bytes

Versions: 16

Compression:

Stored size: 454 Bytes

Contents

module Mautic
  class Event < Model

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

    def event_label
      eventLabel
    end

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

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

  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
mautic-3.1.0 app/models/mautic/event.rb
mautic-3.0.0 app/models/mautic/event.rb
mautic-2.6.1 app/models/mautic/event.rb
mautic-2.6.0 app/models/mautic/event.rb
mautic-2.5.0 app/models/mautic/event.rb
mautic-2.4.0 app/models/mautic/event.rb
mautic-2.3.11 app/models/mautic/event.rb
mautic-2.3.10 app/models/mautic/event.rb
mautic-2.3.9 app/models/mautic/event.rb
mautic-2.3.8 app/models/mautic/event.rb
mautic-2.3.7 app/models/mautic/event.rb
mautic-2.3.6 app/models/mautic/event.rb
mautic-2.3.5 app/models/mautic/event.rb
mautic-2.3.4 app/models/mautic/event.rb
mautic-2.3.3 app/models/mautic/event.rb
mautic-2.3.1 app/models/mautic/event.rb