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.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +19 -17
  3. data/.travis.yml +1 -0
  4. data/CHANGELOG.md +8 -0
  5. data/README.md +24 -4
  6. data/bin/commands/chat.rb +10 -9
  7. data/bin/commands/files.rb +19 -1
  8. data/examples/hi_real_time/hi.rb +2 -0
  9. data/lib/slack-ruby-client.rb +4 -2
  10. data/lib/slack/config.rb +4 -0
  11. data/lib/slack/logger.rb +13 -0
  12. data/lib/slack/messages/message.rb +6 -0
  13. data/lib/slack/real_time/api/schema/event.json +1 -0
  14. data/lib/slack/real_time/api/templates/event_handler.erb +4 -18
  15. data/lib/slack/real_time/client.rb +29 -5
  16. data/lib/slack/real_time/concurrency/celluloid.rb +6 -0
  17. data/lib/slack/real_time/concurrency/eventmachine.rb +22 -1
  18. data/lib/slack/real_time/config.rb +5 -1
  19. data/lib/slack/real_time/socket.rb +5 -0
  20. data/lib/slack/real_time/stores.rb +10 -0
  21. data/lib/slack/real_time/stores/base.rb +34 -0
  22. data/lib/slack/real_time/stores/starter.rb +361 -0
  23. data/lib/slack/real_time/stores/store.rb +479 -0
  24. data/lib/slack/version.rb +1 -1
  25. data/lib/slack/web/api/endpoints/api.rb +1 -1
  26. data/lib/slack/web/api/endpoints/auth.rb +1 -1
  27. data/lib/slack/web/api/endpoints/channels.rb +14 -14
  28. data/lib/slack/web/api/endpoints/chat.rb +15 -13
  29. data/lib/slack/web/api/endpoints/dnd.rb +5 -5
  30. data/lib/slack/web/api/endpoints/emoji.rb +1 -1
  31. data/lib/slack/web/api/endpoints/files.rb +30 -6
  32. data/lib/slack/web/api/endpoints/groups.rb +16 -16
  33. data/lib/slack/web/api/endpoints/im.rb +5 -5
  34. data/lib/slack/web/api/endpoints/mpim.rb +5 -5
  35. data/lib/slack/web/api/endpoints/oauth.rb +1 -1
  36. data/lib/slack/web/api/endpoints/pins.rb +3 -3
  37. data/lib/slack/web/api/endpoints/reactions.rb +4 -4
  38. data/lib/slack/web/api/endpoints/rtm.rb +1 -1
  39. data/lib/slack/web/api/endpoints/search.rb +3 -3
  40. data/lib/slack/web/api/endpoints/stars.rb +3 -3
  41. data/lib/slack/web/api/endpoints/team.rb +3 -3
  42. data/lib/slack/web/api/endpoints/usergroups.rb +6 -6
  43. data/lib/slack/web/api/endpoints/users.rb +5 -5
  44. data/lib/slack/web/api/patches/chat.1.text-attachments-required.patch +1 -1
  45. data/lib/slack/web/api/templates/method.erb +1 -1
  46. data/lib/slack/web/client.rb +1 -0
  47. data/lib/tasks/real_time.rake +27 -21
  48. data/slack-ruby-client.gemspec +1 -0
  49. data/spec/integration/integration_spec.rb +13 -1
  50. data/spec/slack/real_time/client_spec.rb +40 -5
  51. data/spec/slack/real_time/concurrency/celluloid_spec.rb +2 -1
  52. data/spec/slack/real_time/concurrency/eventmachine_spec.rb +3 -2
  53. data/spec/slack/real_time/event_handlers/event_handlers_spec.rb +15 -0
  54. data/spec/slack/real_time/event_handlers/team_spec.rb +54 -52
  55. data/spec/slack/web/api/endpoints/files_spec.rb +10 -0
  56. data/spec/slack/web/client_spec.rb +1 -1
  57. data/spec/support/real_time/connected_client.rb +3 -3
  58. metadata +23 -71
  59. data/lib/slack/real_time/api/templates/event_handlers.erb +0 -5
  60. data/lib/slack/real_time/event_handlers.rb +0 -66
  61. data/lib/slack/real_time/event_handlers/accounts_changed.rb +0 -18
  62. data/lib/slack/real_time/event_handlers/bot_added.rb +0 -16
  63. data/lib/slack/real_time/event_handlers/bot_changed.rb +0 -17
  64. data/lib/slack/real_time/event_handlers/channel_archive.rb +0 -17
  65. data/lib/slack/real_time/event_handlers/channel_created.rb +0 -17
  66. data/lib/slack/real_time/event_handlers/channel_deleted.rb +0 -16
  67. data/lib/slack/real_time/event_handlers/channel_history_changed.rb +0 -18
  68. data/lib/slack/real_time/event_handlers/channel_joined.rb +0 -22
  69. data/lib/slack/real_time/event_handlers/channel_left.rb +0 -17
  70. data/lib/slack/real_time/event_handlers/channel_marked.rb +0 -18
  71. data/lib/slack/real_time/event_handlers/channel_rename.rb +0 -17
  72. data/lib/slack/real_time/event_handlers/channel_unarchive.rb +0 -17
  73. data/lib/slack/real_time/event_handlers/commands_changed.rb +0 -18
  74. data/lib/slack/real_time/event_handlers/dnd_updated.rb +0 -18
  75. data/lib/slack/real_time/event_handlers/dnd_updated_user.rb +0 -18
  76. data/lib/slack/real_time/event_handlers/email_domain_changed.rb +0 -16
  77. data/lib/slack/real_time/event_handlers/emoji_changed.rb +0 -18
  78. data/lib/slack/real_time/event_handlers/file_change.rb +0 -18
  79. data/lib/slack/real_time/event_handlers/file_comment_added.rb +0 -18
  80. data/lib/slack/real_time/event_handlers/file_comment_deleted.rb +0 -18
  81. data/lib/slack/real_time/event_handlers/file_comment_edited.rb +0 -18
  82. data/lib/slack/real_time/event_handlers/file_created.rb +0 -18
  83. data/lib/slack/real_time/event_handlers/file_deleted.rb +0 -18
  84. data/lib/slack/real_time/event_handlers/file_private.rb +0 -18
  85. data/lib/slack/real_time/event_handlers/file_public.rb +0 -18
  86. data/lib/slack/real_time/event_handlers/file_shared.rb +0 -18
  87. data/lib/slack/real_time/event_handlers/file_unshared.rb +0 -18
  88. data/lib/slack/real_time/event_handlers/group_archive.rb +0 -17
  89. data/lib/slack/real_time/event_handlers/group_close.rb +0 -16
  90. data/lib/slack/real_time/event_handlers/group_history_changed.rb +0 -18
  91. data/lib/slack/real_time/event_handlers/group_joined.rb +0 -16
  92. data/lib/slack/real_time/event_handlers/group_left.rb +0 -17
  93. data/lib/slack/real_time/event_handlers/group_marked.rb +0 -18
  94. data/lib/slack/real_time/event_handlers/group_open.rb +0 -16
  95. data/lib/slack/real_time/event_handlers/group_rename.rb +0 -17
  96. data/lib/slack/real_time/event_handlers/group_unarchive.rb +0 -17
  97. data/lib/slack/real_time/event_handlers/im_close.rb +0 -16
  98. data/lib/slack/real_time/event_handlers/im_created.rb +0 -16
  99. data/lib/slack/real_time/event_handlers/im_history_changed.rb +0 -18
  100. data/lib/slack/real_time/event_handlers/im_marked.rb +0 -18
  101. data/lib/slack/real_time/event_handlers/im_open.rb +0 -16
  102. data/lib/slack/real_time/event_handlers/manual_presence_change.rb +0 -16
  103. data/lib/slack/real_time/event_handlers/pin_added.rb +0 -18
  104. data/lib/slack/real_time/event_handlers/pin_removed.rb +0 -18
  105. data/lib/slack/real_time/event_handlers/pref_change.rb +0 -16
  106. data/lib/slack/real_time/event_handlers/presence_change.rb +0 -17
  107. data/lib/slack/real_time/event_handlers/reaction_added.rb +0 -18
  108. data/lib/slack/real_time/event_handlers/reaction_removed.rb +0 -18
  109. data/lib/slack/real_time/event_handlers/reconnect_url.rb +0 -18
  110. data/lib/slack/real_time/event_handlers/star_added.rb +0 -18
  111. data/lib/slack/real_time/event_handlers/star_removed.rb +0 -18
  112. data/lib/slack/real_time/event_handlers/subteam_created.rb +0 -18
  113. data/lib/slack/real_time/event_handlers/subteam_self_added.rb +0 -18
  114. data/lib/slack/real_time/event_handlers/subteam_self_removed.rb +0 -18
  115. data/lib/slack/real_time/event_handlers/subteam_updated.rb +0 -18
  116. data/lib/slack/real_time/event_handlers/team_domain_change.rb +0 -17
  117. data/lib/slack/real_time/event_handlers/team_join.rb +0 -16
  118. data/lib/slack/real_time/event_handlers/team_migration_started.rb +0 -18
  119. data/lib/slack/real_time/event_handlers/team_plan_change.rb +0 -16
  120. data/lib/slack/real_time/event_handlers/team_pref_change.rb +0 -16
  121. data/lib/slack/real_time/event_handlers/team_profile_change.rb +0 -18
  122. data/lib/slack/real_time/event_handlers/team_profile_delete.rb +0 -18
  123. data/lib/slack/real_time/event_handlers/team_profile_reorder.rb +0 -18
  124. data/lib/slack/real_time/event_handlers/team_rename.rb +0 -16
  125. data/lib/slack/real_time/event_handlers/user_change.rb +0 -16
  126. data/lib/slack/real_time/event_handlers/user_typing.rb +0 -18
  127. data/lib/slack/real_time/store.rb +0 -47
