class Configurations::Pusher

Schema Information

Table name: configurations

id         :integer          not null, primary key
settings   :text
type       :string(255)
created_at :datetime
updated_at :datetime
university_id :integer

Public Class Methods

clients() click to toggle source

To set the class variable for client

# File app/models/configurations/pusher.rb, line 44
def self.clients
  @@clients ||= {}
end

Public Instance Methods

client() click to toggle source

To set the client.

# File app/models/configurations/pusher.rb, line 30
def client
  if enabled?
    return self.class.clients[self.id] if self.class.clients[self.id]
    self.class.clients[self.id] = Pusher::Client.new({
      app_id: app_id,
      key: api_key,
      secret: api_secret
    })
  else
    nil
  end
end
update_pusher_client!() click to toggle source

To update pusher client for chat converstion.

# File app/models/configurations/pusher.rb, line 24
def update_pusher_client!
  self.class.clients.delete(self.id)
  self.client
end