telegram-bot-ruby 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/README.md +1 -1
- data/lib/telegram/bot/types/affiliate_info.rb +15 -0
- data/lib/telegram/bot/types/star_transaction.rb +1 -0
- data/lib/telegram/bot/types/transaction_partner.rb +1 -0
- data/lib/telegram/bot/types/transaction_partner_affiliate_program.rb +13 -0
- data/lib/telegram/bot/types/transaction_partner_user.rb +1 -0
- data/lib/telegram/bot/version.rb +1 -1
- data/rakelib/parse_schema.rake +1 -1
- data/rakelib/rebuild_types.rake +3 -3
- data/telegram-bot-ruby.gemspec +1 -1
- metadata +6 -5
- data/utility/type_attributes.json +0 -5138
- /data/{utility → rakelib/templates}/empty_type.erb +0 -0
- /data/{utility → rakelib/templates}/type.erb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c61ae37c189075bf4c60779805815a0eab30f6e06869338741657599a390641c
|
4
|
+
data.tar.gz: ebd700271cbc71e7a1e609936e5e6b01bd37eb6190b90266fe9490be77b62138
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bc5e6853d97f71863ce7f9010f7a6ee948c37adcaa2f0eeb100f1915d73736c4631c1f6c2d36ec189378f10a6a09186bd4b535dc37b267d8d6f324efbbd8d26
|
7
|
+
data.tar.gz: 9e196f0e2709bd705324777f1bd47e0301b407be3a0567ac23f181225d9d1b6e038e787cff2fbac4e5a408446efcd38856d45990d955f76b32d50ff1a606d90f
|
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,16 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 2.2.0
|
4
|
+
|
5
|
+
### Added
|
6
|
+
|
7
|
+
- [Bot API 8.1](https://core.telegram.org/bots/api-changelog#october-31-2024) [#319](https://github.com/atipugin/telegram-bot-ruby/pull/319)
|
8
|
+
|
3
9
|
## 2.1.0
|
4
10
|
|
5
11
|
### Added
|
6
12
|
|
7
|
-
- [Bot API 8.0](https://core.telegram.org/bots/api#november-17-2024)
|
13
|
+
- [Bot API 8.0](https://core.telegram.org/bots/api#november-17-2024) (thx [@seorgiy](https://github.com/seorgiy))
|
8
14
|
|
9
15
|
## 2.0.0
|
10
16
|
|
data/README.md
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telegram
|
4
|
+
module Bot
|
5
|
+
module Types
|
6
|
+
class AffiliateInfo < Base
|
7
|
+
attribute? :affiliate_user, User
|
8
|
+
attribute? :affiliate_chat, Chat
|
9
|
+
attribute :commission_per_mille, Types::Integer
|
10
|
+
attribute :amount, Types::Integer
|
11
|
+
attribute? :nanostar_amount, Types::Integer
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -6,6 +6,7 @@ module Telegram
|
|
6
6
|
class StarTransaction < Base
|
7
7
|
attribute :id, Types::String
|
8
8
|
attribute :amount, Types::Integer
|
9
|
+
attribute? :nanostar_amount, Types::Integer
|
9
10
|
attribute :date, Types::Integer
|
10
11
|
attribute? :source, TransactionPartner
|
11
12
|
attribute? :receiver, TransactionPartner
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telegram
|
4
|
+
module Bot
|
5
|
+
module Types
|
6
|
+
class TransactionPartnerAffiliateProgram < Base
|
7
|
+
attribute :type, Types::String.constrained(eql: 'affiliate_program').default('affiliate_program')
|
8
|
+
attribute? :sponsor_user, User
|
9
|
+
attribute :commission_per_mille, Types::Integer
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -6,6 +6,7 @@ module Telegram
|
|
6
6
|
class TransactionPartnerUser < Base
|
7
7
|
attribute :type, Types::String.constrained(eql: 'user').default('user')
|
8
8
|
attribute :user, User
|
9
|
+
attribute? :affiliate, AffiliateInfo
|
9
10
|
attribute? :invoice_payload, Types::String
|
10
11
|
attribute? :subscription_period, Types::Integer
|
11
12
|
attribute? :paid_media, Types::Array.of(PaidMedia)
|
data/lib/telegram/bot/version.rb
CHANGED
data/rakelib/parse_schema.rake
CHANGED
@@ -50,7 +50,7 @@ task :parse_schema do
|
|
50
50
|
end
|
51
51
|
|
52
52
|
# Input File is literally just a string for our purpose
|
53
|
-
File.write "#{__dir__}/../
|
53
|
+
File.write "#{__dir__}/../data/type_attributes.json", JSON.pretty_generate(result.except('InputFile'))
|
54
54
|
end
|
55
55
|
|
56
56
|
def required_keys(schema)
|
data/rakelib/rebuild_types.rake
CHANGED
@@ -6,7 +6,7 @@ DRY_TYPES = %w[string integer float decimal array hash symbol boolean date date_
|
|
6
6
|
|
7
7
|
desc 'Rebuild types'
|
8
8
|
task :rebuild_types do
|
9
|
-
types = JSON.parse(File.read("#{__dir__}/../
|
9
|
+
types = JSON.parse(File.read("#{__dir__}/../data/type_attributes.json"), symbolize_names: true)
|
10
10
|
|
11
11
|
types.each_pair do |name, attributes|
|
12
12
|
next build_empty_type(name, attributes) if attributes[:type].instance_of?(Array)
|
@@ -35,14 +35,14 @@ task :rebuild_types do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
File.write "#{__dir__}/../lib/telegram/bot/types/#{underscore(name)}.rb",
|
38
|
-
ERB.new(File.read("#{__dir__}
|
38
|
+
ERB.new(File.read("#{__dir__}/templates/type.erb")).result(binding).gsub(" \n", '')
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
42
|
def build_empty_type(name, attributes)
|
43
43
|
attributes = attributes[:type].join(" |\n ")
|
44
44
|
File.write "#{__dir__}/../lib/telegram/bot/types/#{underscore(name)}.rb",
|
45
|
-
ERB.new(File.read("#{__dir__}
|
45
|
+
ERB.new(File.read("#{__dir__}/templates/empty_type.erb")).result(binding).gsub(" \n", '')
|
46
46
|
end
|
47
47
|
|
48
48
|
def apply_default(attributes, attr_name, properties, original_type)
|
data/telegram-bot-ruby.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.summary = "Ruby wrapper for Telegram's Bot API"
|
12
12
|
spec.homepage = 'https://github.com/atipugin/telegram-bot'
|
13
13
|
|
14
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
14
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|data)/}) }
|
15
15
|
spec.bindir = 'exe'
|
16
16
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
17
17
|
spec.require_paths = ['lib']
|
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: 2.
|
4
|
+
version: 2.2.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: 2024-
|
11
|
+
date: 2024-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-struct
|
@@ -97,6 +97,7 @@ files:
|
|
97
97
|
- lib/telegram/bot/exceptions/response_error.rb
|
98
98
|
- lib/telegram/bot/null_logger.rb
|
99
99
|
- lib/telegram/bot/types.rb
|
100
|
+
- lib/telegram/bot/types/affiliate_info.rb
|
100
101
|
- lib/telegram/bot/types/animation.rb
|
101
102
|
- lib/telegram/bot/types/audio.rb
|
102
103
|
- lib/telegram/bot/types/background_fill.rb
|
@@ -307,6 +308,7 @@ files:
|
|
307
308
|
- lib/telegram/bot/types/switch_inline_query_chosen_chat.rb
|
308
309
|
- lib/telegram/bot/types/text_quote.rb
|
309
310
|
- lib/telegram/bot/types/transaction_partner.rb
|
311
|
+
- lib/telegram/bot/types/transaction_partner_affiliate_program.rb
|
310
312
|
- lib/telegram/bot/types/transaction_partner_fragment.rb
|
311
313
|
- lib/telegram/bot/types/transaction_partner_other.rb
|
312
314
|
- lib/telegram/bot/types/transaction_partner_telegram_ads.rb
|
@@ -332,10 +334,9 @@ files:
|
|
332
334
|
- lib/telegram/bot/version.rb
|
333
335
|
- rakelib/parse_schema.rake
|
334
336
|
- rakelib/rebuild_types.rake
|
337
|
+
- rakelib/templates/empty_type.erb
|
338
|
+
- rakelib/templates/type.erb
|
335
339
|
- telegram-bot-ruby.gemspec
|
336
|
-
- utility/empty_type.erb
|
337
|
-
- utility/type.erb
|
338
|
-
- utility/type_attributes.json
|
339
340
|
homepage: https://github.com/atipugin/telegram-bot
|
340
341
|
licenses: []
|
341
342
|
metadata:
|