telegram-bot-ruby 0.7.2 → 0.8.0

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: c02d79f81e719a452e46887b09cc54167d72d80f
4
- data.tar.gz: 2e3a73423f4b29b58a73cf07b5a41018ac5926ab
3
+ metadata.gz: 480b4e15b9e410b8d8023d7af355e8f9cbcb5fe5
4
+ data.tar.gz: 83501301ed0d36db7c9d40c9450913b5fd0d1e34
5
5
  SHA512:
6
- metadata.gz: f840ced90b930aa481ba7331faffd19e9010cf1b0ac18094e0d176e64407676dc24c59fcbedda6b3a0100ecfe457e6952094c8df1d60bf31643ef58420d39ffd
7
- data.tar.gz: 303781ef46d1ec9778036a8f61b86b30234f190104344fd2de92e8a41a25be18f20230de0364f59f03a010cc17045325a8d4ef5340832a5c258b296aab230d02
6
+ metadata.gz: c93d0d104cb261d85aa74d39e83b9c7a9860005fa4974d096459df83d504e09f9632a10377221c73b29570388636ea8b25573e200f36b8be4a8d45151ee2683a
7
+ data.tar.gz: 15d28de13a08b264cfb10af94529a3734f3ace42353ecb3897da3e5b6fe376e0710074794947001da467a2e0366ae8d8efac1a62440f0233b1e383cff768001a
@@ -1,6 +1,10 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
  require: rubocop-rspec
3
3
 
4
+ Metrics/BlockLength:
5
+ Exclude:
6
+ - spec/**/*.rb
7
+
4
8
  Metrics/LineLength:
5
9
  Exclude:
6
10
  - telegram-bot-ruby.gemspec
@@ -8,3 +12,7 @@ Metrics/LineLength:
8
12
 
9
13
  Style/EmptyMethod:
10
14
  EnforcedStyle: expanded