@@ -5,6 +5,26 @@ module Slack
5
5
  module RealTime
6
6
  module Concurrency
7
7
  module Eventmachine
8
+ class Client < Faye::WebSocket::Client
9
+ attr_reader :logger
10
+ protected :logger
11
+
12
+ def initialize(url, protocols = nil, options = {})
13
+ @logger = options.delete(:logger) || Slack::RealTime::Config.logger || Slack::Config.logger
14
+ super
15
+ end
16
+
17
+ def parse(data)
18
+ logger.debug("#{self.class}##{__method__}") { data }
19
+ super data
20
+ end
21
+
22
+ def write(data)
23
+ logger.debug("#{self.class}##{__method__}") { data }
24
+ super data
25
+ end
26
+ end
27
+
8
28
  class Socket < Slack::RealTime::Socket
9
29
  def start_async
10
30
  thread = ensure_reactor_running
@@ -15,6 +35,7 @@ module Slack
15
35
  end
16
36
 
17
37
  def send_data(message)
38
+ logger.debug("#{self.class}##{__method__}") { message }
18
39
  driver.send(message)
19
40
  end
20
41
 
@@ -30,7 +51,7 @@ module Slack
30
51
  end
31
52
 
32
53
  def connect
33
- @driver = ::Faye::WebSocket::Client.new(url, nil, options)
54
+ @driver = Client.new(url, nil, options.merge(logger: logger))
34
55
  end
