mangadex 5.3.1 → 5.3.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 +4 -4
- data/.github/workflows/ruby.yml +36 -0
- data/.gitignore +5 -0
- data/Gemfile.lock +37 -4
- data/README.md +3 -1
- data/lib/mangadex/api/context.rb +47 -37
- data/lib/mangadex/api/response.rb +4 -4
- data/lib/mangadex/api/user.rb +6 -1
- data/lib/mangadex/api/version_checker.rb +31 -0
- data/lib/mangadex/api.rb +1 -1
- data/lib/mangadex/auth.rb +48 -44
- data/lib/mangadex/author.rb +18 -1
- data/lib/mangadex/internal/request.rb +1 -1
- data/lib/mangadex/manga.rb +1 -8
- data/lib/mangadex/scanlation_group.rb +1 -0
- data/lib/mangadex/version.rb +10 -2
- data/mangadex.gemspec +3 -2
- metadata +24 -9
- data/lib/mangadex/api/version.rb +0 -21
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 70cb7894526dbcf74e8911b51fa186c5cfdfd2b206ed80e5c52377040a614b7b
|
|
4
|
+
data.tar.gz: dc1acb66eeec43f0f07a0d0a99d20d762fdac959e0abeb62893c1ec8eeb4266d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 515629e3df563f6e4ec848fa45c50e184332d062aff08a6097df51c9870f40a8ff88fac09d918aa7647cd286271c47e1f99032768d99eb211053e363b1a4d1bc
|
|
7
|
+
data.tar.gz: 3aef7d8db275e3aa1337f4c6494a41ce2dfcd30acd1058c5351df86f2e745f478c8175b4aca27655cba8eb4ca3ff2be5b01f7dadd7d61d035d993fbf1b234802
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
|
2
|
+
# They are provided by a third-party and are governed by
|
|
3
|
+
# separate terms of service, privacy policy, and support
|
|
4
|
+
# documentation.
|
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
|
7
|
+
|
|
8
|
+
name: Ruby
|
|
9
|
+
|
|
10
|
+
on:
|
|
11
|
+
push:
|
|
12
|
+
branches: [culture]
|
|
13
|
+
pull_request:
|
|
14
|
+
branches: [culture]
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
test:
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
strategy:
|
|
20
|
+
matrix:
|
|
21
|
+
ruby-version: ["2.7", "3.0"]
|
|
22
|
+
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v2
|
|
25
|
+
- name: Set up Ruby
|
|
26
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
|
27
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
|
28
|
+
# uses: ruby/setup-ruby@v1
|
|
29
|
+
uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
|
|
30
|
+
with:
|
|
31
|
+
ruby-version: ${{ matrix.ruby-version }}
|
|
32
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
|
33
|
+
- name: Run tests
|
|
34
|
+
run: bundle exec rspec
|
|
35
|
+
- name: Run sorbet typecheck
|
|
36
|
+
run: bundle exec srb tc
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
mangadex (5.3.1)
|
|
4
|
+
mangadex (5.3.1.3)
|
|
5
5
|
activesupport (~> 6.1)
|
|
6
6
|
psych (~> 4.0.1)
|
|
7
7
|
rest-client (~> 2.1)
|
|
@@ -16,11 +16,16 @@ GEM
|
|
|
16
16
|
minitest (>= 5.1)
|
|
17
17
|
tzinfo (~> 2.0)
|
|
18
18
|
zeitwerk (~> 2.3)
|
|
19
|
+
addressable (2.8.0)
|
|
20
|
+
public_suffix (>= 2.0.2, < 5.0)
|
|
19
21
|
coderay (1.1.3)
|
|
20
22
|
concurrent-ruby (1.1.9)
|
|
23
|
+
crack (0.4.5)
|
|
24
|
+
rexml
|
|
21
25
|
diff-lcs (1.4.4)
|
|
22
26
|
domain_name (0.5.20190701)
|
|
23
27
|
unf (>= 0.0.5, < 1.0.0)
|
|
28
|
+
hashdiff (1.0.1)
|
|
24
29
|
http-accept (1.7.0)
|
|
25
30
|
http-cookie (1.0.4)
|
|
26
31
|
domain_name (~> 0.5)
|
|
@@ -31,17 +36,30 @@ GEM
|
|
|
31
36
|
mime-types-data (~> 3.2015)
|
|
32
37
|
mime-types-data (3.2021.0901)
|
|
33
38
|
minitest (5.14.4)
|
|
39
|
+
mustermann (1.1.1)
|
|
40
|
+
ruby2_keywords (~> 0.0.1)
|
|
34
41
|
netrc (0.11.0)
|
|
35
42
|
pry (0.14.1)
|
|
36
43
|
coderay (~> 1.1)
|
|
37
44
|
method_source (~> 1.0)
|
|
38
45
|
psych (4.0.1)
|
|
39
|
-
|
|
46
|
+
public_suffix (4.0.6)
|
|
47
|
+
rack (2.2.3)
|
|
48
|
+
rack-protection (2.1.0)
|
|
49
|
+
rack
|
|
50
|
+
rake (13.0.6)
|
|
51
|
+
request_interceptor (1.0.0)
|
|
52
|
+
activesupport (>= 4.0)
|
|
53
|
+
rack
|
|
54
|
+
sinatra
|
|
55
|
+
smart_properties (~> 1.0)
|
|
56
|
+
webmock (~> 3.0)
|
|
40
57
|
rest-client (2.1.0)
|
|
41
58
|
http-accept (>= 1.7.0, < 2.0)
|
|
42
59
|
http-cookie (>= 1.0.2, < 2.0)
|
|
43
60
|
mime-types (>= 1.16, < 4.0)
|
|
44
61
|
netrc (~> 0.8)
|
|
62
|
+
rexml (3.2.5)
|
|
45
63
|
rspec (3.10.0)
|
|
46
64
|
rspec-core (~> 3.10.0)
|
|
47
65
|
rspec-expectations (~> 3.10.0)
|
|
@@ -55,25 +73,40 @@ GEM
|
|
|
55
73
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
56
74
|
rspec-support (~> 3.10.0)
|
|
57
75
|
rspec-support (3.10.2)
|
|
76
|
+
ruby2_keywords (0.0.5)
|
|
77
|
+
sinatra (2.1.0)
|
|
78
|
+
mustermann (~> 1.0)
|
|
79
|
+
rack (~> 2.2)
|
|
80
|
+
rack-protection (= 2.1.0)
|
|
81
|
+
tilt (~> 2.0)
|
|
82
|
+
smart_properties (1.16.3)
|
|
58
83
|
sorbet (0.5.9152)
|
|
59
84
|
sorbet-static (= 0.5.9152)
|
|
60
|
-
sorbet-runtime (0.5.
|
|
85
|
+
sorbet-runtime (0.5.9158)
|
|
61
86
|
sorbet-static (0.5.9152-universal-darwin-20)
|
|
87
|
+
sorbet-static (0.5.9152-x86_64-linux)
|
|
88
|
+
tilt (2.0.10)
|
|
62
89
|
tzinfo (2.0.4)
|
|
63
90
|
concurrent-ruby (~> 1.0)
|
|
64
91
|
unf (0.1.4)
|
|
65
92
|
unf_ext
|
|
66
93
|
unf_ext (0.0.8)
|
|
94
|
+
webmock (3.14.0)
|
|
95
|
+
addressable (>= 2.8.0)
|
|
96
|
+
crack (>= 0.3.2)
|
|
97
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
|
67
98
|
zeitwerk (2.4.2)
|
|
68
99
|
|
|
69
100
|
PLATFORMS
|
|
70
101
|
x86_64-darwin-20
|
|
102
|
+
x86_64-linux
|
|
71
103
|
|
|
72
104
|
DEPENDENCIES
|
|
73
105
|
bundler (~> 2.2.19)
|
|
74
106
|
mangadex!
|
|
75
107
|
pry
|
|
76
|
-
rake (~>
|
|
108
|
+
rake (~> 13.0)
|
|
109
|
+
request_interceptor (~> 1.0.0)
|
|
77
110
|
rspec (~> 3.0)
|
|
78
111
|
sorbet
|
|
79
112
|
|
data/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
[](https://github.com/thedrummeraki/mangadex/actions/workflows/ruby.yml)<a href="https://rubygems.org/gems/mangadex"><img src="https://badgen.net/rubygems/v/mangadex" /></a>
|
|
2
|
+
|
|
1
3
|
# Mangadex
|
|
2
4
|
|
|
3
5
|
Welcome to `mangadex`, your next favourite Ruby gem for interacting with [Mangadex](https://mangadex.org).
|
|
@@ -20,7 +22,7 @@ Or install it yourself as:
|
|
|
20
22
|
|
|
21
23
|
## Usage
|
|
22
24
|
|
|
23
|
-
Please note that I tried my best to follow Mangadex's naming conventions for [their documentation](https://api.mangadex.org).
|
|
25
|
+
Please note that I tried my best to follow Mangadex's naming conventions for [their documentation](https://api.mangadex.org). Track the progress [here in an issue](https://github.com/thedrummeraki/mangadex/issues/5).
|
|
24
26
|
To find out how to use the gem, you're welcome to [check this out](lib/mangadex).
|
|
25
27
|
|
|
26
28
|
## Development
|
data/lib/mangadex/api/context.rb
CHANGED
|
@@ -2,50 +2,60 @@
|
|
|
2
2
|
module Mangadex
|
|
3
3
|
module Api
|
|
4
4
|
class Context
|
|
5
|
+
extend T::Sig
|
|
6
|
+
|
|
5
7
|
@@user = nil
|
|
8
|
+
@@version = nil
|
|
6
9
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
end
|
|
10
|
+
sig { returns(T.nilable(String)) }
|
|
11
|
+
def self.version
|
|
12
|
+
return @@version unless @@version.nil?
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
)
|
|
20
|
-
elsif user.is_a?(Hash)
|
|
21
|
-
user = user.with_indifferent_access
|
|
22
|
-
|
|
23
|
-
@@user = Mangadex::Api::User.new(
|
|
24
|
-
user[:mangadex_user_id],
|
|
25
|
-
session: user[:session],
|
|
26
|
-
refresh: user[:refresh],
|
|
27
|
-
)
|
|
28
|
-
elsif user.nil?
|
|
29
|
-
@@user = nil
|
|
30
|
-
else
|
|
31
|
-
raise ArgumentError, "Must be an instance of #{Mangadex::Api::User}, #{Mangadex::User} or Hash"
|
|
32
|
-
end
|
|
33
|
-
end
|
|
14
|
+
@@version = Mangadex::Api::Version.check_mangadex_version
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
sig { returns(T.nilable(Mangadex::Api::User)) }
|
|
18
|
+
def self.user
|
|
19
|
+
@@user&.with_valid_session
|
|
20
|
+
end
|
|
34
21
|
|
|
35
|
-
|
|
36
|
-
|
|
22
|
+
sig { params(user: T.nilable(T.any(Hash, Mangadex::Api::User, Mangadex::User))).void }
|
|
23
|
+
def self.user=(user)
|
|
24
|
+
if user.is_a?(Mangadex::Api::User)
|
|
37
25
|
@@user = user
|
|
38
|
-
|
|
39
|
-
@@user =
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
26
|
+
elsif user.is_a?(Mangadex::User)
|
|
27
|
+
@@user = Mangadex::Api::User.new(
|
|
28
|
+
user.id,
|
|
29
|
+
data: user,
|
|
30
|
+
)
|
|
31
|
+
elsif user.is_a?(Hash)
|
|
32
|
+
user = user.with_indifferent_access
|
|
33
|
+
|
|
34
|
+
@@user = Mangadex::Api::User.new(
|
|
35
|
+
user[:mangadex_user_id],
|
|
36
|
+
session: user[:session],
|
|
37
|
+
refresh: user[:refresh],
|
|
38
|
+
)
|
|
39
|
+
elsif user.nil?
|
|
40
|
+
@@user = nil
|
|
43
41
|
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
sig { params(user: T.nilable(T.any(Hash, Mangadex::Api::User, Mangadex::User)), block: T.proc.returns(T.untyped)).returns(T.untyped) }
|
|
45
|
+
def self.with_user(user, &block)
|
|
46
|
+
current_user = @@user
|
|
47
|
+
@@user = user
|
|
48
|
+
response = yield
|
|
49
|
+
@@user = current_user
|
|
50
|
+
response
|
|
51
|
+
ensure
|
|
52
|
+
@@user = current_user
|
|
53
|
+
end
|
|
44
54
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
55
|
+
sig { params(block: T.proc.returns(T.untyped)).returns(T.untyped) }
|
|
56
|
+
def self.without_user(&block)
|
|
57
|
+
with_user(nil) do
|
|
58
|
+
yield
|
|
49
59
|
end
|
|
50
60
|
end
|
|
51
61
|
end
|
|
@@ -40,6 +40,10 @@ module Mangadex
|
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
+
def errored?
|
|
44
|
+
Array(errors).any?
|
|
45
|
+
end
|
|
46
|
+
|
|
43
47
|
private
|
|
44
48
|
|
|
45
49
|
def self.coerce_errors(data)
|
|
@@ -95,10 +99,6 @@ module Mangadex
|
|
|
95
99
|
),
|
|
96
100
|
)
|
|
97
101
|
end
|
|
98
|
-
|
|
99
|
-
def errored?
|
|
100
|
-
Array(errors).any?
|
|
101
|
-
end
|
|
102
102
|
end
|
|
103
103
|
end
|
|
104
104
|
end
|
data/lib/mangadex/api/user.rb
CHANGED
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
module Mangadex
|
|
3
3
|
module Api
|
|
4
4
|
class User
|
|
5
|
+
extend T::Sig
|
|
6
|
+
|
|
5
7
|
attr_accessor :mangadex_user_id, :session, :refresh, :session_valid_until
|
|
6
8
|
attr_reader :data
|
|
7
9
|
|
|
10
|
+
sig { params(mangadex_user_id: String, session: T.nilable(String), refresh: T.nilable(String), data: T.untyped).void }
|
|
8
11
|
def initialize(mangadex_user_id, session: nil, refresh: nil, data: nil)
|
|
9
12
|
raise ArgumentError, 'Missing mangadex_user_id' if mangadex_user_id.to_s.empty?
|
|
10
13
|
|
|
@@ -15,9 +18,9 @@ module Mangadex
|
|
|
15
18
|
@data = data
|
|
16
19
|
end
|
|
17
20
|
|
|
18
|
-
# nil: Nothing happened, no need to refresh the token
|
|
19
21
|
# true: The tokens were successfully refreshed
|
|
20
22
|
# false: Error: refresh token empty or could not refresh the token on the server
|
|
23
|
+
sig { returns(T::Boolean) }
|
|
21
24
|
def refresh!
|
|
22
25
|
return false if refresh.nil?
|
|
23
26
|
|
|
@@ -33,6 +36,7 @@ module Mangadex
|
|
|
33
36
|
true
|
|
34
37
|
end
|
|
35
38
|
|
|
39
|
+
sig { returns(Mangadex::Api::User) }
|
|
36
40
|
def with_valid_session
|
|
37
41
|
session_expired? && refresh!
|
|
38
42
|
self
|
|
@@ -40,6 +44,7 @@ module Mangadex
|
|
|
40
44
|
self
|
|
41
45
|
end
|
|
42
46
|
|
|
47
|
+
sig { returns(T::Boolean) }
|
|
43
48
|
def session_expired?
|
|
44
49
|
@session_valid_until.nil? || @session_valid_until <= Time.now
|
|
45
50
|
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
require "psych"
|
|
3
|
+
|
|
4
|
+
module Mangadex
|
|
5
|
+
module Api
|
|
6
|
+
class Version
|
|
7
|
+
extend T::Sig
|
|
8
|
+
|
|
9
|
+
sig { returns(T.nilable(String)) }
|
|
10
|
+
def self.check_mangadex_version
|
|
11
|
+
puts("Checking Mangadex's latest API version...")
|
|
12
|
+
version = Psych.load(
|
|
13
|
+
RestClient.get(
|
|
14
|
+
'https://api.mangadex.org/api.yaml',
|
|
15
|
+
).body,
|
|
16
|
+
).dig('info', 'version')
|
|
17
|
+
|
|
18
|
+
if version != Mangadex::Version::STRING
|
|
19
|
+
warn(
|
|
20
|
+
"[Warning] This gem is compatible with #{Mangadex::Version::STRING} but it looks like Mangadex is at #{version}",
|
|
21
|
+
"[Warning] Check out #{Mangadex::Internal::Request::BASE_URI} for more information.",
|
|
22
|
+
)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
version
|
|
26
|
+
rescue => error
|
|
27
|
+
nil
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
data/lib/mangadex/api.rb
CHANGED
data/lib/mangadex/auth.rb
CHANGED
|
@@ -1,56 +1,60 @@
|
|
|
1
1
|
# typed: false
|
|
2
2
|
module Mangadex
|
|
3
3
|
class Auth
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
4
|
+
extend T::Sig
|
|
5
|
+
|
|
6
|
+
sig { params(username: String, password: String).returns(T.any(T::Boolean, Mangadex::Api::Response)) }
|
|
7
|
+
def self.login(username, password)
|
|
8
|
+
response = Mangadex::Internal::Request.post(
|
|
9
|
+
'/auth/login',
|
|
10
|
+
payload: {
|
|
11
|
+
username: username,
|
|
12
|
+
password: password,
|
|
13
|
+
},
|
|
14
|
+
)
|
|
15
|
+
return response if response.is_a?(Mangadex::Api::Response) && response.errored?
|
|
16
|
+
|
|
17
|
+
session = response.dig('token', 'session')
|
|
18
|
+
refresh = response.dig('token', 'refresh')
|
|
19
|
+
|
|
20
|
+
mangadex_user = Mangadex::Internal::Request.get('/user/me', headers: { Authorization: session })
|
|
21
|
+
|
|
22
|
+
user = Mangadex::Api::User.new(
|
|
23
|
+
mangadex_user.data.id,
|
|
24
|
+
session: session,
|
|
25
|
+
refresh: refresh,
|
|
26
|
+
data: mangadex_user.data,
|
|
27
|
+
)
|
|
28
|
+
Mangadex::Api::Context.user = user
|
|
29
|
+
!user.session_expired?
|
|
30
|
+
end
|
|
19
31
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
32
|
+
sig { returns(Hash) }
|
|
33
|
+
def self.check_token
|
|
34
|
+
JSON.parse(
|
|
35
|
+
Mangadex::Internal::Request.get(
|
|
36
|
+
'/auth/check',
|
|
37
|
+
raw: true,
|
|
25
38
|
)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def check_token
|
|
31
|
-
JSON.parse(
|
|
32
|
-
Mangadex::Internal::Request.get(
|
|
33
|
-
'/auth/check',
|
|
34
|
-
raw: true,
|
|
35
|
-
)
|
|
36
|
-
)
|
|
37
|
-
end
|
|
39
|
+
)
|
|
40
|
+
end
|
|
38
41
|
|
|
39
|
-
|
|
40
|
-
|
|
42
|
+
sig { returns(T.any(T::Boolean, Mangadex::Api::Response)) }
|
|
43
|
+
def self.logout
|
|
44
|
+
return true if Mangadex::Api::Context.user.nil?
|
|
41
45
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
response = Mangadex::Internal::Request.post(
|
|
47
|
+
'/auth/logout',
|
|
48
|
+
)
|
|
49
|
+
return reponse if response.is_a?(Mangadex::Api::Response) && response.errored?
|
|
46
50
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
Mangadex::Api::Context.user = nil
|
|
52
|
+
true
|
|
53
|
+
end
|
|
50
54
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
55
|
+
sig { returns(T::Boolean) }
|
|
56
|
+
def self.refresh_token
|
|
57
|
+
!(Mangadex::Api::Context.user&.refresh!).nil?
|
|
54
58
|
end
|
|
55
59
|
end
|
|
56
60
|
end
|
data/lib/mangadex/author.rb
CHANGED
|
@@ -4,7 +4,24 @@ require_relative 'mangadex_object'
|
|
|
4
4
|
|
|
5
5
|
module Mangadex
|
|
6
6
|
class Author < MangadexObject
|
|
7
|
-
has_attributes
|
|
7
|
+
has_attributes \
|
|
8
|
+
:name,
|
|
9
|
+
:image_url,
|
|
10
|
+
:biography,
|
|
11
|
+
:twitter,
|
|
12
|
+
:pixiv,
|
|
13
|
+
:melon_book,
|
|
14
|
+
:fan_box,
|
|
15
|
+
:booth,
|
|
16
|
+
:nicovideo,
|
|
17
|
+
:skeb,
|
|
18
|
+
:fantia,
|
|
19
|
+
:tumblr,
|
|
20
|
+
:youtube,
|
|
21
|
+
:website,
|
|
22
|
+
:version,
|
|
23
|
+
:created_at,
|
|
24
|
+
:updated_at
|
|
8
25
|
|
|
9
26
|
# List all authors.
|
|
10
27
|
# Path: +GET /author+
|
|
@@ -68,7 +68,7 @@ module Mangadex
|
|
|
68
68
|
end
|
|
69
69
|
rescue RestClient::Exception => error
|
|
70
70
|
if error.response.body
|
|
71
|
-
raw ? error.response.body : Mangadex::Api::Response.coerce(JSON.parse(error.response.body))
|
|
71
|
+
raw ? error.response.body : Mangadex::Api::Response.coerce(JSON.parse(error.response.body)) rescue raise error
|
|
72
72
|
else
|
|
73
73
|
raise error
|
|
74
74
|
end
|
data/lib/mangadex/manga.rb
CHANGED
|
@@ -114,7 +114,7 @@ module Mangadex
|
|
|
114
114
|
end
|
|
115
115
|
|
|
116
116
|
sig { params(args: T::Api::Arguments).returns(T::Api::GenericResponse) }
|
|
117
|
-
def self.
|
|
117
|
+
def self.all_reading_status(**args)
|
|
118
118
|
Mangadex::Internal::Request.get(
|
|
119
119
|
'/manga/status',
|
|
120
120
|
Mangadex::Internal::Definition.validate(args, {
|
|
@@ -133,13 +133,6 @@ module Mangadex
|
|
|
133
133
|
)
|
|
134
134
|
end
|
|
135
135
|
|
|
136
|
-
sig { returns(T::Api::GenericResponse) }
|
|
137
|
-
def self.all_reading_status
|
|
138
|
-
Mangadex::Internal::Request.get(
|
|
139
|
-
'/manga/status',
|
|
140
|
-
)
|
|
141
|
-
end
|
|
142
|
-
|
|
143
136
|
sig { params(id: String, status: String).returns(T::Api::GenericResponse) }
|
|
144
137
|
def self.update_reading_status(id, status)
|
|
145
138
|
Mangadex::Internal::Request.post(
|
data/lib/mangadex/version.rb
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
# typed:
|
|
1
|
+
# typed: false
|
|
2
2
|
module Mangadex
|
|
3
|
-
|
|
3
|
+
module Version
|
|
4
|
+
MAJOR = "5"
|
|
5
|
+
MINOR = "3"
|
|
6
|
+
TINY = "2"
|
|
7
|
+
PATCH = nil
|
|
8
|
+
|
|
9
|
+
STRING = [MAJOR, MINOR, TINY].compact.join('.')
|
|
10
|
+
FULL = [MAJOR, MINOR, TINY, PATCH].compact.join('.')
|
|
11
|
+
end
|
|
4
12
|
end
|
data/mangadex.gemspec
CHANGED
|
@@ -5,7 +5,7 @@ require "mangadex/version"
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = "mangadex"
|
|
8
|
-
spec.version = Mangadex::
|
|
8
|
+
spec.version = Mangadex::Version::FULL
|
|
9
9
|
spec.authors = ["Akinyele Cafe-Febrissy"]
|
|
10
10
|
spec.email = ["me@akinyele.ca"]
|
|
11
11
|
|
|
@@ -28,8 +28,9 @@ Gem::Specification.new do |spec|
|
|
|
28
28
|
spec.add_dependency "sorbet-runtime"
|
|
29
29
|
|
|
30
30
|
spec.add_development_dependency "bundler", "~> 2.2.19"
|
|
31
|
-
spec.add_development_dependency "rake", "~>
|
|
31
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
|
32
32
|
spec.add_development_dependency "rspec", "~> 3.0"
|
|
33
|
+
spec.add_development_dependency "request_interceptor", "~> 1.0.0"
|
|
33
34
|
spec.add_development_dependency "pry"
|
|
34
35
|
spec.add_development_dependency "sorbet"
|
|
35
36
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mangadex
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.3.
|
|
4
|
+
version: 5.3.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Akinyele Cafe-Febrissy
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-09-
|
|
11
|
+
date: 2021-09-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: psych
|
|
@@ -86,14 +86,14 @@ dependencies:
|
|
|
86
86
|
requirements:
|
|
87
87
|
- - "~>"
|
|
88
88
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: '
|
|
89
|
+
version: '13.0'
|
|
90
90
|
type: :development
|
|
91
91
|
prerelease: false
|
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
93
|
requirements:
|
|
94
94
|
- - "~>"
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: '
|
|
96
|
+
version: '13.0'
|
|
97
97
|
- !ruby/object:Gem::Dependency
|
|
98
98
|
name: rspec
|
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -108,6 +108,20 @@ dependencies:
|
|
|
108
108
|
- - "~>"
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
110
|
version: '3.0'
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: request_interceptor
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - "~>"
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: 1.0.0
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - "~>"
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: 1.0.0
|
|
111
125
|
- !ruby/object:Gem::Dependency
|
|
112
126
|
name: pry
|
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -136,13 +150,14 @@ dependencies:
|
|
|
136
150
|
- - ">="
|
|
137
151
|
- !ruby/object:Gem::Version
|
|
138
152
|
version: '0'
|
|
139
|
-
description:
|
|
153
|
+
description:
|
|
140
154
|
email:
|
|
141
155
|
- me@akinyele.ca
|
|
142
156
|
executables: []
|
|
143
157
|
extensions: []
|
|
144
158
|
extra_rdoc_files: []
|
|
145
159
|
files:
|
|
160
|
+
- ".github/workflows/ruby.yml"
|
|
146
161
|
- ".gitignore"
|
|
147
162
|
- ".rspec"
|
|
148
163
|
- ".ruby-version"
|
|
@@ -162,7 +177,7 @@ files:
|
|
|
162
177
|
- lib/mangadex/api/context.rb
|
|
163
178
|
- lib/mangadex/api/response.rb
|
|
164
179
|
- lib/mangadex/api/user.rb
|
|
165
|
-
- lib/mangadex/api/
|
|
180
|
+
- lib/mangadex/api/version_checker.rb
|
|
166
181
|
- lib/mangadex/artist.rb
|
|
167
182
|
- lib/mangadex/auth.rb
|
|
168
183
|
- lib/mangadex/author.rb
|
|
@@ -221,7 +236,7 @@ homepage: https://github.com/thedrummeraki/mangadex
|
|
|
221
236
|
licenses:
|
|
222
237
|
- MIT
|
|
223
238
|
metadata: {}
|
|
224
|
-
post_install_message:
|
|
239
|
+
post_install_message:
|
|
225
240
|
rdoc_options: []
|
|
226
241
|
require_paths:
|
|
227
242
|
- lib
|
|
@@ -237,7 +252,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
237
252
|
version: '0'
|
|
238
253
|
requirements: []
|
|
239
254
|
rubygems_version: 3.2.15
|
|
240
|
-
signing_key:
|
|
255
|
+
signing_key:
|
|
241
256
|
specification_version: 4
|
|
242
257
|
summary: Your next favourite Ruby gem for interacting with Mangadex.org
|
|
243
258
|
test_files: []
|
data/lib/mangadex/api/version.rb
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# typed: true
|
|
2
|
-
require "psych"
|
|
3
|
-
|
|
4
|
-
module Mangadex
|
|
5
|
-
module Api
|
|
6
|
-
VERSION = -> do
|
|
7
|
-
version = Psych.load(
|
|
8
|
-
RestClient.get(
|
|
9
|
-
'https://api.mangadex.org/api.yaml',
|
|
10
|
-
).body,
|
|
11
|
-
).dig('info', 'version')
|
|
12
|
-
|
|
13
|
-
if version != Mangadex::VERSION
|
|
14
|
-
warn(
|
|
15
|
-
"[Warning] This gem is compatible with #{Mangadex::VERSION} but it looks like Mangadex is at #{version}",
|
|
16
|
-
"[Warning] Check out #{Mangadex::Internal::Request::BASE_URI} for more information.",
|
|
17
|
-
)
|
|
18
|
-
end
|
|
19
|
-
end.call
|
|
20
|
-
end
|
|
21
|
-
end
|