telegram-bot-ruby 0.23.0 → 1.0.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/.env.sample +2 -0
  3. data/.gitignore +1 -0
  4. data/.rubocop.yml +2 -1
  5. data/README.md +25 -13
  6. data/Rakefile +43 -0
  7. data/lib/telegram/bot/types/animation.rb +9 -9
  8. data/lib/telegram/bot/types/audio.rb +9 -9
  9. data/lib/telegram/bot/types/base.rb +3 -2
  10. data/lib/telegram/bot/types/bot_command.rb +2 -2
  11. data/lib/telegram/bot/types/bot_command_scope_all_chat_administrators.rb +1 -1
  12. data/lib/telegram/bot/types/bot_command_scope_all_group_chats.rb +1 -1
  13. data/lib/telegram/bot/types/bot_command_scope_all_private_chats.rb +1 -1
  14. data/lib/telegram/bot/types/bot_command_scope_chat.rb +2 -2
  15. data/lib/telegram/bot/types/bot_command_scope_chat_administrators.rb +2 -2
  16. data/lib/telegram/bot/types/bot_command_scope_chat_member.rb +3 -3
  17. data/lib/telegram/bot/types/bot_command_scope_default.rb +1 -1
  18. data/lib/telegram/bot/types/callback_query.rb +6 -6
  19. data/lib/telegram/bot/types/chat.rb +27 -28
  20. data/lib/telegram/bot/types/chat_administrator_rights.rb +13 -12
  21. data/lib/telegram/bot/types/chat_invite_link.rb +8 -8
  22. data/lib/telegram/bot/types/chat_join_request.rb +3 -3
  23. data/lib/telegram/bot/types/chat_location.rb +1 -1
  24. data/lib/telegram/bot/types/chat_member.rb +0 -22
  25. data/lib/telegram/bot/types/chat_member_administrator.rb +26 -0
  26. data/lib/telegram/bot/types/chat_member_banned.rb +13 -0
  27. data/lib/telegram/bot/types/chat_member_left.rb +12 -0
  28. data/lib/telegram/bot/types/chat_member_member.rb +12 -0
  29. data/lib/telegram/bot/types/chat_member_owner.rb +14 -0
  30. data/lib/telegram/bot/types/chat_member_restricted.rb +23 -0
  31. data/lib/telegram/bot/types/chat_member_updated.rb +2 -2
  32. data/lib/telegram/bot/types/chat_permissions.rb +9 -8
  33. data/lib/telegram/bot/types/chat_photo.rb +4 -4
  34. data/lib/telegram/bot/types/chosen_inline_result.rb +4 -4
  35. data/lib/telegram/bot/types/contact.rb +5 -5
  36. data/lib/telegram/bot/types/dice.rb +2 -2
  37. data/lib/telegram/bot/types/document.rb +6 -6
  38. data/lib/telegram/bot/types/encrypted_credentials.rb +3 -3
  39. data/lib/telegram/bot/types/encrypted_passport_element.rb +10 -10
  40. data/lib/telegram/bot/types/file.rb +4 -4
  41. data/lib/telegram/bot/types/force_reply.rb +3 -3
  42. data/lib/telegram/bot/types/forum_topic.rb +14 -0
  43. data/lib/telegram/bot/types/forum_topic_closed.rb +10 -0
  44. data/lib/telegram/bot/types/forum_topic_created.rb +13 -0
  45. data/lib/telegram/bot/types/forum_topic_reopened.rb +10 -0
  46. data/lib/telegram/bot/types/game.rb +6 -6
  47. data/lib/telegram/bot/types/game_high_score.rb +2 -2
  48. data/lib/telegram/bot/types/inline_keyboard_button.rb +9 -9
  49. data/lib/telegram/bot/types/inline_keyboard_markup.rb +1 -1
  50. data/lib/telegram/bot/types/inline_query.rb +5 -5
  51. data/lib/telegram/bot/types/inline_query_result_article.rb +10 -10
  52. data/lib/telegram/bot/types/inline_query_result_audio.rb +11 -10
  53. data/lib/telegram/bot/types/inline_query_result_cached_audio.rb +8 -7
  54. data/lib/telegram/bot/types/inline_query_result_cached_document.rb +10 -9
  55. data/lib/telegram/bot/types/inline_query_result_cached_gif.rb +9 -8
  56. data/lib/telegram/bot/types/inline_query_result_cached_mpeg4_gif.rb +9 -8
  57. data/lib/telegram/bot/types/inline_query_result_cached_photo.rb +10 -9
  58. data/lib/telegram/bot/types/inline_query_result_cached_sticker.rb +5 -5
  59. data/lib/telegram/bot/types/inline_query_result_cached_video.rb +10 -9
  60. data/lib/telegram/bot/types/inline_query_result_cached_voice.rb +9 -8
  61. data/lib/telegram/bot/types/inline_query_result_contact.rb +11 -11
  62. data/lib/telegram/bot/types/inline_query_result_document.rb +14 -13
  63. data/lib/telegram/bot/types/inline_query_result_game.rb +4 -4
  64. data/lib/telegram/bot/types/inline_query_result_gif.rb +14 -12
  65. data/lib/telegram/bot/types/inline_query_result_location.rb +14 -14
  66. data/lib/telegram/bot/types/inline_query_result_mpeg4_gif.rb +14 -13
  67. data/lib/telegram/bot/types/inline_query_result_photo.rb +13 -12
  68. data/lib/telegram/bot/types/inline_query_result_venue.rb +15 -15
  69. data/lib/telegram/bot/types/inline_query_result_video.rb +15 -14
  70. data/lib/telegram/bot/types/inline_query_result_voice.rb +10 -9
  71. data/lib/telegram/bot/types/input_contact_message_content.rb +4 -4
  72. data/lib/telegram/bot/types/input_invoice_message_content.rb +20 -20
  73. data/lib/telegram/bot/types/input_location_message_content.rb +6 -6
  74. data/lib/telegram/bot/types/input_media_animation.rb +9 -8
  75. data/lib/telegram/bot/types/input_media_audio.rb +9 -8
  76. data/lib/telegram/bot/types/input_media_document.rb +7 -7
  77. data/lib/telegram/bot/types/input_media_photo.rb +5 -4
  78. data/lib/telegram/bot/types/input_media_video.rb +10 -8
  79. data/lib/telegram/bot/types/input_text_message_content.rb +4 -3
  80. data/lib/telegram/bot/types/input_venue_message_content.rb +8 -8
  81. data/lib/telegram/bot/types/invoice.rb +5 -5
  82. data/lib/telegram/bot/types/keyboard_button.rb +5 -5
  83. data/lib/telegram/bot/types/keyboard_button_poll_type.rb +1 -1
  84. data/lib/telegram/bot/types/labeled_price.rb +2 -2
  85. data/lib/telegram/bot/types/location.rb +6 -6
  86. data/lib/telegram/bot/types/login_url.rb +4 -4
  87. data/lib/telegram/bot/types/mask_position.rb +4 -4
  88. data/lib/telegram/bot/types/menu_button_commands.rb +1 -1
  89. data/lib/telegram/bot/types/menu_button_default.rb +1 -1
  90. data/lib/telegram/bot/types/menu_button_web_app.rb +2 -2
  91. data/lib/telegram/bot/types/message.rb +63 -58
  92. data/lib/telegram/bot/types/message_auto_delete_timer_changed.rb +1 -1
  93. data/lib/telegram/bot/types/message_entity.rb +7 -7
  94. data/lib/telegram/bot/types/order_info.rb +4 -4
  95. data/lib/telegram/bot/types/passport_data.rb +1 -1
  96. data/lib/telegram/bot/types/passport_element_error_data_field.rb +5 -5
  97. data/lib/telegram/bot/types/passport_element_error_file.rb +4 -4
  98. data/lib/telegram/bot/types/passport_element_error_files.rb +4 -4
  99. data/lib/telegram/bot/types/passport_element_error_front_side.rb +4 -4
  100. data/lib/telegram/bot/types/passport_element_error_reverse_side.rb +4 -4
  101. data/lib/telegram/bot/types/passport_element_error_selfie.rb +4 -4
  102. data/lib/telegram/bot/types/passport_element_error_translation_file.rb +4 -4
  103. data/lib/telegram/bot/types/passport_element_error_translation_files.rb +4 -4
  104. data/lib/telegram/bot/types/passport_element_error_unspecified.rb +4 -4
  105. data/lib/telegram/bot/types/passport_file.rb +4 -4
  106. data/lib/telegram/bot/types/photo_size.rb +5 -5
  107. data/lib/telegram/bot/types/poll.rb +13 -13
  108. data/lib/telegram/bot/types/poll_answer.rb +2 -2
  109. data/lib/telegram/bot/types/poll_option.rb +2 -2
  110. data/lib/telegram/bot/types/pre_checkout_query.rb +6 -6
  111. data/lib/telegram/bot/types/proximity_alert_triggered.rb +1 -1
  112. data/lib/telegram/bot/types/reply_keyboard_markup.rb +5 -5
  113. data/lib/telegram/bot/types/reply_keyboard_remove.rb +2 -2
  114. data/lib/telegram/bot/types/sent_web_app_message.rb +1 -1
  115. data/lib/telegram/bot/types/shipping_address.rb +6 -6
  116. data/lib/telegram/bot/types/shipping_option.rb +3 -3
  117. data/lib/telegram/bot/types/shipping_query.rb +2 -2
  118. data/lib/telegram/bot/types/sticker.rb +14 -14
  119. data/lib/telegram/bot/types/sticker_set.rb +7 -8
  120. data/lib/telegram/bot/types/successful_payment.rb +7 -7
  121. data/lib/telegram/bot/types/update.rb +15 -15
  122. data/lib/telegram/bot/types/user.rb +11 -11
  123. data/lib/telegram/bot/types/user_profile_photos.rb +2 -2
  124. data/lib/telegram/bot/types/venue.rb +6 -6
  125. data/lib/telegram/bot/types/video.rb +9 -9
  126. data/lib/telegram/bot/types/video_chat_ended.rb +1 -1
  127. data/lib/telegram/bot/types/video_chat_participants_invited.rb +1 -1
  128. data/lib/telegram/bot/types/video_chat_scheduled.rb +1 -1
  129. data/lib/telegram/bot/types/video_note.rb +6 -6
  130. data/lib/telegram/bot/types/voice.rb +5 -5
  131. data/lib/telegram/bot/types/web_app_data.rb +2 -2
  132. data/lib/telegram/bot/types/web_app_info.rb +1 -1
  133. data/lib/telegram/bot/types/webhook_info.rb +9 -9
  134. data/lib/telegram/bot/types.rb +7 -124
  135. data/lib/telegram/bot/version.rb +1 -1
  136. data/lib/telegram/bot.rb +7 -9
  137. data/telegram-bot-ruby.gemspec +4 -2
  138. metadata +51 -13
  139. data/lib/telegram/bot/exceptions.rb +0 -4
