Sha256: de45b0245cd75e88745bcdcd3d0b9467c60d353135bba35c776c5b3effbdebda

Contents?: true

Size: 775 Bytes

Versions: 21

Compression:

Stored size: 775 Bytes

Contents

# @abstract subclass and implement audit event specific attributes
class Zendesk2::Client::AuditEvent < Zendesk2::Client::Model
  extend Zendesk2::Attributes
  extend Forwardable

  def self.all
    @all ||= []
  end

  def self.inherited(klass)
    all << klass
  end

  def self.for(attributes)
    event_class = "Zendesk2::Client::Ticket#{attributes["type"]}"
    if klass = all.find{|k| k.name == event_class}
      klass.new(attributes)
    else # handle unrecognized audit events
      attributes.reject{|k,v| k == :service}
    end
  end

  # @return [String] has the event value
  attribute :type, type: :string

  # @return [Zendesk2::Client::TicketAudit] audit that includes this event
  attr_accessor :ticket_audit

  def_delegators :ticket_audit, :created_at
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
zendesk2-1.5.3 lib/zendesk2/client/models/audit_event.rb