Sha256: 6fbb4fd923890b0f9087b24b7d8035cdde42b9848d891b6b5071fff423a7d147

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

require 'tentd/notifications'
require 'girl_friday'

module TentD
  class Notifications
    def self.queue_job(job, msg)
      const_get(job.to_s.upcase+'_QUEUE').push(msg)
    end

    TRIGGER_QUEUE = GirlFriday::WorkQueue.new(:trigger) do |msg|
      Model::NotificationSubscription.notify_all(msg[:type], msg[:post_id])
    end

    NOTIFY_QUEUE = GirlFriday::WorkQueue.new(:notify) do |msg|
      Model::NotificationSubscription.first(:id => msg[:subscription_id]).notify_about(msg[:post_id], msg[:view])
    end

    NOTIFY_ENTITY_QUEUE = GirlFriday::WorkQueue.new(:notify_entity) do |msg|
      Model::NotificationSubscription.notify_entity(msg[:entity], msg[:post_id])
    end

    UPDATE_FOLLOWING_PROFILE_QUEUE = GirlFriday::WorkQueue.new(:update_following_profile) do |msg|
      Model::Following.update_profile(msg[:following_id])
    end

    PROFILE_INFO_UPDATE_QUEUE = GirlFriday::WorkQueue.new(:profile_info_update) do |msg|
      Model::ProfileInfo.create_update_post(msg[:profile_info_id])
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tentd-0.0.1 lib/tentd/notifications/girl_friday.rb