telepost 0.5.0 → 0.5.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0edb0901c60fb97a116c0c8906d64533bec0d8fe2f4c1b801bcca26e877c44b
4
- data.tar.gz: b8ef137fbb03e9a3dc12373741ad12a56df81e7f139c24f8fbf1f91d5036b633
3
+ metadata.gz: c8bc330d0b778c14b69fbb23bcba9a8f63b7bed6bf05052a2e3e8faab7755958
4
+ data.tar.gz: 7acf2142a9262b5d7da2224e2e4de911274ceb979b3d0204c1960402bc69d42b
5
5
  SHA512:
6
- metadata.gz: 86784f5f376383033d1c862993ea2426780b07bfbdc402ff17d7ea56ceeac8cec63e63e7077bd32475ed2fdfb395f08329144193cfd3d895d292479e5f8e3ebc
7
- data.tar.gz: 99501c8ec53323c14a0684eff1067bd89456285aa47344974de5ab1c860044f8afdc9959464e8ff9a9f5fb30cdeddc3a61dd9a434e6df796abcc8667f328f903
6
+ metadata.gz: e03cc73adf7505c48d5613018ecf113f37b2934efe30b4a4331a809925ad4fc57b00d0f775898006188c5d8e615b9e1c636b50e3937ecca61ef2ee261a2e7e1b
7
+ data.tar.gz: 7a9ee2a7f17bff75bc64b35926e2ccf0841aacadfc1de04f19e8f5b8c697ec3f89e428757fa3b3751122d374762ffd95796b5474eb153e05ba9f6077cc695c58
data/.0pdd.yml CHANGED
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2024 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.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
22
5
  ---
23
6
  errors:
24
7
  - yegor256@gmail.com
@@ -1,23 +1,7 @@
1
- # Copyright (c) 2018-2024 Yegor Bugayenko
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the 'Software'), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in all
11
- # copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
- # SOFTWARE.
1
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Yegor Bugayenko
2
+ # SPDX-License-Identifier: MIT
20
3
  ---
4
+ # yamllint disable rule:line-length
21
5
  name: actionlint
22
6
  'on':
23
7
  push:
@@ -28,12 +12,12 @@ name: actionlint
28
12
  - master
29
13
  jobs:
30
14
  actionlint:
15
+ timeout-minutes: 15
31
16
  runs-on: ubuntu-24.04
32
17
  steps:
33
18
  - uses: actions/checkout@v4
34
19
  - name: Download actionlint
35
20
  id: get_actionlint
36
- # yamllint disable-line rule:line-length
37
21
  run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
38
22
  shell: bash
39
23
  - name: Check workflow files
@@ -1,38 +1,25 @@
1
- # Copyright (c) 2018-2024 Yegor Bugayenko
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the 'Software'), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in all
11
- # copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
- # SOFTWARE.
1
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Yegor Bugayenko
2
+ # SPDX-License-Identifier: MIT
20
3
  ---
4
+ # yamllint disable rule:line-length
21
5
  name: codecov
22
- on:
6
+ 'on':
23
7
  push:
24
8
  branches:
25
9
  - master
26
10
  jobs:
27
11
  codecov:
12
+ timeout-minutes: 15
28
13
  runs-on: ubuntu-24.04
29
14
  steps:
30
15
  - uses: actions/checkout@v4
31
16
  - uses: ruby/setup-ruby@v1
32
17
  with:
33
- ruby-version: 3.2
34
- - run: bundle update
18
+ ruby-version: 3.3
19
+ bundler-cache: true
20
+ - run: bundle config set --global path "$(pwd)/vendor/bundle"
21
+ - run: bundle install --no-color
35
22
  - run: bundle exec rake
36
- - uses: codecov/codecov-action@v4
23
+ - uses: codecov/codecov-action@v5
37
24
  with:
38
25
  token: ${{ secrets.CODECOV_TOKEN }}
@@ -1,30 +1,15 @@
1
- # Copyright (c) 2018-2024 Yegor Bugayenko
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the 'Software'), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in all
11
- # copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
- # SOFTWARE.
1
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Yegor Bugayenko
2
+ # SPDX-License-Identifier: MIT
20
3
  ---
4
+ # yamllint disable rule:line-length
21
5
  name: copyrights
22
6
  'on':
23
7
  push:
24
8
  pull_request:
25
9
  jobs:
26
10
  copyrights:
11
+ timeout-minutes: 15
27
12
  runs-on: ubuntu-24.04
28
13
  steps:
29
14
  - uses: actions/checkout@v4
30
- - uses: yegor256/copyrights-action@0.0.5
15
+ - uses: yegor256/copyrights-action@0.0.8
@@ -1,23 +1,7 @@
1
- # Copyright (c) 2018-2024 Yegor Bugayenko
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the 'Software'), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in all
11
- # copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
- # SOFTWARE.
1
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Yegor Bugayenko
2
+ # SPDX-License-Identifier: MIT
20
3
  ---
4
+ # yamllint disable rule:line-length
21
5
  name: markdown-lint
22
6
  'on':
23
7
  push:
@@ -32,6 +16,7 @@ concurrency:
32
16
  cancel-in-progress: true
33
17
  jobs:
34
18
  markdown-lint:
19
+ timeout-minutes: 15
35
20
  runs-on: ubuntu-24.04
36
21
  steps:
37
22
  - uses: actions/checkout@v4
@@ -1,25 +1,9 @@
1
- # Copyright (c) 2018-2024 Yegor Bugayenko
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the 'Software'), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in all
11
- # copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
- # SOFTWARE.
1
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Yegor Bugayenko
2
+ # SPDX-License-Identifier: MIT
20
3
  ---
4
+ # yamllint disable rule:line-length
21
5
  name: pdd
22
- on:
6
+ 'on':
23
7
  push:
24
8
  branches:
25
9
  - master
@@ -28,6 +12,7 @@ on:
28
12
  - master
29
13
  jobs:
30
14
  pdd:
15
+ timeout-minutes: 15
31
16
  runs-on: ubuntu-24.04
32
17
  steps:
33
18
  - uses: actions/checkout@v4
@@ -1,25 +1,9 @@
1
- # Copyright (c) 2018-2024 Yegor Bugayenko
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the 'Software'), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in all
11
- # copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
- # SOFTWARE.
1
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Yegor Bugayenko
2
+ # SPDX-License-Identifier: MIT
20
3
  ---
4
+ # yamllint disable rule:line-length
21
5
  name: rake
22
- on:
6
+ 'on':
23
7
  push:
24
8
  branches:
25
9
  - master
@@ -28,16 +12,17 @@ on:
28
12
  - master
29
13
  jobs:
30
14
  test:
31
- name: test
32
15
  strategy:
33
16
  matrix:
34
- os: [ubuntu-24.04, macos-12, windows-2022]
35
- ruby: [3.2, 3.3]
17
+ os: [ubuntu-24.04, macos-15, windows-2022]
18
+ ruby: [3.3]
36
19
  runs-on: ${{ matrix.os }}
37
20
  steps:
38
21
  - uses: actions/checkout@v4
39
22
  - uses: ruby/setup-ruby@v1
40
23
  with:
41
24
  ruby-version: ${{ matrix.ruby }}
42
- - run: bundle update
25
+ bundler-cache: true
26
+ - run: bundle config set --global path "$(pwd)/vendor/bundle"
27
+ - run: bundle install --no-color
43
28
  - run: bundle exec rake
@@ -0,0 +1,19 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Yegor Bugayenko
2
+ # SPDX-License-Identifier: MIT
3
+ ---
4
+ # yamllint disable rule:line-length
5
+ name: reuse
6
+ 'on':
7
+ push:
8
+ branches:
9
+ - master
10
+ pull_request:
11
+ branches:
12
+ - master
13
+ jobs:
14
+ reuse:
15
+ timeout-minutes: 15
16
+ runs-on: ubuntu-24.04
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - uses: fsfe/reuse-action@v5
@@ -0,0 +1,19 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Yegor Bugayenko
2
+ # SPDX-License-Identifier: MIT
3
+ ---
4
+ # yamllint disable rule:line-length
5
+ name: typos
6
+ 'on':
7
+ push:
8
+ branches:
9
+ - master
10
+ pull_request:
11
+ branches:
12
+ - master
13
+ jobs:
14
+ typos:
15
+ timeout-minutes: 15
16
+ runs-on: ubuntu-24.04
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - uses: crate-ci/typos@v1.32.0
@@ -1,29 +1,14 @@
1
- # Copyright (c) 2018-2024 Yegor Bugayenko
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the 'Software'), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in all
11
- # copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
- # SOFTWARE.
1
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Yegor Bugayenko
2
+ # SPDX-License-Identifier: MIT
20
3
  ---
4
+ # yamllint disable rule:line-length
21
5
  name: xcop
22
- on:
6
+ 'on':
23
7
  push:
