Sha256: 314f436a4cf6b5cd85905670cc4068493af362b33c40880379062dd727952789

Contents?: true

Size: 771 Bytes

Versions: 13

Compression:

Stored size: 771 Bytes

Contents

class ForeignOffice::Busses::PusherBus < ForeignOffice::Busses::GenericBus
  def self.config(config)
    # Pusher now pulls config directly from the ENV
    Pusher.encrypted = true
  end

  def self.app_id=(app_id)
    @app_id = app_id
  end

  def self.app_id
    @app_id
  end
  
  def self.key=(key)
    @key = key
  end

  def self.key
    @key
  end
  
  def self.secret=(secret)
    @secret = secret
  end

  def self.secret
    @secret
  end
  
  def self.connection
    @pusher ||= Pusher
  end

  def self.publish(message)
    message.symbolize_keys!
    channel = sanitize_channel(message[:channel])
    self.connection.trigger(
      channel,
      'publish',
      message
    )
  end

  def self.sanitize_channel(channel)
    channel.gsub(/::/,'.')
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
foreign_office-0.16.2 lib/foreign_office/busses/pusher_bus.rb
foreign_office-0.16.1 lib/foreign_office/busses/pusher_bus.rb
foreign_office-0.16.0 lib/foreign_office/busses/pusher_bus.rb
foreign_office-0.15.12 lib/foreign_office/busses/pusher_bus.rb
foreign_office-0.15.11 lib/foreign_office/busses/pusher_bus.rb
foreign_office-0.15.10 lib/foreign_office/busses/pusher_bus.rb
foreign_office-0.15.9 lib/foreign_office/busses/pusher_bus.rb
foreign_office-0.15.8 lib/foreign_office/busses/pusher_bus.rb
foreign_office-0.15.7 lib/foreign_office/busses/pusher_bus.rb
foreign_office-0.15.6 lib/foreign_office/busses/pusher_bus.rb
foreign_office-0.15.5 lib/foreign_office/busses/pusher_bus.rb
foreign_office-0.15.4 lib/foreign_office/busses/pusher_bus.rb
foreign_office-0.15.3 lib/foreign_office/busses/pusher_bus.rb