boppers 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d1e8512a3d75ad25183e69b5ba639cf6aafc1c57
4
- data.tar.gz: bde111d6ff7f23f5274b73b18c5c1d3fb95a8f9e
3
+ metadata.gz: 77306f9f179e0f4e7fe5cc73db627c7029b3dcf4
4
+ data.tar.gz: 86ec66cb44941b313083fc0c1049fb24b8d12261
5
5
  SHA512:
6
- metadata.gz: a3db28ba81b7a6199bfc446ecbaee34ddaabe32f68caad8edd21f498efda9161994c8f1b0d7eb146bbfb4f26fa344faea9c12d886a44a0164f8da7cb1dba0c29
7
- data.tar.gz: 39f51b0597ae7635bdbc4c19c80db4174c4989a9dbcb5075f3d9762bd75d555074fdd83b8e0f02f857aed0133d3537be18805238f3caaa2fdb73ec1b1b16b83f
6
+ metadata.gz: 628e66d5e17e3161de9178b30e9ea554b9499ccd35789f3c80f2c26a919f89e97875b24371b3ebd2d44a1287aefc7bb37e8cce8c316e72a4261cb6071f25c503
7
+ data.tar.gz: 567b790974604ffaaeb7ec2735db15765b537790368ff9739d8ef031a69d0769f5bf2a4255f53bd85d37d7f4e9d45ae7627626908473ce8d28d0fd23c51f7587
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- boppers (0.0.8)
4
+ boppers (0.0.9)
5
5
  aitch
6
6
  thor
7
7
 
@@ -6,28 +6,25 @@ module Boppers
6
6
  attr_reader :api_token, :channel_id, :subscribe
7
7
 
8
8
  def initialize(api_token:, channel_id:, subscribe: nil)
9
- require "telegram_bot"
10
-
11
9
  @api_token = api_token
12
10
  @channel_id = channel_id
13
11
  @subscribe = subscribe
14
12
  end
15
13
 
16
14
  def call(title, message, options)
15
+ context = self
17
16
  telegram_options = options.fetch(:telegram, {})
18
17
  title = telegram_options.delete(:title) { title }
19
18
  message = telegram_options.delete(:message) { message }
20
19
 
21
- bot = TelegramBot.new(token: api_token)
22
- notification = TelegramBot::OutMessage.new
23
- notification.chat = TelegramBot::Channel.new(id: channel_id)
24
- notification.text = "#{title}\n\n#{message}"
20
+ telegram_options[:text] = "#{title}\n\n#{message}"
21
+ telegram_options[:chat_id] = channel_id
25
22
 
26
- telegram_options.each do |key, value|
27
- notification.public_send("#{key}=", value)
23
+ HttpClient.post do
24
+ url "https://api.telegram.org/bot#{context.api_token}/sendMessage"
25
+ params telegram_options
26
+ options expect: 200
28
27
  end
29
-
30
- notification.send_with(bot)
31
28
  end
32
29
  end
33
30
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Boppers
4
- VERSION = "0.0.8"
4
+ VERSION = "0.0.9"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boppers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira