Class: Chat::JoinService

Inherits:
Object
  • Object
show all
Defined in:
app/services/doodle/chat/join_service.rb

Instance Method Summary collapse

Constructor Details

#initialize(user, protocol) ⇒ JoinService



3
4
5
6
# File 'app/services/doodle/chat/join_service.rb', line 3

def initialize(user, protocol)
  @protocol = protocol
  @user = user
end

Instance Method Details

#break_limit?Boolean



14
15
16
# File 'app/services/doodle/chat/join_service.rb', line 14

def break_limit?
  @user.break_limit_concurrent_protocols?
end

#join(channel) ⇒ Object



8
9
10
11
12
# File 'app/services/doodle/chat/join_service.rb', line 8

def join(channel)
  @protocol.add_analyst_into(@user)
  @protocol.add_participant_into_conversation(@user.)
  @user.enter_in_channel(channel)
end

#out(channel) ⇒ Object



18
19
20
21
# File 'app/services/doodle/chat/join_service.rb', line 18

def out(channel)
  @protocol.remove_participant_from_conversation(@user.)
  @user.out_of_channel(channel)
end