telegram-bot-types 0.4.1 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +11 -1
  3. data/.travis.yml +1 -1
  4. data/CHANGELOG.md +22 -0
  5. data/Gemfile +2 -0
  6. data/Rakefile +2 -0
  7. data/bin/console +1 -0
  8. data/bin/install_git_hooks +2 -1
  9. data/lib/telegram/bot/types.rb +19 -70
  10. data/lib/telegram/bot/types/animation.rb +6 -0
  11. data/lib/telegram/bot/types/audio.rb +5 -0
  12. data/lib/telegram/bot/types/base.rb +6 -0
  13. data/lib/telegram/bot/types/callback_game.rb +2 -0
  14. data/lib/telegram/bot/types/callback_query.rb +2 -0
  15. data/lib/telegram/bot/types/chat.rb +10 -0
  16. data/lib/telegram/bot/types/chat_invite_link.rb +16 -0
  17. data/lib/telegram/bot/types/chat_location.rb +12 -0
  18. data/lib/telegram/bot/types/chat_member.rb +22 -0
  19. data/lib/telegram/bot/types/chat_member_updated.rb +16 -0
  20. data/lib/telegram/bot/types/chat_permissions.rb +18 -0
  21. data/lib/telegram/bot/types/chat_photo.rb +14 -0
  22. data/lib/telegram/bot/types/chosen_inline_result.rb +2 -0
  23. data/lib/telegram/bot/types/contact.rb +3 -0
  24. data/lib/telegram/bot/types/dice.rb +12 -0
  25. data/lib/telegram/bot/types/document.rb +3 -0
  26. data/lib/telegram/bot/types/encrypted_credentials.rb +13 -0
  27. data/lib/telegram/bot/types/encrypted_passport_element.rb +20 -0
  28. data/lib/telegram/bot/types/file.rb +3 -0
  29. data/lib/telegram/bot/types/force_reply.rb +2 -0
  30. data/lib/telegram/bot/types/game.rb +2 -0
  31. data/lib/telegram/bot/types/game_high_score.rb +2 -0
  32. data/lib/telegram/bot/types/inline_keyboard_button.rb +3 -0
  33. data/lib/telegram/bot/types/inline_keyboard_markup.rb +2 -0
  34. data/lib/telegram/bot/types/inline_query.rb +2 -0
  35. data/lib/telegram/bot/types/inline_query_result_article.rb +2 -0
  36. data/lib/telegram/bot/types/inline_query_result_audio.rb +3 -0
  37. data/lib/telegram/bot/types/inline_query_result_cached_audio.rb +3 -0
  38. data/lib/telegram/bot/types/inline_query_result_cached_document.rb +3 -0
  39. data/lib/telegram/bot/types/inline_query_result_cached_gif.rb +3 -0
  40. data/lib/telegram/bot/types/inline_query_result_cached_mpeg4_gif.rb +3 -0
  41. data/lib/telegram/bot/types/inline_query_result_cached_photo.rb +3 -0
  42. data/lib/telegram/bot/types/inline_query_result_cached_sticker.rb +2 -0
  43. data/lib/telegram/bot/types/inline_query_result_cached_video.rb +3 -0
  44. data/lib/telegram/bot/types/inline_query_result_cached_voice.rb +3 -0
  45. data/lib/telegram/bot/types/inline_query_result_contact.rb +3 -0
  46. data/lib/telegram/bot/types/inline_query_result_document.rb +3 -0
  47. data/lib/telegram/bot/types/inline_query_result_game.rb +2 -0
  48. data/lib/telegram/bot/types/inline_query_result_gif.rb +3 -0
  49. data/lib/telegram/bot/types/inline_query_result_location.rb +6 -0
  50. data/lib/telegram/bot/types/inline_query_result_mpeg4_gif.rb +4 -0
  51. data/lib/telegram/bot/types/inline_query_result_photo.rb +3 -0
  52. data/lib/telegram/bot/types/inline_query_result_venue.rb +5 -0
  53. data/lib/telegram/bot/types/inline_query_result_video.rb +3 -0
  54. data/lib/telegram/bot/types/inline_query_result_voice.rb +3 -0
  55. data/lib/telegram/bot/types/input_contact_message_content.rb +3 -0
  56. data/lib/telegram/bot/types/input_location_message_content.rb +6 -0
  57. data/lib/telegram/bot/types/input_media_animation.rb +18 -0
  58. data/lib/telegram/bot/types/input_media_audio.rb +18 -0
  59. data/lib/telegram/bot/types/input_media_document.rb +17 -0
  60. data/lib/telegram/bot/types/input_media_photo.rb +14 -0
  61. data/lib/telegram/bot/types/input_media_video.rb +18 -0
  62. data/lib/telegram/bot/types/input_message_content.rb +2 -0
  63. data/lib/telegram/bot/types/input_text_message_content.rb +2 -0
  64. data/lib/telegram/bot/types/input_venue_message_content.rb +5 -0
  65. data/lib/telegram/bot/types/invoice.rb +2 -0
  66. data/lib/telegram/bot/types/keyboard_button.rb +3 -0
  67. data/lib/telegram/bot/types/keyboard_button_poll_type.rb +11 -0
  68. data/lib/telegram/bot/types/labeled_price.rb +2 -0
  69. data/lib/telegram/bot/types/location.rb +6 -0
  70. data/lib/telegram/bot/types/login_url.rb +14 -0
  71. data/lib/telegram/bot/types/mask_position.rb +14 -0
  72. data/lib/telegram/bot/types/message.rb +20 -0
  73. data/lib/telegram/bot/types/message_auto_delete_timer_changed.rb +11 -0
  74. data/lib/telegram/bot/types/message_entity.rb +3 -0
  75. data/lib/telegram/bot/types/order_info.rb +2 -0
  76. data/lib/telegram/bot/types/passport_data.rb +12 -0
  77. data/lib/telegram/bot/types/passport_element_error_data_field.rb +15 -0
  78. data/lib/telegram/bot/types/passport_element_error_file.rb +14 -0
  79. data/lib/telegram/bot/types/passport_element_error_files.rb +14 -0
  80. data/lib/telegram/bot/types/passport_element_error_front_side.rb +14 -0
  81. data/lib/telegram/bot/types/passport_element_error_reverse_side.rb +14 -0
  82. data/lib/telegram/bot/types/passport_element_error_selfie.rb +14 -0
  83. data/lib/telegram/bot/types/passport_element_error_translation_file.rb +14 -0
  84. data/lib/telegram/bot/types/passport_element_error_translation_files.rb +14 -0
  85. data/lib/telegram/bot/types/passport_element_error_unspecified.rb +14 -0
  86. data/lib/telegram/bot/types/passport_file.rb +14 -0
  87. data/lib/telegram/bot/types/photo_size.rb +3 -0
  88. data/lib/telegram/bot/types/poll.rb +23 -0
  89. data/lib/telegram/bot/types/poll_answer.rb +13 -0
  90. data/lib/telegram/bot/types/poll_option.rb +12 -0
  91. data/lib/telegram/bot/types/pre_checkout_query.rb +2 -0
  92. data/lib/telegram/bot/types/proximity_alert_triggered.rb +13 -0
  93. data/lib/telegram/bot/types/reply_keyboard_markup.rb +2 -0
  94. data/lib/telegram/bot/types/reply_keyboard_remove.rb +2 -0
  95. data/lib/telegram/bot/types/response.rb +94 -0
  96. data/lib/telegram/bot/types/shipping_address.rb +2 -0
  97. data/lib/telegram/bot/types/shipping_option.rb +2 -0
  98. data/lib/telegram/bot/types/shipping_query.rb +2 -0
  99. data/lib/telegram/bot/types/sticker.rb +6 -0
  100. data/lib/telegram/bot/types/sticker_set.rb +16 -0
  101. data/lib/telegram/bot/types/successful_payment.rb +2 -0
  102. data/lib/telegram/bot/types/update.rb +6 -0
  103. data/lib/telegram/bot/types/user.rb +6 -0
  104. data/lib/telegram/bot/types/user_profile_photos.rb +2 -0
  105. data/lib/telegram/bot/types/venue.rb +5 -0
  106. data/lib/telegram/bot/types/version.rb +3 -1
  107. data/lib/telegram/bot/types/video.rb +4 -0
  108. data/lib/telegram/bot/types/video_note.rb +3 -0
  109. data/lib/telegram/bot/types/voice.rb +3 -0
  110. data/lib/telegram/bot/types/voice_chat_ended.rb +11 -0
  111. data/lib/telegram/bot/types/voice_chat_participants_invited.rb +11 -0
  112. data/lib/telegram/bot/types/voice_chat_started.rb +10 -0
  113. data/lib/telegram/bot/types/webhook_info.rb +19 -0
  114. data/telegram-bot-types.gemspec +5 -4
  115. metadata +50 -26
