Sha256: ee6bbb146c0f9bbca0ffafc714ef7a3adc478c26e115c612e21898a810e41178
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
module Kublog module Notification module FbPost def self.included(base) base.send :include, InstanceMethods base.send :include, case Kublog.notification_processing.try(:to_sym) when :delayed_job then DelayedJob else Immediate end base.send :after_create, :notify_facebook base.send :validates_presence_of, :facebook_text, :if => :facebook_notify end module InstanceMethods protected def notify_facebook if self.facebook_notify wall_post_deliver(:link => self.url, :message => self.facebook_text) end end end module DelayedJob def wall_post_deliver(elements={}) Delayed::Job.enqueue(FbPostJob.new(elements)) end end module Immediate def wall_post_deliver(elements={}) Kublog.facebook_client.link!(elements) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kublog-0.0.1.1 | lib/kublog/notification/fb_post.rb |