tgbot 0.2.7 → 0.3.2

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.
data/lib/tgbot/version.rb CHANGED
@@ -1,3 +1,3 @@
1
- class Tgbot
2
- VERSION = '0.2.7'.freeze
3
- end
1
+ class Tgbot
2
+ VERSION = '0.3.2'.freeze
3
+ end
data/tgbot.gemspec CHANGED
@@ -1,30 +1,30 @@
1
- # coding: utf-8
2
- lib = File.expand_path("../lib", __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "tgbot/version"
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "tgbot"
8
- spec.version = Tgbot::VERSION
9
- spec.authors = ["hyrious"]
10
- spec.email = ["hyrious@outlook.com"]
11
-
12
- spec.summary = 'Telegram Bot API'
13
- spec.description = 'A deadly simple Telegram Bot API wrapper.'
14
- spec.homepage = 'https://github.com/hyrious/tgbot'
15
- spec.license = "MIT"
16
-
17
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
- f.match(%r{^(test|spec|features)/})
19
- end
20
- spec.bindir = "exe"
21
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
- spec.require_paths = ["lib"]
23
-
24
- spec.add_development_dependency "bundler"
25
- spec.add_development_dependency "rake"
26
-
27
- spec.add_dependency 'http'
28
- spec.add_dependency 'mimemagic'
29
- spec.required_ruby_version = '>= 2.6.0'
30
- end
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "tgbot/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "tgbot"
8
+ spec.version = Tgbot::VERSION
9
+ spec.authors = ["hyrious"]
10
+ spec.email = ["hyrious@outlook.com"]
11
+
12
+ spec.summary = 'Telegram Bot API'
13
+ spec.description = 'A deadly simple Telegram Bot API wrapper.'
14
+ spec.homepage = 'https://github.com/hyrious/tgbot'
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_development_dependency "bundler"
25
+ spec.add_development_dependency "rake"
26
+
27
+ spec.add_dependency 'http'
28
+ spec.add_dependency 'mimemagic'
29
+ spec.required_ruby_version = '>= 2.6.0'
30
+ end
data/tool/gen.rb CHANGED
@@ -1,32 +1,34 @@
1
- require 'http'
2
- require 'nokogiri'
3
-
4
- raw = HTTP.via('127.0.0.1', 1080).get('https://core.telegram.org/bots/api').to_s
5
- nodes = Nokogiri::HTML(raw).at('#dev_page_content').children
6
- ret = [{ name: 'Telegram Bot API', children: [] }]
7
- uplevels = [2]
8
- nodes.each do |node|
9
- case node.name
10
- when 'h3', 'h4'
11
- n = node.name[/\d/].to_i
12
- while uplevels[-1] >= n
13
- ret.pop
14
- uplevels.pop
15
- end
16
- ret[-1][:children] << (x = { name: node.content, children: [] })
17
- ret << x
18
- uplevels << n
19
- when 'h6', 'p', 'blockquote', 'pre'
20
- (ret[-1]['desc'] ||= []) << { name: node.name, content: node.content.strip }
21
- when 'ul', 'ol'
22
- (ret[-1]['desc'] ||= []) << { name: node.name, content: node.css('li').map(&:content).map(&:strip) }
23
- when 'table'
24
- keys = node.css('th').map(&:content)
25
- ret[-1]['table'] = node.css('tbody > tr').map do |tr|
26
- keys.zip(tr.css('td').map(&:content)).to_h
27
- end
28
- end
29
- end
30
- ret = JSON.parse JSON.generate ret[0]
31
- require 'psych'
32
- open(File.expand_path('../lib/api.yaml', __dir__), 'wb') { |f| Psych.dump ret, f, line_width: 1<<30 }
1
+ require 'net/http'
2
+ require 'nokogiri'
3
+
4
+ uri = URI('https://core.telegram.org/bots/api')
5
+ raw = Net::HTTP.get(uri)
6
+ nodes = Nokogiri::HTML(raw).at('#dev_page_content').children
7
+ ret = [{ name: 'Telegram Bot API', children: [] }]
8
+ uplevels = [2]
9
+ nodes.each do |node|
10
+ case node.name
11
+ when 'h3', 'h4'
12
+ n = node.name[/\d/].to_i
13
+ while uplevels[-1] >= n
14
+ ret.pop
15
+ uplevels.pop
16
+ end
17
+ ret[-1][:children] << (x = { name: node.content, children: [] })
18
+ ret << x
19
+ uplevels << n
20
+ when 'h6', 'p', 'blockquote', 'pre'
21
+ (ret[-1]['desc'] ||= []) << { name: node.name, content: node.content.strip }
22
+ when 'ul', 'ol'
23
+ (ret[-1]['desc'] ||= []) << { name: node.name, content: node.css('li').map(&:content).map(&:strip) }
24
+ when 'table'
25
+ keys = node.css('th').map(&:content)
26
+ ret[-1]['table'] = node.css('tbody > tr').map do |tr|
27
+ keys.zip(tr.css('td').map(&:content)).to_h
28
+ end
29
+ end
30
+ end
31
+ require 'json'
32
+ ret = JSON.parse JSON.generate ret[0]
33
+ require 'psych'
34
+ open(File.expand_path('../lib/api.yaml', __dir__), 'wb') { |f| Psych.dump ret, f, line_width: 1<<30 }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tgbot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - hyrious
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-31 00:00:00.000000000 Z
11
+ date: 2021-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -89,7 +89,7 @@ homepage: https://github.com/hyrious/tgbot
89
89
  licenses:
90
90
  - MIT
91
91
  metadata: {}
92
- post_install_message:
92
+ post_install_message:
93
93
  rdoc_options: []
94
94
  require_paths:
95
95
  - lib
@@ -104,8 +104,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  - !ruby/object:Gem::Version
105
105
  version: '0'
106
106
  requirements: []
107
- rubygems_version: 3.1.2
108
- signing_key:
107
+ rubygems_version: 3.2.15
108
+ signing_key:
109
109
  specification_version: 4
110
110
  summary: Telegram Bot API
111
111
  test_files: []