@@ -1,8 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
4
6
  class PhotoSize < Base
5
7
  attribute :file_id, String
8
+ attribute :file_unique_id, String
6
9
  attribute :width, Integer
7
10
  attribute :height, Integer
8
11
  attribute :file_size, Integer
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class Poll < Base
7
+ attribute :id, String
8
+ attribute :question, String
9
+ attribute :options, [PollOption]
10
+ attribute :total_voter_count, Integer
11
+ attribute :is_closed, Boolean
12
+ attribute :is_anonymous, Boolean
13
+ attribute :type, String
14
+ attribute :allows_multiple_answers, Boolean
15
+ attribute :correct_option_id, Integer
16
+ attribute :explanation, String
17
+ attribute :explanation_entities, [MessageEntity]
18
+ attribute :open_period, Integer
19
+ attribute :close_date, Integer
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class PollAnswer < Base
7
+ attribute :poll_id, String
8
+ attribute :user, User
9
+ attribute :option_ids, [Integer]
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class PollOption < Base
7
+ attribute :text, String
8
+ attribute :voter_count, Integer
9
+ end
10
+ end
11
+ end
12
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class ProximityAlertTriggered < Base
7
+ attribute :traveler, User
8
+ attribute :watcher, User
9
+ attribute :distance, Integer
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
@@ -0,0 +1,94 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ module Response
7
+ module_function
8
+
9
+ WRAPPED_METHODS = {
10
+ # Generated with bin/fetch-telegram-methods
11
+ # Bot API 3.5.
12
+
13
+ getUpdates: [Update],
14
+ # setWebhook
15
+ # deleteWebhook
16
+ getWebhookInfo: WebhookInfo,
17
+
18
+ getMe: User,
19
+ sendMessage: Message,
20
+ forwardMessage: Message,
21
+ sendPhoto: Message,
22
+ sendAudio: Message,
23
+ sendDocument: Message,
24
+ sendVideo: Message,
25
+ sendVoice: Message,
26
+ sendVideoNote: Message,
27
+ sendMediaGroup: Message,
28
+ sendLocation: Message,
29
+ editMessageLiveLocation: Message, # or true
30
+ stopMessageLiveLocation: Message, # or true
31
+ sendVenue: Message,
32
+ sendContact: Message,
33
+ # sendChatAction
34
+ getUserProfilePhotos: UserProfilePhotos,
35
+ getFile: File,
36
+ # kickChatMember
37
+ # unbanChatMember
38
+ # restrictChatMember
39
+ # promoteChatMember
40
+ # exportChatInviteLink
41
+ # setChatPhoto
42
+ # deleteChatPhoto
43
+ # setChatTitle
44
+ # setChatDescription
45
+ # pinChatMessage
46
+ # unpinChatMessage
47
+ # leaveChat
48
+ getChat: Chat,
49
+ getChatAdministrators: [ChatMember],
50
+ # getChatMembersCount
51
+ getChatMember: ChatMember,
52
+ # setChatStickerSet
53
+ # deleteChatStickerSet
54
+ # answerCallbackQuery
55
+
56
+ editMessageText: Message, # or true
57
+ editMessageCaption: Message, # or true
58
+ editMessageReplyMarkup: Message, # or true
59
+ # deleteMessage
60
+
61
+ sendSticker: Message,
62
+ getStickerSet: StickerSet,
63
+ uploadStickerFile: File,
64
+ # createNewStickerSet
65
+ # addStickerToSet
66
+ # setStickerPositionInSet
67
+ # deleteStickerFromSet
68
+
69
+ # answerInlineQuery
70
+
71
+ sendInvoice: Message,
72
+ # answerShippingQuery
73
+ # answerPreCheckoutQuery
74
+
75
+ sendGame: Message,
76
+ setGameScore: Message, # or true
77
+ getGameHighScores: [GameHighScore],
78
+ }.freeze
79
+
80
+ # Wraps response with a given type. There are some methods that can
81
+ # return either object ot true, so it bypasses true value as is.
82
+ def wrap(object, type)
83
+ return object if object == true
84
+ if type.is_a?(Array)
85
+ type = type.first
86
+ object.map { |x| type.new(x) }
87
+ else
88
+ type.new(object)
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
@@ -1,12 +1,18 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
4
6
  class Sticker < Base
