telegram-bot-ruby 0.3.2 → 0.3.3

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: 3369a4112bd8f530bb867b571c0b91091e455a84
4
- data.tar.gz: bc07b294379caeef4d90e64bc2d3a4af5bc51f01
3
+ metadata.gz: 0736511a6c4fa9c27902fe5b18330aee0a90c733
4
+ data.tar.gz: af1edd744e538db9638c1a35904e4e12cf475e8e
5
5
  SHA512:
6
- metadata.gz: 0db02515566c58598d1c4a7a9a333f6372d959070cd5f8b9759a469531d87c6a985e4c31fea6318c9b2062f39f548d549a457c709323f23a673ffa428c54d279
7
- data.tar.gz: 33a4a466c3ad4edda8bc5b8100424efc1fc54747ebe31b19a2ef2342a5fdc736c480a1e18932c23b1fb2b4725e6bc69137ea53f2db4457b15e27b8b1761c13a3
6
+ metadata.gz: 829e4c7f85a03cb3e929dd3b930fdba8f2401160f1ebc8f6f6ac4fa40966106b7b557285338f375345c7f1ba49bedc630f65a271d674a5aa5e6de8419c64bf30
7
+ data.tar.gz: 592a7fa7785301d046c699111d785ba100a359327ca3cb10733770c77e7c893eb3e2cfead22526d9f2f2572f7a58c51bc0ea3a99314be69e6286a6bb642c80a9
@@ -22,17 +22,19 @@ module Telegram
22
22
  yield self
23
23
  end
24
24
 
25
- def listen
26
- loop do
27
- response = api.getUpdates(offset: offset, timeout: timeout)
28
- next unless response['ok']
29
-
30
- response['result'].each do |data|
31
- update = Types::Update.new(data)
32
- @offset = update.update_id.next
33
- log_incoming_message(update.message)
34
- yield update.message
35
- end
25
+ def listen(&block)
26
+ loop { fetch_updates(&block) }
27
+ end
28
+
29
+ def fetch_updates
30
+ response = api.getUpdates(offset: offset, timeout: timeout)
31
+ return unless response['ok']
32
+
33
+ response['result'].each do |data|
34
+ update = Types::Update.new(data)
35
+ @offset = update.update_id.next
36
+ log_incoming_message(update.message)
37
+ yield update.message
36
38
  end
37
39
  rescue *TIMEOUT_EXCEPTIONS
38
40
  retry
@@ -1,5 +1,5 @@
1
1
  module Telegram
2
2
  module Bot
3
- VERSION = '0.3.2'
3
+ VERSION = '0.3.3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: telegram-bot-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Tipugin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-09-03 00:00:00.000000000 Z
11
+ date: 2015-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httmultiparty