@@ -4,13 +4,13 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class SuccessfulPayment < Base
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
- attribute :telegram_payment_charge_id, String
13
- attribute :provider_payment_charge_id, String
7
+ attribute :currency, Types::String
8
+ attribute :total_amount, Types::Integer
9
+ attribute :invoice_payload, Types::String
10
+ attribute? :shipping_option_id, Types::String
11
+ attribute? :order_info, OrderInfo
12
+ attribute :telegram_payment_charge_id, Types::String
13
+ attribute :provider_payment_charge_id, Types::String
14
14
  end
15
15
  end
16
16
  end
@@ -4,21 +4,21 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class Update < Base
7
- attribute :update_id, Integer
8
- attribute :message, Message
9
- attribute :edited_message, Message
10
- attribute :channel_post, Message
11
- attribute :edited_channel_post, Message
12
- attribute :inline_query, InlineQuery
13
- attribute :chosen_inline_result, ChosenInlineResult
14
- attribute :callback_query, CallbackQuery
15
- attribute :shipping_query, ShippingQuery
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
21
- attribute :chat_join_request, ChatJoinRequest
7
+ attribute :update_id, Types::Integer
8
+ attribute? :message, Message
9
+ attribute? :edited_message, Message
10
+ attribute? :channel_post, Message
11
+ attribute? :edited_channel_post, Message
12
+ attribute? :inline_query, InlineQuery
13
+ attribute? :chosen_inline_result, ChosenInlineResult
14
+ attribute? :callback_query, CallbackQuery
15
+ attribute? :shipping_query, ShippingQuery
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
21
+ attribute? :chat_join_request, ChatJoinRequest
22
22
 
