netbout 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.0pdd.yml +5 -0
- data/.gitattributes +7 -0
- data/.github/workflows/codecov.yml +21 -0
- data/.github/workflows/pdd.yml +15 -0
- data/.github/workflows/rake.yml +24 -0
- data/.github/workflows/xcop.yml +11 -0
- data/.gitignore +7 -0
- data/.pdd +7 -0
- data/.rubocop.yml +27 -0
- data/.rultor.yml +22 -0
- data/.simplecov +41 -0
- data/Gemfile +34 -0
- data/LICENSE.txt +21 -0
- data/README.md +28 -0
- data/Rakefile +71 -0
- data/lib/netbout/bout.rb +65 -0
- data/lib/netbout/http.rb +90 -0
- data/lib/netbout/inbox.rb +55 -0
- data/lib/netbout/message.rb +54 -0
- data/lib/netbout/search.rb +45 -0
- data/lib/netbout/tags.rb +40 -0
- data/lib/netbout/version.rb +30 -0
- data/lib/netbout.rb +30 -0
- data/netbout.gemspec +51 -0
- data/renovate.json +6 -0
- data/test/netbout/test_bout.rb +39 -0
- data/test/test__helper.rb +30 -0
- data/test/test_netbout.rb +35 -0
- metadata +158 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '0609a1212f6f2413d82f2883a236429d21b9d293b8959a8662323ec3fc8f03dd'
|
4
|
+
data.tar.gz: 2a714d3a6e2bb2b09adf7c2e341e882330a03314bdb9db96d772082aa0eb5517
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0e8d57eba1b82394e14bae90fd932b8c9880a8cbf75babeae84b114436c425e645d4ba1d751360269f1a6be2a7756458ac15020217acd02dc5324e4fca5404d8
|
7
|
+
data.tar.gz: e938723b00fe40245d66f647854c94d1bea9148c5d7843de09508bcd0e5f1e1d43ec2141c08c65f44b7c14349f030db90bccab76d62111d0af9bab73650b392d
|
data/.0pdd.yml
ADDED
data/.gitattributes
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
---
|
2
|
+
name: codecov
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
jobs:
|
8
|
+
codecov:
|
9
|
+
runs-on: ubuntu-22.04
|
10
|
+
steps:
|
11
|
+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
|
12
|
+
- uses: ruby/setup-ruby@v1
|
13
|
+
with:
|
14
|
+
ruby-version: 2.7
|
15
|
+
- run: bundle update
|
16
|
+
- run: bundle exec rake
|
17
|
+
- uses: codecov/codecov-action@v4.0.0-beta.3
|
18
|
+
with:
|
19
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
20
|
+
file: coverage/.resultset.json
|
21
|
+
fail_ci_if_error: true
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
name: rake
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
pull_request:
|
8
|
+
branches:
|
9
|
+
- master
|
10
|
+
jobs:
|
11
|
+
rake:
|
12
|
+
name: test
|
13
|
+
strategy:
|
14
|
+
matrix:
|
15
|
+
os: [ubuntu-20.04, macos-12]
|
16
|
+
ruby: [2.7, 3.2]
|
17
|
+
runs-on: ${{ matrix.os }}
|
18
|
+
steps:
|
19
|
+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
|
20
|
+
- uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: ${{ matrix.ruby }}
|
23
|
+
- run: bundle update
|
24
|
+
- run: bundle exec rake
|
data/.gitignore
ADDED
data/.pdd
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
3
|
+
- 'bin/**/*'
|
4
|
+
- 'assets/**/*'
|
5
|
+
DisplayCopNames: true
|
6
|
+
TargetRubyVersion: 2.3
|
7
|
+
SuggestExtensions: false
|
8
|
+
NewCops: enable
|
9
|
+
|
10
|
+
Gemspec/RequiredRubyVersion:
|
11
|
+
Enabled: false
|
12
|
+
Metrics/MethodLength:
|
13
|
+
Enabled: false
|
14
|
+
Style/ClassAndModuleChildren:
|
15
|
+
Enabled: false
|
16
|
+
Layout/MultilineMethodCallIndentation:
|
17
|
+
Enabled: false
|
18
|
+
Metrics/AbcSize:
|
19
|
+
Enabled: false
|
20
|
+
Metrics/BlockLength:
|
21
|
+
Max: 30
|
22
|
+
Metrics/CyclomaticComplexity:
|
23
|
+
Max: 20
|
24
|
+
Metrics/PerceivedComplexity:
|
25
|
+
Max: 20
|
26
|
+
Layout/EmptyLineAfterGuardClause:
|
27
|
+
Enabled: false
|
data/.rultor.yml
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
docker:
|
2
|
+
image: yegor256/rultor-image:1.22.0
|
3
|
+
assets:
|
4
|
+
rubygems.yml: yegor256/home#assets/rubygems.yml
|
5
|
+
install: |
|
6
|
+
pdd -f /dev/null
|
7
|
+
bundle install --no-color
|
8
|
+
release:
|
9
|
+
pre: false
|
10
|
+
script: |-
|
11
|
+
[[ "${tag}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || exit -1
|
12
|
+
bundle exec rake
|
13
|
+
rm -rf *.gem
|
14
|
+
sed -i "s/0\.0\.0/${tag}/g" lib/netbout/version.rb
|
15
|
+
git add lib/netbout/version.rb
|
16
|
+
git commit -m "version set to ${tag}"
|
17
|
+
gem build netbout.gemspec
|
18
|
+
chmod 0600 ../rubygems.yml
|
19
|
+
gem push *.gem --config-file ../rubygems.yml
|
20
|
+
merge:
|
21
|
+
script: |-
|
22
|
+
bundle exec rake
|
data/.simplecov
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#
|
4
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
|
24
|
+
if Gem.win_platform?
|
25
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
26
|
+
SimpleCov::Formatter::HTMLFormatter
|
27
|
+
]
|
28
|
+
SimpleCov.start do
|
29
|
+
add_filter '/test/'
|
30
|
+
add_filter '/features/'
|
31
|
+
end
|
32
|
+
else
|
33
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
|
34
|
+
[SimpleCov::Formatter::HTMLFormatter]
|
35
|
+
)
|
36
|
+
SimpleCov.start do
|
37
|
+
add_filter '/test/'
|
38
|
+
add_filter '/features/'
|
39
|
+
minimum_coverage 20
|
40
|
+
end
|
41
|
+
end
|
data/Gemfile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#
|
4
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
|
24
|
+
source 'https://rubygems.org'
|
25
|
+
gemspec
|
26
|
+
|
27
|
+
gem 'minitest', '5.21.2', require: false
|
28
|
+
gem 'rake', '13.1.0', require: false
|
29
|
+
gem 'rdoc', '6.6.2', require: false
|
30
|
+
gem 'rspec-rails', '6.1.1', require: false
|
31
|
+
gem 'rubocop', '1.60.2', require: false
|
32
|
+
gem 'rubocop-rspec', '2.26.1', require: false
|
33
|
+
gem 'simplecov', '0.22.0', require: false
|
34
|
+
gem 'webmock', '3.19.1', require: false
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
(The MIT License)
|
2
|
+
|
3
|
+
Copyright (c) 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.
|
data/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
<img src="https://github.com/yegor256/netbout/raw/master/public/logo.svg" width="132px"/>
|
2
|
+
|
3
|
+
[![DevOps By Rultor.com](http://www.rultor.com/b/yegor256/netbout)](http://www.rultor.com/p/yegor256/netbout)
|
4
|
+
[![We recommend RubyMine](https://www.elegantobjects.org/rubymine.svg)](https://www.jetbrains.com/ruby/)
|
5
|
+
|
6
|
+
[![rake](https://github.com/yegor256/netbout/actions/workflows/rake.yml/badge.svg)](https://github.com/yegor256/netbout/actions/workflows/rake.yml)
|
7
|
+
[![PDD status](http://www.0pdd.com/svg?name=yegor256/netbout)](http://www.0pdd.com/p?name=yegor256/netbout)
|
8
|
+
[![Gem Version](https://badge.fury.io/rb/netbout.svg)](http://badge.fury.io/rb/netbout)
|
9
|
+
[![Test Coverage](https://img.shields.io/codecov/c/github/yegor256/netbout.svg)](https://codecov.io/github/yegor256/netbout?branch=master)
|
10
|
+
[![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://rubydoc.info/github/yegor256/netbout/master/frames)
|
11
|
+
[![Hits-of-Code](https://hitsofcode.com/github/yegor256/netbout)](https://hitsofcode.com/view/github/yegor256/netbout)
|
12
|
+
[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/yegor256/netbout/blob/master/LICENSE.txt)
|
13
|
+
|
14
|
+
This Ruby gem connects you to [Netbout](https://netbout.com).
|
15
|
+
|
16
|
+
## How to contribute
|
17
|
+
|
18
|
+
Read [these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).
|
19
|
+
Make sure you build is green before you contribute
|
20
|
+
your pull request. You will need to have [Ruby](https://www.ruby-lang.org/en/) 2.3+ and
|
21
|
+
[Bundler](https://bundler.io/) installed. Then:
|
22
|
+
|
23
|
+
```
|
24
|
+
$ bundle update
|
25
|
+
$ bundle exec rake
|
26
|
+
```
|
27
|
+
|
28
|
+
If it's clean and you don't see any error messages, submit your pull request.
|
data/Rakefile
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#
|
4
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
|
24
|
+
require 'rubygems'
|
25
|
+
require 'rake'
|
26
|
+
require 'rdoc'
|
27
|
+
require 'rake/clean'
|
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 copyright]
|
38
|
+
|
39
|
+
require 'rake/testtask'
|
40
|
+
desc 'Run all unit tests'
|
41
|
+
Rake::TestTask.new(:test) do |test|
|
42
|
+
Rake::Cleaner.cleanup_files(['coverage'])
|
43
|
+
test.libs << 'lib' << 'test'
|
44
|
+
test.pattern = 'test/**/test_*.rb'
|
45
|
+
test.warning = true
|
46
|
+
test.verbose = false
|
47
|
+
end
|
48
|
+
|
49
|
+
require 'rdoc/task'
|
50
|
+
desc 'Build RDoc documentation'
|
51
|
+
Rake::RDocTask.new do |rdoc|
|
52
|
+
rdoc.rdoc_dir = 'rdoc'
|
53
|
+
rdoc.title = "#{name} #{version}"
|
54
|
+
rdoc.rdoc_files.include('README*')
|
55
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
56
|
+
end
|
57
|
+
|
58
|
+
require 'rubocop/rake_task'
|
59
|
+
desc 'Run RuboCop on all directories'
|
60
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
61
|
+
task.fail_on_error = true
|
62
|
+
task.requires << 'rubocop-rspec'
|
63
|
+
end
|
64
|
+
|
65
|
+
task :copyright do
|
66
|
+
sh "grep -q -r '#{Date.today.strftime('%Y')}' \
|
67
|
+
--include '*.rb' \
|
68
|
+
--include '*.txt' \
|
69
|
+
--include 'Rakefile' \
|
70
|
+
."
|
71
|
+
end
|
data/lib/netbout/bout.rb
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#
|
4
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
|
24
|
+
require_relative 'message'
|
25
|
+
require_relative 'http'
|
26
|
+
require_relative 'tags'
|
27
|
+
|
28
|
+
# Bout.
|
29
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
30
|
+
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
31
|
+
# License:: MIT
|
32
|
+
class Netbout::Bout
|
33
|
+
def initialize(iri, token, json)
|
34
|
+
@iri = iri
|
35
|
+
@token = token
|
36
|
+
@json = json
|
37
|
+
end
|
38
|
+
|
39
|
+
def id
|
40
|
+
@json['id']
|
41
|
+
end
|
42
|
+
|
43
|
+
def title
|
44
|
+
@json['title']
|
45
|
+
end
|
46
|
+
|
47
|
+
def owner
|
48
|
+
@json['owner']
|
49
|
+
end
|
50
|
+
|
51
|
+
def post(text)
|
52
|
+
rsp = Netbout::Http.new(@iri.append('/b').append(id).append('/post'), @token).post('text' => text)
|
53
|
+
id = rsp.headers['X-Netbout-Message'].to_i
|
54
|
+
take(id)
|
55
|
+
end
|
56
|
+
|
57
|
+
def take(id)
|
58
|
+
rsp = Netbout::Http.new(@iri.append('/message').append(id), @token).get
|
59
|
+
Netbout::Message.new(@iri, @token, JSON.parse(rsp.response_body))
|
60
|
+
end
|
61
|
+
|
62
|
+
def tags
|
63
|
+
Netbout::Tags.new(@token, self)
|
64
|
+
end
|
65
|
+
end
|
data/lib/netbout/http.rb
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#
|
4
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
|
24
|
+
require 'iri'
|
25
|
+
require 'backtrace'
|
26
|
+
require 'typhoeus'
|
27
|
+
require_relative 'version'
|
28
|
+
|
29
|
+
# HTTP.
|
30
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
31
|
+
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
32
|
+
# License:: MIT
|
33
|
+
module Netbout
|
34
|
+
# Http page
|
35
|
+
class Http
|
36
|
+
# Connect timeout in seconds
|
37
|
+
CONNECT_TIMEOUT = 0.8
|
38
|
+
private_constant :CONNECT_TIMEOUT
|
39
|
+
|
40
|
+
def initialize(iri, token)
|
41
|
+
@iri = iri
|
42
|
+
@token = token
|
43
|
+
end
|
44
|
+
|
45
|
+
def get
|
46
|
+
checked(
|
47
|
+
Typhoeus::Request.get(
|
48
|
+
@iri.to_s,
|
49
|
+
accept_encoding: 'gzip',
|
50
|
+
headers: headers,
|
51
|
+
connecttimeout: CONNECT_TIMEOUT,
|
52
|
+
timeout: CONNECT_TIMEOUT
|
53
|
+
)
|
54
|
+
)
|
55
|
+
end
|
56
|
+
|
57
|
+
def post(hash)
|
58
|
+
checked(
|
59
|
+
Typhoeus::Request.post(
|
60
|
+
@iri.to_s,
|
61
|
+
accept_encoding: 'gzip',
|
62
|
+
body: hash.map { |k, v| "#{k}=#{CGI.escape(v)}" }.join('&'),
|
63
|
+
headers: headers.merge(
|
64
|
+
'Content-Type': 'application/x-www-form-urlencoded'
|
65
|
+
),
|
66
|
+
connecttimeout: CONNECT_TIMEOUT,
|
67
|
+
timeout: CONNECT_TIMEOUT
|
68
|
+
)
|
69
|
+
)
|
70
|
+
end
|
71
|
+
|
72
|
+
private
|
73
|
+
|
74
|
+
def checked(rsp)
|
75
|
+
code = rsp.response_code.to_i
|
76
|
+
raise "Invalid response #{code}: '#{rsp.headers['x-netbout-flash']}'" if code != 200 && code != 303
|
77
|
+
rsp
|
78
|
+
end
|
79
|
+
|
80
|
+
def headers
|
81
|
+
{
|
82
|
+
Connection: 'close',
|
83
|
+
'X-Netbout-Token': @token,
|
84
|
+
'User-Agent': "Netbout.rb #{Netbout::VERSION}",
|
85
|
+
'Accept-Encoding': 'gzip',
|
86
|
+
'X-Netbout-Version': Netbout::VERSION
|
87
|
+
}
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#
|
4
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
|
24
|
+
require 'iri'
|
25
|
+
require 'json'
|
26
|
+
require_relative 'http'
|
27
|
+
require_relative 'bout'
|
28
|
+
require_relative 'search'
|
29
|
+
|
30
|
+
# Inbox.
|
31
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
32
|
+
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
33
|
+
# License:: MIT
|
34
|
+
class Netbout::Inbox
|
35
|
+
def initialize(token)
|
36
|
+
require_relative 'http'
|
37
|
+
@token = token
|
38
|
+
@iri = Iri.new('https://netbout.com')
|
39
|
+
end
|
40
|
+
|
41
|
+
def search(query = '')
|
42
|
+
Netbout::Search.new(@iri, @token, query)
|
43
|
+
end
|
44
|
+
|
45
|
+
def start(title)
|
46
|
+
rsp = Netbout::Http.new(@iri.append('/start'), @token).post('title' => title)
|
47
|
+
id = rsp.headers['X-Netbout-Bout'].to_i
|
48
|
+
take(id)
|
49
|
+
end
|
50
|
+
|
51
|
+
def take(id)
|
52
|
+
rsp = Netbout::Http.new(@iri.append('/bout').append(id), @token).get
|
53
|
+
Netbout::Bout.new(@iri, @token, JSON.parse(rsp.response_body))
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#
|
4
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
|
24
|
+
# Message.
|
25
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
26
|
+
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
27
|
+
# License:: MIT
|
28
|
+
class Netbout::Message
|
29
|
+
def initialize(iri, token, json)
|
30
|
+
@iri = iri
|
31
|
+
@token = token
|
32
|
+
@json = json
|
33
|
+
end
|
34
|
+
|
35
|
+
def id
|
36
|
+
@json['id'].to_i
|
37
|
+
end
|
38
|
+
|
39
|
+
def author
|
40
|
+
@json['author']
|
41
|
+
end
|
42
|
+
|
43
|
+
def text
|
44
|
+
@json['text']
|
45
|
+
end
|
46
|
+
|
47
|
+
def flags
|
48
|
+
[]
|
49
|
+
end
|
50
|
+
|
51
|
+
def attach(flag); end
|
52
|
+
|
53
|
+
def detach(flag); end
|
54
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#
|
4
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
|
24
|
+
require_relative 'http'
|
25
|
+
require_relative 'message'
|
26
|
+
|
27
|
+
# Search.
|
28
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
29
|
+
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
30
|
+
# License:: MIT
|
31
|
+
class Netbout::Search
|
32
|
+
def initialize(iri, token, query)
|
33
|
+
@iri = iri
|
34
|
+
@token = token
|
35
|
+
@query = query
|
36
|
+
end
|
37
|
+
|
38
|
+
def each
|
39
|
+
rsp = Netbout::Http.new(@iri.append('/search').add(q: @query), @token).get
|
40
|
+
json = JSON.parse(rsp.response_body)
|
41
|
+
json.each do |h|
|
42
|
+
yield Netbout::Message.new(@iri, token, h['id'])
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/lib/netbout/tags.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#
|
4
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
|
24
|
+
# Tags.
|
25
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
26
|
+
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
27
|
+
# License:: MIT
|
28
|
+
class Netbout::Tags
|
29
|
+
def initialize(iri, token, bout)
|
30
|
+
@iri = iri
|
31
|
+
@token = token
|
32
|
+
@bout = bout
|
33
|
+
end
|
34
|
+
|
35
|
+
def each
|
36
|
+
[]
|
37
|
+
end
|
38
|
+
|
39
|
+
def put(key, value); end
|
40
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#
|
4
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
|
24
|
+
# Netbout main module.
|
25
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
26
|
+
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
27
|
+
# License:: MIT
|
28
|
+
module Netbout
|
29
|
+
VERSION = '0.0.1'
|
30
|
+
end
|
data/lib/netbout.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#
|
4
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
|
24
|
+
# Netbout main module.
|
25
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
26
|
+
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
27
|
+
# License:: MIT
|
28
|
+
module Netbout; end
|
29
|
+
|
30
|
+
require_relative 'netbout/inbox'
|
data/netbout.gemspec
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright (c) 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.
|
22
|
+
|
23
|
+
require 'English'
|
24
|
+
|
25
|
+
lib = File.expand_path('lib', __dir__)
|
26
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
27
|
+
require_relative 'lib/netbout/version'
|
28
|
+
|
29
|
+
Gem::Specification.new do |s|
|
30
|
+
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
31
|
+
s.required_ruby_version = '>=2.3'
|
32
|
+
s.name = 'netbout'
|
33
|
+
s.version = Netbout::VERSION
|
34
|
+
s.license = 'MIT'
|
35
|
+
s.summary = 'Netbout API client'
|
36
|
+
s.description = 'Connects to Netbout.com and enables manipulation of all entities'
|
37
|
+
s.authors = ['Yegor Bugayenko']
|
38
|
+
s.email = 'yegor256@gmail.com'
|
39
|
+
s.homepage = 'http://github.com/yegor256/netbout.rb'
|
40
|
+
s.files = `git ls-files`.split($RS)
|
41
|
+
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
42
|
+
s.rdoc_options = ['--charset=UTF-8']
|
43
|
+
s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
|
44
|
+
s.add_runtime_dependency 'backtrace', '~>0.3'
|
45
|
+
s.add_runtime_dependency 'iri'
|
46
|
+
s.add_runtime_dependency 'json', '~>2.2'
|
47
|
+
s.add_runtime_dependency 'openssl', '>=1.0'
|
48
|
+
s.add_runtime_dependency 'rainbow', '~>3.0'
|
49
|
+
s.add_runtime_dependency 'typhoeus', '~>1.3'
|
50
|
+
s.metadata['rubygems_mfa_required'] = 'true'
|
51
|
+
end
|
data/renovate.json
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#
|
4
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
|
24
|
+
require 'minitest/autorun'
|
25
|
+
require_relative '../../lib/netbout'
|
26
|
+
|
27
|
+
# Netbout main module test.
|
28
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
29
|
+
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
30
|
+
# License:: MIT
|
31
|
+
class TestBout < Minitest::Test
|
32
|
+
def test_start_and_post
|
33
|
+
inbox = Netbout::Inbox.new('test')
|
34
|
+
bout = inbox.start('Hello!')
|
35
|
+
assert(bout.id.positive?)
|
36
|
+
msg = bout.post('How are you?')
|
37
|
+
assert(msg.id.positive?)
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#
|
4
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
|
24
|
+
$stdout.sync = true
|
25
|
+
|
26
|
+
require 'simplecov'
|
27
|
+
SimpleCov.start
|
28
|
+
|
29
|
+
require 'minitest/autorun'
|
30
|
+
require_relative '../lib/netbout'
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#
|
4
|
+
# Copyright (c) 2024 Yegor Bugayenko
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
|
24
|
+
require 'minitest/autorun'
|
25
|
+
require_relative '../lib/netbout'
|
26
|
+
|
27
|
+
# Netbout main module test.
|
28
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
29
|
+
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
|
30
|
+
# License:: MIT
|
31
|
+
class TestNetbout < Minitest::Test
|
32
|
+
def test_basic
|
33
|
+
# Nothing yet
|
34
|
+
end
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,158 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: netbout
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yegor Bugayenko
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-01-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: backtrace
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.3'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: iri
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: json
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.2'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: openssl
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rainbow
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: typhoeus
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.3'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.3'
|
97
|
+
description: Connects to Netbout.com and enables manipulation of all entities
|
98
|
+
email: yegor256@gmail.com
|
99
|
+
executables: []
|
100
|
+
extensions: []
|
101
|
+
extra_rdoc_files:
|
102
|
+
- README.md
|
103
|
+
- LICENSE.txt
|
104
|
+
files:
|
105
|
+
- ".0pdd.yml"
|
106
|
+
- ".gitattributes"
|
107
|
+
- ".github/workflows/codecov.yml"
|
108
|
+
- ".github/workflows/pdd.yml"
|
109
|
+
- ".github/workflows/rake.yml"
|
110
|
+
- ".github/workflows/xcop.yml"
|
111
|
+
- ".gitignore"
|
112
|
+
- ".pdd"
|
113
|
+
- ".rubocop.yml"
|
114
|
+
- ".rultor.yml"
|
115
|
+
- ".simplecov"
|
116
|
+
- Gemfile
|
117
|
+
- LICENSE.txt
|
118
|
+
- README.md
|
119
|
+
- Rakefile
|
120
|
+
- lib/netbout.rb
|
121
|
+
- lib/netbout/bout.rb
|
122
|
+
- lib/netbout/http.rb
|
123
|
+
- lib/netbout/inbox.rb
|
124
|
+
- lib/netbout/message.rb
|
125
|
+
- lib/netbout/search.rb
|
126
|
+
- lib/netbout/tags.rb
|
127
|
+
- lib/netbout/version.rb
|
128
|
+
- netbout.gemspec
|
129
|
+
- renovate.json
|
130
|
+
- test/netbout/test_bout.rb
|
131
|
+
- test/test__helper.rb
|
132
|
+
- test/test_netbout.rb
|
133
|
+
homepage: http://github.com/yegor256/netbout.rb
|
134
|
+
licenses:
|
135
|
+
- MIT
|
136
|
+
metadata:
|
137
|
+
rubygems_mfa_required: 'true'
|
138
|
+
post_install_message:
|
139
|
+
rdoc_options:
|
140
|
+
- "--charset=UTF-8"
|
141
|
+
require_paths:
|
142
|
+
- lib
|
143
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - ">="
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '2.3'
|
148
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
requirements: []
|
154
|
+
rubygems_version: 3.4.10
|
155
|
+
signing_key:
|
156
|
+
specification_version: 4
|
157
|
+
summary: Netbout API client
|
158
|
+
test_files: []
|