35
56
  end
36
57
  end
@@ -10,7 +10,9 @@ module Slack
10
10
  :websocket_ping,
11
11
  :websocket_proxy,
12
12
  :concurrency,
13
- :start_options
13
+ :start_options,
14
+ :store_class,
15
+ :logger
14
16
  ]
15
17
 
16
18
  attr_accessor(*Config::ATTRIBUTES)
@@ -21,6 +23,8 @@ module Slack
21
23
  self.token = nil
22
24
  self.concurrency = method(:detect_concurrency)
23
25
  self.start_options = {}
26
+ self.store_class = Slack::RealTime::Store
27
+ self.logger = nil
24
28
  end
25
29
 
26
30
  def concurrency
@@ -4,14 +4,18 @@ module Slack
4
4
  attr_accessor :url
5
5
  attr_accessor :options
6
6
  attr_reader :driver
7
+ attr_reader :logger
8
+ protected :logger
7
9
 
8
10
  def initialize(url, options = {})
9
11
  @url = url
10
12
  @options = options
11
13
  @driver = nil
14
+ @logger = options.delete(:logger) || Slack::RealTime::Config.logger || Slack::Config.logger
12
15
  end
13
16
 
14
17
  def send_data(message)
18
+ logger.debug("#{self.class}##{__method__}") { message }
15
19
  case message
16
20
  when Numeric then driver.text(message.to_s)
17
21
  when String then driver.text(message)
@@ -24,6 +28,7 @@ module Slack
24
28
  return if connected?
25
29
 
26
30
  connect
31
+ logger.debug("#{self.class}##{__method__}") { driver.class }
27
32
 
28
33
  yield driver if block_given?
29
34
  end