23
23
  def current_message
24
24
  @current_message ||=
@@ -4,17 +4,17 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class User < Base
7
- attribute :id, Integer
8
- attribute :is_bot, Boolean
9
- attribute :first_name, String
10
- attribute :last_name, String
11
- attribute :username, String
12
- attribute :language_code, String
13
- attribute :is_premium, Boolean
14
- attribute :added_to_attachment_menu, Boolean
15
- attribute :can_join_groups, Boolean
16
- attribute :can_read_all_group_messages, Boolean
17
- attribute :supports_inline_queries, Boolean
7
+ attribute :id, Types::Integer
8
+ attribute :is_bot, Types::Bool
9
+ attribute :first_name, Types::String
10
+ attribute? :last_name, Types::String
11
+ attribute? :username, Types::String
12
+ attribute? :language_code, Types::String
13
+ attribute? :is_premium, Types::Bool
14
+ attribute? :added_to_attachment_menu, Types::Bool
15
+ attribute? :can_join_groups, Types::Bool
16
+ attribute? :can_read_all_group_messages, Types::Bool
17
+ attribute? :supports_inline_queries, Types::Bool
18
18
  end
19
19
  end
20
20
  end
@@ -4,8 +4,8 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class UserProfilePhotos < Base
7
- attribute :total_count, Integer
8
- attribute :photos, Array[Array[PhotoSize]]
7
+ attribute :total_count, Types::Integer
8
+ attribute :photos, Types::Array.of(Types::Array.of(PhotoSize))
9
9
  end
10
10
  end
11
11
  end
@@ -5,12 +5,12 @@ module Telegram
5
5
  module Types
6
6
  class Venue < Base
7
7
  attribute :location, Location
8
- attribute :title, String
9
- attribute :address, String
10
- attribute :foursquare_id, String
11
- attribute :foursquare_type, String
12
- attribute :google_place_id, String
13
- attribute :google_place_type, String
8
+ attribute :title, Types::String
9
+ attribute :address, Types::String
10
+ attribute? :foursquare_id, Types::String
11
+ attribute? :foursquare_type, Types::String
12
+ attribute? :google_place_id, Types::String
13
+ attribute? :google_place_type, Types::String
14
14
  end
15
15
  end
16
16
  end
@@ -4,15 +4,15 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class Video < Base
7
- attribute :file_id, String
8
- attribute :file_unique_id, String
9
- attribute :width, Integer
10
- attribute :height, Integer
11
- attribute :duration, Integer
12
- attribute :thumb, PhotoSize
13
- attribute :file_name, String
14
- attribute :mime_type, String
15
- attribute :file_size, Integer
7
+ attribute :file_id, Types::String
8
+ attribute :file_unique_id, Types::String
9
+ attribute :width, Types::Integer
10
+ attribute :height, Types::Integer
11
+ attribute :duration, Types::Integer
12
+ attribute? :thumb, PhotoSize
13
+ attribute? :file_name, Types::String
14
+ attribute? :mime_type, Types::String
15
+ attribute? :file_size, Types::Integer
16
16
  end
17
17
  end
18
18
  end
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class VideoChatEnded < Base
7
- attribute :duration, Integer
7
+ attribute :duration, Types::Integer
8
8
  end
9
9
  end
10
10
  end
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class VideoChatParticipantsInvited < Base
7
- attribute :users, Array[User]
7
+ attribute :users, Types::Array.of(User)
8
8
  end
9
9
  end
10
10
  end
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class VideoChatScheduled < Base
7
- attribute :start_date, Integer
7
+ attribute :start_date, Types::Integer
8
8
  end
9
9
  end
10
10
  end
@@ -4,12 +4,12 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class VideoNote < Base
7
- attribute :file_id, String
8
- attribute :file_unique_id, String
9
- attribute :length, Integer
10
- attribute :duration, Integer
11
- attribute :thumb, PhotoSize
12
- attribute :file_size, Integer
7
+ attribute :file_id, Types::String
8
+ attribute :file_unique_id, Types::String
9
+ attribute :length, Types::Integer
10
+ attribute :duration, Types::Integer
11
+ attribute? :thumb, PhotoSize
12
+ attribute? :file_size, Types::Integer
13
13
  end
14
14
  end
15
15
  end
@@ -4,11 +4,11 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class Voice < Base
7
- attribute :file_id, String
8
- attribute :file_unique_id, String
9
- attribute :duration, Integer
10
- attribute :mime_type, String
11
- attribute :file_size, Integer
7
+ attribute :file_id, Types::String
8
+ attribute :file_unique_id, Types::String
9
+ attribute :duration, Types::Integer
10
+ attribute? :mime_type, Types::String
11
+ attribute? :file_size, Types::Integer
12
12
  end
13
13
  end
14
14
  end
@@ -4,8 +4,8 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class WebAppData < Base
7
- attribute :data, String
8
- attribute :button_text, String
7
+ attribute :data, Types::String
8
+ attribute :button_text, Types::String
9
9
  end
10
10
  end
11
11
  end
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class WebAppInfo < Base
7
- attribute :url, String
7
+ attribute :url, Types::String
8
8
  end
9
9
  end
10
10
  end
@@ -4,15 +4,15 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
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 :last_synchronization_error_date, Integer
14
- attribute :max_connections, Integer
15
- attribute :allowed_updates, Array[String]
7
+ attribute :url, Types::String
8
+ attribute :has_custom_certificate, Types::Bool
9
+ attribute :pending_update_count, Types::Integer
10
+ attribute? :ip_address, Types::String
11
+ attribute? :last_error_date, Types::Integer
12
+ attribute? :last_error_message, Types::String
13
+ attribute? :last_synchronization_error_date, Types::Integer
14
+ attribute? :max_connections, Types::Integer
15
+ attribute? :allowed_updates, Types::Array.of(String)
16
16
  end
17
17
  end
18
18
  end
@@ -1,126 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'telegram/bot/types/compactable'
4
- require 'telegram/bot/types/pattern_matching'
5
- require 'telegram/bot/types/base'
6
- require 'telegram/bot/types/file'
7
- require 'telegram/bot/types/user'
8
- require 'telegram/bot/types/photo_size'
9
- require 'telegram/bot/types/audio'
10
- require 'telegram/bot/types/document'
11
- require 'telegram/bot/types/mask_position'
12
- require 'telegram/bot/types/sticker'
13
- require 'telegram/bot/types/sticker_set'
14
- require 'telegram/bot/types/video'
15
- require 'telegram/bot/types/voice'
16
- require 'telegram/bot/types/video_note'
17
- require 'telegram/bot/types/contact'
18
- require 'telegram/bot/types/dice'
19
- require 'telegram/bot/types/location'
20
- require 'telegram/bot/types/chat_photo'
21
- require 'telegram/bot/types/chat_permissions'
22
- require 'telegram/bot/types/chat_location'
23
- require 'telegram/bot/types/chat'
24
- require 'telegram/bot/types/message_entity'
25
- require 'telegram/bot/types/venue'
26
- require 'telegram/bot/types/animation'
27
- require 'telegram/bot/types/game'
28
- require 'telegram/bot/types/callback_game'
29
- require 'telegram/bot/types/game_high_score'
30
- require 'telegram/bot/types/invoice'
31
- require 'telegram/bot/types/shipping_address'
32
- require 'telegram/bot/types/order_info'
33
- require 'telegram/bot/types/successful_payment'
34
- require 'telegram/bot/types/poll_option'
35
- require 'telegram/bot/types/poll_answer'
36
- require 'telegram/bot/types/poll'
37
- require 'telegram/bot/types/passport_file'
38
- require 'telegram/bot/types/encrypted_passport_element'
39
- require 'telegram/bot/types/encrypted_credentials'
40
- require 'telegram/bot/types/passport_data'
41
- require 'telegram/bot/types/passport_element_error_data_field'
42
- require 'telegram/bot/types/passport_element_error_front_side'
43
- require 'telegram/bot/types/passport_element_error_reverse_side'
44
- require 'telegram/bot/types/passport_element_error_selfie'
45
- require 'telegram/bot/types/passport_element_error_file'
46
- require 'telegram/bot/types/passport_element_error_files'
47
- require 'telegram/bot/types/passport_element_error_translation_file'
48
- require 'telegram/bot/types/passport_element_error_translation_files'
49
- require 'telegram/bot/types/passport_element_error_unspecified'
50
- require 'telegram/bot/types/labeled_price'
51
- require 'telegram/bot/types/input_message_content'
52
- require 'telegram/bot/types/input_contact_message_content'
53
- require 'telegram/bot/types/input_invoice_message_content'
54
- require 'telegram/bot/types/input_location_message_content'
55
- require 'telegram/bot/types/input_text_message_content'
56
- require 'telegram/bot/types/input_venue_message_content'
57
- require 'telegram/bot/types/login_url'
58
- require 'telegram/bot/types/web_app_info'
59
- require 'telegram/bot/types/inline_keyboard_button'
60
- require 'telegram/bot/types/inline_keyboard_markup'
61
- require 'telegram/bot/types/inline_query'
62
- require 'telegram/bot/types/inline_query_result_article'
63
- require 'telegram/bot/types/inline_query_result_audio'
64
- require 'telegram/bot/types/inline_query_result_cached_audio'
65
- require 'telegram/bot/types/inline_query_result_cached_document'
66
- require 'telegram/bot/types/inline_query_result_cached_gif'
67
- require 'telegram/bot/types/inline_query_result_cached_mpeg4_gif'
68
- require 'telegram/bot/types/inline_query_result_cached_photo'
69
- require 'telegram/bot/types/inline_query_result_cached_sticker'
70
- require 'telegram/bot/types/inline_query_result_cached_video'
71
- require 'telegram/bot/types/inline_query_result_cached_voice'
72
- require 'telegram/bot/types/inline_query_result_contact'
73
- require 'telegram/bot/types/inline_query_result_game'
74
- require 'telegram/bot/types/inline_query_result_document'
75
- require 'telegram/bot/types/inline_query_result_gif'
76
- require 'telegram/bot/types/inline_query_result_location'
77
- require 'telegram/bot/types/inline_query_result_mpeg4_gif'
78
- require 'telegram/bot/types/inline_query_result_photo'
79
- require 'telegram/bot/types/inline_query_result_venue'
80
- require 'telegram/bot/types/inline_query_result_video'
81
- require 'telegram/bot/types/inline_query_result_voice'
82
- require 'telegram/bot/types/chosen_inline_result'
83
- require 'telegram/bot/types/proximity_alert_triggered'
84
- require 'telegram/bot/types/video_chat_scheduled'
85
- require 'telegram/bot/types/video_chat_started'
86
- require 'telegram/bot/types/video_chat_ended'
87
- require 'telegram/bot/types/video_chat_participants_invited'
88
- require 'telegram/bot/types/message_auto_delete_timer_changed'
89
- require 'telegram/bot/types/web_app_data'
90
- require 'telegram/bot/types/message'
91
- require 'telegram/bot/types/callback_query'
92
- require 'telegram/bot/types/shipping_query'
93
- require 'telegram/bot/types/pre_checkout_query'
94
- require 'telegram/bot/types/keyboard_button_poll_type'
95
- require 'telegram/bot/types/keyboard_button'
96
- require 'telegram/bot/types/reply_keyboard_markup'
97
- require 'telegram/bot/types/reply_keyboard_remove'
98
- require 'telegram/bot/types/force_reply'
99
- require 'telegram/bot/types/shipping_option'
100
- require 'telegram/bot/types/chat_invite_link'
101
- require 'telegram/bot/types/chat_member'
102
- require 'telegram/bot/types/chat_member_updated'
103
- require 'telegram/bot/types/chat_join_request'
104
- require 'telegram/bot/types/update'
105
- require 'telegram/bot/types/user_profile_photos'
106
- require 'telegram/bot/types/input_media_photo'
107
- require 'telegram/bot/types/input_media_video'
108
- require 'telegram/bot/types/input_media_animation'
109
- require 'telegram/bot/types/input_media_audio'
110
- require 'telegram/bot/types/input_media_document'
111
- require 'telegram/bot/types/webhook_info'
112
- require 'telegram/bot/types/bot_command'
113
- require 'telegram/bot/types/bot_command_scope_all_chat_administrators'
114
- require 'telegram/bot/types/bot_command_scope_all_group_chats'
115
- require 'telegram/bot/types/bot_command_scope_all_private_chats'
116
- require 'telegram/bot/types/bot_command_scope_chat_administrators'
117
- require 'telegram/bot/types/bot_command_scope_chat_member'
118
- require 'telegram/bot/types/bot_command_scope_chat'
119
- require 'telegram/bot/types/bot_command_scope_default'
120
- require 'telegram/bot/types/sent_web_app_message'
121
- require 'telegram/bot/types/menu_button_commands'
122
- require 'telegram/bot/types/menu_button_web_app'
123
- require 'telegram/bot/types/menu_button_default'
124
- require 'telegram/bot/types/chat_administrator_rights'
125
-
126
- Virtus.finalize
3
+ module Telegram
4
+ module Bot
5
+ module Types
6
+ include Dry.Types()
7
+ end
8
+ end
9
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Telegram
4
4
  module Bot