24
8
  pull_request:
25
9
  jobs:
26
10
  xcop:
11
+ timeout-minutes: 15
27
12
  runs-on: ubuntu-24.04
28
13
  steps:
29
14
  - uses: actions/checkout@v4
@@ -0,0 +1,19 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Yegor Bugayenko
2
+ # SPDX-License-Identifier: MIT
3
+ ---
4
+ # yamllint disable rule:line-length
5
+ name: yamllint
6
+ 'on':
7
+ push:
8
+ branches:
9
+ - master
10
+ pull_request:
11
+ branches:
12
+ - master
13
+ jobs:
14
+ yamllint:
15
+ timeout-minutes: 15
16
+ runs-on: ubuntu-24.04
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - uses: ibiqlik/action-yamllint@v3
data/.gitignore CHANGED
@@ -1,7 +1,10 @@
1
- *.gem
2
1
  .bundle/
3
2
  .DS_Store
4
- rdoc/
5
3
  .idea/
6
4
  .yardoc/
7
- doc/
5
+ *.gem
6
+ coverage/
7
+ doc/
8
+ node_modules/
9
+ rdoc/
10
+ vendor/
data/.rubocop.yml CHANGED
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2024 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.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
22
5
  ---
23
6
  AllCops:
24
7
  Exclude:
@@ -30,7 +13,12 @@ AllCops:
30
13
  TargetRubyVersion: 3.2
31
14
  NewCops: enable
32
15
  SuggestExtensions: false
33
-
16
+ plugins:
17
+ - rubocop-rake
18
+ - rubocop-minitest
19
+ - rubocop-performance
20
+ Minitest/EmptyLineBeforeAssertionMethods:
21
+ Enabled: false
34
22
  Layout/EmptyLineAfterGuardClause:
35
23
  Enabled: false
36
24
  Layout/MultilineMethodCallIndentation:
data/.rultor.yml CHANGED
@@ -1,27 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2024 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.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
22
5
  ---
6
+ # yamllint disable rule:line-length
23
7
  docker:
24
- image: yegor256/rultor-ruby
8
+ image: yegor256/ruby
25
9
  assets:
26
10
  rubygems.yml: yegor256/home#assets/rubygems.yml
27
11
  install: |-
data/Gemfile CHANGED
@@ -1,31 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2024 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.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
6
  source 'https://rubygems.org'
24
7
  gemspec
25
8
 
26
- gem 'minitest', '5.25.1', require: false
27
- gem 'rake', '13.2.1', require: false
28
- gem 'rubocop', '1.66.1', require: false
29
- gem 'rubocop-rspec', '3.0.5', require: false
30
- gem 'simplecov', '0.22.0', require: false
31
- gem 'yard', '0.9.37', require: false
9
+ gem 'minitest', '~>5.25', require: false
10
+ gem 'minitest-reporters', '~>1.7', require: false
11
+ gem 'rake', '~>13.2', require: false
12
+ gem 'rubocop', '~>1.71', require: false
13
+ gem 'rubocop-minitest', '>0', require: false
14
+ gem 'rubocop-performance', '>0', require: false
15
+ gem 'rubocop-rake', '>0', require: false
16
+ gem 'simplecov', '~>0.22', require: false
17
+ gem 'simplecov-cobertura', '~>2.1', require: false
18
+ gem 'webmock', '~>3.23', require: false
19
+ gem 'yard', '~>0.9', require: false
data/Gemfile.lock CHANGED
@@ -7,73 +7,106 @@ PATH
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- ast (2.4.2)
11
- bigdecimal (3.1.8)
12
- concurrent-ruby (1.3.4)
10
+ addressable (2.8.7)
11
+ public_suffix (>= 2.0.2, < 7.0)
12
+ ansi (1.5.0)
13
+ ast (2.4.3)
14
+ bigdecimal (3.1.9)
15
+ builder (3.3.0)
16
+ concurrent-ruby (1.3.5)
17
+ crack (1.0.0)
18
+ bigdecimal
19
+ rexml
13
20
  docile (1.4.1)
14
- dry-core (1.0.1)
21
+ dry-core (1.1.0)
15
22
  concurrent-ruby (~> 1.0)
23
+ logger
16
24
  zeitwerk (~> 2.6)
17
- dry-inflector (1.1.0)
18
- dry-logic (1.5.0)
25
+ dry-inflector (1.2.0)
26
+ dry-logic (1.6.0)
27
+ bigdecimal
19
28
  concurrent-ruby (~> 1.0)
