telegram-bot-types 0.6.3 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +3 -0
  3. data/CHANGELOG.md +4 -0
  4. data/README.md +1 -1
  5. data/lib/telegram/bot/types/base.rb +29 -5
  6. data/lib/telegram/bot/types/encrypted_passport_element.rb +2 -2
  7. data/lib/telegram/bot/types/force_reply.rb +1 -1
  8. data/lib/telegram/bot/types/game.rb +2 -2
  9. data/lib/telegram/bot/types/inline_keyboard_markup.rb +1 -1
  10. data/lib/telegram/bot/types/inline_query_result_article.rb +1 -1
  11. data/lib/telegram/bot/types/inline_query_result_audio.rb +1 -1
  12. data/lib/telegram/bot/types/inline_query_result_cached_audio.rb +1 -1
  13. data/lib/telegram/bot/types/inline_query_result_cached_document.rb +1 -1
  14. data/lib/telegram/bot/types/inline_query_result_cached_gif.rb +1 -1
  15. data/lib/telegram/bot/types/inline_query_result_cached_mpeg4_gif.rb +1 -1
  16. data/lib/telegram/bot/types/inline_query_result_cached_photo.rb +1 -1
  17. data/lib/telegram/bot/types/inline_query_result_cached_sticker.rb +1 -1
  18. data/lib/telegram/bot/types/inline_query_result_cached_video.rb +1 -1
  19. data/lib/telegram/bot/types/inline_query_result_cached_voice.rb +1 -1
  20. data/lib/telegram/bot/types/inline_query_result_contact.rb +1 -1
  21. data/lib/telegram/bot/types/inline_query_result_document.rb +1 -1
  22. data/lib/telegram/bot/types/inline_query_result_game.rb +1 -1
  23. data/lib/telegram/bot/types/inline_query_result_gif.rb +1 -1
  24. data/lib/telegram/bot/types/inline_query_result_location.rb +1 -1
  25. data/lib/telegram/bot/types/inline_query_result_mpeg4_gif.rb +1 -1
  26. data/lib/telegram/bot/types/inline_query_result_photo.rb +1 -1
  27. data/lib/telegram/bot/types/inline_query_result_venue.rb +1 -1
  28. data/lib/telegram/bot/types/inline_query_result_video.rb +1 -1
  29. data/lib/telegram/bot/types/inline_query_result_voice.rb +1 -1
  30. data/lib/telegram/bot/types/input_media_animation.rb +1 -1
  31. data/lib/telegram/bot/types/input_media_audio.rb +1 -1
  32. data/lib/telegram/bot/types/input_media_document.rb +2 -2
  33. data/lib/telegram/bot/types/input_media_photo.rb +1 -1
  34. data/lib/telegram/bot/types/input_media_video.rb +1 -1
  35. data/lib/telegram/bot/types/message.rb +5 -5
  36. data/lib/telegram/bot/types/passport_data.rb +1 -1
  37. data/lib/telegram/bot/types/passport_element_error_data_field.rb +1 -1
  38. data/lib/telegram/bot/types/passport_element_error_file.rb +1 -1
  39. data/lib/telegram/bot/types/passport_element_error_files.rb +2 -2
  40. data/lib/telegram/bot/types/passport_element_error_front_side.rb +1 -1
  41. data/lib/telegram/bot/types/passport_element_error_reverse_side.rb +1 -1
  42. data/lib/telegram/bot/types/passport_element_error_selfie.rb +1 -1
  43. data/lib/telegram/bot/types/passport_element_error_translation_file.rb +1 -1
  44. data/lib/telegram/bot/types/passport_element_error_translation_files.rb +2 -2
  45. data/lib/telegram/bot/types/passport_element_error_unspecified.rb +1 -1
  46. data/lib/telegram/bot/types/poll.rb +2 -2
  47. data/lib/telegram/bot/types/poll_answer.rb +1 -1
  48. data/lib/telegram/bot/types/reply_keyboard_markup.rb +4 -4
  49. data/lib/telegram/bot/types/reply_keyboard_remove.rb +1 -1
  50. data/lib/telegram/bot/types/response.rb +1 -1
  51. data/lib/telegram/bot/types/shipping_option.rb +1 -1
  52. data/lib/telegram/bot/types/sticker_set.rb +1 -1
  53. data/lib/telegram/bot/types/user_profile_photos.rb +1 -1
  54. data/lib/telegram/bot/types/version.rb +1 -1
  55. data/lib/telegram/bot/types/voice_chat_participants_invited.rb +1 -1
  56. data/lib/telegram/bot/types/webhook_info.rb +1 -2
  57. data/telegram-bot-types.gemspec +2 -2
  58. metadata +8 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0606fc748fb8602745774a0445227cfd5ead1b8d5669bd08bd9ee1bb0ce3b53b