5
- VERSION = '0.23.0'
5
+ VERSION = '1.0.0.pre'
6
6
  end
7
7
  end
data/lib/telegram/bot.rb CHANGED
@@ -1,18 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'virtus'
4
3
  require 'logger'
5
4
  require 'json'
6
5
  require 'faraday'
7
6
  require 'faraday/multipart'
8
-
9
- require 'telegram/bot/types'
10
- require 'telegram/bot/exceptions'
11
- require 'telegram/bot/api'
12
- require 'telegram/bot/null_logger'
13
- require 'telegram/bot/client'
14
- require 'telegram/bot/version'
15
- require 'telegram/bot/configuration'
7
+ require 'zeitwerk'
8
+ require 'dry-struct'
16
9
 
17
10
  module Telegram
18
11
  module Bot
@@ -29,3 +22,8 @@ module Telegram
29
22
  end
30
23
  end
31
24
  end
25
+
26
+ loader = Zeitwerk::Loader.new
27
+ loader.inflector = Zeitwerk::GemInflector.new(__FILE__)
28
+ loader.push_dir("#{__dir__}/bot", namespace: Telegram::Bot)
29
+ loader.setup
@@ -22,11 +22,13 @@ Gem::Specification.new do |spec|
22
22
  spec.required_ruby_version = '>= 2.7'
23
23
  spec.metadata['rubygems_mfa_required'] = 'true'
24
24
 
25
- spec.add_dependency 'dry-inflector'
25
+ spec.add_dependency 'dry-struct', '~> 1.6'
26
26
  spec.add_dependency 'faraday', '~> 2.0'
27
27
  spec.add_dependency 'faraday-multipart', '~> 1.0'
28
- spec.add_dependency 'virtus', '~> 2.0'
28
+ spec.add_dependency 'zeitwerk', '~> 2.6'
29
29
 