5
7
  attribute :file_id, String
8
+ attribute :file_unique_id, String
6
9
  attribute :width, Integer
7
10
  attribute :height, Integer
11
+ attribute :is_animated, Boolean
8
12
  attribute :thumb, PhotoSize
9
13
  attribute :emoji, String
14
+ attribute :set_name, String
15
+ attribute :mask_position, MaskPosition
10
16
  attribute :file_size, Integer
11
17
  end
12
18
  end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class StickerSet < Base
7
+ attribute :name, String
8
+ attribute :title, String
9
+ attribute :is_animated, Boolean
10
+ attribute :contains_masks, Boolean
11
+ attribute :stickers, [Sticker]
12
+ attribute :thumb, PhotoSize
13
+ end
14
+ end
15
+ end
16
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
@@ -12,6 +14,10 @@ module Telegram
12
14
  attribute :callback_query, CallbackQuery
13
15
  attribute :shipping_query, ShippingQuery
14
16
  attribute :pre_checkout_query, PreCheckoutQuery
17
+ attribute :poll, Poll
18
+ attribute :poll_answer, PollAnswer
19
+ attribute :my_chat_member, ChatMemberUpdated
20
+ attribute :chat_member, ChatMemberUpdated
15
21
  end
16
22
  end
17
23
  end
