Sha256: c039898a79d4516352b088c597526272831b0115ee0612c7fecfb5cc157c1cbf
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 KB
Contents
require 'rhosync/ping' module Rhosync module PingJob @queue = :ping # Perform a ping for all clients registered to a user def self.perform(params) user = User.load(params["user_id"]) device_pins = [] user.clients.members.each do |client_id| client = Client.load(client_id,{:source_name => '*'}) params.merge!('device_port' => client.device_port, 'device_pin' => client.device_pin) if client.device_type and client.device_type.size > 0 and client.device_pin and client.device_pin.size > 0 unless device_pins.include? client.device_pin device_pins << client.device_pin klass = Object.const_get(camelize(client.device_type.downcase)) if klass params['vibrate'] = params['vibrate'].to_s klass.ping(params) end else log "Dropping ping request for client_id '#{client_id}' because it's already in user's device pin list." end else log "Skipping ping for non-registered client_id '#{client_id}'..." end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rhosync-2.1.6 | lib/rhosync/jobs/ping_job.rb |
rhosync-2.1.3 | lib/rhosync/jobs/ping_job.rb |