4
- data.tar.gz: b8c309b5149ac1b850dcd7de3e4fda9150091d1b91dff03376b5e8b93c15d44e
3
+ metadata.gz: 0d4df9be660382c7bee82232c59643d7ab50be12b85a26d552192a6d99888b26
4
+ data.tar.gz: ba50f17387c975027d9ecf851761db6a2cab9bb1cbf829d8e4534c6d6e679cca
5
5
  SHA512:
6
- metadata.gz: 2c5928397f4828c224ca987c5487655ccf5e9603329859fa13c64b6e12dc792ec53d62d0cc3b3b201be552982e7e1e12dba72eabb986c0dbc42c8bde28639d2d
7
- data.tar.gz: 26927705f798cc3da58bc6371f10d8b1c1104342a913f29e8a9298b38ee16ea0bb20900fd4e016f7a493742edf6740645efa3743e09f0ee55d631ee959096a90
6
+ metadata.gz: '01487ea354a9775fb6cb3888309bb7a138612b27cf01c2f3085a23622e3dacb48ebe15b10640ff89140ef7839552598aaf174a097bc9d4a066c7ea6c06dd3859'
7
+ data.tar.gz: 42d3966817d6fb83548c2bd0f3f8deacf9b8fa4c3af7bede415713d752509d1ecff87732263bed01d07005af44eaf4315520d2194ae8788d6c9bb7b84d8bdac4
data/.rubocop.yml CHANGED
@@ -12,3 +12,6 @@ Lint/StructNewOverride: {Enabled: true}
12
12
  Style/HashEachMethods: {Enabled: true}
13
13
  Style/HashTransformKeys: {Enabled: true}
14
14
  Style/HashTransformValues: {Enabled: true}
15
+
16
+ # This one offences all specs, routes and some initializers.
17
+ Metrics/BlockLength: {Enabled: false}
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Unreleased
2
2
 
3
+ # 0.7.0
4
+
5
+ - Use dry-types instead of virtus.
6
+
3
7
  # 0.6.3
4
8
 
5
9
  - Bunch of new types from Bot API 5.3.
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Virtus types for Telegram Bot API.
4
4
 
