telepost 0.1.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 +7 -0
- data/.0pdd.yml +9 -0
- data/.gitignore +5 -0
- data/.pdd +5 -0
- data/.rubocop.yml +20 -0
- data/.rultor.yml +26 -0
- data/.travis.yml +12 -0
- data/Gemfile +24 -0
- data/README.md +68 -0
- data/Rakefile +59 -0
- data/appveyor.yml +38 -0
- data/lib/telepost.rb +89 -0
- data/telepost.gemspec +51 -0
- data/test/test_telepost.rb +39 -0
- metadata +143 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ba5f7eb9ca2541557776464020da4ff32eb59672585dec56005727ee88570471
|
4
|
+
data.tar.gz: f699e2b454615c3f8534371c0ee7cc81201e0c931195f6611c330eac8f971ca3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3e09b438f36303b10fa9a14d7d63f63d79c6edcde32c6aceb9bfa1044cf085b6a6ee04a5283b8538bda2cdf43301d8cdc43400b7fec95d8ba42ce39f75c9b2fd
|
7
|
+
data.tar.gz: d75997905404f05aed34490ce6b0f7dfbedb50f12afa347178df12de03d0efb261b175fb954bb88566d247606b73a95c7897c7ebf03b95ce77f1116cf8a94f02
|
data/.0pdd.yml
ADDED
data/.gitignore
ADDED
data/.pdd
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
AllCops:
|
2
|
+
DisplayCopNames: true
|
3
|
+
TargetRubyVersion: 2.5.1
|
4
|
+
|
5
|
+
Layout/EmptyLineAfterGuardClause:
|
6
|
+
Enabled: false
|
7
|
+
Layout/MultilineMethodCallIndentation:
|
8
|
+
Enabled: false
|
9
|
+
Metrics/AbcSize:
|
10
|
+
Max: 50
|
11
|
+
Metrics/MethodLength:
|
12
|
+
Max: 30
|
13
|
+
Metrics/CyclomaticComplexity:
|
14
|
+
Max: 10
|
15
|
+
Metrics/PerceivedComplexity:
|
16
|
+
Max: 10
|
17
|
+
Metrics/ParameterLists:
|
18
|
+
Max: 10
|
19
|
+
Layout/AlignParameters:
|
20
|
+
Enabled: false
|
data/.rultor.yml
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
assets:
|
2
|
+
rubygems.yml: zerocracy/home#assets/rubygems.yml
|
3
|
+
install: |-
|
4
|
+
export GEM_HOME=~/.ruby
|
5
|
+
export GEM_PATH=$GEM_HOME:$GEM_PATH
|
6
|
+
release:
|
7
|
+
script: |-
|
8
|
+
bundle install
|
9
|
+
rake
|
10
|
+
rm -rf *.gem
|
11
|
+
sed -i "s/0\.0\.0/${tag}/g" telepost.gemspec
|
12
|
+
git add telepost.gemspec
|
13
|
+
git commit -m "Version set to ${tag}"
|
14
|
+
gem build telepost.gemspec
|
15
|
+
chmod 0600 ../rubygems.yml
|
16
|
+
gem push *.gem --config-file ../rubygems.yml
|
17
|
+
commanders:
|
18
|
+
- yegor256
|
19
|
+
architect:
|
20
|
+
- yegor256
|
21
|
+
merge:
|
22
|
+
commanders: []
|
23
|
+
script: |-
|
24
|
+
bundle install
|
25
|
+
bundle exec rake
|
26
|
+
deploy: {}
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright (c) 2018 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
source 'https://rubygems.org'
|
24
|
+
gemspec
|
data/README.md
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
[](http://www.elegantobjects.org)
|
2
|
+
[](http://www.rultor.com/p/yegor256/telepost)
|
3
|
+
[](https://www.jetbrains.com/ruby/)
|
4
|
+
|
5
|
+
[](https://travis-ci.org/yegor256/telepost)
|
6
|
+
[](http://badge.fury.io/rb/telepost)
|
7
|
+
[](https://codeclimate.com/github/yegor256/telepost/maintainability)
|
8
|
+
[](http://rubydoc.info/github/yegor256/telepost/master/frames)
|
9
|
+
|
10
|
+
Telepost is a simple gateway to Telegram, which can post messages and respond to primitive requests.
|
11
|
+
|
12
|
+
First, install it:
|
13
|
+
|
14
|
+
```bash
|
15
|
+
$ gem install telepost
|
16
|
+
```
|
17
|
+
|
18
|
+
Then, use it like this:
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
require 'telepost'
|
22
|
+
require 'logger'
|
23
|
+
tp = Telepost.new('..token..')
|
24
|
+
tp.run do |chat, msg|
|
25
|
+
tp.post(chat: chat, 'Thanks for talking to me!')
|
26
|
+
end
|
27
|
+
tp.post(chat: 12345, 'How are you?', 'How are you doing?')
|
28
|
+
```
|
29
|
+
|
30
|
+
That's it.
|
31
|
+
|
32
|
+
# How to contribute
|
33
|
+
|
34
|
+
Read [these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).
|
35
|
+
Make sure you build is green before you contribute
|
36
|
+
your pull request. You will need to have [Ruby](https://www.ruby-lang.org/en/) 2.3+ and
|
37
|
+
[Bundler](https://bundler.io/) installed. Then:
|
38
|
+
|
39
|
+
```
|
40
|
+
$ bundle update
|
41
|
+
$ bundle exec rake
|
42
|
+
```
|
43
|
+
|
44
|
+
If it's clean and you don't see any error messages, submit your pull request.
|
45
|
+
|
46
|
+
# License
|
47
|
+
|
48
|
+
(The MIT License)
|
49
|
+
|
50
|
+
Copyright (c) 2018 Yegor Bugayenko
|
51
|
+
|
52
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
53
|
+
of this software and associated documentation files (the 'Software'), to deal
|
54
|
+
in the Software without restriction, including without limitation the rights
|
55
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
56
|
+
copies of the Software, and to permit persons to whom the Software is
|
57
|
+
furnished to do so, subject to the following conditions:
|
58
|
+
|
59
|
+
The above copyright notice and this permission notice shall be included in all
|
60
|
+
copies or substantial portions of the Software.
|
61
|
+
|
62
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
63
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
64
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
65
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
66
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
67
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
68
|
+
SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright (c) 2018 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require 'rubygems'
|
24
|
+
require 'rake'
|
25
|
+
require 'rake/clean'
|
26
|
+
|
27
|
+
CLEAN = FileList['coverage']
|
28
|
+
|
29
|
+
def name
|
30
|
+
@name ||= File.basename(Dir['*.gemspec'].first, '.*')
|
31
|
+
end
|
32
|
+
|
33
|
+
def version
|
34
|
+
Gem::Specification.load(Dir['*.gemspec'].first).version
|
35
|
+
end
|
36
|
+
|
37
|
+
task default: %i[clean test rubocop]
|
38
|
+
|
39
|
+
require 'rake/testtask'
|
40
|
+
desc 'Run all unit tests'
|
41
|
+
Rake::TestTask.new(:test) do |test|
|
42
|
+
test.libs << 'lib' << 'test'
|
43
|
+
test.pattern = 'test/**/test_*.rb'
|
44
|
+
test.verbose = false
|
45
|
+
end
|
46
|
+
|
47
|
+
require 'rdoc/task'
|
48
|
+
RDoc::Task.new do |rdoc|
|
49
|
+
rdoc.main = 'README.md'
|
50
|
+
rdoc.rdoc_dir = 'rdoc'
|
51
|
+
rdoc.rdoc_files.include('README.md', 'lib/**/*.rb')
|
52
|
+
end
|
53
|
+
|
54
|
+
require 'rubocop/rake_task'
|
55
|
+
desc 'Run RuboCop on all directories'
|
56
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
57
|
+
task.fail_on_error = true
|
58
|
+
task.requires << 'rubocop-rspec'
|
59
|
+
end
|
data/appveyor.yml
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
version: '{build}'
|
2
|
+
skip_tags: true
|
3
|
+
clone_depth: 10
|
4
|
+
branches:
|
5
|
+
only:
|
6
|
+
- master
|
7
|
+
except:
|
8
|
+
- gh-pages
|
9
|
+
os: Windows Server 2012
|
10
|
+
environment:
|
11
|
+
matrix:
|
12
|
+
- ruby_version: "23-x64"
|
13
|
+
- ruby_version: "24-x64"
|
14
|
+
- ruby_version: "25-x64"
|
15
|
+
install:
|
16
|
+
- ps: |
|
17
|
+
$Env:PATH = "C:\Ruby${Env:ruby_version}\bin;${Env:PATH}"
|
18
|
+
if ($Env:ruby_version -match "^23" ) {
|
19
|
+
# RubyInstaller; download OpenSSL headers from OpenKnapsack Project
|
20
|
+
$Env:openssl_dir = "C:\Ruby${Env:ruby_version}"
|
21
|
+
appveyor DownloadFile http://dl.bintray.com/oneclick/OpenKnapsack/x64/openssl-1.0.2j-x64-windows.tar.lzma
|
22
|
+
7z e openssl-1.0.2j-x64-windows.tar.lzma
|
23
|
+
7z x -y -oC:\Ruby${Env:ruby_version} openssl-1.0.2j-x64-windows.tar
|
24
|
+
} else {
|
25
|
+
# RubyInstaller2; openssl package seems to be installed already
|
26
|
+
$Env:openssl_dir = "C:\msys64\mingw64"
|
27
|
+
}
|
28
|
+
- bundle config --local path vendor/bundle
|
29
|
+
- bundle config build.openssl --with-openssl-dir=%openssl_dir%
|
30
|
+
- ruby -v
|
31
|
+
- bundle -v
|
32
|
+
build_script:
|
33
|
+
- bundle update
|
34
|
+
- bundle install
|
35
|
+
test_script:
|
36
|
+
- bundle exec rake --quiet
|
37
|
+
cache:
|
38
|
+
- vendor/bundle
|
data/lib/telepost.rb
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# (The MIT License)
|
4
|
+
#
|
5
|
+
# Copyright (c) 2018 Yegor Bugayenko
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
15
|
+
# copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
# SOFTWARE.
|
24
|
+
|
25
|
+
require 'telebot'
|
26
|
+
|
27
|
+
# Telepost is a simple gateway to Telegram, which can post messages and
|
28
|
+
# respond to primitive requests:
|
29
|
+
#
|
30
|
+
# require 'telepost'
|
31
|
+
# tp = Telepost.new('... secret token ...')
|
32
|
+
# tp.run do |chat, msg|
|
33
|
+
# # Reply to the message via tp.post(msg, chat)
|
34
|
+
# end
|
35
|
+
#
|
36
|
+
# For more information read
|
37
|
+
# {README}[https://github.com/yegor256/telepost/blob/master/README.md] file.
|
38
|
+
#
|
39
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
40
|
+
# Copyright:: Copyright (c) 2018 Yegor Bugayenko
|
41
|
+
# License:: MIT
|
42
|
+
class Telepost
|
43
|
+
# Fake one
|
44
|
+
class Fake
|
45
|
+
attr_reader :sent
|
46
|
+
def initialize
|
47
|
+
@sent = []
|
48
|
+
end
|
49
|
+
|
50
|
+
def run
|
51
|
+
# Nothing to do here
|
52
|
+
end
|
53
|
+
|
54
|
+
def post(*lines, chat: 0)
|
55
|
+
@sent << "#{chat}: #{lines.join(' ')}"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def initialize(token, chat: 0)
|
60
|
+
@token = token
|
61
|
+
@client = Telebot::Client.new(token)
|
62
|
+
@chat = chat
|
63
|
+
end
|
64
|
+
|
65
|
+
def run
|
66
|
+
Telebot::Bot.new(@token).run do |chat, message|
|
67
|
+
if block_given?
|
68
|
+
yield(chat, message)
|
69
|
+
else
|
70
|
+
post(
|
71
|
+
"This is your chat ID: `#{message.chat.id}`.",
|
72
|
+
chat: message.chat.id
|
73
|
+
)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def post(*lines, chat: @chat)
|
79
|
+
raise 'Default chat ID is not provided in the constuctor' if chat.zero?
|
80
|
+
@client.send_message(
|
81
|
+
chat_id: chat,
|
82
|
+
parse_mode: 'Markdown',
|
83
|
+
disable_web_page_preview: true,
|
84
|
+
text: lines.join(' ')
|
85
|
+
)
|
86
|
+
rescue Telebot::Error => e
|
87
|
+
raise "#{e.message}: \"#{msg}\""
|
88
|
+
end
|
89
|
+
end
|
data/telepost.gemspec
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# (The MIT License)
|
4
|
+
#
|
5
|
+
# Copyright (c) 2018 Yegor Bugayenko
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
15
|
+
# copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
# SOFTWARE.
|
24
|
+
|
25
|
+
require 'English'
|
26
|
+
Gem::Specification.new do |s|
|
27
|
+
s.specification_version = 2 if s.respond_to? :specification_version=
|
28
|
+
if s.respond_to? :required_rubygems_version=
|
29
|
+
s.required_rubygems_version = Gem::Requirement.new('>= 0')
|
30
|
+
end
|
31
|
+
s.rubygems_version = '2.5.1'
|
32
|
+
s.required_ruby_version = '>=2.5'
|
33
|
+
s.name = 'telepost'
|
34
|
+
s.version = '0.1.0'
|
35
|
+
s.license = 'MIT'
|
36
|
+
s.summary = 'Simple Telegram posting Ruby gem'
|
37
|
+
s.description = 'Simple Telegram posting Ruby gem'
|
38
|
+
s.authors = ['Yegor Bugayenko']
|
39
|
+
s.email = 'yegor256@gmail.com'
|
40
|
+
s.homepage = 'http://github.com/yegor256/telepost'
|
41
|
+
s.files = `git ls-files`.split($RS)
|
42
|
+
s.test_files = s.files.grep(%r{^(test)/})
|
43
|
+
s.rdoc_options = ['--charset=UTF-8']
|
44
|
+
s.extra_rdoc_files = ['README.md']
|
45
|
+
s.add_runtime_dependency 'telebot', '0.1.2'
|
46
|
+
s.add_development_dependency 'minitest', '5.11.3'
|
47
|
+
s.add_development_dependency 'rake', '12.3.1'
|
48
|
+
s.add_development_dependency 'rdoc', '4.3.0'
|
49
|
+
s.add_development_dependency 'rubocop', '0.60.0'
|
50
|
+
s.add_development_dependency 'rubocop-rspec', '1.30.1'
|
51
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# (The MIT License)
|
4
|
+
#
|
5
|
+
# Copyright (c) 2018 Yegor Bugayenko
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
15
|
+
# copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
# SOFTWARE.
|
24
|
+
|
25
|
+
require 'minitest/autorun'
|
26
|
+
require_relative '../lib/telepost'
|
27
|
+
|
28
|
+
# Telepost test.
|
29
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
30
|
+
# Copyright:: Copyright (c) 2018 Yegor Bugayenko
|
31
|
+
# License:: MIT
|
32
|
+
class TelepostTest < Minitest::Test
|
33
|
+
def test_fake_posting
|
34
|
+
tp = Telepost::Fake.new
|
35
|
+
tp.run
|
36
|
+
tp.post('This is', 'a simple', 'message')
|
37
|
+
assert_equal(1, tp.sent.count)
|
38
|
+
end
|
39
|
+
end
|
metadata
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: telepost
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yegor Bugayenko
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-12-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: telebot
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.1.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.1.2
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: minitest
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 5.11.3
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 5.11.3
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 12.3.1
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 12.3.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rdoc
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 4.3.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 4.3.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.60.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.60.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop-rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.30.1
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 1.30.1
|
97
|
+
description: Simple Telegram posting Ruby gem
|
98
|
+
email: yegor256@gmail.com
|
99
|
+
executables: []
|
100
|
+
extensions: []
|
101
|
+
extra_rdoc_files:
|
102
|
+
- README.md
|
103
|
+
files:
|
104
|
+
- ".0pdd.yml"
|
105
|
+
- ".gitignore"
|
106
|
+
- ".pdd"
|
107
|
+
- ".rubocop.yml"
|
108
|
+
- ".rultor.yml"
|
109
|
+
- ".travis.yml"
|
110
|
+
- Gemfile
|
111
|
+
- README.md
|
112
|
+
- Rakefile
|
113
|
+
- appveyor.yml
|
114
|
+
- lib/telepost.rb
|
115
|
+
- telepost.gemspec
|
116
|
+
- test/test_telepost.rb
|
117
|
+
homepage: http://github.com/yegor256/telepost
|
118
|
+
licenses:
|
119
|
+
- MIT
|
120
|
+
metadata: {}
|
121
|
+
post_install_message:
|
122
|
+
rdoc_options:
|
123
|
+
- "--charset=UTF-8"
|
124
|
+
require_paths:
|
125
|
+
- lib
|
126
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '2.5'
|
131
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - ">="
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
requirements: []
|
137
|
+
rubyforge_project:
|
138
|
+
rubygems_version: 2.7.6
|
139
|
+
signing_key:
|
140
|
+
specification_version: 2
|
141
|
+
summary: Simple Telegram posting Ruby gem
|
142
|
+
test_files:
|
143
|
+
- test/test_telepost.rb
|