15
+
16
+ Style/PercentLiteralDelimiters:
17
+ PreferredDelimiters:
18
+ '%w': '()'
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.8.0
4
+
5
+ - Implement [Bot API 3.0](https://core.telegram.org/bots/api#may-18-2017) (thx [@ivanovaleksey](https://github.com/ivanovaleksey))
6
+
3
7
  ## 0.7.2
4
8
 
5
9
  - Bug fixes
data/README.md CHANGED
@@ -5,6 +5,7 @@ Ruby wrapper for [Telegram's Bot API](https://core.telegram.org/bots/api).
5
5
  [![Gem Version](https://badge.fury.io/rb/telegram-bot-ruby.svg)](http://badge.fury.io/rb/telegram-bot-ruby)
6
6
  [![Code Climate](https://codeclimate.com/github/atipugin/telegram-bot-ruby/badges/gpa.svg)](https://codeclimate.com/github/atipugin/telegram-bot-ruby)
7
7
  [![Build Status](https://travis-ci.org/atipugin/telegram-bot-ruby.svg?branch=master)](https://travis-ci.org/atipugin/telegram-bot-ruby)
8
+ [![Say Thanks!](https://img.shields.io/badge/Say%20Thanks!-🦉-1EAEDB.svg)](https://saythanks.io/to/atipugin)
8
9
 
9
10
  ## Installation
10
11
 
@@ -4,12 +4,13 @@ module Telegram
4
4
  ENDPOINTS = %w(
5
5
  getUpdates setWebhook deleteWebhook getWebhookInfo getMe sendMessage
6
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
7
+ sendVoice sendVideoNote sendLocation sendVenue sendContact
8
+ sendChatAction getUserProfilePhotos getFile kickChatMember
9
+ unbanChatMember leaveChat getChat getChatAdministrators
10
+ getChatMembersCount getChatMember answerCallbackQuery editMessageText
11
+ editMessageCaption editMessageReplyMarkup deleteMessage
12
+ answerInlineQuery sendInvoice answerShippingQuery answerPreCheckoutQuery
13
+ sendGame setGameScore getGameHighScores
13
14
  ).freeze
14
15
  REPLY_MARKUP_TYPES = [
15
16
  Telegram::Bot::Types::ReplyKeyboardMarkup,
@@ -55,7 +55,7 @@ module Telegram
55
55
  message
56
56
  channel_post
57
57
  edited_channel_post)
58
- types.inject(nil) { |acc, elem| acc || update.send(elem) }
58
+ types.inject(nil) { |acc, elem| acc || update.public_send(elem) }
59
59
  end
60
60
 
61
61
  def log_incoming_message(message)
@@ -6,6 +6,7 @@ require 'telegram/bot/types/document'
6
6
  require 'telegram/bot/types/sticker'
7
7
  require 'telegram/bot/types/video'
8
8
  require 'telegram/bot/types/voice'
9
+ require 'telegram/bot/types/video_note'
9
10
  require 'telegram/bot/types/contact'
10
11
  require 'telegram/bot/types/location'
11
12
  require 'telegram/bot/types/chat'
@@ -15,6 +16,10 @@ require 'telegram/bot/types/animation'
15
16
  require 'telegram/bot/types/game'
16
17
  require 'telegram/bot/types/callback_game'
17
18
  require 'telegram/bot/types/game_high_score'
19
+ require 'telegram/bot/types/invoice'
20
+ require 'telegram/bot/types/shipping_address'
21
+ require 'telegram/bot/types/order_info'
22
+ require 'telegram/bot/types/successful_payment'
18
23
  require 'telegram/bot/types/message'
19
24
  require 'telegram/bot/types/input_message_content'
20
25
  require 'telegram/bot/types/input_contact_message_content'
@@ -46,9 +51,13 @@ require 'telegram/bot/types/inline_query_result_video'
46
51
  require 'telegram/bot/types/inline_query_result_voice'
47
52
  require 'telegram/bot/types/chosen_inline_result'
48
53
  require 'telegram/bot/types/callback_query'
54
+ require 'telegram/bot/types/shipping_query'
55
+ require 'telegram/bot/types/pre_checkout_query'
49
56
  require 'telegram/bot/types/update'
50
57
  require 'telegram/bot/types/keyboard_button'
51
58
  require 'telegram/bot/types/reply_keyboard_markup'
52
59
  require 'telegram/bot/types/reply_keyboard_remove'
53
60
  require 'telegram/bot/types/force_reply'
54
61
  require 'telegram/bot/types/file'
62
+ require 'telegram/bot/types/labeled_price'
63
+ require 'telegram/bot/types/shipping_option'
@@ -8,6 +8,7 @@ module Telegram
8
8
  attribute :switch_inline_query, String
9
9
  attribute :switch_inline_query_current_chat, String
10
10
  attribute :callback_game, CallbackGame
11
+ attribute :pay, Boolean
11
12
  end
12
13
  end
13
14
  end
@@ -7,6 +7,7 @@ module Telegram
7
7
  attribute :gif_url, String
8
8
  attribute :gif_width, Integer
9
9
  attribute :gif_height, Integer
10
+ attribute :gif_duration, Integer
10
11
  attribute :thumb_url, String
11
12
  attribute :title, String
12
13
  attribute :caption, String
@@ -7,6 +7,7 @@ module Telegram
7
7
  attribute :mpeg4_url, String
8
8
  attribute :mpeg4_width, Integer
9
9
  attribute :mpeg4_height, Integer
10
+ attribute :mpeg4_duration, Integer
10
11
  attribute :thumb_url, String
11
12
  attribute :title, String
12
13
  attribute :caption, String
@@ -0,0 +1,13 @@
1
+ module Telegram
2
+ module Bot
3
+ module Types
4
+ class Invoice < Base
5
+ attribute :title, String
6
+ attribute :description, String
7
+ attribute :start_parameter, String
8
+ attribute :currency, String
9
+ attribute :total_amount, Integer
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,10 @@
1
+ module Telegram
2
+ module Bot
3
+ module Types
4
+ class LabeledPrice < Base
5
+ attribute :label, String
6
+ attribute :amount, Integer
7
+ end
8
+ end
9
+ end
10
+ end
@@ -21,11 +21,12 @@ module Telegram
21
21
  attribute :sticker, Sticker
22
22
  attribute :video, Video
23
23
  attribute :voice, Voice
24
+ attribute :video_note, VideoNote
24
25
  attribute :caption, String
25
26
  attribute :contact, Contact
26
27
  attribute :location, Location
27
28
  attribute :venue, Venue
28
- attribute :new_chat_member, User
29
+ attribute :new_chat_members, Array[User]
29
30
  attribute :left_chat_member, User
30
31
  attribute :new_chat_title, String
31
32
  attribute :new_chat_photo, Array[PhotoSize]
@@ -36,6 +37,8 @@ module Telegram
36
37
  attribute :migrate_to_chat_id, Integer
37
38
  attribute :migrate_from_chat_id, Integer
38
39
  attribute :pinned_message, Message
40
+ attribute :invoice, Invoice
41
+ attribute :successful_payment, SuccessfulPayment
39
42
 
40
43
  alias to_s text
41
44
  end
@@ -0,0 +1,12 @@
1
+ module Telegram
2
+ module Bot
3
+ module Types
4
+ class OrderInfo < Base
5
+ attribute :name, String
6
+ attribute :phone_number, String
7
+ attribute :email, String
8
+ attribute :shipping_address, ShippingAddress
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,15 @@
1
+ module Telegram
2
+ module Bot
3
+ module Types
4
+ class PreCheckoutQuery < Base
5
+ attribute :id, String
6
+ attribute :from, User
7
+ attribute :currency, String
8
+ attribute :total_amount, Integer
9
+ attribute :invoice_payload, String
10
+ attribute :shipping_option_id, String
11
+ attribute :order_info, OrderInfo
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,14 @@
1
+ module Telegram
2
+ module Bot
3
+ module Types
4
+ class ShippingAddress < Base
5
+ attribute :country_code, String
6
+ attribute :state, String
7
+ attribute :city, String
8
+ attribute :street_line1, String
9
+ attribute :street_line2, String
10
+ attribute :post_code, String
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,11 @@
1
+ module Telegram
2
+ module Bot
3
+ module Types
4
+ class ShippingOption < Base
5
+ attribute :id, String
6
+ attribute :title, String
7
+ attribute :prices, Array[LabeledPrice]
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ module Telegram
2
+ module Bot
3
+ module Types
4
+ class ShippingQuery < Base
5
+ attribute :id, String
6
+ attribute :from, User
7
+ attribute :invoice_payload, String
8
+ attribute :shipping_address, ShippingAddress
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,15 @@
1
+ module Telegram
2
+ module Bot
3
+ module Types
4
+ class SuccessfulPayment < Base
5
+ attribute :currency, String
6
+ attribute :total_amount, Integer
7
+ attribute :invoice_payload, String
8
+ attribute :shipping_option_id, String
9
+ attribute :order_info, OrderInfo
10
+ attribute :telegram_payment_charge_id, String
11
+ attribute :provider_payment_charge_id, String
12
+ end
13
+ end
14
+ end
15
+ end
@@ -10,6 +10,8 @@ module Telegram
10
10
  attribute :inline_query, InlineQuery
11
11
  attribute :chosen_inline_result, ChosenInlineResult
12
12
  attribute :callback_query, CallbackQuery
13
+ attribute :shipping_query, ShippingQuery
14
+ attribute :pre_checkout_query, PreCheckoutQuery
13
15
  end
14
16
  end
15
17
  end
@@ -6,6 +6,7 @@ module Telegram
6
6
  attribute :first_name, String
7
7
  attribute :last_name, String
8
8
  attribute :username, String
9
+ attribute :language_code, String
9
10
  end
10
11
  end
11
12
  end
@@ -0,0 +1,13 @@
1
+ module Telegram
2
+ module Bot
3
+ module Types
4
+ class VideoNote < Base
5
+ attribute :file_id, String
6
+ attribute :length, Integer
7
+ attribute :duration, Integer
8
+ attribute :thumb, PhotoSize
9
+ attribute :file_size, Integer
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,5 +1,5 @@
1
1
  module Telegram
2
2
  module Bot
3
- VERSION = '0.7.2'.freeze
3
+ VERSION = '0.8.0'.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.46.0'
26
+ spec.add_development_dependency 'rubocop', '~> 0.48.1'
27
27
  spec.add_development_dependency 'rspec', '~> 3.4'
28
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.2
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Tipugin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-11 00:00:00.000000000 Z
11
+ date: 2017-05-29 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.46.0
89
+ version: 0.48.1
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.46.0
96
+ version: 0.48.1
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rspec
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -193,18 +193,27 @@ files:
193
193
  - lib/telegram/bot/types/input_message_content.rb
194
194
  - lib/telegram/bot/types/input_text_message_content.rb
195
195
  - lib/telegram/bot/types/input_venue_message_content.rb
196
+ - lib/telegram/bot/types/invoice.rb
196
197
  - lib/telegram/bot/types/keyboard_button.rb
198
+ - lib/telegram/bot/types/labeled_price.rb
197
199
  - lib/telegram/bot/types/location.rb
198
200
  - lib/telegram/bot/types/message.rb
199
201
  - lib/telegram/bot/types/message_entity.rb
202
+ - lib/telegram/bot/types/order_info.rb
200
203
  - lib/telegram/bot/types/photo_size.rb
204
+ - lib/telegram/bot/types/pre_checkout_query.rb
201
205
  - lib/telegram/bot/types/reply_keyboard_markup.rb
202
206
  - lib/telegram/bot/types/reply_keyboard_remove.rb
207
+ - lib/telegram/bot/types/shipping_address.rb
208
+ - lib/telegram/bot/types/shipping_option.rb
209
+ - lib/telegram/bot/types/shipping_query.rb
203
210
  - lib/telegram/bot/types/sticker.rb
211
+ - lib/telegram/bot/types/successful_payment.rb
204
212
  - lib/telegram/bot/types/update.rb
205
213
  - lib/telegram/bot/types/user.rb
206
214
  - lib/telegram/bot/types/venue.rb
207
215
  - lib/telegram/bot/types/video.rb
216
+ - lib/telegram/bot/types/video_note.rb
208
217
  - lib/telegram/bot/types/voice.rb
209
218
  - lib/telegram/bot/version.rb
210
219
  - telegram-bot-ruby.gemspec
@@ -227,7 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
227
236
  version: '0'
228
237
  requirements: []
229
238
  rubyforge_project:
230
- rubygems_version: 2.5.2
239
+ rubygems_version: 2.6.11
231
240
  signing_key:
232
241
  specification_version: 4
233
242
  summary: Ruby wrapper for Telegram's Bot API