Class: NaranyaEcm::Notification

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model, ActiveModel::Serialization
Defined in:
lib/naranya_ecm/models/notification.rb

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/naranya_ecm/models/notification.rb', line 23

def method_missing(method, *args, &block)
  if method =~ /\A(\w+)=\z/i
    @attributes[$1.to_sym] = args.first
  elsif method =~ /\A(\w+)\z/i
    @attributes[$1.to_sym]
  else
    super # You *must* call super if you don't handle the
          # method, otherwise you'll mess up Ruby's method
          # lookup.
  end
end

Class Method Details

.process(given_attributes) ⇒ Object



35
36
37
38
# File 'lib/naranya_ecm/models/notification.rb', line 35

def self.process(given_attributes)
  notification = self.new given_attributes
  notification.process
end

Instance Method Details

#attributesObject



8
9
10
# File 'lib/naranya_ecm/models/notification.rb', line 8

def attributes
  @attributes
end

#initialize_with_attributes_hash(attribs = {}) ⇒ Object



12
13
14
# File 'lib/naranya_ecm/models/notification.rb', line 12

def initialize_with_attributes_hash(attribs = {})
  @attributes = attribs
end

#processObject



18
19
20
21
# File 'lib/naranya_ecm/models/notification.rb', line 18

def process
  NContent::SDK.logger.debug "NaranyaEcm::Notification: #{self.attributes}"
  NContent::SDK.logger.debug "NaranyaEcm::Notification: No processing implemented."
end