rarbg 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +8 -7
- data/.travis.yml +1 -2
- data/CHANGELOG.md +24 -3
- data/CODE_OF_CONDUCT.md +3 -3
- data/README.md +29 -9
- data/lib/rarbg.rb +13 -0
- data/lib/rarbg/api.rb +6 -2
- data/lib/rarbg/categories.rb +30 -0
- data/lib/rarbg/version.rb +1 -1
- data/rarbg.gemspec +3 -3
- data/spec/rarbg/list_spec.rb +17 -1
- data/spec/rarbg/rarbg_spec.rb +12 -1
- data/spec/rarbg/search_spec.rb +18 -2
- data/spec/rarbg/token_spec.rb +2 -2
- data/spec/spec_helper.rb +3 -0
- data/spec/stubs.rb +6 -7
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c363697d12aee6fc8092c9c9ffd9a9cf9e15590
|
4
|
+
data.tar.gz: 6ea7ffedae9962a448abe88ef7d5cfe28f758a6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cba0cfb521eaa9f43b4a6e93e0223832922323b37f02ddd3301624bfda0e059e0a76b619a4cff267aa12b29589f46127dd8b7c9a69564e8e49374458105eae04
|
7
|
+
data.tar.gz: 76527bbe48867db464f5f598e5ee03904db8e0e5f8d9e519231283b5c594c4d938ee7fa12e76d2e0d14c7cfdf70ac1f9c95146d6c82767a3537c370f9403e711
|
data/.gitignore
CHANGED
@@ -8,31 +8,32 @@
|
|
8
8
|
/test/version_tmp/
|
9
9
|
/tmp/
|
10
10
|
|
11
|
-
|
11
|
+
# Version specifiers
|
12
12
|
Gemfile.lock
|
13
13
|
.ruby-version
|
14
14
|
.ruby-gemset
|
15
15
|
|
16
|
-
|
16
|
+
# Environment normalization
|
17
17
|
/.bundle/
|
18
18
|
/lib/bundler/man/
|
19
19
|
|
20
|
-
|
20
|
+
# RSpec
|
21
21
|
/spec/reports/
|
22
22
|
/spec/examples.txt
|
23
23
|
.rspec_status
|
24
24
|
|
25
|
-
|
25
|
+
# Documentation cache
|
26
26
|
/.yardoc/
|
27
27
|
/_yardoc/
|
28
28
|
/doc/
|
29
29
|
/rdoc/
|
30
30
|
|
31
|
-
|
31
|
+
# Logs
|
32
32
|
*.log
|
33
|
+
*.log.[0-9]*
|
33
34
|
|
34
|
-
|
35
|
+
# RVM
|
35
36
|
.rvmrc
|
36
37
|
|
37
|
-
|
38
|
+
# Project specific
|
38
39
|
apidocs_v2.txt
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,26 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
|
-
The format is based on [Keep a Changelog](
|
5
|
-
and this project adheres to [Semantic Versioning](
|
4
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/),
|
5
|
+
and this project adheres to [Semantic Versioning](https://semver.org/).
|
6
|
+
|
7
|
+
## Unreleased
|
8
|
+
[Diff](https://github.com/epistrephein/rarbg/compare/v1.1.0...master)
|
9
|
+
|
10
|
+
|
11
|
+
## 1.1.0 - 2018-10-05
|
12
|
+
[RubyGems](https://rubygems.org/gems/rarbg/versions/1.1.0) |
|
13
|
+
[Release](https://github.com/epistrephein/rarbg/releases/tag/v1.1.0) |
|
14
|
+
[Diff](https://github.com/epistrephein/rarbg/compare/v1.0.1...v1.1.0)
|
15
|
+
|
16
|
+
#### Added
|
17
|
+
- `list` and `search` methods are now available from top level namespace.
|
18
|
+
- `RARBG::CATEGORIES` now returns name/id pairs of all RARBG categories.
|
19
|
+
- Faraday now uses the `APP_ID` as User agent.
|
20
|
+
|
6
21
|
|
7
22
|
## 1.0.1 - 2018-05-04
|
23
|
+
[RubyGems](https://rubygems.org/gems/rarbg/versions/1.0.1) |
|
8
24
|
[Release](https://github.com/epistrephein/rarbg/releases/tag/v1.0.1) |
|
9
25
|
[Diff](https://github.com/epistrephein/rarbg/compare/v1.0.0...v1.0.1)
|
10
26
|
|
@@ -17,6 +33,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
17
33
|
|
18
34
|
|
19
35
|
## 1.0.0 – 2018-04-02
|
36
|
+
[RubyGems](https://rubygems.org/gems/rarbg/versions/1.0.0) |
|
20
37
|
[Release](https://github.com/epistrephein/rarbg/releases/tag/v1.0.0) |
|
21
38
|
[Diff](https://github.com/epistrephein/rarbg/compare/v0.1.4...v1.0.0)
|
22
39
|
|
@@ -37,6 +54,7 @@ search type must be specified as a keyword argument upon `search`.
|
|
37
54
|
|
38
55
|
|
39
56
|
## 0.1.4 – 2017-12-22
|
57
|
+
[RubyGems](https://rubygems.org/gems/rarbg/versions/0.1.4) |
|
40
58
|
[Release](https://github.com/epistrephein/rarbg/releases/tag/v0.1.4) |
|
41
59
|
[Diff](https://github.com/epistrephein/rarbg/compare/v0.1.3...v0.1.4)
|
42
60
|
|
@@ -45,6 +63,7 @@ search type must be specified as a keyword argument upon `search`.
|
|
45
63
|
|
46
64
|
|
47
65
|
## 0.1.3 – 2016-12-23
|
66
|
+
[RubyGems](https://rubygems.org/gems/rarbg/versions/0.1.3) |
|
48
67
|
[Release](https://github.com/epistrephein/rarbg/releases/tag/v0.1.3) |
|
49
68
|
[Diff](https://github.com/epistrephein/rarbg/compare/v0.1.2...v0.1.3)
|
50
69
|
|
@@ -53,6 +72,7 @@ search type must be specified as a keyword argument upon `search`.
|
|
53
72
|
|
54
73
|
|
55
74
|
## 0.1.2 – 2016-12-21
|
75
|
+
[RubyGems](https://rubygems.org/gems/rarbg/versions/0.1.2) |
|
56
76
|
[Release](https://github.com/epistrephein/rarbg/releases/tag/v0.1.2) |
|
57
77
|
[Diff](https://github.com/epistrephein/rarbg/compare/v0.1.1...v0.1.2)
|
58
78
|
|
@@ -61,6 +81,7 @@ search type must be specified as a keyword argument upon `search`.
|
|
61
81
|
|
62
82
|
|
63
83
|
## 0.1.1 – 2016-12-21
|
84
|
+
[RubyGems](https://rubygems.org/gems/rarbg/versions/0.1.1) |
|
64
85
|
[Release](https://github.com/epistrephein/rarbg/releases/tag/v0.1.1) |
|
65
86
|
[Diff](https://github.com/epistrephein/rarbg/compare/v0.1.0...v0.1.1)
|
66
87
|
|
@@ -70,4 +91,4 @@ search type must be specified as a keyword argument upon `search`.
|
|
70
91
|
|
71
92
|
## 0.1.0 – 2016-12-21
|
72
93
|
|
73
|
-
Initial release. Yanked from [
|
94
|
+
Initial release. Yanked from [RubyGems](https://rubygems.org).
|
data/CODE_OF_CONDUCT.md
CHANGED
@@ -68,7 +68,7 @@ members of the project's leadership.
|
|
68
68
|
## Attribution
|
69
69
|
|
70
70
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
71
|
-
version 1.4, available at [
|
71
|
+
version 1.4, available at [https://contributor-covenant.org/version/1/4][version]
|
72
72
|
|
73
|
-
[homepage]:
|
74
|
-
[version]:
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/README.md
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# RARBG
|
2
2
|
[![Gem Version](https://img.shields.io/gem/v/rarbg.svg?colorB=brightgreen)](https://rubygems.org/gems/rarbg)
|
3
3
|
[![Build status](https://travis-ci.org/epistrephein/rarbg.svg?branch=master)](https://travis-ci.org/epistrephein/rarbg)
|
4
|
+
[![Dependencies](https://badges.depfu.com/badges/32877a5a58ad7eb3f5db321d85a23c1b/overview.svg)](https://depfu.com/github/epistrephein/rarbg?project_id=5845)
|
4
5
|
[![Maintainability](https://api.codeclimate.com/v1/badges/adf6a91b754bb4aaacf2/maintainability)](https://codeclimate.com/github/epistrephein/rarbg/maintainability)
|
5
6
|
[![Test Coverage](https://api.codeclimate.com/v1/badges/adf6a91b754bb4aaacf2/test_coverage)](https://codeclimate.com/github/epistrephein/rarbg/test_coverage)
|
6
|
-
[![
|
7
|
-
[![
|
8
|
-
[![Inline docs](http://inch-ci.org/github/epistrephein/rarbg.svg?branch=master)](http://inch-ci.org/github/epistrephein/rarbg)
|
7
|
+
[![Inline docs](https://inch-ci.org/github/epistrephein/rarbg.svg?branch=master)](https://inch-ci.org/github/epistrephein/rarbg)
|
8
|
+
[![Documentation](https://img.shields.io/badge/docs-yard-blue.svg)](https://www.rubydoc.info/github/epistrephein/rarbg/master)
|
9
9
|
|
10
|
-
Ruby wrapper for RARBG Torrent API.
|
10
|
+
Ruby wrapper for the RARBG Torrent API.
|
11
11
|
|
12
12
|
## Installation
|
13
13
|
|
@@ -23,7 +23,7 @@ Or add it to your Gemfile and execute `bundle install`
|
|
23
23
|
gem 'rarbg', '~> 1.0'
|
24
24
|
```
|
25
25
|
|
26
|
-
## Usage
|
26
|
+
## Usage
|
27
27
|
|
28
28
|
This gem wraps all API methods available from [RARBG TorrentAPI](https://torrentapi.org/apidocs_v2.txt).
|
29
29
|
|
@@ -72,6 +72,25 @@ rarbg.search(imdb: 'tt2488496', category: [44, 45])
|
|
72
72
|
rarbg.search(themoviedb: 140607, ranked: false, sort: :last)
|
73
73
|
```
|
74
74
|
|
75
|
+
These methods are also available from the top module namespace for convenience.
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
RARBG.list(sort: :leechers, min_leechers: 10)
|
79
|
+
|
80
|
+
RARBG.search(string: 'Star Wars', category: [48])
|
81
|
+
```
|
82
|
+
|
83
|
+
A list of name/id pairs for each category is also available for quick lookup.
|
84
|
+
|
85
|
+
```ruby
|
86
|
+
RARBG::CATEGORIES
|
87
|
+
# => { "Movies/XVID" => 14,
|
88
|
+
# "Movies/XVID/720" => 48,
|
89
|
+
# "Movies/x264" => 17,
|
90
|
+
# ...
|
91
|
+
# }
|
92
|
+
```
|
93
|
+
|
75
94
|
#### Errors
|
76
95
|
|
77
96
|
API endpoint errors will raise a `RARBG::APIError` exception with the API error message.
|
@@ -97,11 +116,11 @@ rarbg.search(limit: 50)
|
|
97
116
|
# => ArgumentError: At least one parameter required among string, imdb, tvdb, themoviedb for search mode.
|
98
117
|
```
|
99
118
|
|
100
|
-
## Contributing
|
119
|
+
## Contributing
|
101
120
|
|
102
121
|
Bug reports and pull requests are welcome on [GitHub](https://github.com/epistrephein/rarbg).
|
103
122
|
|
104
|
-
This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Code of Conduct](CODE_OF_CONDUCT.md).
|
123
|
+
This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Code of Conduct](https://github.com/epistrephein/rarbg/blob/master/CODE_OF_CONDUCT.md).
|
105
124
|
|
106
125
|
You can contribute changes by forking the project and submitting a pull request. To get started:
|
107
126
|
|
@@ -113,5 +132,6 @@ You can contribute changes by forking the project and submitting a pull request.
|
|
113
132
|
6. Push to the branch (`git push origin my-new-feature`)
|
114
133
|
7. Create a new pull request
|
115
134
|
|
116
|
-
## License
|
117
|
-
|
135
|
+
## License
|
136
|
+
|
137
|
+
This gem is released as open source under the terms of the [MIT License](https://github.com/epistrephein/rarbg/blob/master/LICENSE).
|
data/lib/rarbg.rb
CHANGED
@@ -1,4 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'rarbg/version'
|
4
|
+
require 'rarbg/categories'
|
4
5
|
require 'rarbg/api'
|
6
|
+
|
7
|
+
# Module shortcut methods
|
8
|
+
module RARBG
|
9
|
+
class << self
|
10
|
+
%i[list search].each do |m|
|
11
|
+
define_method(m) do |*arg|
|
12
|
+
@rarbg ||= RARBG::API.new
|
13
|
+
@rarbg.send(m, *arg)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/rarbg/api.rb
CHANGED
@@ -19,6 +19,9 @@ module RARBG
|
|
19
19
|
# Default token expiration time.
|
20
20
|
TOKEN_EXPIRATION = 800
|
21
21
|
|
22
|
+
# Default API rate limit.
|
23
|
+
RATE_LIMIT = 2.1
|
24
|
+
|
22
25
|
# @return [Faraday::Connection] the Faraday connection object.
|
23
26
|
attr_reader :conn
|
24
27
|
|
@@ -45,7 +48,8 @@ module RARBG
|
|
45
48
|
conn.options.timeout = 90
|
46
49
|
conn.options.open_timeout = 10
|
47
50
|
|
48
|
-
conn.
|
51
|
+
conn.headers[:user_agent] = APP_ID
|
52
|
+
conn.params[:app_id] = APP_ID
|
49
53
|
end
|
50
54
|
end
|
51
55
|
|
@@ -198,7 +202,7 @@ module RARBG
|
|
198
202
|
|
199
203
|
# Perform API request.
|
200
204
|
def request(params)
|
201
|
-
rate_limit!(
|
205
|
+
rate_limit!(RATE_LIMIT)
|
202
206
|
|
203
207
|
response = @conn.get(nil, params)
|
204
208
|
@last_request = time
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RARBG
|
4
|
+
# RARBG categories
|
5
|
+
CATEGORIES = {
|
6
|
+
'Movies/XVID' => 14,
|
7
|
+
'Movies/XVID/720' => 48,
|
8
|
+
'Movies/x264' => 17,
|
9
|
+
'Movies/x264/1080' => 44,
|
10
|
+
'Movies/x264/720' => 45,
|
11
|
+
'Movies/x264/3D' => 47,
|
12
|
+
'Movies/x264/4k' => 50,
|
13
|
+
'Movies/x265/4k' => 51,
|
14
|
+
'Movies/x265/4k/HDR' => 52,
|
15
|
+
'Movies/Full BD' => 42,
|
16
|
+
'Movies/BD Remux' => 46,
|
17
|
+
'TV Episodes' => 18,
|
18
|
+
'TV HD Episodes' => 41,
|
19
|
+
'TV UHD Episodes' => 49,
|
20
|
+
'Music/MP3' => 23,
|
21
|
+
'Music/FLAC' => 25,
|
22
|
+
'Games/PC ISO' => 27,
|
23
|
+
'Games/PC RIP' => 28,
|
24
|
+
'Games/PS3' => 40,
|
25
|
+
'Games/PS4' => 53,
|
26
|
+
'Games/XBOX-360' => 32,
|
27
|
+
'Software/PC ISO' => 33,
|
28
|
+
'XXX' => 4
|
29
|
+
}.freeze
|
30
|
+
end
|
data/lib/rarbg/version.rb
CHANGED
data/rarbg.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.email = 'epistrephein@gmail.com'
|
12
12
|
|
13
13
|
spec.summary = 'RARBG Ruby client.'
|
14
|
-
spec.description = 'Ruby wrapper for RARBG Torrent API.'
|
14
|
+
spec.description = 'Ruby wrapper for the RARBG Torrent API.'
|
15
15
|
spec.homepage = 'https://github.com/epistrephein/rarbg'
|
16
16
|
spec.license = 'MIT'
|
17
17
|
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.metadata = {
|
25
25
|
'bug_tracker_uri' => 'https://github.com/epistrephein/rarbg/issues',
|
26
26
|
'changelog_uri' => 'https://github.com/epistrephein/rarbg/blob/master/CHANGELOG.md',
|
27
|
-
'documentation_uri' => "
|
27
|
+
'documentation_uri' => "https://www.rubydoc.info/gems/rarbg/#{RARBG::VERSION}",
|
28
28
|
'homepage_uri' => 'https://github.com/epistrephein/rarbg',
|
29
29
|
'source_code_uri' => 'https://github.com/epistrephein/rarbg'
|
30
30
|
}
|
@@ -39,6 +39,6 @@ Gem::Specification.new do |spec|
|
|
39
39
|
spec.add_development_dependency 'rake', '~> 12.0'
|
40
40
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
41
41
|
spec.add_development_dependency 'simplecov', '~> 0'
|
42
|
-
spec.add_development_dependency 'webmock', '~> 3.
|
42
|
+
spec.add_development_dependency 'webmock', '~> 3.4'
|
43
43
|
spec.add_development_dependency 'yard', '~> 0.9'
|
44
44
|
end
|
data/spec/rarbg/list_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
RSpec.describe RARBG::API do
|
3
|
+
RSpec.describe 'RARBG::API#list' do
|
4
4
|
before(:all) do
|
5
5
|
@rarbg = RARBG::API.new
|
6
6
|
@token = SecureRandom.hex(5)
|
@@ -92,4 +92,20 @@ RSpec.describe RARBG::API do
|
|
92
92
|
)
|
93
93
|
end
|
94
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
|
95
111
|
end
|
data/spec/rarbg/rarbg_spec.rb
CHANGED
@@ -1,12 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
RSpec.describe RARBG
|
3
|
+
RSpec.describe RARBG do
|
4
4
|
it 'has a version number' do
|
5
5
|
expect(RARBG::VERSION).not_to be nil
|
6
|
+
expect(RARBG::VERSION).to match(/(\d+\.)(\d+\.)(\d+)(-?[\S]+)?/)
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'has a category list' do
|
10
|
+
expect(RARBG::CATEGORIES).to be_kind_of(Hash)
|
11
|
+
expect(RARBG::CATEGORIES).to include(/Movies/, /TV/, /Music/)
|
6
12
|
end
|
7
13
|
|
8
14
|
it 'has an app id' do
|
9
15
|
expect(RARBG::API::APP_ID).not_to be nil
|
16
|
+
expect(RARBG::API::APP_ID).to be_kind_of(String)
|
10
17
|
end
|
11
18
|
|
12
19
|
it 'has the correct API endpoint' do
|
@@ -16,4 +23,8 @@ RSpec.describe RARBG::API do
|
|
16
23
|
it 'has a token expiration' do
|
17
24
|
expect(RARBG::API::TOKEN_EXPIRATION).to be_kind_of(Numeric)
|
18
25
|
end
|
26
|
+
|
27
|
+
it 'has a rate limit' do
|
28
|
+
expect(RARBG::API::RATE_LIMIT).to be_kind_of(Numeric)
|
29
|
+
end
|
19
30
|
end
|
data/spec/rarbg/search_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
RSpec.describe RARBG::API do
|
3
|
+
RSpec.describe 'RARBG::API#search' do
|
4
4
|
before(:all) do
|
5
5
|
@rarbg = RARBG::API.new
|
6
6
|
@token = SecureRandom.hex(5)
|
@@ -29,7 +29,7 @@ RSpec.describe RARBG::API do
|
|
29
29
|
)
|
30
30
|
end
|
31
31
|
|
32
|
-
it 'returns
|
32
|
+
it 'returns an array of hashes' do
|
33
33
|
expect(@rarbg.search(string: 'a search string')).to all(be_an(Hash))
|
34
34
|
end
|
35
35
|
|
@@ -104,4 +104,20 @@ RSpec.describe RARBG::API do
|
|
104
104
|
)
|
105
105
|
end
|
106
106
|
end
|
107
|
+
|
108
|
+
context 'when called from top level namespace' do
|
109
|
+
let(:rarbg_module) { RARBG.clone }
|
110
|
+
|
111
|
+
before(:example) do
|
112
|
+
stub_search(
|
113
|
+
@token
|
114
|
+
)
|
115
|
+
end
|
116
|
+
|
117
|
+
it 'instantiates an API object' do
|
118
|
+
expect { rarbg_module.search(string: 'string') }
|
119
|
+
.to change { rarbg_module.instance_variable_get(:@rarbg).class }
|
120
|
+
.to(RARBG::API)
|
121
|
+
end
|
122
|
+
end
|
107
123
|
end
|
data/spec/rarbg/token_spec.rb
CHANGED
@@ -25,8 +25,8 @@ RSpec.describe RARBG::API do
|
|
25
25
|
expect(@rarbg.token_time).to be_a(Numeric)
|
26
26
|
end
|
27
27
|
|
28
|
-
it '
|
29
|
-
expect(@rarbg.last_request - @rarbg.token_time).to be
|
28
|
+
it 'respects rate limit' do
|
29
|
+
expect(@rarbg.last_request - @rarbg.token_time).to be >= RARBG::API::RATE_LIMIT
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
data/spec/spec_helper.rb
CHANGED
@@ -20,6 +20,9 @@ RSpec.configure do |config|
|
|
20
20
|
# Disable RSpec exposing methods globally on `Module` and `main`
|
21
21
|
config.disable_monkey_patching!
|
22
22
|
|
23
|
+
# Enable temporarily focused examples and groups
|
24
|
+
config.filter_run_when_matching :focus
|
25
|
+
|
23
26
|
config.expect_with :rspec do |c|
|
24
27
|
c.syntax = :expect
|
25
28
|
end
|
data/spec/stubs.rb
CHANGED
@@ -1,17 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Stubs
|
4
|
-
|
5
|
-
APP_ID = 'rarbg-rubygem'
|
4
|
+
API_ENDPOINT = RARBG::API::API_ENDPOINT
|
6
5
|
|
7
6
|
def stub_token(token)
|
8
|
-
stub_request(:get,
|
7
|
+
stub_request(:get, API_ENDPOINT)
|
9
8
|
.with(query: hash_including('get_token' => 'get_token'))
|
10
9
|
.to_return(status: 200, body: { token: token }.to_json)
|
11
10
|
end
|
12
11
|
|
13
12
|
def stub_list(token, params = {}, result = {})
|
14
|
-
stub_request(:get,
|
13
|
+
stub_request(:get, API_ENDPOINT)
|
15
14
|
.with(query: hash_including(params.update(
|
16
15
|
mode: 'list',
|
17
16
|
token: token
|
@@ -20,7 +19,7 @@ module Stubs
|
|
20
19
|
end
|
21
20
|
|
22
21
|
def stub_search(token, params = {}, result = {})
|
23
|
-
stub_request(:get,
|
22
|
+
stub_request(:get, API_ENDPOINT)
|
24
23
|
.with(query: hash_including(params.update(
|
25
24
|
mode: 'search',
|
26
25
|
token: token
|
@@ -29,13 +28,13 @@ module Stubs
|
|
29
28
|
end
|
30
29
|
|
31
30
|
def stub_error(status, error)
|
32
|
-
stub_request(:get,
|
31
|
+
stub_request(:get, API_ENDPOINT)
|
33
32
|
.with(query: hash_including({}))
|
34
33
|
.to_return(status: [status, error])
|
35
34
|
end
|
36
35
|
|
37
36
|
def stub_timeout
|
38
|
-
stub_request(:get,
|
37
|
+
stub_request(:get, API_ENDPOINT)
|
39
38
|
.with(query: hash_including({}))
|
40
39
|
.to_timeout
|
41
40
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rarbg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tommaso Barbato
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05
|
11
|
+
date: 2018-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '3.
|
117
|
+
version: '3.4'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '3.
|
124
|
+
version: '3.4'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: yard
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,7 +136,7 @@ dependencies:
|
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0.9'
|
139
|
-
description: Ruby wrapper for RARBG Torrent API.
|
139
|
+
description: Ruby wrapper for the RARBG Torrent API.
|
140
140
|
email: epistrephein@gmail.com
|
141
141
|
executables: []
|
142
142
|
extensions: []
|
@@ -157,6 +157,7 @@ files:
|
|
157
157
|
- bin/setup
|
158
158
|
- lib/rarbg.rb
|
159
159
|
- lib/rarbg/api.rb
|
160
|
+
- lib/rarbg/categories.rb
|
160
161
|
- lib/rarbg/version.rb
|
161
162
|
- rarbg.gemspec
|
162
163
|
- spec/rarbg/list_spec.rb
|
@@ -171,7 +172,7 @@ licenses:
|
|
171
172
|
metadata:
|
172
173
|
bug_tracker_uri: https://github.com/epistrephein/rarbg/issues
|
173
174
|
changelog_uri: https://github.com/epistrephein/rarbg/blob/master/CHANGELOG.md
|
174
|
-
documentation_uri:
|
175
|
+
documentation_uri: https://www.rubydoc.info/gems/rarbg/1.1.0
|
175
176
|
homepage_uri: https://github.com/epistrephein/rarbg
|
176
177
|
source_code_uri: https://github.com/epistrephein/rarbg
|
177
178
|
post_install_message:
|