20
- dry-core (~> 1.0, < 2)
29
+ dry-core (~> 1.1)
21
30
  zeitwerk (~> 2.6)
22
- dry-struct (1.6.0)
23
- dry-core (~> 1.0, < 2)
24
- dry-types (>= 1.7, < 2)
31
+ dry-struct (1.8.0)
32
+ dry-core (~> 1.1)
33
+ dry-types (~> 1.8, >= 1.8.2)
25
34
  ice_nine (~> 0.11)
26
35
  zeitwerk (~> 2.6)
27
- dry-types (1.7.2)
36
+ dry-types (1.8.2)
28
37
  bigdecimal (~> 3.0)
29
38
  concurrent-ruby (~> 1.0)
30
39
  dry-core (~> 1.0)
31
40
  dry-inflector (~> 1.0)
32
41
  dry-logic (~> 1.4)
33
42
  zeitwerk (~> 2.6)
34
- faraday (2.12.0)
35
- faraday-net_http (>= 2.0, < 3.4)
43
+ faraday (2.13.1)
44
+ faraday-net_http (>= 2.0, < 3.5)
36
45
  json
37
46
  logger
38
- faraday-multipart (1.0.4)
39
- multipart-post (~> 2)
40
- faraday-net_http (3.3.0)
41
- net-http
47
+ faraday-multipart (1.1.0)
48
+ multipart-post (~> 2.0)
49
+ faraday-net_http (3.4.0)
50
+ net-http (>= 0.5.0)
51
+ hashdiff (1.1.2)
42
52
  ice_nine (0.11.2)
43
- json (2.7.2)
44
- language_server-protocol (3.17.0.3)
45
- logger (1.6.1)
46
- minitest (5.25.1)
53
+ json (2.11.3)
54
+ language_server-protocol (3.17.0.4)
55
+ lint_roller (1.1.0)
56
+ logger (1.7.0)
57
+ minitest (5.25.5)
58
+ minitest-reporters (1.7.1)
59
+ ansi
60
+ builder
61
+ minitest (>= 5.0)
62
+ ruby-progressbar
47
63
  multipart-post (2.4.1)
48
- net-http (0.4.1)
64
+ net-http (0.6.0)
49
65
  uri
50
- parallel (1.26.3)
51
- parser (3.3.5.0)
66
+ parallel (1.27.0)
67
+ parser (3.3.8.0)
52
68
  ast (~> 2.4.1)
53
69
  racc
70
+ prism (1.4.0)
71
+ public_suffix (6.0.2)
54
72
  racc (1.8.1)
55
73
  rainbow (3.1.1)
56
74
  rake (13.2.1)
57
- regexp_parser (2.9.2)
58
- rubocop (1.66.1)
75
+ regexp_parser (2.10.0)
76
+ rexml (3.4.1)
77
+ rubocop (1.75.5)
59
78
  json (~> 2.3)
60
- language_server-protocol (>= 3.17.0)
79
+ language_server-protocol (~> 3.17.0.2)
80
+ lint_roller (~> 1.1.0)
61
81
  parallel (~> 1.10)
62
82
  parser (>= 3.3.0.2)
63
83
  rainbow (>= 2.2.2, < 4.0)
64
- regexp_parser (>= 2.4, < 3.0)
65
- rubocop-ast (>= 1.32.2, < 2.0)
84
+ regexp_parser (>= 2.9.3, < 3.0)
85
+ rubocop-ast (>= 1.44.0, < 2.0)
66
86
  ruby-progressbar (~> 1.7)
67
- unicode-display_width (>= 2.4.0, < 3.0)
68
- rubocop-ast (1.32.3)
69
- parser (>= 3.3.1.0)
70
- rubocop-rspec (3.0.5)
71
- rubocop (~> 1.61)
87
+ unicode-display_width (>= 2.4.0, < 4.0)
88
+ rubocop-ast (1.44.1)
89
+ parser (>= 3.3.7.2)
90
+ prism (~> 1.4)
91
+ rubocop-minitest (0.38.0)
92
+ lint_roller (~> 1.1)
93
+ rubocop (>= 1.75.0, < 2.0)
94
+ rubocop-ast (>= 1.38.0, < 2.0)
95
+ rubocop-performance (1.25.0)
96
+ lint_roller (~> 1.1)
97
+ rubocop (>= 1.75.0, < 2.0)
98
+ rubocop-ast (>= 1.38.0, < 2.0)
99
+ rubocop-rake (0.7.1)
100
+ lint_roller (~> 1.1)
101
+ rubocop (>= 1.72.1)
72
102
  ruby-progressbar (1.13.0)
