Class: EurekaBot::Tg::Sender

Inherits:
Object
  • Object
show all
Includes:
Instrumentation
Defined in:
lib/eureka_bot/tg/sender.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client: EurekaBot::Tg.client, logger: EurekaBot.logger) ⇒ Sender

Returns a new instance of Sender.



6
7
8
9
# File 'lib/eureka_bot/tg/sender.rb', line 6

def initialize(client: EurekaBot::Tg.client, logger: EurekaBot.logger)
  @logger = logger
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



4
5
6
# File 'lib/eureka_bot/tg/sender.rb', line 4

def client
  @client
end

#loggerObject (readonly)

Returns the value of attribute logger.



4
5
6
# File 'lib/eureka_bot/tg/sender.rb', line 4

def logger
  @logger
end

Instance Method Details

#deliver(message) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/eureka_bot/tg/sender.rb', line 11

def deliver(message)
  message = message.stringify_keys
  client.make_request(
      message['method'],
      method: :post,
      payload: message['params'].to_json
  )
end