Sha256: 4023cca3aa413c5d17d4b0304cb57da9b80bc1a11925c43bf668696f47ee5ec0

Contents?: true

Size: 728 Bytes

Versions: 8

Compression:

Stored size: 728 Bytes

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"])
      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
          klass = Object.const_get(camelize(client.device_type.downcase))
          klass.ping(params) if klass
        else
          log "Skipping ping for non-registered client_id '#{client_id}'..."
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rhosync-2.1.0.beta.1 lib/rhosync/jobs/ping_job.rb
rhosync-2.0.9 lib/rhosync/jobs/ping_job.rb
rhosync-2.0.8 lib/rhosync/jobs/ping_job.rb
rhosync-2.0.7 lib/rhosync/jobs/ping_job.rb
rhosync-2.0.6 lib/rhosync/jobs/ping_job.rb
rhosync-2.0.5 lib/rhosync/jobs/ping_job.rb
rhosync-2.0.4 lib/rhosync/jobs/ping_job.rb
rhosync-2.0.3 lib/rhosync/jobs/ping_job.rb