73
103
  simplecov (0.22.0)
74
104
  docile (~> 1.1)
75
105
  simplecov-html (~> 0.11)
76
106
  simplecov_json_formatter (~> 0.1)
107
+ simplecov-cobertura (2.1.0)
108
+ rexml
109
+ simplecov (~> 0.19)
77
110
  simplecov-html (0.13.1)
78
111
  simplecov_json_formatter (0.1.4)
79
112
  telegram-bot-ruby (1.0.0)
@@ -81,23 +114,37 @@ GEM
81
114
  faraday (~> 2.0)
82
115
  faraday-multipart (~> 1.0)
83
116
  zeitwerk (~> 2.6)
84
- unicode-display_width (2.6.0)
85
- uri (0.13.1)
117
+ unicode-display_width (3.1.4)
118
+ unicode-emoji (~> 4.0, >= 4.0.4)
119
+ unicode-emoji (4.0.4)
120
+ uri (1.0.3)
121
+ webmock (3.25.1)
122
+ addressable (>= 2.8.0)
123
+ crack (>= 0.3.2)
124
+ hashdiff (>= 0.4.0, < 2.0.0)
86
125
  yard (0.9.37)
87
- zeitwerk (2.6.18)
126
+ zeitwerk (2.7.2)
88
127
 
89
128
  PLATFORMS
90
129
  arm64-darwin-22
130
+ arm64-darwin-23
91
131
  ruby
132
+ x64-mingw-ucrt
133
+ x86_64-linux
92
134
 
93
135
  DEPENDENCIES
94
- minitest (= 5.25.1)
95
- rake (= 13.2.1)
96
- rubocop (= 1.66.1)
97
- rubocop-rspec (= 3.0.5)
98
- simplecov (= 0.22.0)
136
+ minitest (~> 5.25)
137
+ minitest-reporters (~> 1.7)
138
+ rake (~> 13.2)
139
+ rubocop (~> 1.71)
140
+ rubocop-minitest (> 0)
141
+ rubocop-performance (> 0)
142
+ rubocop-rake (> 0)
143
+ simplecov (~> 0.22)
144
+ simplecov-cobertura (~> 2.1)
99
145
  telepost!
100
- yard (= 0.9.37)
146
+ webmock (~> 3.23)
147
+ yard (~> 0.9)
101
148
 
102
149
  BUNDLED WITH
103
- 2.5.18
150
+ 2.5.16
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2018-2024 Yegor Bugayenko
3
+ Copyright (c) 2018-2025 Yegor Bugayenko
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/LICENSES/MIT.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018-2025 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
13
+ in all 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 NON-INFRINGEMENT. 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.
data/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
  # Ruby Telegram Client
2
2
 
