rarbg 1.4.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/LICENSE +1 -1
- data/README.md +3 -4
- data/lib/rarbg/api.rb +76 -62
- data/lib/rarbg/version.rb +1 -1
- data/rarbg.gemspec +8 -11
- metadata +21 -52
- data/.editorconfig +0 -12
- data/.github/CODEOWNERS +0 -4
- data/.github/ISSUE_TEMPLATE/BUG_REPORT.md +0 -25
- data/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md +0 -18
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -14
- data/.gitignore +0 -44
- data/.hound.yml +0 -5
- data/.rspec +0 -4
- data/.rubocop.yml +0 -36
- data/.travis.yml +0 -21
- data/.yardopts +0 -8
- data/CODE_OF_CONDUCT.md +0 -74
- data/CONTRIBUTING.md +0 -96
- data/Gemfile +0 -4
- data/Rakefile +0 -13
- data/bin/console +0 -8
- data/bin/setup +0 -7
- data/spec/rarbg/list_spec.rb +0 -111
- data/spec/rarbg/rarbg_spec.rb +0 -30
- data/spec/rarbg/search_spec.rb +0 -138
- data/spec/rarbg/token_spec.rb +0 -76
- data/spec/spec_helper.rb +0 -36
- data/spec/stubs.rb +0 -45
data/.editorconfig
DELETED
data/.github/CODEOWNERS
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
---
|
2
|
-
name: Bug Report
|
3
|
-
about: Report something that isn't working as expected.
|
4
|
-
|
5
|
-
---
|
6
|
-
|
7
|
-
## Bug description
|
8
|
-
A clear and concise description of what the bug is, what you expected to happen
|
9
|
-
and what happened instead.
|
10
|
-
|
11
|
-
## Steps to reproduce
|
12
|
-
1. Instantiate object...
|
13
|
-
2. Call method...
|
14
|
-
3. Error is raised...
|
15
|
-
|
16
|
-
## Environment
|
17
|
-
- Gem version:
|
18
|
-
- Ruby version:
|
19
|
-
- OS and version:
|
20
|
-
|
21
|
-
## Logs
|
22
|
-
If applicable, add logs or screenshots to help explain your problem.
|
23
|
-
|
24
|
-
## Additional context
|
25
|
-
Add any other context about the problem here.
|
@@ -1,18 +0,0 @@
|
|
1
|
-
---
|
2
|
-
name: Feature request
|
3
|
-
about: Suggest an idea for this project.
|
4
|
-
|
5
|
-
---
|
6
|
-
|
7
|
-
## Feature description
|
8
|
-
A clear and concise description of what problem you're trying to solve and what
|
9
|
-
you'd want to happen.
|
10
|
-
|
11
|
-
## Possible implementations
|
12
|
-
If possible, suggest a way to add this feature.
|
13
|
-
|
14
|
-
## Alternatives considered
|
15
|
-
A description of any alternative solutions or features you've considered.
|
16
|
-
|
17
|
-
## Additional context
|
18
|
-
Add any other context about the feature here.
|
@@ -1,14 +0,0 @@
|
|
1
|
-
## Pull Request description
|
2
|
-
A clear and concise explanation of what changes your PR introduces and why this was needed.
|
3
|
-
|
4
|
-
## Pull Request checklist
|
5
|
-
|
6
|
-
- [ ] My code is a **bug fix** (non-breaking change which fixes an issue)
|
7
|
-
- [ ] My code is a **new feature** (non-breaking change which adds functionality)
|
8
|
-
- [ ] My code introduces a **breaking change** (fix or feature that would break existing functionality)
|
9
|
-
- [ ] My code follows the code style of this project
|
10
|
-
- [ ] My change requires a change to the documentation
|
11
|
-
- [ ] I have updated the documentation accordingly
|
12
|
-
- [ ] I have included the CHANGELOG entry for the changes
|
13
|
-
- [ ] I have added tests to cover my changes
|
14
|
-
- [ ] All new and existing tests passed
|
data/.gitignore
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
/.config
|
4
|
-
/coverage/
|
5
|
-
/InstalledFiles
|
6
|
-
/pkg/
|
7
|
-
/test/tmp/
|
8
|
-
/test/version_tmp/
|
9
|
-
/tmp/
|
10
|
-
|
11
|
-
# Version specifiers
|
12
|
-
Gemfile.lock
|
13
|
-
gems.locked
|
14
|
-
.ruby-version
|
15
|
-
.ruby-gemset
|
16
|
-
|
17
|
-
# Environment normalization
|
18
|
-
/.bundle/
|
19
|
-
/lib/bundler/man/
|
20
|
-
|
21
|
-
# RSpec
|
22
|
-
/spec/reports/
|
23
|
-
/spec/examples.txt
|
24
|
-
.rspec_status
|
25
|
-
|
26
|
-
# Documentation cache
|
27
|
-
/.yardoc/
|
28
|
-
/_yardoc/
|
29
|
-
/doc/
|
30
|
-
/rdoc/
|
31
|
-
|
32
|
-
# Logs
|
33
|
-
*.log
|
34
|
-
*.log.[0-9]*
|
35
|
-
|
36
|
-
# Pry
|
37
|
-
.pryrc
|
38
|
-
.pry_history
|
39
|
-
|
40
|
-
# RVM
|
41
|
-
.rvmrc
|
42
|
-
|
43
|
-
# Project specific
|
44
|
-
apidocs_v2.txt
|
data/.hound.yml
DELETED
data/.rspec
DELETED
data/.rubocop.yml
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
AllCops:
|
2
|
-
TargetRubyVersion: 2.3
|
3
|
-
DisplayCopNames: true
|
4
|
-
DisplayStyleGuide: true
|
5
|
-
|
6
|
-
Gemspec/RequiredRubyVersion:
|
7
|
-
Enabled: false
|
8
|
-
|
9
|
-
Layout/AlignHash:
|
10
|
-
EnforcedHashRocketStyle: table
|
11
|
-
EnforcedColonStyle: table
|
12
|
-
|
13
|
-
Layout/IndentFirstArgument:
|
14
|
-
EnforcedStyle: consistent
|
15
|
-
|
16
|
-
Layout/IndentFirstArrayElement:
|
17
|
-
EnforcedStyle: consistent
|
18
|
-
|
19
|
-
Layout/IndentFirstHashElement:
|
20
|
-
EnforcedStyle: consistent
|
21
|
-
|
22
|
-
Metrics/BlockLength:
|
23
|
-
Exclude:
|
24
|
-
- '*.gemspec'
|
25
|
-
ExcludedMethods:
|
26
|
-
- 'describe'
|
27
|
-
- 'context'
|
28
|
-
|
29
|
-
Metrics/ClassLength:
|
30
|
-
Enabled: false
|
31
|
-
|
32
|
-
Metrics/LineLength:
|
33
|
-
Max: 90
|
34
|
-
|
35
|
-
Style/BracesAroundHashParameters:
|
36
|
-
EnforcedStyle: context_dependent
|
data/.travis.yml
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
sudo: false
|
2
|
-
language: ruby
|
3
|
-
cache: bundler
|
4
|
-
script: bundle exec rspec
|
5
|
-
rvm:
|
6
|
-
- 2.6.3
|
7
|
-
- 2.5.5
|
8
|
-
- 2.4.6
|
9
|
-
branches:
|
10
|
-
only: master
|
11
|
-
notifications:
|
12
|
-
email: false
|
13
|
-
env:
|
14
|
-
global:
|
15
|
-
- CC_TEST_REPORTER_ID=ca61b641c417ff48e8cff3c0d10e5503539bf81348b0df8daca6c74e2401d4e4
|
16
|
-
before_script:
|
17
|
-
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
18
|
-
- chmod +x ./cc-test-reporter
|
19
|
-
- ./cc-test-reporter before-build
|
20
|
-
after_script:
|
21
|
-
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
data/.yardopts
DELETED
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
2
|
-
|
3
|
-
## Our Pledge
|
4
|
-
|
5
|
-
In the interest of fostering an open and welcoming environment, we as
|
6
|
-
contributors and maintainers pledge to making participation in our project and
|
7
|
-
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
-
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
-
education, socio-economic status, nationality, personal appearance, race,
|
10
|
-
religion, or sexual identity and orientation.
|
11
|
-
|
12
|
-
## Our Standards
|
13
|
-
|
14
|
-
Examples of behavior that contributes to creating a positive environment
|
15
|
-
include:
|
16
|
-
|
17
|
-
* Using welcoming and inclusive language
|
18
|
-
* Being respectful of differing viewpoints and experiences
|
19
|
-
* Gracefully accepting constructive criticism
|
20
|
-
* Focusing on what is best for the community
|
21
|
-
* Showing empathy towards other community members
|
22
|
-
|
23
|
-
Examples of unacceptable behavior by participants include:
|
24
|
-
|
25
|
-
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
-
advances
|
27
|
-
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
-
* Public or private harassment
|
29
|
-
* Publishing others' private information, such as a physical or electronic
|
30
|
-
address, without explicit permission
|
31
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
-
professional setting
|
33
|
-
|
34
|
-
## Our Responsibilities
|
35
|
-
|
36
|
-
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
-
behavior and are expected to take appropriate and fair corrective action in
|
38
|
-
response to any instances of unacceptable behavior.
|
39
|
-
|
40
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
-
threatening, offensive, or harmful.
|
45
|
-
|
46
|
-
## Scope
|
47
|
-
|
48
|
-
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
-
when an individual is representing the project or its community. Examples of
|
50
|
-
representing a project or community include using an official project e-mail
|
51
|
-
address, posting via an official social media account, or acting as an appointed
|
52
|
-
representative at an online or offline event. Representation of a project may be
|
53
|
-
further defined and clarified by project maintainers.
|
54
|
-
|
55
|
-
## Enforcement
|
56
|
-
|
57
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported by contacting the project team at epistrephein@gmail.com. All
|
59
|
-
complaints will be reviewed and investigated and will result in a response that
|
60
|
-
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
-
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
-
Further details of specific enforcement policies may be posted separately.
|
63
|
-
|
64
|
-
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
-
faith may face temporary or permanent repercussions as determined by other
|
66
|
-
members of the project's leadership.
|
67
|
-
|
68
|
-
## Attribution
|
69
|
-
|
70
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
71
|
-
version 1.4, available at [https://contributor-covenant.org/version/1/4][version]
|
72
|
-
|
73
|
-
[homepage]: https://contributor-covenant.org
|
74
|
-
[version]: https://contributor-covenant.org/version/1/4/
|
data/CONTRIBUTING.md
DELETED
@@ -1,96 +0,0 @@
|
|
1
|
-
# Contributing
|
2
|
-
|
3
|
-
First off, thank you for considering contributing to this project.
|
4
|
-
|
5
|
-
As part of the open source community, this project thrives thanks to the help
|
6
|
-
and the contributions of its users. There are many ways to contribute - from
|
7
|
-
submitting bug reports and feature requests, to improving the documentation, or
|
8
|
-
writing code which can be incorporated into the codebase.
|
9
|
-
|
10
|
-
In these guidelines, you will find the most common scenarios related to
|
11
|
-
contributing and information on how to proceed to make sure that your submission
|
12
|
-
can be evaluated swiftly and properly.
|
13
|
-
|
14
|
-
This project is intended to be a safe, welcoming space for collaboration,
|
15
|
-
and contributors are expected to adhere to the
|
16
|
-
[Code of Conduct](https://github.com/epistrephein/rarbg/blob/master/CODE_OF_CONDUCT.md).
|
17
|
-
|
18
|
-
## Opening an issue
|
19
|
-
|
20
|
-
Opening an issue on GitHub is the fastest way to get in touch with the maintainers
|
21
|
-
of the project and start a discussion regarding a problem you're experiencing or
|
22
|
-
a missing feature you would like to suggest.
|
23
|
-
|
24
|
-
For this reason, upon opening a new issue, you'll be able to choose between
|
25
|
-
different templates for your submission, with some pre-allocated sections to fill.
|
26
|
-
Please try to follow the existing structure of the issue and to provide as much
|
27
|
-
information as possible regarding your situation. This will help the maintainers
|
28
|
-
to reproduce the bug or effectively consider the feature you'd like to see
|
29
|
-
implemented.
|
30
|
-
|
31
|
-
If you think your issue doesn't fit into any of the existing templates, or if you
|
32
|
-
just have a question regarding the existing functionalities of the project,
|
33
|
-
simply open a regular issue and describe the problem in the clearest way possible.
|
34
|
-
|
35
|
-
## Contributing with code
|
36
|
-
|
37
|
-
If you would like to contribute to the project by writing code, you can open a
|
38
|
-
Pull Request on GitHub with your changes and ask a maintainer for a review.
|
39
|
-
|
40
|
-
As an open source Ruby gem, this project uses the most common development tools
|
41
|
-
to test, validate, and document the code.
|
42
|
-
|
43
|
-
### Tools and integrations
|
44
|
-
|
45
|
-
We use [RSpec](http://rspec.info/) as testing framework.
|
46
|
-
The test suite lives in the `spec` directory, and you can run it to test your
|
47
|
-
changes with `rake spec`.
|
48
|
-
|
49
|
-
We also use [RuboCop](https://docs.rubocop.org/en/latest/) to enforce code style.
|
50
|
-
The configuration file used for this project lives in `.rubocop.yml`. You can check
|
51
|
-
the code style of your changes with `rake rubocop`.
|
52
|
-
Pull Requests on GitHub are automatically linted with RuboCop via [Hound](https://houndci.com/).
|
53
|
-
|
54
|
-
The default Rake task, runnable using `rake`, performs code linting via Rubocop
|
55
|
-
and then runs the RSpec tests.
|
56
|
-
|
57
|
-
Documentation is written as [YARD](https://yardoc.org/) docblocks in the Ruby code.
|
58
|
-
This is rendered as self-hosted Web pages on [GitHub pages](https://epistrephein.github.io/rarbg/).
|
59
|
-
Sources are stored in the repository under the `docs` folder and can be automatically
|
60
|
-
generated and updated via `rake yard`.
|
61
|
-
The completeness of the documentation is then measured via
|
62
|
-
[Inch CI](https://inch-ci.org/github/epistrephein/rarbg).
|
63
|
-
|
64
|
-
Continuous integration and automated tests are run on
|
65
|
-
[Travis CI](https://travis-ci.org/epistrephein/rarbg) and integrated with the
|
66
|
-
GitHub Pull Request flow.
|
67
|
-
|
68
|
-
Code quality and test coverage are then scored via
|
69
|
-
[CodeClimate](https://codeclimate.com/github/epistrephein/rarbg).
|
70
|
-
|
71
|
-
Finally, dependencies are kept up-to-date thanks to
|
72
|
-
[Depfu](https://depfu.com/github/epistrephein/rarbg) integration.
|
73
|
-
|
74
|
-
### Submitting a PR
|
75
|
-
|
76
|
-
This project follows the [GitHub flow](https://guides.github.com/introduction/flow/)
|
77
|
-
for Pull Request submissions.
|
78
|
-
|
79
|
-
To submit a PR with your proposed changes, follow these steps:
|
80
|
-
|
81
|
-
1. [Fork the repo](https://github.com/epistrephein/rarbg/fork) in your GitHub
|
82
|
-
userspace and clone it locally
|
83
|
-
2. Install the dependencies with bundler (`bin/setup`)
|
84
|
-
3. Create a feature branch (`git checkout -b my-new-feature`)
|
85
|
-
4. Add your code to the branch and then commit the changes (`git commit -am 'Add some feature'`)
|
86
|
-
5. Run the test suite (`rake spec`) and make sure that existing and newly introduced
|
87
|
-
tests pass. You can also run Rubocop linting with `rake rubocop`, or just use `rake`
|
88
|
-
to run both Rubocop and RSpec tests
|
89
|
-
6. Push to your remote branch on GitHub (`git push origin my-new-feature`)
|
90
|
-
7. Create a [new pull request](https://github.com/epistrephein/rarbg/pulls)
|
91
|
-
|
92
|
-
By submitting a patch, you agree to allow the project owners to license your work
|
93
|
-
under the terms of the [MIT License](https://github.com/epistrephein/rarbg/blob/master/LICENSE).
|
94
|
-
|
95
|
-
As for issues, when opening a new Pull Request, please fill out the template with
|
96
|
-
all the relevant information in order to reduce the review effort of the maintainers.
|
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'bundler/gem_tasks'
|
4
|
-
require 'rspec/core/rake_task'
|
5
|
-
require 'rubocop/rake_task'
|
6
|
-
require 'yard'
|
7
|
-
|
8
|
-
RSpec::Core::RakeTask.new(:spec)
|
9
|
-
RuboCop::RakeTask.new(:rubocop)
|
10
|
-
YARD::Rake::YardocTask.new(:yard)
|
11
|
-
|
12
|
-
# Run RuboCop and RSpec as default task.
|
13
|
-
task default: %i[rubocop spec]
|
data/bin/console
DELETED
data/bin/setup
DELETED
data/spec/rarbg/list_spec.rb
DELETED
@@ -1,111 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RSpec.describe 'RARBG::API#list' do
|
4
|
-
before(:all) do
|
5
|
-
@rarbg = RARBG::API.new
|
6
|
-
@token = SecureRandom.hex(5)
|
7
|
-
end
|
8
|
-
|
9
|
-
before(:each) do
|
10
|
-
stub_token(@token)
|
11
|
-
end
|
12
|
-
|
13
|
-
context 'when list request succeeds' do
|
14
|
-
before(:example) do
|
15
|
-
stub_list(
|
16
|
-
@token, {},
|
17
|
-
{ torrent_results: [
|
18
|
-
{
|
19
|
-
filename: 'first stubbed name',
|
20
|
-
category: 'first stubbed category',
|
21
|
-
download: 'first stubbed magnet link'
|
22
|
-
},
|
23
|
-
{
|
24
|
-
filename: 'second stubbed name',
|
25
|
-
category: 'second stubbed category',
|
26
|
-
download: 'second stubbed magnet link'
|
27
|
-
}
|
28
|
-
] }
|
29
|
-
)
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'returns and array of hashes' do
|
33
|
-
expect(@rarbg.list).to all(be_an(Hash))
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'returns hashes with filename and download link' do
|
37
|
-
expect(@rarbg.list).to all include('filename').and include('download')
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
context 'when list request returns no result' do
|
42
|
-
before(:example) do
|
43
|
-
stub_list(
|
44
|
-
@token, {},
|
45
|
-
{ error: 'No results found' }
|
46
|
-
)
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'returns an empty array' do
|
50
|
-
expect(@rarbg.list).to eq([])
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
context 'when list request parameters is not an hash' do
|
55
|
-
before(:example) do
|
56
|
-
stub_list(
|
57
|
-
@token
|
58
|
-
)
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'raises an ArgumentError exception' do
|
62
|
-
expect { @rarbg.list('string') }.to raise_error(
|
63
|
-
ArgumentError, 'Expected params hash'
|
64
|
-
)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
context 'when list request has invalid parameters' do
|
69
|
-
before(:example) do
|
70
|
-
stub_list(
|
71
|
-
@token,
|
72
|
-
{ min_seeders: 'string' },
|
73
|
-
{ error: 'Invalid value for min_seeders' }
|
74
|
-
)
|
75
|
-
end
|
76
|
-
|
77
|
-
it 'raises a RARBG::APIError exception' do
|
78
|
-
expect { @rarbg.list(min_seeders: 'string') }.to raise_error(
|
79
|
-
RARBG::APIError, 'Invalid value for min_seeders'
|
80
|
-
)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
context 'when list request fails' do
|
85
|
-
before(:example) do
|
86
|
-
stub_error(500, 'Internal Server Error')
|
87
|
-
end
|
88
|
-
|
89
|
-
it 'raises a RARBG::APIError exception' do
|
90
|
-
expect { @rarbg.list }.to raise_error(
|
91
|
-
RARBG::APIError, 'Internal Server Error (500)'
|
92
|
-
)
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
context 'when called from top level namespace' do
|
97
|
-
let(:rarbg_module) { RARBG.clone }
|
98
|
-
|
99
|
-
before(:example) do
|
100
|
-
stub_list(
|
101
|
-
@token
|
102
|
-
)
|
103
|
-
end
|
104
|
-
|
105
|
-
it 'instantiates an API object' do
|
106
|
-
expect { rarbg_module.list }
|
107
|
-
.to change { rarbg_module.instance_variable_get(:@rarbg).class }
|
108
|
-
.to(RARBG::API)
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|