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.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/lib/telegram/bot/types/base.rb +29 -5
- data/lib/telegram/bot/types/encrypted_passport_element.rb +2 -2
- data/lib/telegram/bot/types/force_reply.rb +1 -1
- data/lib/telegram/bot/types/game.rb +2 -2
- data/lib/telegram/bot/types/inline_keyboard_markup.rb +1 -1
- data/lib/telegram/bot/types/inline_query_result_article.rb +1 -1
- data/lib/telegram/bot/types/inline_query_result_audio.rb +1 -1
- data/lib/telegram/bot/types/inline_query_result_cached_audio.rb +1 -1
- data/lib/telegram/bot/types/inline_query_result_cached_document.rb +1 -1
- data/lib/telegram/bot/types/inline_query_result_cached_gif.rb +1 -1
- data/lib/telegram/bot/types/inline_query_result_cached_mpeg4_gif.rb +1 -1
- data/lib/telegram/bot/types/inline_query_result_cached_photo.rb +1 -1
- data/lib/telegram/bot/types/inline_query_result_cached_sticker.rb +1 -1
- data/lib/telegram/bot/types/inline_query_result_cached_video.rb +1 -1
- data/lib/telegram/bot/types/inline_query_result_cached_voice.rb +1 -1
- data/lib/telegram/bot/types/inline_query_result_contact.rb +1 -1
- data/lib/telegram/bot/types/inline_query_result_document.rb +1 -1
- data/lib/telegram/bot/types/inline_query_result_game.rb +1 -1
- data/lib/telegram/bot/types/inline_query_result_gif.rb +1 -1
- data/lib/telegram/bot/types/inline_query_result_location.rb +1 -1
- data/lib/telegram/bot/types/inline_query_result_mpeg4_gif.rb +1 -1
- data/lib/telegram/bot/types/inline_query_result_photo.rb +1 -1
- data/lib/telegram/bot/types/inline_query_result_venue.rb +1 -1
- data/lib/telegram/bot/types/inline_query_result_video.rb +1 -1
- data/lib/telegram/bot/types/inline_query_result_voice.rb +1 -1
- data/lib/telegram/bot/types/input_media_animation.rb +1 -1
- data/lib/telegram/bot/types/input_media_audio.rb +1 -1
- data/lib/telegram/bot/types/input_media_document.rb +2 -2
- data/lib/telegram/bot/types/input_media_photo.rb +1 -1
- data/lib/telegram/bot/types/input_media_video.rb +1 -1
- data/lib/telegram/bot/types/message.rb +5 -5
- data/lib/telegram/bot/types/passport_data.rb +1 -1
- data/lib/telegram/bot/types/passport_element_error_data_field.rb +1 -1
- data/lib/telegram/bot/types/passport_element_error_file.rb +1 -1
- data/lib/telegram/bot/types/passport_element_error_files.rb +2 -2
- data/lib/telegram/bot/types/passport_element_error_front_side.rb +1 -1
- data/lib/telegram/bot/types/passport_element_error_reverse_side.rb +1 -1
- data/lib/telegram/bot/types/passport_element_error_selfie.rb +1 -1
- data/lib/telegram/bot/types/passport_element_error_translation_file.rb +1 -1
- data/lib/telegram/bot/types/passport_element_error_translation_files.rb +2 -2
- data/lib/telegram/bot/types/passport_element_error_unspecified.rb +1 -1
- data/lib/telegram/bot/types/poll.rb +2 -2
- data/lib/telegram/bot/types/poll_answer.rb +1 -1
- data/lib/telegram/bot/types/reply_keyboard_markup.rb +4 -4
- data/lib/telegram/bot/types/reply_keyboard_remove.rb +1 -1
- data/lib/telegram/bot/types/response.rb +1 -1
- data/lib/telegram/bot/types/shipping_option.rb +1 -1
- data/lib/telegram/bot/types/sticker_set.rb +1 -1
- data/lib/telegram/bot/types/user_profile_photos.rb +1 -1
- data/lib/telegram/bot/types/version.rb +1 -1
- data/lib/telegram/bot/types/voice_chat_participants_invited.rb +1 -1
- data/lib/telegram/bot/types/webhook_info.rb +1 -2
- data/telegram-bot-types.gemspec +2 -2
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d4df9be660382c7bee82232c59643d7ab50be12b85a26d552192a6d99888b26
|
4
|
+
data.tar.gz: ba50f17387c975027d9ecf851761db6a2cab9bb1cbf829d8e4534c6d6e679cca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
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.
|
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 '
|
3
|
+
require 'dry/struct'
|
4
4
|
|
5
5
|
module Telegram
|
6
6
|
module Bot
|
7
7
|
module Types
|
8
|
-
|
9
|
-
include Virtus.model
|
8
|
+
include Dry.Types()
|
10
9
|
|
11
|
-
|
12
|
-
|
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,
|
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,
|
15
|
+
attribute :translation, Array.of(PassportFile)
|
16
16
|
attribute :hash, String
|
17
17
|
end
|
18
18
|
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,
|
9
|
+
attribute :photo, Array.of(PhotoSize)
|
10
10
|
attribute :text, String
|
11
|
-
attribute :text_entities,
|
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 InlineQueryResultArticle < Base
|
7
|
-
attribute :type, String
|
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 InlineQueryResultCachedDocument < Base
|
7
|
-
attribute :type, String
|
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 InlineQueryResultCachedMpeg4Gif < Base
|
7
|
-
attribute :type, String
|
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 InlineQueryResultCachedSticker < Base
|
7
|
-
attribute :type, String
|
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 InlineQueryResultGame < Base
|
7
|
-
attribute :type, String
|
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 InlineQueryResultMpeg4Gif < Base
|
7
|
-
attribute :type, String
|
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,12 +4,12 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class InputMediaDocument < Base
|
7
|
-
attribute :type, String
|
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,
|
12
|
+
attribute :caption_entities, Array.of(MessageEntity)
|
13
13
|
attribute :disable_content_type_detection, Boolean
|
14
14
|
end
|
15
15
|
end
|
@@ -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,
|
25
|
-
attribute :caption_entities,
|
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,
|
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,
|
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,
|
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 PassportElementErrorDataField < Base
|
7
|
-
attribute :source, String
|
7
|
+
attribute :source, String.default('data')
|
8
8
|
attribute :type, String
|
9
9
|
attribute :field_name, String
|
10
10
|
attribute :data_hash, String
|
@@ -4,9 +4,9 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class PassportElementErrorFiles < Base
|
7
|
-
attribute :source, String
|
7
|
+
attribute :source, String.default('files')
|
8
8
|
attribute :type, String
|
9
|
-
attribute :file_hashes,
|
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
|
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
|
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 PassportElementErrorTranslationFile < Base
|
7
|
-
attribute :source, String
|
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
|
7
|
+
attribute :source, String.default('translation_files')
|
8
8
|
attribute :type, String
|
9
|
-
attribute :file_hashes,
|
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
|
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,
|
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,
|
17
|
+
attribute :explanation_entities, Array.of(MessageEntity)
|
18
18
|
attribute :open_period, Integer
|
19
19
|
attribute :close_date, Integer
|
20
20
|
end
|
@@ -4,10 +4,10 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class ReplyKeyboardMarkup < Base
|
7
|
-
attribute :keyboard,
|
8
|
-
attribute :resize_keyboard, Boolean
|
9
|
-
attribute :one_time_keyboard, Boolean
|
10
|
-
attribute :selective, Boolean
|
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
|
@@ -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,
|
14
|
+
attribute :allowed_updates, Array.of(String)
|
16
15
|
end
|
17
16
|
end
|
18
17
|
end
|
data/telegram-bot-types.gemspec
CHANGED
@@ -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 '
|
23
|
+
spec.add_dependency 'dry-struct', '~> 1.0'
|
24
24
|
|
25
|
-
spec.add_development_dependency 'bundler', '
|
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.
|
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:
|
12
|
+
date: 2022-03-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
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.
|
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.
|
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.
|
258
|
+
rubygems_version: 3.2.3
|
259
259
|
signing_key:
|
260
260
|
specification_version: 4
|
261
261
|
summary: Virtus types for Telegram Bot API
|