Class: Zendesk2::AuditEvent Abstract

Inherits:
Object
  • Object
show all
Extended by:
Forwardable, Attributes
Includes:
Model
Defined in:
lib/zendesk2/audit_event.rb

Overview

This class is abstract.

subclass and implement audit event specific attributes

Instance Attribute Summary collapse

Attributes included from Model

#errors

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Attributes

assoc_accessor, assoc_reader, assoc_writer

Methods included from Model

#destroy, #destroyed?, #missing_attributes, #save, #save!, #update!

Instance Attribute Details

#ticket_auditZendesk2::TicketAudit

Returns audit that includes this event.

Returns:



31
32
33
# File 'lib/zendesk2/audit_event.rb', line 31

def ticket_audit
  @ticket_audit
end

Class Method Details

.allObject



9
10
11
# File 'lib/zendesk2/audit_event.rb', line 9

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

.for(attributes) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/zendesk2/audit_event.rb', line 17

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

.inherited(klass) ⇒ Object



13
14
15
# File 'lib/zendesk2/audit_event.rb', line 13

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

Instance Method Details

#typeString

Returns has the event value.

Returns:

  • (String)

    has the event value



28
# File 'lib/zendesk2/audit_event.rb', line 28

attribute :type, type: :string