Method: Facebooker::Rails::Publisher.method_missing

Defined in:
lib/facebooker/rails/publisher.rb

.method_missing(name, *args) ⇒ Object



533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
# File 'lib/facebooker/rails/publisher.rb', line 533

def method_missing(name,*args)
  should_send = false
  method = ''
  if md = /^create_(.*)$/.match(name.to_s)
    method = md[1]
  elsif md = /^deliver_(.*)$/.match(name.to_s)
    method = md[1]
    should_send = true            
  elsif md = /^register_(.*)$/.match(name.to_s)
    return FacebookTemplate.register(self, md[1])
  else
    super
  end
      
  #now create the item
  (publisher=new).send(method,*args)
  case publisher._body
  when UserAction
    publisher._body.template_name = method
    publisher._body.template_id ||= FacebookTemplate.bundle_id_for_class_and_method(self,method)
  end
  
  should_send ? publisher.send_message(method) : publisher._body
end