@@ -1,12 +1,18 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
4
6
  class User < Base
5
7
  attribute :id, Integer
8
+ attribute :is_bot, Boolean
6
9
  attribute :first_name, String
7
10
  attribute :last_name, String
8
11
  attribute :username, String
9
12
  attribute :language_code, String
13
+ attribute :can_join_groups, Boolean
14
+ attribute :can_read_all_group_messages, Boolean
15
+ attribute :supports_inline_queries, Boolean
10
16
  end
11
17
  end
12
18
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
@@ -6,6 +8,9 @@ module Telegram
6
8
  attribute :title, String
7
9
  attribute :address, String
8
10
  attribute :foursquare_id, String
11
+ attribute :foursquare_type, String
12
+ attribute :google_place_id, String
13
+ attribute :google_place_type, String
9
14
  end
10
15
  end
11
16
  end
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
4
- VERSION = '0.4.1'.freeze
6
+ VERSION = '0.6.3'
5
7
 
6
8
  def self.gem_version
7
9
  Gem::Version.new VERSION
@@ -1,12 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
4
6
  class Video < Base
5
7
  attribute :file_id, String
8
+ attribute :file_unique_id, String
6
9
  attribute :width, Integer
7
10
  attribute :height, Integer
8
11
  attribute :duration, Integer
9
12
  attribute :thumb, PhotoSize
13
+ attribute :file_name, String
10
14
  attribute :mime_type, String
11
15
  attribute :file_size, Integer
12
16
  end
@@ -1,8 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
4
6
  class VideoNote < Base
5
7
  attribute :file_id, String
8
+ attribute :file_unique_id, String
6
9
  attribute :length, Integer
7
10
  attribute :duration, Integer
8
11
  attribute :thumb, PhotoSize
@@ -1,8 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Telegram
2
4
  module Bot
3
5
  module Types
4
6
  class Voice < Base
5
7
  attribute :file_id, String
8
+ attribute :file_unique_id, String
6
9
  attribute :duration, Integer
7
10
  attribute :mime_type, String
8
11
  attribute :file_size, Integer
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class VoiceChatEnded < Base
7
+ attribute :duration, Integer
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class VoiceChatParticipantsInvited < Base
7
+ attribute :users, [User]
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class VoiceChatStarted < Base
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ class WebhookInfo < Base
7
+ attribute :url, String
8
+ attribute :has_custom_certificate, Boolean
9
+ attribute :pending_update_count, Integer
10
+ attribute :ip_address, String
11
+ attribute :last_error_date, Integer
12
+ attribute :last_error_message, String
13
+ attribute :max_connections, String
14
+ attribute :max_connections, Integer
15
+ attribute :allowed_updates, [String]
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,4 +1,6 @@
1
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
 
4
6
  require 'telegram/bot/types/version'
@@ -19,13 +21,12 @@ Gem::Specification.new do |spec|
19
21
  spec.require_paths = ['lib']
20
22
 
21
23
  spec.add_dependency 'virtus', '~> 1.0'
22
- spec.add_dependency 'activesupport'
23
24
 
24
25
  spec.add_development_dependency 'bundler', '~> 1.9'
25
- spec.add_development_dependency 'rake', '~> 10.0'
26
+ spec.add_development_dependency 'rake', '~> 13.0'
26
27
  spec.add_development_dependency 'rspec', '~> 3.3'
27
28
  spec.add_development_dependency 'rspec-its', '~> 1.1'
28
29
 
29
30
  spec.add_development_dependency 'pry', '~> 0.10'
30
- spec.add_development_dependency 'rubocop', '~> 0.37.0'
31
+ spec.add_development_dependency 'rubocop', '~> 0.81.0'
31
32
  end