Class: QuickBase::EventNotifier::EventNotification

Inherits:
Object
  • Object
show all
Defined in:
lib/QuickBaseEventNotifier.rb

Overview

Event, notification, and checking policy

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tableEvent, notification = nil, eventCheckPolicy = nil) ⇒ EventNotification

Returns a new instance of EventNotification.



377
378
379
380
381
382
383
384
385
# File 'lib/QuickBaseEventNotifier.rb', line 377

def initialize(tableEvent, notification=nil, eventCheckPolicy=nil)
   if tableEvent and tableEvent.is_a?(TableEvent)
      @tableEvent,@notification,@eventCheckPolicy=tableEvent,notification,eventCheckPolicy
      @notification = Notification.new if @notification.nil?
      @eventCheckPolicy = EventCheckPolicy.new if @eventCheckPolicy.nil?
   else
      raise "tableEvent must be TableEvent" 
   end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
# File 'lib/QuickBaseEventNotifier.rb', line 387

def method_missing(method, *args)
   if method == :nextCheckTime
      @eventCheckPolicy.nextCheckTime
   elsif method == :setNextCheckTime
      @eventCheckPolicy.setNextCheckTime(args[0],args[1])
   elsif method == :stopChecking?
      @eventCheckPolicy.stopChecking?
   elsif method == :numChecks
      @eventCheckPolicy.numChecks
   elsif method == :numSuccessfulChecks
      @eventCheckPolicy.numSuccessfulChecks
   elsif method == :eventOccurred?
      @tableEvent.eventOccurred?(@qbc)
   elsif method == :url
      @tableEvent.url
   elsif method == :tableEventNotificationMessage
      @tableEvent.tableEventNotificationMessage
   else
      super.method_missing(method)
   end
end

Instance Attribute Details

#notificationObject (readonly)

Returns the value of attribute notification.



375
376
377
# File 'lib/QuickBaseEventNotifier.rb', line 375

def notification
  @notification
end

Instance Method Details

#validate(qbc) ⇒ Object



409
410
411
412
413
414
415
416
417
# File 'lib/QuickBaseEventNotifier.rb', line 409

def validate(qbc)
   if qbc and qbc.is_a?(QuickBase::Client)
      @tableEvent.validate(qbc)
      @qbc = qbc
   else
      raise "qbc must be an instance of QuickBase::Client"
   end
   true
end