Sha256: 8a0e33f589d07576f8cec0e86032a3993eab030fa8001b6a8933fa3afcbcdf1d
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
module Slack module RealTime class Store attr_accessor :users attr_accessor :bots attr_accessor :channels attr_accessor :groups attr_accessor :teams attr_accessor :ims def self users[@self_id] end def team teams[@team_id] end def initialize(attrs) if attrs.team @team_id = attrs.team.id @teams = { @team_id => Models::Team.new(attrs.team) } else @teams = {} end { 'users' => Models::User, 'channels' => Models::Channel, 'bots' => Models::Bot, 'groups' => Models::Group, 'ims' => Models::Im }.each_pair do |key, klass| instance_variable_set "@#{key}", {} attrs[key].each do |data| instance_variable_get("@#{key}").send(:[]=, data.id, klass.new(data)) end if attrs.key?(key) end if attrs.self @self_id = attrs.self.id @users[@self_id].merge!(attrs.self) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
slack-ruby-client-0.6.0 | lib/slack/real_time/store.rb |