5
5
  [![Gem Version](https://badge.fury.io/rb/telegram-bot-types.svg)](http://badge.fury.io/rb/telegram-bot-types)
6
- [![Build Status](https://travis-ci.org/telegram-bot-rb/telegram-bot-types.svg)](https://travis-ci.org/telegram-bot-rb/telegram-bot-types)
6
+ [![Build Status](https://app.travis-ci.com/telegram-bot-rb/telegram-bot-types.svg)](https://app.travis-ci.com/github/telegram-bot-rb/telegram-bot-types)
7
7
 
8
8
  ## Installation
9
9
 
@@ -1,15 +1,39 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'virtus'
3
+ require 'dry/struct'
4
4
 
5
5
  module Telegram
6
6
  module Bot
7
7
  module Types
8
- class Base
9
- include Virtus.model
8
+ include Dry.Types()
10
9
 
11
- def to_hash(*)
12
- super.reject { |_k, v| v.nil? }
10
+ # Collection of default types. They are also available without
11
+ # `Types::` prefix in nested classes in opposite to other built-in types.
12
+ Boolean = self::Bool
13
+ Integer = Coercible::Integer
14
+ Float = Coercible::Float
15
+ String = Coercible::String
16
+ Array = self::Array
17
+
18
+ class Base < Dry::Struct
19
+ transform_keys(&:to_sym)
20
+
21
+ class << self
22
+ # Make all attributes optional.
23
+ # Copied from #attribute?
24
+ def attribute(name, *args, &block)
25
+ super(:"#{name}?", build_type(name, *args, &block))
26
+ end
27
+ end
28
+
29
+ # Access fields by string values for backward compatibility.
30
+ # Don't raise errors when accessing missing attributes.
31
+ # https://github.com/dry-rb/dry-struct/pull/177
32
+ def [](name)
33
+ name = name.to_sym
34
+ super(name)
35
+ rescue MissingAttributeError
36
+ raise unless self.class.attribute_names.include?(name)
13
37
  end
14
38
  end
15
39
  end
@@ -8,11 +8,11 @@ module Telegram
8
8
  attribute :data, String
9
9
  attribute :phone_number, String
10
10
  attribute :email, String
11
- attribute :files, [PassportFile]
11
+ attribute :files, Array.of(PassportFile)
12
12
  attribute :front_side, PassportFile
13
13
  attribute :reverse_side, PassportFile
14
14
  attribute :selfie, PassportFile
15
- attribute :translation, [PassportFile]
15
+ attribute :translation, Array.of(PassportFile)
16
16
  attribute :hash, String
17
17
  end
18
18
  end
@@ -5,7 +5,7 @@ module Telegram
5
5
  module Types
6
6
  class ForceReply < Base
7
7
  attribute :force_reply, Boolean
8
- attribute :selective, Boolean, default: false
8
+ attribute :selective, Boolean.default(false)
9
9
  end
10
10
  end
11
11
  end
@@ -6,9 +6,9 @@ module Telegram
6
6
  class Game < Base
7
7
  attribute :title, String
8
8
  attribute :description, String
9
- attribute :photo, [PhotoSize]
9
+ attribute :photo, Array.of(PhotoSize)
10
10
  attribute :text, String
11
- attribute :text_entities, [MessageEntity]
11
+ attribute :text_entities, Array.of(MessageEntity)
12
12
  attribute :animation, Animation
13
13
  end
14
14
  end
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineKeyboardMarkup < Base
7
- attribute :inline_keyboard, [[InlineKeyboardButton]]
7
+ attribute :inline_keyboard, Array.of(Array.of(InlineKeyboardButton))
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 InlineQueryResultArticle < Base
7
- attribute :type, String, default: 'article'
7
+ attribute :type, String.default('article')
8
8
  attribute :id, String
9
9
  attribute :title, String
10
10
  attribute :input_message_content, InputMessageContent
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultAudio < Base
7
- attribute :type, String, default: 'audio'
7
+ attribute :type, String.default('audio')
8
8
  attribute :id, String
9
9
  attribute :audio_url, String
10
10
  attribute :title, String
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultCachedAudio < Base
7
- attribute :type, String, default: 'audio'
7
+ attribute :type, String.default('audio')
8
8
  attribute :id, String
9
9
  attribute :audio_file_id, String
10
10
  attribute :caption, String
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultCachedDocument < Base
7
- attribute :type, String, default: 'document'
7
+ attribute :type, String.default('document')
8
8
  attribute :id, String
9
9
  attribute :title, String
10
10
  attribute :document_file_id, String
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultCachedGif < Base
7
- attribute :type, String, default: 'gif'
7
+ attribute :type, String.default('gif')
8
8
  attribute :id, String
9
9
  attribute :gif_file_id, String
10
10
  attribute :title, String
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultCachedMpeg4Gif < Base
7
- attribute :type, String, default: 'mpeg4_gif'
7
+ attribute :type, String.default('mpeg4_gif')
8
8
  attribute :id, String
9
9
  attribute :mpeg4_file_id, String
10
10
  attribute :title, String
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultCachedPhoto < Base
7
- attribute :type, String, default: 'photo'
7
+ attribute :type, String.default('photo')
8
8
  attribute :id, String
9
9
  attribute :photo_file_id, String
10
10
  attribute :title, String
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultCachedSticker < Base
7
- attribute :type, String, default: 'sticker'
7
+ attribute :type, String.default('sticker')
8
8
  attribute :id, String
9
9
  attribute :sticker_file_id, String
10
10
  attribute :reply_markup, InlineKeyboardMarkup
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultCachedVideo < Base
7
- attribute :type, String, default: 'video'
7
+ attribute :type, String.default('video')
8
8
  attribute :id, String
9
9
  attribute :video_file_id, String
10
10
  attribute :title, String
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultCachedVoice < Base
7
- attribute :type, String, default: 'voice'
7
+ attribute :type, String.default('voice')
8
8
  attribute :id, String
9
9
  attribute :voice_file_id, String
10
10
  attribute :title, String
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultContact < Base
7
- attribute :type, String, default: 'contact'
7
+ attribute :type, String.default('contact')
8
8
  attribute :id, String
9
9
  attribute :phone_number, String
10
10
  attribute :first_name, String
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultDocument < Base
7
- attribute :type, String, default: 'document'
7
+ attribute :type, String.default('document')
8
8
  attribute :id, String
9
9
  attribute :title, String
10
10
  attribute :caption, String
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultGame < Base
7
- attribute :type, String, default: 'game'
7
+ attribute :type, String.default('game')
8
8
  attribute :id, String
9
9
  attribute :game_short_name, String
10
10
  attribute :reply_markup, InlineKeyboardMarkup
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultGif < Base
7
- attribute :type, String, default: 'gif'
7
+ attribute :type, String.default('gif')
8
8
  attribute :id, String
9
9
  attribute :gif_url, String
10
10
  attribute :gif_width, Integer
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultLocation < Base
7
- attribute :type, String, default: 'location'
7
+ attribute :type, String.default('location')
8
8
  attribute :id, String
9
9
  attribute :latitude, Float
10
10
  attribute :longitude, Float
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultMpeg4Gif < Base
7
- attribute :type, String, default: 'mpeg4_gif'
7
+ attribute :type, String.default('mpeg4_gif')
8
8
  attribute :id, String
9
9
  attribute :mpeg4_url, String
10
10
  attribute :mpeg4_width, Integer
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultPhoto < Base
7
- attribute :type, String, default: 'photo'
7
+ attribute :type, String.default('photo')
8
8
  attribute :id, String
9
9
  attribute :photo_url, String
10
10
  attribute :thumb_url, String
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultVenue < Base
7
- attribute :type, String, default: 'venue'
7
+ attribute :type, String.default('venue')
8
8
  attribute :id, String
9
9
  attribute :latitude, Float
10
10
  attribute :longitude, Float
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultVideo < Base
7
- attribute :type, String, default: 'video'
7
+ attribute :type, String.default('video')
8
8
  attribute :id, String
9
9
  attribute :video_url, String
10
10
  attribute :mime_type, String
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InlineQueryResultVoice < Base
7
- attribute :type, String, default: 'voice'
7
+ attribute :type, String.default('voice')
8
8
  attribute :id, String
9
9
  attribute :voice_url, String
10
10
  attribute :title, String
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InputMediaAnimation < Base
7
- attribute :type, String, default: 'animation'
7
+ attribute :type, String.default('animation')
8
8
  attribute :media, String
9
9
  attribute :thumb, String
10
10
  attribute :caption, String
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InputMediaAudio < Base
7
- attribute :type, String, default: 'audio'
7
+ attribute :type, String.default('audio')
8
8
  attribute :media, String
9
9
  attribute :thumb, String
10
10
  attribute :caption, String
@@ -4,12 +4,12 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InputMediaDocument < Base
7
- attribute :type, String, default: 'document'
7
+ attribute :type, String.default('document')
8
8
  attribute :media, String
9
9
  attribute :thumb, String
10
10
  attribute :caption, String
11
11
  attribute :parse_mode, String
12
- attribute :caption_entities, [MessageEntity]
12
+ attribute :caption_entities, Array.of(MessageEntity)
13
13
  attribute :disable_content_type_detection, Boolean
14
14
  end
15
15
  end
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InputMediaPhoto < Base
7
- attribute :type, String, default: 'photo'
7
+ attribute :type, String.default('photo')
8
8
  attribute :media, String
9
9
  attribute :caption, String
10
10
  attribute :parse_mode, String
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class InputMediaVideo < Base
7
- attribute :type, String, default: 'video'
7
+ attribute :type, String.default('video')
8
8
  attribute :media, String
9
9
  attribute :caption, String
10
10
  attribute :parse_mode, String
@@ -21,13 +21,13 @@ module Telegram
21
21
  attribute :media_group_id, String
22
22
  attribute :author_signature, String
23
23
  attribute :text, String
24
- attribute :entities, [MessageEntity]
25
- attribute :caption_entities, [MessageEntity]
24
+ attribute :entities, Array.of(MessageEntity)
25
+ attribute :caption_entities, Array.of(MessageEntity)
26
26
  attribute :audio, Audio
27
27
  attribute :document, Document
28
28
  attribute :animation, Animation
29
29
  attribute :game, Game
30
- attribute :photo, [PhotoSize]
30
+ attribute :photo, Array.of(PhotoSize)
31
31
  attribute :sticker, Sticker
32
32
  attribute :video, Video
33
33
  attribute :voice, Voice
@@ -38,10 +38,10 @@ module Telegram
38
38
  attribute :location, Location
39
39
  attribute :venue, Venue
40
40
  attribute :poll, Poll
41
- attribute :new_chat_members, [User]
41
+ attribute :new_chat_members, Array.of(User)
42
42
  attribute :left_chat_member, User
43
43
  attribute :new_chat_title, String
44
- attribute :new_chat_photo, [PhotoSize]
44
+ attribute :new_chat_photo, Array.of(PhotoSize)
45
45
  attribute :delete_chat_photo, Boolean
46
46
  attribute :group_chat_created, Boolean
47
47
  attribute :supergroup_chat_created, Boolean
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class PassportData < Base
7
- attribute :data, [EncryptedPassportElement]
7
+ attribute :data, Array.of(EncryptedPassportElement)
8
8
  attribute :credentials, EncryptedCredentials
9
9
  end
10
10
  end
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class PassportElementErrorDataField < Base
7
- attribute :source, String, default: 'data'
7
+ attribute :source, String.default('data')
8
8
  attribute :type, String
9
9
  attribute :field_name, String
10
10
  attribute :data_hash, String
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class PassportElementErrorFile < Base
7
- attribute :source, String, default: 'file'
7
+ attribute :source, String.default('file')
8
8
  attribute :type, String
9
9
  attribute :file_hash, String
10
10
  attribute :message, String
@@ -4,9 +4,9 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class PassportElementErrorFiles < Base
7
- attribute :source, String, default: 'files'
7
+ attribute :source, String.default('files')
8
8
  attribute :type, String
9
- attribute :file_hashes, [String]
9
+ attribute :file_hashes, Array.of(String)
10
10
  attribute :message, String
11
11
  end
12
12
  end
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class PassportElementErrorFrontSide < Base
7
- attribute :source, String, default: 'front_side'
7
+ attribute :source, String.default('front_side')
8
8
  attribute :type, String
9
9
  attribute :file_hash, String
10
10
  attribute :message, String
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class PassportElementErrorReverseSide < Base
7
- attribute :source, String, default: 'reverse_side'
7
+ attribute :source, String.default('reverse_side')
8
8
  attribute :type, String
9
9
  attribute :file_hash, String
10
10
  attribute :message, String
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class PassportElementErrorSelfie < Base
7
- attribute :source, String, default: 'selfie'
7
+ attribute :source, String.default('selfie')
8
8
  attribute :type, String
9
9
  attribute :file_hash, String
10
10
  attribute :message, String
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class PassportElementErrorTranslationFile < Base
7
- attribute :source, String, default: 'translation_file'
7
+ attribute :source, String.default('translation_file')
8
8
  attribute :type, String
9
9
  attribute :file_hash, String
10
10
  attribute :message, String
@@ -4,9 +4,9 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class PassportElementErrorTranslationFiles < Base
7
- attribute :source, String, default: 'translation_files'
7
+ attribute :source, String.default('translation_files')
8
8
  attribute :type, String
9
- attribute :file_hashes, [String]
9
+ attribute :file_hashes, Array.of(String)
10
10
  attribute :message, String
11
11
  end
12
12
  end
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class PassportElementErrorUnspecified < Base
7
- attribute :source, String, default: 'unspecified'
7
+ attribute :source, String.default('unspecified')
8
8
  attribute :type, String
9
9
  attribute :element_hash, String
10
10
  attribute :message, String
@@ -6,7 +6,7 @@ module Telegram
6
6
  class Poll < Base
7
7
  attribute :id, String
8
8
  attribute :question, String
9
- attribute :options, [PollOption]
9
+ attribute :options, Array.of(PollOption)
10
10
  attribute :total_voter_count, Integer
11
11
  attribute :is_closed, Boolean
12
12
  attribute :is_anonymous, Boolean
@@ -14,7 +14,7 @@ module Telegram
14
14
  attribute :allows_multiple_answers, Boolean
15
15
  attribute :correct_option_id, Integer
16
16
  attribute :explanation, String
17
- attribute :explanation_entities, [MessageEntity]
17
+ attribute :explanation_entities, Array.of(MessageEntity)
18
18
  attribute :open_period, Integer
19
19
  attribute :close_date, Integer
20
20
  end
@@ -6,7 +6,7 @@ module Telegram
6
6
  class PollAnswer < Base
7
7
  attribute :poll_id, String
8
8
  attribute :user, User
9
- attribute :option_ids, [Integer]
9
+ attribute :option_ids, Array.of(Integer)
10
10
  end
11
11
  end
12
12
  end
@@ -4,10 +4,10 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class ReplyKeyboardMarkup < Base
7
- attribute :keyboard, [[KeyboardButton]]
8
- attribute :resize_keyboard, Boolean, default: false
9
- attribute :one_time_keyboard, Boolean, default: false
10
- attribute :selective, Boolean, default: false
7
+ attribute :keyboard, Array.of(Array.of(KeyboardButton))
8
+ attribute :resize_keyboard, Boolean.default(false)
9
+ attribute :one_time_keyboard, Boolean.default(false)
10
+ attribute :selective, Boolean.default(false)
11
11
  end
12
12
  end
13
13
  end
@@ -5,7 +5,7 @@ module Telegram
5
5
  module Types
6
6
  class ReplyKeyboardRemove < Base
7
7
  attribute :remove_keyboard, Boolean
8
- attribute :selective, Boolean, default: false
8
+ attribute :selective, Boolean.default(false)
9
9
  end
10
10
  end
11
11
  end
@@ -81,7 +81,7 @@ module Telegram
81
81
  # return either object ot true, so it bypasses true value as is.
82
82
  def wrap(object, type)
83
83
  return object if object == true
84
- if type.is_a?(Array)
84
+ if type.is_a?(::Array)
85
85
  type = type.first
86
86
  object.map { |x| type.new(x) }
87
87
  else
@@ -6,7 +6,7 @@ module Telegram
6
6
  class ShippingOption < Base
7
7
  attribute :id, String
8
8
  attribute :title, String
9
- attribute :prices, [LabeledPrice]
9
+ attribute :prices, Array.of(LabeledPrice)
10
10
  end
11
11
  end
12
12
  end
@@ -8,7 +8,7 @@ module Telegram
8
8
  attribute :title, String
9
9
  attribute :is_animated, Boolean
10
10
  attribute :contains_masks, Boolean
11
- attribute :stickers, [Sticker]
11
+ attribute :stickers, Array.of(Sticker)
12
12
  attribute :thumb, PhotoSize
13
13
  end
14
14
  end
@@ -5,7 +5,7 @@ module Telegram
5
5
  module Types
6
6
  class UserProfilePhotos < Base
7
7
  attribute :total_count, Integer
8
- attribute :photos, [[PhotoSize]]
8
+ attribute :photos, Array.of(Array.of(PhotoSize))
9
9
  end
10
10
  end
11
11
  end
@@ -3,7 +3,7 @@
3
3
  module Telegram
4
4
  module Bot
5
5
  module Types
6
- VERSION = '0.6.3'
6
+ VERSION = '0.7.0'
7
7
 
8
8
  def self.gem_version
9
9
  Gem::Version.new VERSION
@@ -4,7 +4,7 @@ module Telegram
4
4
  module Bot
5
5
  module Types
6
6
  class VoiceChatParticipantsInvited < Base
7
- attribute :users, [User]
7
+ attribute :users, Array.of(User)
8
8
  end
9
9
  end
10
10
  end
@@ -10,9 +10,8 @@ module Telegram
10
10
  attribute :ip_address, String
11
11
  attribute :last_error_date, Integer
12
12
  attribute :last_error_message, String
13
- attribute :max_connections, String
14
13
  attribute :max_connections, Integer
15
- attribute :allowed_updates, [String]
14
+ attribute :allowed_updates, Array.of(String)
16
15
  end
17
16
  end
18
17
  end
@@ -20,9 +20,9 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ['lib']
22
22
 
23
- spec.add_dependency 'virtus', '~> 1.0'
23
+ spec.add_dependency 'dry-struct', '~> 1.0'
24
24
 
25
- spec.add_development_dependency 'bundler', '~> 1.9'
25
+ spec.add_development_dependency 'bundler', '> 1.16'
26
26
  spec.add_development_dependency 'rake', '~> 13.0'
27
27
  spec.add_development_dependency 'rspec', '~> 3.3'
28
28
  spec.add_development_dependency 'rspec-its', '~> 1.1'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: telegram-bot-types
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Tipugin
@@ -9,10 +9,10 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2021-06-25 00:00:00.000000000 Z
12
+ date: 2022-03-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: virtus
15
+ name: dry-struct
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
18
  - - "~>"
@@ -29,16 +29,16 @@ dependencies:
29
29
  name: bundler
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - "~>"
32
+ - - ">"
33
33
  - !ruby/object:Gem::Version
34
- version: '1.9'
34
+ version: '1.16'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - "~>"
39
+ - - ">"
40
40
  - !ruby/object:Gem::Version
41
- version: '1.9'
41
+ version: '1.16'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rake
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -255,7 +255,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
255
255
  - !ruby/object:Gem::Version
256
256
  version: '0'
257
257
  requirements: []
258
- rubygems_version: 3.1.4
258
+ rubygems_version: 3.2.3
259
259
  signing_key:
260
260
  specification_version: 4
261
261
  summary: Virtus types for Telegram Bot API