Class: Kodo::Channels::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/kodo/channels/base.rb

Direct Known Subclasses

Console, Telegram

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(channel_id:) ⇒ Base

Returns a new instance of Base.



8
9
10
11
# File 'lib/kodo/channels/base.rb', line 8

def initialize(channel_id:)
  @channel_id = channel_id
  @running = false
end

Instance Attribute Details

#channel_id ⇒ Object (readonly)

Returns the value of attribute channel_id.



6
7
8
# File 'lib/kodo/channels/base.rb', line 6

def channel_id
  @channel_id
end

Instance Method Details

#connect! ⇒ Object

Raises:

  • (NotImplementedError)


13
14
15
# File 'lib/kodo/channels/base.rb', line 13

def connect!
  raise NotImplementedError
end

#disconnect! ⇒ Object



17
18
19
# File 'lib/kodo/channels/base.rb', line 17

def disconnect!
  @running = false
end

#poll ⇒ Object

Check for new messages. Returns ArrayKodo::Message

Raises:

  • (NotImplementedError)


22
23
24
# File 'lib/kodo/channels/base.rb', line 22

def poll
  raise NotImplementedError
end

#running? ⇒ Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/kodo/channels/base.rb', line 31

def running?
  @running
end

#send_message(message) ⇒ Object

Send a message through this channel

Raises:

  • (NotImplementedError)


27
28
29
# File 'lib/kodo/channels/base.rb', line 27

def send_message(message)
  raise NotImplementedError
end