@@ -0,0 +1,10 @@
1
+ require 'slack/real_time/stores/base'
2
+ require 'slack/real_time/stores/starter'
3
+ require 'slack/real_time/stores/store'
4
+
5
+ module Slack
6
+ module RealTime
7
+ class Store < Stores::Store
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,34 @@
1
+ module Slack
2
+ module RealTime
3
+ module Stores
4
+ # Doesn't store anything.
5
+ class Base
6
+ class_attribute :events
7
+
8
+ attr_accessor :users
9
+ attr_accessor :bots
10
+ attr_accessor :channels
11
+ attr_accessor :groups
12
+ attr_accessor :teams
13
+ attr_accessor :ims
14
+
15
+ def self
16
+ nil
17
+ end
18
+
19
+ def team
20
+ nil
21
+ end
22
+
23
+ def initialize(_attrs)
24
+ end
25
+
26
+ def self.on(event, &block)
27
+ self.events ||= {}
28
+ self.events[event.to_s] ||= []
29
+ self.events[event.to_s] << block
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,361 @@
1
+ module Slack
2
+ module RealTime
3
+ module Stores
4
+ # Only stores initial information.
5
+ class Starter < Base
6
+ attr_reader :self
7
+
8
+ attr_reader :team
9
+
10
+ def initialize(attrs)
11
+ @team = Models::Team.new(attrs.team)
12
+ @self = Models::Team.new(attrs.self)
13
+ end
14
+
15
+ ### RealTime Events
16
+
17
+ # A channel member is typing a message.
18
+ # @see https://api.slack.com/events/user_typing
19
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/user_typing.json
20
+ # on :user_typing do |data|
21
+
22
+ # A team member's data has changed.
23
+ # @see https://api.slack.com/events/user_change
24
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/user_change.json
25
+ # on :user_change do |data|
26
+
27
+ # A new team member has joined.
28
+ # @see https://api.slack.com/events/team_join
29
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/team_join.json
30
+ # on :team_join do |data|
31
+
32
+ # An existing user group has been updated or its members changed.
33
+ # @see https://api.slack.com/events/subteam_updated
34
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/subteam_updated.json
35
+ # on :subteam_updated do |data|
36
+
37
+ # You have been removed from a user group.
38
+ # @see https://api.slack.com/events/subteam_self_removed
39
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/subteam_self_removed.json
40
+ # on :subteam_self_removed do |data|
41
+
42
+ # You have been added to a user group.
43
+ # @see https://api.slack.com/events/subteam_self_added
44
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/subteam_self_added.json
45
+ # on :subteam_self_added do |data|
46
+
47
+ # A user group has been added to the team.
48
+ # @see https://api.slack.com/events/subteam_created
49
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/subteam_created.json
50
+ # on :subteam_created do |data|
51
+
52
+ # A team member removed a star.
53
+ # @see https://api.slack.com/events/star_removed
54
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/star_removed.json
55
+ # on :star_removed do |data|
56
+
57
+ # A team member has starred an item.
58
+ # @see https://api.slack.com/events/star_added
59
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/star_added.json
60
+ # on :star_added do |data|
61
+
62
+ # Experimental.
63
+ # @see https://api.slack.com/events/reconnect_url
64
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/reconnect_url.json
65
+ # on :reconnect_url do |data|
66
+
67
+ # A team member removed an emoji reaction.
68
+ # @see https://api.slack.com/events/reaction_removed
69
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/reaction_removed.json
70
+ # on :reaction_removed do |data|
71
+
72
+ # A team member has added an emoji reaction to an item.
73
+ # @see https://api.slack.com/events/reaction_added
74
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/reaction_added.json
75
+ # on :reaction_added do |data|
76
+
77
+ # A team member's presence changed.
78
+ # @see https://api.slack.com/events/presence_change
79
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/presence_change.json
80
+ # on :presence_change do |data|
81
+
82
+ # You have updated your preferences.
83
+ # @see https://api.slack.com/events/pref_change
84
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/pref_change.json
85
+ # on :pref_change do |data|
86
+
87
+ # A pin was removed from a channel.
88
+ # @see https://api.slack.com/events/pin_removed
89
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/pin_removed.json
90
+ # on :pin_removed do |data|
91
+
92
+ # A pin was added to a channel.
93
+ # @see https://api.slack.com/events/pin_added
94
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/pin_added.json
95
+ # on :pin_added do |data|
96
+
97
+ # You manually updated your presence.
98
+ # @see https://api.slack.com/events/manual_presence_change
99
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/manual_presence_change.json
100
+ # on :manual_presence_change do |data|
101
+
102
+ # You opened a direct message channel.
103
+ # @see https://api.slack.com/events/im_open
104
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/im_open.json
105
+ # on :im_open do |data|
106
+
107
+ # A direct message read marker was updated.
108
+ # @see https://api.slack.com/events/im_marked
109
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/im_marked.json
110
+ # on :im_marked do |data|
111
+
112
+ # Bulk updates were made to a DM channel's history.
113
+ # @see https://api.slack.com/events/im_history_changed
114
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/im_history_changed.json
115
+ # on :im_history_changed do |data|
116
+
117
+ # A direct message channel was created.
118
+ # @see https://api.slack.com/events/im_created
119
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/im_created.json
120
+ # on :im_created do |data|
121
+
122
+ # You closed a direct message channel.
123
+ # @see https://api.slack.com/events/im_close
124
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/im_close.json
125
+ # on :im_close do |data|
126
+
127
+ # A private group was unarchived.
128
+ # @see https://api.slack.com/events/group_unarchive
129
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/group_unarchive.json
130
+ # on :group_unarchive do |data|
131
+
132
+ # A private group was renamed.
133
+ # @see https://api.slack.com/events/group_rename
134
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/group_rename.json
135
+ # on :group_rename do |data|
136
+
137
+ # You opened a group channel.
138
+ # @see https://api.slack.com/events/group_open
139
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/group_open.json
140
+ # on :group_open do |data|
141
+
142
+ # A private group read marker was updated.
143
+ # @see https://api.slack.com/events/group_marked
144
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/group_marked.json
145
+ # on :group_marked do |data|
146
+
147
+ # You left a private group.
148
+ # @see https://api.slack.com/events/group_left
149
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/group_left.json
150
+ # on :group_left do |data|
151
+
152
+ # You joined a private group.
153
+ # @see https://api.slack.com/events/group_joined
154
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/group_joined.json
155
+ # on :group_joined do |data|
156
+
157
+ # Bulk updates were made to a group's history.
158
+ # @see https://api.slack.com/events/group_history_changed
159
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/group_history_changed.json
160
+ # on :group_history_changed do |data|
161
+
162
+ # You closed a group channel.
163
+ # @see https://api.slack.com/events/group_close
164
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/group_close.json
165
+ # on :group_close do |data|
166
+
167
+ # A private group was archived.
168
+ # @see https://api.slack.com/events/group_archive
169
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/group_archive.json
170
+ # on :group_archive do |data|
171
+
172
+ # A file was unshared.
173
+ # @see https://api.slack.com/events/file_unshared
174
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/file_unshared.json
175
+ # on :file_unshared do |data|
176
+
177
+ # A file was shared.
178
+ # @see https://api.slack.com/events/file_shared
179
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/file_shared.json
180
+ # on :file_shared do |data|
181
+
182
+ # A file was made public.
183
+ # @see https://api.slack.com/events/file_public
184
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/file_public.json
185
+ # on :file_public do |data|
186
+
187
+ # A file was made private.
188
+ # @see https://api.slack.com/events/file_private
189
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/file_private.json
190
+ # on :file_private do |data|
191
+
192
+ # A file was deleted.
193
+ # @see https://api.slack.com/events/file_deleted
194
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/file_deleted.json
195
+ # on :file_deleted do |data|
196
+
197
+ # A file was created.
198
+ # @see https://api.slack.com/events/file_created
199
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/file_created.json
200
+ # on :file_created do |data|
201
+
202
+ # A file comment was edited.
203
+ # @see https://api.slack.com/events/file_comment_edited
204
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/file_comment_edited.json
205
+ # on :file_comment_edited do |data|
206
+
207
+ # A file comment was deleted.
208
+ # @see https://api.slack.com/events/file_comment_deleted
209
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/file_comment_deleted.json
210
+ # on :file_comment_deleted do |data|
211
+
212
+ # A file comment was added.
213
+ # @see https://api.slack.com/events/file_comment_added
214
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/file_comment_added.json
215
+ # on :file_comment_added do |data|
216
+
217
+ # A file was changed.
218
+ # @see https://api.slack.com/events/file_change
219
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/file_change.json
220
+ # on :file_change do |data|
221
+
222
+ # A team custom emoji has been added or changed.
223
+ # @see https://api.slack.com/events/emoji_changed
224
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/emoji_changed.json
225
+ # on :emoji_changed do |data|
226
+
227
+ # Do not Disturb settings changed for a team member.
228
+ # @see https://api.slack.com/events/dnd_updated_user
229
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/dnd_updated_user.json
230
+ # on :dnd_updated_user do |data|
231
+
232
+ # Do not Disturb settings changed for the current user.
233
+ # @see https://api.slack.com/events/dnd_updated
234
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/dnd_updated.json
235
+ # on :dnd_updated do |data|
236
+
237
+ # A team slash command has been added or changed.
238
+ # @see https://api.slack.com/events/commands_changed
239
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/commands_changed.json
240
+ # on :commands_changed do |data|
241
+
242
+ # A team channel was unarchived.
243
+ # @see https://api.slack.com/events/channel_unarchive
244
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/channel_unarchive.json
245
+ # on :channel_unarchive do |data|
246
+
247
+ # A team channel was renamed.
248
+ # @see https://api.slack.com/events/channel_rename
249
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/channel_rename.json
250
+ # on :channel_rename do |data|
251
+
252
+ # Your channel read marker was updated.
253
+ # @see https://api.slack.com/events/channel_marked
254
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/channel_marked.json
255
+ # on :channel_marked do |data|
256
+
257
+ # You left a channel.
258
+ # @see https://api.slack.com/events/channel_left
259
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/channel_left.json
260
+ # on :channel_left do |data|
261
+
262
+ # You joined a channel.
263
+ # @see https://api.slack.com/events/channel_joined
264
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/channel_joined.json
265
+ # on :channel_joined do |data|
266
+
267
+ # Bulk updates were made to a channel's history.
268
+ # @see https://api.slack.com/events/channel_history_changed
269
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/channel_history_changed.json
270
+ # on :channel_history_changed do |data|
271
+
272
+ # A team channel was deleted.
273
+ # @see https://api.slack.com/events/channel_deleted
274
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/channel_deleted.json
275
+ # on :channel_deleted do |data|
276
+
277
+ # A team channel was created.
278
+ # @see https://api.slack.com/events/channel_created
279
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/channel_created.json
280
+ # on :channel_created do |data|
281
+
282
+ # A team channel was archived.
283
+ # @see https://api.slack.com/events/channel_archive
284
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/channel_archive.json
285
+ # on :channel_archive do |data|
286
+
287
+ # An integration bot was changed.
288
+ # @see https://api.slack.com/events/bot_changed
289
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/bot_changed.json
290
+ # on :bot_changed do |data|
291
+
292
+ # An integration bot was added.
293
+ # @see https://api.slack.com/events/bot_added
294
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/bot_added.json
295
+ # on :bot_added do |data|
296
+
297
+ # The list of accounts a user is signed into has changed.
298
+ # @see https://api.slack.com/events/accounts_changed
299
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/accounts_changed.json
300
+ # on :accounts_changed do |data|
301
+
302
+ # The team domain has changed.
303
+ # @see https://api.slack.com/events/team_domain_change
304
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/team_domain_change.json
305
+ on :team_domain_change do |data|
306
+ team.url = data.url
307
+ team.domain = data.domain
308
+ end
309
+
310
+ # The team is being migrated between servers.
311
+ # @see https://api.slack.com/events/team_migration_started
312
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/team_migration_started.json
313
+ # on :team_migration_started do |data|
314
+
315
+ # The team billing plan has changed.
316
+ # @see https://api.slack.com/events/team_plan_change
317
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/team_plan_change.json
318
+ on :team_plan_change do |data|
319
+ team.plan = data.plan
320
+ end
321
+
322
+ # A team preference has been updated.
323
+ # @see https://api.slack.com/events/team_pref_change
324
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/team_pref_change.json
325
+ on :team_pref_change do |data|
326
+ team.prefs ||= {}
327
+ team.prefs[data.name] = data.value
328
+ end
329
+
330
+ # Team profile fields have been updated.
331
+ # @see https://api.slack.com/events/team_profile_change
332
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/team_profile_change.json
333
+ # on :team_profile_change do |data|
334
+
335
+ # Team profile fields have been deleted.
336
+ # @see https://api.slack.com/events/team_profile_delete
337
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/team_profile_delete.json
338
+ # on :team_profile_delete do |data|
339
+
340
+ # Team profile fields have been reordered.
341
+ # @see https://api.slack.com/events/team_profile_reorder
342
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/team_profile_reorder.json
343
+ # on :team_profile_reorder do |data|
344
+
345
+ # The team name has changed.
346
+ # @see https://api.slack.com/events/team_rename
347
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/team_rename.json
348
+ on :team_rename do |data|
349
+ team.name = data.name
350
+ end
351
+
352
+ # The team email domain has changed.
353
+ # @see https://api.slack.com/events/email_domain_changed
354
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/email_domain_changed.json
355
+ on :email_domain_changed do |data|
356
+ team.email_domain = data.email_domain
357
+ end
358
+ end
359
+ end
360
+ end
361
+ end