slack-ruby-client 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +19 -17
- data/.travis.yml +1 -0
- data/CHANGELOG.md +8 -0
- data/README.md +24 -4
- data/bin/commands/chat.rb +10 -9
- data/bin/commands/files.rb +19 -1
- data/examples/hi_real_time/hi.rb +2 -0
- data/lib/slack-ruby-client.rb +4 -2
- data/lib/slack/config.rb +4 -0
- data/lib/slack/logger.rb +13 -0
- data/lib/slack/messages/message.rb +6 -0
- data/lib/slack/real_time/api/schema/event.json +1 -0
- data/lib/slack/real_time/api/templates/event_handler.erb +4 -18
- data/lib/slack/real_time/client.rb +29 -5
- data/lib/slack/real_time/concurrency/celluloid.rb +6 -0
- data/lib/slack/real_time/concurrency/eventmachine.rb +22 -1
- data/lib/slack/real_time/config.rb +5 -1
- data/lib/slack/real_time/socket.rb +5 -0
- data/lib/slack/real_time/stores.rb +10 -0
- data/lib/slack/real_time/stores/base.rb +34 -0
- data/lib/slack/real_time/stores/starter.rb +361 -0
- data/lib/slack/real_time/stores/store.rb +479 -0
- data/lib/slack/version.rb +1 -1
- data/lib/slack/web/api/endpoints/api.rb +1 -1
- data/lib/slack/web/api/endpoints/auth.rb +1 -1
- data/lib/slack/web/api/endpoints/channels.rb +14 -14
- data/lib/slack/web/api/endpoints/chat.rb +15 -13
- data/lib/slack/web/api/endpoints/dnd.rb +5 -5
- data/lib/slack/web/api/endpoints/emoji.rb +1 -1
- data/lib/slack/web/api/endpoints/files.rb +30 -6
- data/lib/slack/web/api/endpoints/groups.rb +16 -16
- data/lib/slack/web/api/endpoints/im.rb +5 -5
- data/lib/slack/web/api/endpoints/mpim.rb +5 -5
- data/lib/slack/web/api/endpoints/oauth.rb +1 -1
- data/lib/slack/web/api/endpoints/pins.rb +3 -3
- data/lib/slack/web/api/endpoints/reactions.rb +4 -4
- data/lib/slack/web/api/endpoints/rtm.rb +1 -1
- data/lib/slack/web/api/endpoints/search.rb +3 -3
- data/lib/slack/web/api/endpoints/stars.rb +3 -3
- data/lib/slack/web/api/endpoints/team.rb +3 -3
- data/lib/slack/web/api/endpoints/usergroups.rb +6 -6
- data/lib/slack/web/api/endpoints/users.rb +5 -5
- data/lib/slack/web/api/patches/chat.1.text-attachments-required.patch +1 -1
- data/lib/slack/web/api/templates/method.erb +1 -1
- data/lib/slack/web/client.rb +1 -0
- data/lib/tasks/real_time.rake +27 -21
- data/slack-ruby-client.gemspec +1 -0
- data/spec/integration/integration_spec.rb +13 -1
- data/spec/slack/real_time/client_spec.rb +40 -5
- data/spec/slack/real_time/concurrency/celluloid_spec.rb +2 -1
- data/spec/slack/real_time/concurrency/eventmachine_spec.rb +3 -2
- data/spec/slack/real_time/event_handlers/event_handlers_spec.rb +15 -0
- data/spec/slack/real_time/event_handlers/team_spec.rb +54 -52
- data/spec/slack/web/api/endpoints/files_spec.rb +10 -0
- data/spec/slack/web/client_spec.rb +1 -1
- data/spec/support/real_time/connected_client.rb +3 -3
- metadata +23 -71
- data/lib/slack/real_time/api/templates/event_handlers.erb +0 -5
- data/lib/slack/real_time/event_handlers.rb +0 -66
- data/lib/slack/real_time/event_handlers/accounts_changed.rb +0 -18
- data/lib/slack/real_time/event_handlers/bot_added.rb +0 -16
- data/lib/slack/real_time/event_handlers/bot_changed.rb +0 -17
- data/lib/slack/real_time/event_handlers/channel_archive.rb +0 -17
- data/lib/slack/real_time/event_handlers/channel_created.rb +0 -17
- data/lib/slack/real_time/event_handlers/channel_deleted.rb +0 -16
- data/lib/slack/real_time/event_handlers/channel_history_changed.rb +0 -18
- data/lib/slack/real_time/event_handlers/channel_joined.rb +0 -22
- data/lib/slack/real_time/event_handlers/channel_left.rb +0 -17
- data/lib/slack/real_time/event_handlers/channel_marked.rb +0 -18
- data/lib/slack/real_time/event_handlers/channel_rename.rb +0 -17
- data/lib/slack/real_time/event_handlers/channel_unarchive.rb +0 -17
- data/lib/slack/real_time/event_handlers/commands_changed.rb +0 -18
- data/lib/slack/real_time/event_handlers/dnd_updated.rb +0 -18
- data/lib/slack/real_time/event_handlers/dnd_updated_user.rb +0 -18
- data/lib/slack/real_time/event_handlers/email_domain_changed.rb +0 -16
- data/lib/slack/real_time/event_handlers/emoji_changed.rb +0 -18
- data/lib/slack/real_time/event_handlers/file_change.rb +0 -18
- data/lib/slack/real_time/event_handlers/file_comment_added.rb +0 -18
- data/lib/slack/real_time/event_handlers/file_comment_deleted.rb +0 -18
- data/lib/slack/real_time/event_handlers/file_comment_edited.rb +0 -18
- data/lib/slack/real_time/event_handlers/file_created.rb +0 -18
- data/lib/slack/real_time/event_handlers/file_deleted.rb +0 -18
- data/lib/slack/real_time/event_handlers/file_private.rb +0 -18
- data/lib/slack/real_time/event_handlers/file_public.rb +0 -18
- data/lib/slack/real_time/event_handlers/file_shared.rb +0 -18
- data/lib/slack/real_time/event_handlers/file_unshared.rb +0 -18
- data/lib/slack/real_time/event_handlers/group_archive.rb +0 -17
- data/lib/slack/real_time/event_handlers/group_close.rb +0 -16
- data/lib/slack/real_time/event_handlers/group_history_changed.rb +0 -18
- data/lib/slack/real_time/event_handlers/group_joined.rb +0 -16
- data/lib/slack/real_time/event_handlers/group_left.rb +0 -17
- data/lib/slack/real_time/event_handlers/group_marked.rb +0 -18
- data/lib/slack/real_time/event_handlers/group_open.rb +0 -16
- data/lib/slack/real_time/event_handlers/group_rename.rb +0 -17
- data/lib/slack/real_time/event_handlers/group_unarchive.rb +0 -17
- data/lib/slack/real_time/event_handlers/im_close.rb +0 -16
- data/lib/slack/real_time/event_handlers/im_created.rb +0 -16
- data/lib/slack/real_time/event_handlers/im_history_changed.rb +0 -18
- data/lib/slack/real_time/event_handlers/im_marked.rb +0 -18
- data/lib/slack/real_time/event_handlers/im_open.rb +0 -16
- data/lib/slack/real_time/event_handlers/manual_presence_change.rb +0 -16
- data/lib/slack/real_time/event_handlers/pin_added.rb +0 -18
- data/lib/slack/real_time/event_handlers/pin_removed.rb +0 -18
- data/lib/slack/real_time/event_handlers/pref_change.rb +0 -16
- data/lib/slack/real_time/event_handlers/presence_change.rb +0 -17
- data/lib/slack/real_time/event_handlers/reaction_added.rb +0 -18
- data/lib/slack/real_time/event_handlers/reaction_removed.rb +0 -18
- data/lib/slack/real_time/event_handlers/reconnect_url.rb +0 -18
- data/lib/slack/real_time/event_handlers/star_added.rb +0 -18
- data/lib/slack/real_time/event_handlers/star_removed.rb +0 -18
- data/lib/slack/real_time/event_handlers/subteam_created.rb +0 -18
- data/lib/slack/real_time/event_handlers/subteam_self_added.rb +0 -18
- data/lib/slack/real_time/event_handlers/subteam_self_removed.rb +0 -18
- data/lib/slack/real_time/event_handlers/subteam_updated.rb +0 -18
- data/lib/slack/real_time/event_handlers/team_domain_change.rb +0 -17
- data/lib/slack/real_time/event_handlers/team_join.rb +0 -16
- data/lib/slack/real_time/event_handlers/team_migration_started.rb +0 -18
- data/lib/slack/real_time/event_handlers/team_plan_change.rb +0 -16
- data/lib/slack/real_time/event_handlers/team_pref_change.rb +0 -16
- data/lib/slack/real_time/event_handlers/team_profile_change.rb +0 -18
- data/lib/slack/real_time/event_handlers/team_profile_delete.rb +0 -18
- data/lib/slack/real_time/event_handlers/team_profile_reorder.rb +0 -18
- data/lib/slack/real_time/event_handlers/team_rename.rb +0 -16
- data/lib/slack/real_time/event_handlers/user_change.rb +0 -16
- data/lib/slack/real_time/event_handlers/user_typing.rb +0 -18
- data/lib/slack/real_time/store.rb +0 -47
@@ -1,18 +0,0 @@
|
|
1
|
-
# This file was auto-generated by lib/tasks/real_time.rake
|
2
|
-
|
3
|
-
# module Slack
|
4
|
-
# module RealTime
|
5
|
-
# module EventHandlers
|
6
|
-
# module ReconnectUrl
|
7
|
-
# # Experimental.
|
8
|
-
# # @see https://api.slack.com/events/reconnect_url
|
9
|
-
# # @see https://github.com/dblock/slack-api-ref/blob/master/events/reconnect_url.json
|
10
|
-
# def self.call(_client, _data)
|
11
|
-
# # TODO
|
12
|
-
# end
|
13
|
-
# end
|
14
|
-
# end
|
15
|
-
# end
|
16
|
-
# end
|
17
|
-
#
|
18
|
-
# Slack::RealTime::Client.events['reconnect_url'] = Slack::RealTime::EventHandlers::ReconnectUrl
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# This file was auto-generated by lib/tasks/real_time.rake
|
2
|
-
|
3
|
-
# module Slack
|
4
|
-
# module RealTime
|
5
|
-
# module EventHandlers
|
6
|
-
# module StarAdded
|
7
|
-
# # A team member has starred an item.
|
8
|
-
# # @see https://api.slack.com/events/star_added
|
9
|
-
# # @see https://github.com/dblock/slack-api-ref/blob/master/events/star_added.json
|
10
|
-
# def self.call(_client, _data)
|
11
|
-
# # TODO
|
12
|
-
# end
|
13
|
-
# end
|
14
|
-
# end
|
15
|
-
# end
|
16
|
-
# end
|
17
|
-
#
|
18
|
-
# Slack::RealTime::Client.events['star_added'] = Slack::RealTime::EventHandlers::StarAdded
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# This file was auto-generated by lib/tasks/real_time.rake
|
2
|
-
|
3
|
-
# module Slack
|
4
|
-
# module RealTime
|
5
|
-
# module EventHandlers
|
6
|
-
# module StarRemoved
|
7
|
-
# # A team member removed a star.
|
8
|
-
# # @see https://api.slack.com/events/star_removed
|
9
|
-
# # @see https://github.com/dblock/slack-api-ref/blob/master/events/star_removed.json
|
10
|
-
# def self.call(_client, _data)
|
11
|
-
# # TODO
|
12
|
-
# end
|
13
|
-
# end
|
14
|
-
# end
|
15
|
-
# end
|
16
|
-
# end
|
17
|
-
#
|
18
|
-
# Slack::RealTime::Client.events['star_removed'] = Slack::RealTime::EventHandlers::StarRemoved
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# This file was auto-generated by lib/tasks/real_time.rake
|
2
|
-
|
3
|
-
# module Slack
|
4
|
-
# module RealTime
|
5
|
-
# module EventHandlers
|
6
|
-
# module SubteamCreated
|
7
|
-
# # A user group has been added to the team.
|
8
|
-
# # @see https://api.slack.com/events/subteam_created
|
9
|
-
# # @see https://github.com/dblock/slack-api-ref/blob/master/events/subteam_created.json
|
10
|
-
# def self.call(_client, _data)
|
11
|
-
# # TODO
|
12
|
-
# end
|
13
|
-
# end
|
14
|
-
# end
|
15
|
-
# end
|
16
|
-
# end
|
17
|
-
#
|
18
|
-
# Slack::RealTime::Client.events['subteam_created'] = Slack::RealTime::EventHandlers::SubteamCreated
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# This file was auto-generated by lib/tasks/real_time.rake
|
2
|
-
|
3
|
-
# module Slack
|
4
|
-
# module RealTime
|
5
|
-
# module EventHandlers
|
6
|
-
# module SubteamSelfAdded
|
7
|
-
# # You have been added to a user group.
|
8
|
-
# # @see https://api.slack.com/events/subteam_self_added
|
9
|
-
# # @see https://github.com/dblock/slack-api-ref/blob/master/events/subteam_self_added.json
|
10
|
-
# def self.call(_client, _data)
|
11
|
-
# # TODO
|
12
|
-
# end
|
13
|
-
# end
|
14
|
-
# end
|
15
|
-
# end
|
16
|
-
# end
|
17
|
-
#
|
18
|
-
# Slack::RealTime::Client.events['subteam_self_added'] = Slack::RealTime::EventHandlers::SubteamSelfAdded
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# This file was auto-generated by lib/tasks/real_time.rake
|
2
|
-
|
3
|
-
# module Slack
|
4
|
-
# module RealTime
|
5
|
-
# module EventHandlers
|
6
|
-
# module SubteamSelfRemoved
|
7
|
-
# # You have been removed from a user group.
|
8
|
-
# # @see https://api.slack.com/events/subteam_self_removed
|
9
|
-
# # @see https://github.com/dblock/slack-api-ref/blob/master/events/subteam_self_removed.json
|
10
|
-
# def self.call(_client, _data)
|
11
|
-
# # TODO
|
12
|
-
# end
|
13
|
-
# end
|
14
|
-
# end
|
15
|
-
# end
|
16
|
-
# end
|
17
|
-
#
|
18
|
-
# Slack::RealTime::Client.events['subteam_self_removed'] = Slack::RealTime::EventHandlers::SubteamSelfRemoved
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# This file was auto-generated by lib/tasks/real_time.rake
|
2
|
-
|
3
|
-
# module Slack
|
4
|
-
# module RealTime
|
5
|
-
# module EventHandlers
|
6
|
-
# module SubteamUpdated
|
7
|
-
# # An existing user group has been updated or its members changed.
|
8
|
-
# # @see https://api.slack.com/events/subteam_updated
|
9
|
-
# # @see https://github.com/dblock/slack-api-ref/blob/master/events/subteam_updated.json
|
10
|
-
# def self.call(_client, _data)
|
11
|
-
# # TODO
|
12
|
-
# end
|
13
|
-
# end
|
14
|
-
# end
|
15
|
-
# end
|
16
|
-
# end
|
17
|
-
#
|
18
|
-
# Slack::RealTime::Client.events['subteam_updated'] = Slack::RealTime::EventHandlers::SubteamUpdated
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module Slack
|
2
|
-
module RealTime
|
3
|
-
module EventHandlers
|
4
|
-
module TeamDomainChange
|
5
|
-
# The team domain has changed.
|
6
|
-
# @see https://api.slack.com/events/team_domain_change
|
7
|
-
# @see https://github.com/dblock/slack-api-ref/blob/master/events/team_domain_change.json
|
8
|
-
def self.call(client, data)
|
9
|
-
client.team.url = data.url
|
10
|
-
client.team.domain = data.domain
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
Slack::RealTime::Client.events['team_domain_change'] = Slack::RealTime::EventHandlers::TeamDomainChange
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module Slack
|
2
|
-
module RealTime
|
3
|
-
module EventHandlers
|
4
|
-
module TeamJoin
|
5
|
-
# A new team member has joined.
|
6
|
-
# @see https://api.slack.com/events/team_join
|
7
|
-
# @see https://github.com/dblock/slack-api-ref/blob/master/events/team_join.json
|
8
|
-
def self.call(client, data)
|
9
|
-
client.users[data.user.id] = Models::User.new(data.user)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
Slack::RealTime::Client.events['team_join'] = Slack::RealTime::EventHandlers::TeamJoin
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# This file was auto-generated by lib/tasks/real_time.rake
|
2
|
-
|
3
|
-
# module Slack
|
4
|
-
# module RealTime
|
5
|
-
# module EventHandlers
|
6
|
-
# module TeamMigrationStarted
|
7
|
-
# # The team is being migrated between servers.
|
8
|
-
# # @see https://api.slack.com/events/team_migration_started
|
9
|
-
# # @see https://github.com/dblock/slack-api-ref/blob/master/events/team_migration_started.json
|
10
|
-
# def self.call(_client, _data)
|
11
|
-
# # TODO
|
12
|
-
# end
|
13
|
-
# end
|
14
|
-
# end
|
15
|
-
# end
|
16
|
-
# end
|
17
|
-
#
|
18
|
-
# Slack::RealTime::Client.events['team_migration_started'] = Slack::RealTime::EventHandlers::TeamMigrationStarted
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module Slack
|
2
|
-
module RealTime
|
3
|
-
module EventHandlers
|
4
|
-
module TeamPlanChange
|
5
|
-
# The team billing plan has changed.
|
6
|
-
# @see https://api.slack.com/events/team_plan_change
|
7
|
-
# @see https://github.com/dblock/slack-api-ref/blob/master/events/team_plan_change.json
|
8
|
-
def self.call(client, data)
|
9
|
-
client.team.plan = data.plan
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
Slack::RealTime::Client.events['team_plan_change'] = Slack::RealTime::EventHandlers::TeamPlanChange
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module Slack
|
2
|
-
module RealTime
|
3
|
-
module EventHandlers
|
4
|
-
module TeamPrefChange
|
5
|
-
# A team preference has been updated.
|
6
|
-
# @see https://api.slack.com/events/team_pref_change
|
7
|
-
# @see https://github.com/dblock/slack-api-ref/blob/master/events/team_pref_change.json
|
8
|
-
def self.call(client, data)
|
9
|
-
client.team.prefs[data.name] = data.value
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
Slack::RealTime::Client.events['team_pref_change'] = Slack::RealTime::EventHandlers::TeamPrefChange
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# This file was auto-generated by lib/tasks/real_time.rake
|
2
|
-
|
3
|
-
# module Slack
|
4
|
-
# module RealTime
|
5
|
-
# module EventHandlers
|
6
|
-
# module TeamProfileChange
|
7
|
-
# # Team profile fields have been updated.
|
8
|
-
# # @see https://api.slack.com/events/team_profile_change
|
9
|
-
# # @see https://github.com/dblock/slack-api-ref/blob/master/events/team_profile_change.json
|
10
|
-
# def self.call(_client, _data)
|
11
|
-
# # TODO
|
12
|
-
# end
|
13
|
-
# end
|
14
|
-
# end
|
15
|
-
# end
|
16
|
-
# end
|
17
|
-
#
|
18
|
-
# Slack::RealTime::Client.events['team_profile_change'] = Slack::RealTime::EventHandlers::TeamProfileChange
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# This file was auto-generated by lib/tasks/real_time.rake
|
2
|
-
|
3
|
-
# module Slack
|
4
|
-
# module RealTime
|
5
|
-
# module EventHandlers
|
6
|
-
# module TeamProfileDelete
|
7
|
-
# # Team profile fields have been deleted.
|
8
|
-
# # @see https://api.slack.com/events/team_profile_delete
|
9
|
-
# # @see https://github.com/dblock/slack-api-ref/blob/master/events/team_profile_delete.json
|
10
|
-
# def self.call(_client, _data)
|
11
|
-
# # TODO
|
12
|
-
# end
|
13
|
-
# end
|
14
|
-
# end
|
15
|
-
# end
|
16
|
-
# end
|
17
|
-
#
|
18
|
-
# Slack::RealTime::Client.events['team_profile_delete'] = Slack::RealTime::EventHandlers::TeamProfileDelete
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# This file was auto-generated by lib/tasks/real_time.rake
|
2
|
-
|
3
|
-
# module Slack
|
4
|
-
# module RealTime
|
5
|
-
# module EventHandlers
|
6
|
-
# module TeamProfileReorder
|
7
|
-
# # Team profile fields have been reordered.
|
8
|
-
# # @see https://api.slack.com/events/team_profile_reorder
|
9
|
-
# # @see https://github.com/dblock/slack-api-ref/blob/master/events/team_profile_reorder.json
|
10
|
-
# def self.call(_client, _data)
|
11
|
-
# # TODO
|
12
|
-
# end
|
13
|
-
# end
|
14
|
-
# end
|
15
|
-
# end
|
16
|
-
# end
|
17
|
-
#
|
18
|
-
# Slack::RealTime::Client.events['team_profile_reorder'] = Slack::RealTime::EventHandlers::TeamProfileReorder
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module Slack
|
2
|
-
module RealTime
|
3
|
-
module EventHandlers
|
4
|
-
module TeamRename
|
5
|
-
# The team name has changed.
|
6
|
-
# @see https://api.slack.com/events/team_rename
|
7
|
-
# @see https://github.com/dblock/slack-api-ref/blob/master/events/team_rename.json
|
8
|
-
def self.call(client, data)
|
9
|
-
client.team.name = data.name
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
Slack::RealTime::Client.events['team_rename'] = Slack::RealTime::EventHandlers::TeamRename
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module Slack
|
2
|
-
module RealTime
|
3
|
-
module EventHandlers
|
4
|
-
module UserChange
|
5
|
-
# A team member's data has changed.
|
6
|
-
# @see https://api.slack.com/events/user_change
|
7
|
-
# @see https://github.com/dblock/slack-api-ref/blob/master/events/user_change.json
|
8
|
-
def self.call(client, data)
|
9
|
-
client.users[data.user.id] = Models::User.new(data.user)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
Slack::RealTime::Client.events['user_change'] = Slack::RealTime::EventHandlers::UserChange
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# This file was auto-generated by lib/tasks/real_time.rake
|
2
|
-
|
3
|
-
# module Slack
|
4
|
-
# module RealTime
|
5
|
-
# module EventHandlers
|
6
|
-
# module UserTyping
|
7
|
-
# # A channel member is typing a message.
|
8
|
-
# # @see https://api.slack.com/events/user_typing
|
9
|
-
# # @see https://github.com/dblock/slack-api-ref/blob/master/events/user_typing.json
|
10
|
-
# def self.call(_client, _data)
|
11
|
-
# # TODO
|
12
|
-
# end
|
13
|
-
# end
|
14
|
-
# end
|
15
|
-
# end
|
16
|
-
# end
|
17
|
-
#
|
18
|
-
# Slack::RealTime::Client.events['user_typing'] = Slack::RealTime::EventHandlers::UserTyping
|
@@ -1,47 +0,0 @@
|
|
1
|
-
module Slack
|
2
|
-
module RealTime
|
3
|
-
class Store
|
4
|
-
attr_accessor :users
|
5
|
-
attr_accessor :bots
|
6
|
-
attr_accessor :channels
|
7
|
-
attr_accessor :groups
|
8
|
-
attr_accessor :teams
|
9
|
-
attr_accessor :ims
|
10
|
-
|
11
|
-
def self
|
12
|
-
users[@self_id]
|
13
|
-
end
|
14
|
-
|
15
|
-
def team
|
16
|
-
teams[@team_id]
|
17
|
-
end
|
18
|
-
|
19
|
-
def initialize(attrs)
|
20
|
-
if attrs.team
|
21
|
-
@team_id = attrs.team.id
|
22
|
-
@teams = { @team_id => Models::Team.new(attrs.team) }
|
23
|
-
else
|
24
|
-
@teams = {}
|
25
|
-
end
|
26
|
-
|
27
|
-
{
|
28
|
-
'users' => Models::User,
|
29
|
-
'channels' => Models::Channel,
|
30
|
-
'bots' => Models::Bot,
|
31
|
-
'groups' => Models::Group,
|
32
|
-
'ims' => Models::Im
|
33
|
-
}.each_pair do |key, klass|
|
34
|
-
instance_variable_set "@#{key}", {}
|
35
|
-
attrs[key].each do |data|
|
36
|
-
instance_variable_get("@#{key}").send(:[]=, data.id, klass.new(data))
|
37
|
-
end if attrs.key?(key)
|
38
|
-
end
|
39
|
-
|
40
|
-
if attrs.self
|
41
|
-
@self_id = attrs.self.id
|
42
|
-
@users[@self_id].merge!(attrs.self)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|