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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3f5e768b4d861cf0dc9f407d3466b23c1d25730d
4
- data.tar.gz: 9f0d4f4543cc5b78aa5dd93d01df4b0abec357ae
3
+ metadata.gz: a5850a71fd2d890834b4a43a1e3f46a9ff47ff8c
4
+ data.tar.gz: 904f3f8e59dee8a2e567e5a1a7c06bcad446ed23
5
5
  SHA512:
6
- metadata.gz: d1a47e1ca1720f7697a5b170e0c17d758b133a321bf46e684ae65a38e33cdbfdc274251937e2ecff55a12c6a392b27e9eda93743cd0062eac7873eb113305909
7
- data.tar.gz: 73c74431e421e6b0b26c2edebec77e499d332fc7d0f017cbb7423c31a1a8d5c49eb8c527ab7a39e0b8949b009ca4781fb2d5decda9d0a5853838673384c79770
6
+ metadata.gz: 957a8220c52d3fb4e6a06fdf00c2c0075cecf983c4ce714c66d8d8314e60521b81ac4d57bb66f272b08ca9ceb298ea16f3f3efc44f7dc2b6a3205b2fba4c01db
7
+ data.tar.gz: 7a79d9806f8dc166cddc263d1bbbfd57c7b1aa528927f05c3637721b970e7eeb11c927cc62713c80c10d93b4dfe98f231ca85db321bb60bb9f79e5230701ac0f
data/.rspec CHANGED
@@ -1 +1,2 @@
1
1
  --require spec_helper
2
+ --color
@@ -1,2 +1,10 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
  require: rubocop-rspec
3
+
4
+ Metrics/LineLength:
5
+ Exclude:
6
+ - telegram-bot-ruby.gemspec
7
+ - examples/*.rb
8
+
9
+ Style/EmptyMethod:
10
+ EnforcedStyle: expanded
@@ -5,6 +5,9 @@
5
5
  # Note that changes in the inspected code, or installation of new
6
6
  # versions of RuboCop, may require this file to be generated again.
7
7
 
8
+ Metrics/MethodLength:
9
+ Max: 11
10
+
8
11
  # Offense count: 15
9
12
  Style/Documentation:
10
13
  Enabled: false
@@ -1,6 +1,6 @@
1
- ---
2
1
  language: ruby
3
2
  rvm:
4
3
  - 2.3.0
5
- before_install:
6
- - gem install bundler
4
+ script:
5
+ - bundle exec rubocop
6
+ - bundle exec rspec
@@ -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))
@@ -2,13 +2,14 @@ module Telegram
2
2
  module Bot
3
3
  class Api
4
4
  ENDPOINTS = %w(
5
- getUpdates setWebhook getMe sendMessage forwardMessage sendPhoto
6
- sendAudio sendDocument sendSticker sendVideo sendVoice sendLocation
7
- sendVenue sendContact sendChatAction getUserProfilePhotos getFile
8
- kickChatMember unbanChatMember answerCallbackQuery editMessageText
9
- editMessageCaption editMessageReplyMarkup answerInlineQuery getChat
10
- leaveChat getChatAdministrators getChatMember getChatMembersCount
11
- sendGame setGameScore getGameHighScores getWebhookInfo
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 value.is_a?(Array) && value.all? { |i| INLINE_QUERY_RESULT_TYPES.include?(i.class) }
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
 
@@ -1,7 +1,7 @@
1
1
  module Telegram
2
2
  module Bot
3
3
  class Client
4
- attr_reader :api, :offset, :timeout
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
- @offset = options[:offset]
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(offset: offset, timeout: timeout)
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
@@ -1,5 +1,5 @@
1
1
  module Telegram
2
2
  module Bot
3
- VERSION = '0.7.0'.freeze
3
+ VERSION = '0.7.1'.freeze
4
4
  end
5
5
  end
@@ -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.42.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.4'
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.0
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-28 00:00:00.000000000 Z
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.42.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.42.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.4'
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.4'
124
+ version: '1.8'
125
125
  description:
126
126
  email:
127
127
  - atipugin@gmail.com