telegram-bot-ruby 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/.rubocop.yml +8 -0
- data/.rubocop_todo.yml +3 -0
- data/.travis.yml +3 -3
- data/CHANGELOG.md +4 -0
- data/lib/telegram/bot/api.rb +11 -8
- data/lib/telegram/bot/client.rb +5 -7
- data/lib/telegram/bot/version.rb +1 -1
- data/telegram-bot-ruby.gemspec +2 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5850a71fd2d890834b4a43a1e3f46a9ff47ff8c
|
4
|
+
data.tar.gz: 904f3f8e59dee8a2e567e5a1a7c06bcad446ed23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 957a8220c52d3fb4e6a06fdf00c2c0075cecf983c4ce714c66d8d8314e60521b81ac4d57bb66f272b08ca9ceb298ea16f3f3efc44f7dc2b6a3205b2fba4c01db
|
7
|
+
data.tar.gz: 7a79d9806f8dc166cddc263d1bbbfd57c7b1aa528927f05c3637721b970e7eeb11c927cc62713c80c10d93b4dfe98f231ca85db321bb60bb9f79e5230701ac0f
|
data/.rspec
CHANGED
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.7.1
|
4
|
+
|
5
|
+
- Implement [Bot API 2.3.1](https://core.telegram.org/bots/api-changelog#december-4-2016)
|
6
|
+
|
3
7
|
## 0.7.0
|
4
8
|
|
5
9
|
- Implement [Bot API 2.3](https://core.telegram.org/bots/api-changelog#november-21-2016) (thx [@ivanovaleksey](https://github.com/ivanovaleksey))
|
data/lib/telegram/bot/api.rb
CHANGED
@@ -2,13 +2,14 @@ module Telegram
|
|
2
2
|
module Bot
|
3
3
|
class Api
|
4
4
|
ENDPOINTS = %w(
|
5
|
-
getUpdates setWebhook getMe sendMessage
|
6
|
-
sendAudio sendDocument sendSticker sendVideo
|
7
|
-
sendVenue sendContact sendChatAction
|
8
|
-
kickChatMember unbanChatMember
|
9
|
-
|
10
|
-
|
11
|
-
sendGame setGameScore
|
5
|
+
getUpdates setWebhook deleteWebhook getWebhookInfo getMe sendMessage
|
6
|
+
forwardMessage sendPhoto sendAudio sendDocument sendSticker sendVideo
|
7
|
+
sendVoice sendLocation sendVenue sendContact sendChatAction
|
8
|
+
getUserProfilePhotos getFile kickChatMember leaveChat unbanChatMember
|
9
|
+
getChat getChatAdministrators getChatMembersCount getChatMember
|
10
|
+
answerCallbackQuery editMessageText editMessageCaption
|
11
|
+
editMessageReplyMarkup answerInlineQuery sendGame setGameScore
|
12
|
+
getGameHighScores
|
12
13
|
).freeze
|
13
14
|
REPLY_MARKUP_TYPES = [
|
14
15
|
Telegram::Bot::Types::ReplyKeyboardMarkup,
|
@@ -88,7 +89,9 @@ module Telegram
|
|
88
89
|
end
|
89
90
|
|
90
91
|
def jsonify_inline_query_results(value)
|
91
|
-
return value unless
|
92
|
+
return value unless
|
93
|
+
value.is_a?(Array) &&
|
94
|
+
value.all? { |i| INLINE_QUERY_RESULT_TYPES.include?(i.class) }
|
92
95
|
value.map { |i| i.to_compact_hash.select { |_, v| v } }.to_json
|
93
96
|
end
|
94
97
|
|
data/lib/telegram/bot/client.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Telegram
|
2
2
|
module Bot
|
3
3
|
class Client
|
4
|
-
attr_reader :api, :
|
4
|
+
attr_reader :api, :options
|
5
5
|
attr_accessor :logger
|
6
6
|
|
7
7
|
def self.run(*args, &block)
|
@@ -9,11 +9,9 @@ module Telegram
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def initialize(token, h = {})
|
12
|
-
options = default_options.merge(h)
|
12
|
+
@options = default_options.merge(h)
|
13
13
|
@api = Api.new(token)
|
14
|
-
@
|
15
|
-
@timeout = options[:timeout]
|
16
|
-
@logger = options[:logger]
|
14
|
+
@logger = options.delete(:logger)
|
17
15
|
end
|
18
16
|
|
19
17
|
def run
|
@@ -29,12 +27,12 @@ module Telegram
|
|
29
27
|
end
|
30
28
|
|
31
29
|
def fetch_updates
|
32
|
-
response = api.getUpdates(
|
30
|
+
response = api.getUpdates(options)
|
33
31
|
return unless response['ok']
|
34
32
|
|
35
33
|
response['result'].each do |data|
|
36
34
|
update = Types::Update.new(data)
|
37
|
-
@offset = update.update_id.next
|
35
|
+
@options[:offset] = update.update_id.next
|
38
36
|
message = extract_message(update)
|
39
37
|
log_incoming_message(message)
|
40
38
|
yield message
|
data/lib/telegram/bot/version.rb
CHANGED
data/telegram-bot-ruby.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency 'bundler', '~> 1.9'
|
24
24
|
spec.add_development_dependency 'rake', '~> 10.0'
|
25
25
|
spec.add_development_dependency 'pry'
|
26
|
-
spec.add_development_dependency 'rubocop', '~> 0.
|
26
|
+
spec.add_development_dependency 'rubocop', '~> 0.46.0'
|
27
27
|
spec.add_development_dependency 'rspec', '~> 3.4'
|
28
|
-
spec.add_development_dependency 'rubocop-rspec', '~> 1.
|
28
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 1.8'
|
29
29
|
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.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Tipugin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.
|
89
|
+
version: 0.46.0
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.
|
96
|
+
version: 0.46.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rspec
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '1.
|
117
|
+
version: '1.8'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '1.
|
124
|
+
version: '1.8'
|
125
125
|
description:
|
126
126
|
email:
|
127
127
|
- atipugin@gmail.com
|