3
3
  [![EO principles respected here](https://www.elegantobjects.org/badge.svg)](https://www.elegantobjects.org)
4
- [![DevOps By Rultor.com](http://www.rultor.com/b/yegor256/telepost)](http://www.rultor.com/p/yegor256/telepost)
4
+ [![DevOps By Rultor.com](https://www.rultor.com/b/yegor256/telepost)](https://www.rultor.com/p/yegor256/telepost)
5
5
  [![We recommend RubyMine](https://www.elegantobjects.org/rubymine.svg)](https://www.jetbrains.com/ruby/)
6
6
 
7
7
  [![rake](https://github.com/yegor256/telepost/actions/workflows/rake.yml/badge.svg)](https://github.com/yegor256/telepost/actions/workflows/rake.yml)
8
- [![Gem Version](https://badge.fury.io/rb/telepost.svg)](http://badge.fury.io/rb/telepost)
8
+ [![Gem Version](https://badge.fury.io/rb/telepost.svg)](https://badge.fury.io/rb/telepost)
9
9
  [![Maintainability](https://api.codeclimate.com/v1/badges/21aec58faee3866bdfbb/maintainability)](https://codeclimate.com/github/yegor256/telepost/maintainability)
10
- [![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://rubydoc.info/github/yegor256/telepost/master/frames)
10
+ [![Yard Docs](https://img.shields.io/badge/yard-docs-blue.svg)](https://rubydoc.info/github/yegor256/telepost/master/frames)
11
11
  [![Hits-of-Code](https://hitsofcode.com/github/yegor256/telepost)](https://hitsofcode.com/view/github/yegor256/telepost)
12
12
 
13
13
  Telepost is a simple gateway to Telegram, which can post messages
@@ -42,7 +42,7 @@ Your bot has to be an admin of the channel, in order to post there.
42
42
  Here is how you "spam":
43
43
 
44
44
  ```ruby
45
- tp = Telepost.new('..token..', chats: ['my_channel'])
45
+ tp = Telepost.new('..token..', chats: [12345])
46
46
  tp.spam('How are you?')
47
47
  ```
48
48
 
@@ -52,9 +52,9 @@ That's it.
52
52
 
53
53
  Read
54
54
  [these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).
55
- Make sure you build is green before you contribute
55
+ Make sure your build is green before you contribute
56
56
  your pull request. You will need to have
57
- [Ruby](https://www.ruby-lang.org/en/) 2.3+ and
57
+ [Ruby](https://www.ruby-lang.org/en/) 3.2+ and
58
58
  [Bundler](https://bundler.io/) installed. Then:
59
59
 
60
60
  ```bash
data/REUSE.toml ADDED
@@ -0,0 +1,35 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2025 Yegor Bugayenko
2
+ # SPDX-License-Identifier: MIT
3
+
4
+ version = 1
5
+ [[annotations]]
6
+ path = [
7
+ ".DS_Store",
8
+ ".gitattributes",
9
+ ".gitignore",
10
+ ".pdd",
11
+ "**.json",
12
+ "**.md",
13
+ "**.svg",
14
+ "**.txt",
15
+ "**/.DS_Store",
16
+ "**/.gitignore",
17
+ "**/.pdd",
18
+ "**/*.csv",
19
+ "**/*.jpg",
20
+ "**/*.json",
21
+ "**/*.md",
22
+ "**/*.pdf",
23
+ "**/*.png",
24
+ "**/*.svg",
25
+ "**/*.txt",
26
+ "**/*.vm",
27
+ "**/CNAME",
28
+ "**/Gemfile.lock",
29
+ "Gemfile.lock",
30
+ "README.md",
31
+ "renovate.json",
32
+ ]
33
+ precedence = "override"
34
+ SPDX-FileCopyrightText = "Copyright (c) 2025 Yegor Bugayenko"
35
+ SPDX-License-Identifier = "MIT"
data/Rakefile CHANGED
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2024 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.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
22
5
 
23
6
  require 'rubygems'
24
7
  require 'rake'
@@ -48,7 +31,6 @@ require 'rubocop/rake_task'
48
31
  desc 'Run RuboCop on all directories'
49
32
  RuboCop::RakeTask.new(:rubocop) do |task|
50
33
  task.fail_on_error = true
51
- task.requires << 'rubocop-rspec'
52
34
  end
53
35
 
54
36
  require 'yard'
data/lib/telepost.rb CHANGED
@@ -1,26 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # (The MIT License)
4
- #
5
- # Copyright (c) 2018-2024 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.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
24
5
 
25
6
  require 'telegram/bot'
26
7
 
@@ -37,10 +18,12 @@ require 'telegram/bot'
37
18
  # {README}[https://github.com/yegor256/telepost/blob/master/README.md] file.
38
19
  #
39
20
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
40
- # Copyright:: Copyright (c) 2018-2024 Yegor Bugayenko
21
+ # Copyright:: Copyright (c) 2018-2025 Yegor Bugayenko
41
22
  # License:: MIT
42
23
  class Telepost
43
- # Fake one
24
+ # Fake implementation for testing
25
+ #
26
+ # @note Use this class for testing purposes
44
27
  class Fake
45
28
  attr_reader :sent
46
29
 
@@ -62,13 +45,20 @@ class Telepost
62
45
  end
63
46
 
64
47
  # When can't post a message
48
+ #
49
+ # @note Raised when message posting fails
65
50
  class CantPost < StandardError; end
66
51
 
67
52
  # To make it possible to get the client.
53
+ #
54
+ # @return [Telegram::Bot::Client] The Telegram bot client
68
55
  attr_reader :client
69
56
 
70
57
  # Makes a new object. To obtain a token you should talk
71
58
  # to the @BotFather in Telegram.
59
+ #
60
+ # @param token [String] Telegram bot token
61
+ # @param chats [Array<Integer>] Optional list of chat IDs
72
62
  def initialize(token, chats: [])
73
63
  @token = token
74
64
  @chats = chats
@@ -77,10 +67,14 @@ class Telepost
77
67
 
78
68
  # You can run a chat bot to listen to the messages coming to it, in
79
69
  # a separate thread.
70
+ #
71
+ # @yield [Integer, String] Yields chat ID and message text
72
+ # @return [void]
73
+ # @raise [RuntimeError] If no block is given
80
74
  def run
81
75
  raise 'Block must be given' unless block_given?
82
76
  @bot.listen do |message|
83
- yield(message.chat.id, message.text)
77
+ yield(message.chat.id, message.respond_to?(:text) ? message.text : '')
84
78
  end
85
79
  rescue Net::OpenTimeout
86
80
  retry
@@ -89,19 +83,26 @@ class Telepost
89
83
  # Send the message (lines will be concatenated with a space
90
84
  # between them) to the chats provided in the constructor
91
85
  # and encapsulated.
86
+ #
87
+ # @param lines [Array<String>] Message lines to send
88
+ # @return [void]
92
89
  def spam(*lines)
93
90
  @chats.each do |chat|
94
- post(chat, lines)
91
+ post(chat, *lines)
95
92
  end
96
93
  end
97
94
 
98
95
  # Post a single message to the designated chat room. The
99
- # chat argument can either me an integer, if you know the
96
+ # chat argument can either be an integer, if you know the
100
97
  # chat ID, or the name of the channel (your bot has to
101
98
  # be the admin there). The lines provided will be
102
99
  # concatenated with a space between them.
100
+ #
101
+ # @param chat [Integer, String] Chat ID or channel name
102
+ # @param lines [Array<String>] Message lines to send
103
+ # @return [Telegram::Bot::Types::Message] The sent message object
103
104
  def post(chat, *lines)
104
- @bot.send_message(
105
+ @bot.api.send_message(
105
106
  chat_id: chat,
106
107
  parse_mode: 'Markdown',
107
108
  disable_web_page_preview: true,
data/logo.svg CHANGED
@@ -16,4 +16,4 @@
16
16
  </g>
17
17
  </g>
18
18
  </g>
19
- </svg>
19
+ </svg>
data/telepost.gemspec CHANGED
@@ -1,26 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # (The MIT License)
4
- #
5
- # Copyright (c) 2018-2024 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.
3
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
24
5
 
25
6
  require 'English'
26
7
 
@@ -28,13 +9,13 @@ Gem::Specification.new do |s|
28
9
  s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
29
10
  s.required_ruby_version = '>=3.2'
30
11
  s.name = 'telepost'
31
- s.version = '0.5.0'
12
+ s.version = '0.5.2'
32
13
  s.license = 'MIT'
33
14
  s.summary = 'Simple Telegram posting Ruby gem'
34
15
  s.description = 'Simple Telegram posting Ruby gem'
35
16
  s.authors = ['Yegor Bugayenko']
36
17
  s.email = 'yegor256@gmail.com'
37
- s.homepage = 'http://github.com/yegor256/telepost'
18
+ s.homepage = 'https://github.com/yegor256/telepost'
38
19
  s.files = `git ls-files`.split($RS)
39
20
  s.rdoc_options = ['--charset=UTF-8']
40
21
  s.extra_rdoc_files = ['README.md']
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
5
+
6
+ $stdout.sync = true
7
+
8
+ require 'simplecov'
9
+ require 'simplecov-cobertura'
10
+ unless SimpleCov.running || ENV['PICKS']
11
+ SimpleCov.command_name('test')
12
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
13
+ [
14
+ SimpleCov::Formatter::HTMLFormatter,
15
+ SimpleCov::Formatter::CoberturaFormatter
16
+ ]
17
+ )
18
+ SimpleCov.minimum_coverage 85
19
+ SimpleCov.minimum_coverage_by_file 85
20
+ SimpleCov.start do
21
+ add_filter 'test/'
22
+ add_filter 'vendor/'
23
+ add_filter 'target/'
24
+ track_files 'lib/**/*.rb'
25
+ track_files '*.rb'
26
+ end
27
+ end
28
+
29
+ require 'minitest/autorun'
30
+ require 'minitest/reporters'
31
+ Minitest::Reporters.use! [Minitest::Reporters::SpecReporter.new]
32
+
33
+ require 'webmock/minitest'
@@ -1,48 +1,67 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # (The MIT License)
4
- #
5
- # Copyright (c) 2018-2024 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'
3
+ # SPDX-FileCopyrightText: Copyright (c) 2018-2025 Yegor Bugayenko
4
+ # SPDX-License-Identifier: MIT
5
+
6
+ require 'yaml'
7
+ require_relative 'test__helper'
26
8
  require_relative '../lib/telepost'
27
9
 
28
10
  # Telepost test.
29
11
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
30
- # Copyright:: Copyright (c) 2018-2024 Yegor Bugayenko
12
+ # Copyright:: Copyright (c) 2018-2025 Yegor Bugayenko
31
13
  # License:: MIT
32
14
  class TelepostTest < Minitest::Test
33
15
  def test_fake_posting
34
16
  tp = Telepost::Fake.new
35
17
  tp.run
36
- tp.post('This is', 'a simple', 'message')
18
+ tp.post(123, 'This is', 'a simple', 'message')
37
19
  assert_equal(1, tp.sent.count)
38
20
  end
39
21
 
22
+ def test_fake_spam
23
+ tp = Telepost::Fake.new
24
+ tp.spam('how are you all?')
25
+ end
26
+
27
+ def test_sends_single_message
28
+ WebMock.disable_net_connect!
29
+ stub_request(:post, 'https://api.telegram.org/botfoo/sendMessage').to_return(body: '{}')
30
+ tp = Telepost.new('foo')
31
+ tp.post(42, 'hello!')
32
+ end
33
+
34
+ def test_sends_simple_spam
35
+ WebMock.disable_net_connect!
36
+ stub_request(:post, 'https://api.telegram.org/bottoken/sendMessage').to_return(body: '{}')
37
+ tp = Telepost.new('token', chats: [42])
38
+ tp.spam('hey!')
39
+ end
40
+
41
+ def test_listens
42
+ WebMock.disable_net_connect!
43
+ stub_request(:post, 'https://api.telegram.org/botxx/getUpdates')
44
+ .to_return(status: 200, body: '{}')
45
+ tp = Telepost.new('xx')
46
+ t =
47
+ Thread.new do
48
+ tp.run do |chat, msg|
49
+ # we'll never reach this point
50
+ end
51
+ end
52
+ t.terminate
53
+ t.join
54
+ end
55
+
40
56
  def test_real_posting
41
- skip
57
+ WebMock.enable_net_connect!
58
+ cfg = '/code/home/assets/zerocracy/baza.yml'
59
+ skip unless File.exist?(cfg)
60
+ yaml = YAML.safe_load_file(cfg)
42
61
  tp = Telepost.new(
43
- '1088589765:...',
44
- chats: [-1_001_438_256_738] # codexia channel
62
+ yaml['tg']['token'],
63
+ chats: [yaml['tg']['admin_chat'].to_i]
45
64
  )
46
- tp.spam('This is just a test message')
65
+ tp.spam('This is just a test message from telepost test')
47
66
  end
48
67
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: telepost
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-09-26 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: telegram-bot-ruby
@@ -38,7 +37,10 @@ files:
38
37
  - ".github/workflows/markdown-lint.yml"
39
38
  - ".github/workflows/pdd.yml"
40
39
  - ".github/workflows/rake.yml"
40
+ - ".github/workflows/reuse.yml"
41
+ - ".github/workflows/typos.yml"
41
42
  - ".github/workflows/xcop.yml"
43
+ - ".github/workflows/yamllint.yml"
42
44
  - ".gitignore"
43
45
  - ".pdd"
44
46
  - ".rubocop.yml"
@@ -46,19 +48,21 @@ files:
46
48
  - Gemfile
47
49
  - Gemfile.lock
48
50
  - LICENSE.txt
51
+ - LICENSES/MIT.txt
49
52
  - README.md
53
+ - REUSE.toml
50
54
  - Rakefile
51
55
  - lib/telepost.rb
52
56
  - logo.svg
53
57
  - renovate.json
54
58
  - telepost.gemspec
59
+ - test/test__helper.rb
55
60
  - test/test_telepost.rb
56
- homepage: http://github.com/yegor256/telepost
61
+ homepage: https://github.com/yegor256/telepost
57
62
  licenses:
58
63
  - MIT
59
64
  metadata:
60
65
  rubygems_mfa_required: 'true'
61
- post_install_message:
62
66
  rdoc_options:
63
67
  - "--charset=UTF-8"
64
68
  require_paths:
@@ -74,8 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
78
  - !ruby/object:Gem::Version
75
79
  version: '0'
76
80
  requirements: []
77
- rubygems_version: 3.4.10
78
- signing_key:
81
+ rubygems_version: 3.6.7
79
82
  specification_version: 4
80
83
  summary: Simple Telegram posting Ruby gem
81
84
  test_files: []