30
+ spec.add_development_dependency 'dotenv', '~> 2.8'
31
+ spec.add_development_dependency 'nokogiri', '~> 1.13'
30
32
  spec.add_development_dependency 'pry'
31
33
  spec.add_development_dependency 'rake', '~> 13.0'
32
34
  spec.add_development_dependency 'rspec', '~> 3.4'
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: telegram-bot-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.0
4
+ version: 1.0.0.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Tipugin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-11-29 00:00:00.000000000 Z
11
+ date: 2022-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: dry-inflector
14
+ name: dry-struct
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '1.6'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '1.6'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: faraday
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -53,19 +53,47 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: virtus
56
+ name: zeitwerk
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '2.0'
61
+ version: '2.6'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '2.0'
68
+ version: '2.6'
69
+ - !ruby/object:Gem::Dependency
70
+ name: dotenv
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '2.8'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2.8'
83
+ - !ruby/object:Gem::Dependency
84
+ name: nokogiri
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.13'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.13'
69
97
  - !ruby/object:Gem::Dependency
70
98
  name: pry
71
99
  requirement: !ruby/object:Gem::Requirement
@@ -157,6 +185,7 @@ executables: []
157
185
  extensions: []
158
186
  extra_rdoc_files: []
159
187
  files:
188
+ - ".env.sample"
160
189
  - ".github/workflows/ci.yml"
161
190
  - ".gitignore"
162
191
  - ".rspec"
@@ -173,7 +202,6 @@ files:
173
202
  - lib/telegram/bot/api.rb
174
203
  - lib/telegram/bot/client.rb
175
204
  - lib/telegram/bot/configuration.rb
176
- - lib/telegram/bot/exceptions.rb
177
205
  - lib/telegram/bot/exceptions/base.rb
178
206
  - lib/telegram/bot/exceptions/response_error.rb
179
207
  - lib/telegram/bot/null_logger.rb
@@ -197,6 +225,12 @@ files:
197
225
  - lib/telegram/bot/types/chat_join_request.rb
198
226
  - lib/telegram/bot/types/chat_location.rb
199
227
  - lib/telegram/bot/types/chat_member.rb
228
+ - lib/telegram/bot/types/chat_member_administrator.rb
229
+ - lib/telegram/bot/types/chat_member_banned.rb
230
+ - lib/telegram/bot/types/chat_member_left.rb
231
+ - lib/telegram/bot/types/chat_member_member.rb
232
+ - lib/telegram/bot/types/chat_member_owner.rb
233
+ - lib/telegram/bot/types/chat_member_restricted.rb
200
234
  - lib/telegram/bot/types/chat_member_updated.rb
201
235
  - lib/telegram/bot/types/chat_permissions.rb
202
236
  - lib/telegram/bot/types/chat_photo.rb
@@ -209,6 +243,10 @@ files:
209
243
  - lib/telegram/bot/types/encrypted_passport_element.rb
210
244
  - lib/telegram/bot/types/file.rb
211
245
  - lib/telegram/bot/types/force_reply.rb
246
+ - lib/telegram/bot/types/forum_topic.rb
247
+ - lib/telegram/bot/types/forum_topic_closed.rb
248
+ - lib/telegram/bot/types/forum_topic_created.rb
249
+ - lib/telegram/bot/types/forum_topic_reopened.rb
212
250
  - lib/telegram/bot/types/game.rb
213
251
  - lib/telegram/bot/types/game_high_score.rb
214
252
  - lib/telegram/bot/types/inline_keyboard_button.rb
@@ -317,9 +355,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
317
355
  version: '2.7'
318
356
  required_rubygems_version: !ruby/object:Gem::Requirement
319
357
  requirements:
320
- - - ">="
358
+ - - ">"
321
359
  - !ruby/object:Gem::Version
322
- version: '0'
360
+ version: 1.3.1
323
361
  requirements: []
324
362
  rubygems_version: 3.3.7
325
363
  signing_key:
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'telegram/bot/exceptions/base'
4
- require 'telegram/bot/exceptions/response_error'