mangadex 5.3.2 → 5.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 70cb7894526dbcf74e8911b51fa186c5cfdfd2b206ed80e5c52377040a614b7b
4
- data.tar.gz: dc1acb66eeec43f0f07a0d0a99d20d762fdac959e0abeb62893c1ec8eeb4266d
3
+ metadata.gz: 166fb230b0125992e5168515129718a28f7d545c3c1cb07f9bc81e837ad8c2c7
4
+ data.tar.gz: cf310df080bb7fdce3df2fd885aa478de4ae050272e58d97ce6fdbe0b60459af
5
5
  SHA512:
6
- metadata.gz: 515629e3df563f6e4ec848fa45c50e184332d062aff08a6097df51c9870f40a8ff88fac09d918aa7647cd286271c47e1f99032768d99eb211053e363b1a4d1bc
7
- data.tar.gz: 3aef7d8db275e3aa1337f4c6494a41ce2dfcd30acd1058c5351df86f2e745f478c8175b4aca27655cba8eb4ca3ff2be5b01f7dadd7d61d035d993fbf1b234802
6
+ metadata.gz: 4babccf80e64908e70f612d5afb152b00fef108c827cbfc75a273478ee2f1230b6b2366318bab5a3fadb3b2025e0e7a64bed88746c04484d18a9c1a62a241e2a
7
+ data.tar.gz: aebcdeed93c99b1beb9e4723e8371875c21da6629311270cbf2b6ca5c58c55b0dca39e8a222bcd886180ee7b1059e40853948f90a25553da4dea8f1d261b4f44
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mangadex (5.3.1.3)
4
+ mangadex (5.3.2)
5
5
  activesupport (~> 6.1)
6
6
  psych (~> 4.0.1)
7
7
  rest-client (~> 2.1)
@@ -82,7 +82,7 @@ GEM
82
82
  smart_properties (1.16.3)
83
83
  sorbet (0.5.9152)
84
84
  sorbet-static (= 0.5.9152)
85
- sorbet-runtime (0.5.9158)
85
+ sorbet-runtime (0.5.9161)
86
86
  sorbet-static (0.5.9152-universal-darwin-20)
87
87
  sorbet-static (0.5.9152-x86_64-linux)
88
88
  tilt (2.0.10)
@@ -6,6 +6,7 @@ module Mangadex
6
6
 
7
7
  @@user = nil
8
8
  @@version = nil
9
+ @@force_raw_requests = nil
9
10
 
10
11
  sig { returns(T.nilable(String)) }
11
12
  def self.version
@@ -58,6 +59,32 @@ module Mangadex
58
59
  yield
59
60
  end
60
61
  end
62
+
63
+ def self.force_raw_requests(&block)
64
+ if block_given?
65
+ temp_force_raw_requests do
66
+ yield
67
+ end
68
+ else
69
+ !!@@force_raw_requests
70
+ end
71
+ end
72
+
73
+ def self.force_raw_requests=(value)
74
+ @@force_raw_requests = value
75
+ end
76
+
77
+ private
78
+
79
+ def self.temp_force_raw_requests(&block)
80
+ current_force_raw_requests = @@force_raw_requests
81
+ @@force_raw_requests = true
82
+ response = yield
83
+ @@force_raw_requests = current_force_raw_requests
84
+ response
85
+ ensure
86
+ @@force_raw_requests = current_force_raw_requests
87
+ end
61
88
  end
62
89
  end
63
90
  end
@@ -7,6 +7,7 @@ module Mangadex
7
7
 
8
8
  attr_accessor :result, :response, :errors, :data
9
9
  attr_accessor :limit, :offset, :total
10
+ attr_accessor :raw_data
10
11
 
11
12
  def self.attributes_to_inspect
12
13
  %i(result errors limit offset total data)
@@ -44,6 +45,10 @@ module Mangadex
44
45
  Array(errors).any?
45
46
  end
46
47
 
48
+ def as_json(*)
49
+ Hash(raw_data)
50
+ end
51
+
47
52
  private
48
53
 
49
54
  def self.coerce_errors(data)
@@ -60,6 +65,7 @@ module Mangadex
60
65
  )
61
66
  end
62
67
  ),
68
+ raw_data: data,
63
69
  )
64
70
  end
65
71
 
@@ -75,6 +81,7 @@ module Mangadex
75
81
  result: data['result'],
76
82
  response: data['response'],
77
83
  data: klass.from_data(data['data'] || data),
84
+ raw_data: data,
78
85
  )
79
86
  end
80
87
 
@@ -97,6 +104,7 @@ module Mangadex
97
104
  end
98
105
  )
99
106
  ),
107
+ raw_data: data,
100
108
  )
101
109
  end
102
110
  end
@@ -66,6 +66,8 @@ module Mangadex
66
66
  # @return [Mangadex::Api::Response] with a entity of author
67
67
  sig { params(id: String, args: T::Api::Arguments).returns(Mangadex::Api::Response[Author]) }
68
68
  def self.get(id, **args)
69
+ Mangadex::Internal::Definition.must(id)
70
+
69
71
  Mangadex::Internal::Request.get(
70
72
  format('/author/%{id}', id: id),
71
73
  Mangadex::Internal::Definition.validate(args, {
@@ -81,6 +83,8 @@ module Mangadex
81
83
  # @return [Mangadex::Api::Response] with a entity of author
82
84
  sig { params(id: String, args: T::Api::Arguments).returns(Mangadex::Api::Response[Author]) }
83
85
  def self.update(id, **args)
86
+ Mangadex::Internal::Definition.must(id)
87
+
84
88
  Mangadex::Internal::Request.put(
85
89
  format('/author/%{id}', id: id),
86
90
  payload: Mangadex::Internal::Definition.validate(args, {
@@ -98,6 +102,8 @@ module Mangadex
98
102
  # @return [Hash]
99
103
  sig { params(id: String).returns(Hash) }
100
104
  def self.delete(id)
105
+ Mangadex::Internal::Definition.must(id)
106
+
101
107
  Mangadex::Internal::Request.delete(
102
108
  format('/author/%{id}', id: id)
103
109
  )
@@ -107,6 +113,10 @@ module Mangadex
107
113
  [:name]
108
114
  end
109
115
 
116
+ class << self
117
+ alias_method :view, :get
118
+ end
119
+
110
120
  # Indicates if this is an artist
111
121
  #
112
122
  # @return [Boolean] whether this is an artist or not.
@@ -31,6 +31,8 @@ module Mangadex
31
31
 
32
32
  sig { params(id: String, args: T::Api::Arguments).returns(Mangadex::Api::Response[Chapter]) }
33
33
  def self.get(id, **args)
34
+ Mangadex::Internal::Definition.must(id)
35
+
34
36
  Mangadex::Internal::Request.get(
35
37
  '/chapter/%{id}' % {id: id},
36
38
  Mangadex::Internal::Definition.validate(args, {
@@ -41,6 +43,8 @@ module Mangadex
41
43
 
42
44
  sig { params(id: String, args: T::Api::Arguments).returns(Mangadex::Api::Response[Chapter]) }
43
45
  def self.update(id, **args)
46
+ Mangadex::Internal::Definition.must(id)
47
+
44
48
  Mangadex::Internal::Request.put(
45
49
  '/chapter/%{id}' % {id: id},
46
50
  payload: Mangadex::Internal::Definition.validate(args, {
@@ -56,11 +60,17 @@ module Mangadex
56
60
 
57
61
  sig { params(id: String).returns(Hash) }
58
62
  def self.delete(id)
63
+ Mangadex::Internal::Definition.must(id)
64
+
59
65
  Mangadex::Internal::Request.delete(
60
66
  '/chapter/%{id}' % {id: id},
61
67
  )
62
68
  end
63
69
 
70
+ class << self
71
+ alias_method :view, :get
72
+ end
73
+
64
74
  sig { returns(String) }
65
75
  def title
66
76
  attributes&.title.presence || chapter.presence && "Chapter #{chapter}" || "N/A"
@@ -64,7 +64,7 @@ module Mangadex
64
64
 
65
65
  private
66
66
 
67
- sig { params(value: T.any(T::Api::Text, T::Api::ContentRating)).void }
67
+ sig { params(value: T.any(T::Api::Text, T::Api::ContentRating)).returns(T.any(T::Api::Text, T::Api::ContentRating)) }
68
68
  def ensure_value!(value)
69
69
  return value if value.is_a?(ContentRating)
70
70
  return value if VALUES.include?(value)
@@ -47,6 +47,8 @@ module Mangadex
47
47
 
48
48
  sig { params(id: String, args: T::Api::Arguments).returns(Mangadex::Api::Response[CoverArt]) }
49
49
  def self.get(id, **args)
50
+ Mangadex::Internal::Definition.must(id)
51
+
50
52
  Mangadex::Internal::Request.get(
51
53
  '/cover/%{id}' % {id: id},
52
54
  Mangadex::Internal::Definition.validate(args, {
@@ -57,6 +59,8 @@ module Mangadex
57
59
 
58
60
  sig { params(id: String, args: T::Api::Arguments).returns(Mangadex::Api::Response[CoverArt]) }
59
61
  def self.edit(id, **args)
62
+ Mangadex::Internal::Definition.must(id)
63
+
60
64
  Mangadex::Internal::Request.put(
61
65
  '/cover/%{id}' % {id: id},
62
66
  Mangadex::Internal::Definition.validate(args, {
@@ -69,11 +73,18 @@ module Mangadex
69
73
 
70
74
  sig { params(id: String).returns(Hash) }
71
75
  def self.delete(id)
76
+ Mangadex::Internal::Definition.must(id)
77
+
72
78
  Mangadex::Internal::Request.delete(
73
79
  '/cover/%{id}' % {id: id},
74
80
  )
75
81
  end
76
82
 
83
+ class << self
84
+ alias_method :view, :get
85
+ alias_method :update, :edit
86
+ end
87
+
77
88
  sig { params(size: T::Api::Text).returns(T.nilable(String)) }
78
89
  def image_url(size: :small)
79
90
  return unless manga.present?
@@ -24,6 +24,8 @@ module Mangadex
24
24
 
25
25
  sig { params(id: String).returns(Mangadex::Api::Response[CustomList]) }
26
26
  def self.get(id)
27
+ Mangadex::Internal::Definition.must(id)
28
+
27
29
  Mangadex::Internal::Request.get(
28
30
  '/list/%{id}' % {id: id},
29
31
  )
@@ -31,6 +33,8 @@ module Mangadex
31
33
 
32
34
  sig { params(id: String, args: T::Api::Arguments).returns(Mangadex::Api::Response[CustomList]) }
33
35
  def self.update(id, **args)
36
+ Mangadex::Internal::Definition.must(id)
37
+
34
38
  Mangadex::Internal::Request.put(
35
39
  '/list/%{id}' % {id: id},
36
40
  payload: Mangadex::Internal::Definition.validate(args, {
@@ -44,6 +48,8 @@ module Mangadex
44
48
 
45
49
  sig { params(id: String).returns(T::Boolean) }
46
50
  def self.delete(id)
51
+ Mangadex::Internal::Definition.must(id)
52
+
47
53
  Mangadex::Internal::Request.delete(
48
54
  '/list/%{id}' % {id: id},
49
55
  )
@@ -51,6 +57,8 @@ module Mangadex
51
57
 
52
58
  sig { params(id: String, args: T::Api::Arguments).returns(Mangadex::Api::Response[Chapter]) }
53
59
  def self.feed(id, **args)
60
+ Mangadex::Internal::Definition.must(id)
61
+
54
62
  Mangadex::Internal::Request.get(
55
63
  '/list/%{id}/feed' % {id: id},
56
64
  Mangadex::Internal::Definition.chapter_list(args),
@@ -59,6 +67,8 @@ module Mangadex
59
67
 
60
68
  sig { params(id: String, list_id: String).returns(T::Boolean) }
61
69
  def self.add_manga(id, list_id:)
70
+ Mangadex::Internal::Definition.must(id)
71
+
62
72
  response = Mangadex::Internal::Request.post(
63
73
  '/manga/%{id}/list/%{list_id}' % {id: id, list_id: list_id},
64
74
  )
@@ -71,6 +81,8 @@ module Mangadex
71
81
 
72
82
  sig { params(id: String, list_id: String).returns(T::Boolean) }
73
83
  def self.remove_manga(id, list_id:)
84
+ Mangadex::Internal::Definition.must(id)
85
+
74
86
  response = Mangadex::Internal::Request.delete(
75
87
  '/manga/%{id}/list/%{list_id}' % {id: id, list_id: list_id},
76
88
  )
@@ -94,6 +106,8 @@ module Mangadex
94
106
 
95
107
  sig { params(user_id: String, args: T::Api::Arguments).returns(Mangadex::Api::Response[CustomList]) }
96
108
  def self.user_list(user_id, **args)
109
+ Mangadex::Internal::Definition.must(user_id)
110
+
97
111
  Mangadex::Internal::Request.get(
98
112
  '/user/%{id}/list' % {id: user_id},
99
113
  Mangadex::Internal::Definition.validate(args, {
@@ -103,6 +117,11 @@ module Mangadex
103
117
  )
104
118
  end
105
119
 
120
+ class << self
121
+ alias_method :view, :get
122
+ alias_method :edit, :update
123
+ end
124
+
106
125
  sig { params(id: String).returns(T::Boolean) }
107
126
  def add_manga(id)
108
127
  Mangadex::CustomList.add_manga(id, list_id: self.id)
@@ -120,6 +120,19 @@ module Mangadex
120
120
  )
121
121
  end
122
122
 
123
+ def must(*args)
124
+ args = args.each_with_index.map do |arg, index|
125
+ ["arg_at_position_#{index}".to_sym, arg]
126
+ end.to_h
127
+
128
+ definition = args.keys.map do |key|
129
+ [key, { required: true }]
130
+ end.to_h
131
+
132
+ validate(args, definition)
133
+ args.values
134
+ end
135
+
123
136
  def validate(args, definition)
124
137
  args = Hash(args).with_indifferent_access
125
138
  definition = Hash(definition).with_indifferent_access
@@ -144,7 +157,7 @@ module Mangadex
144
157
  if errors.any?
145
158
  error_message = errors.map do |error|
146
159
  if error[:extra]
147
- "params[:#{error[:extra]}] does not exist and cannot be passed to this request"
160
+ "paalidate_required!rams[:#{error[:extra]}] does not exist and cannot be passed to this request"
148
161
  elsif error[:message]
149
162
  error[:message]
150
163
  else
@@ -62,13 +62,15 @@ module Mangadex
62
62
  end_time = Time.now
63
63
  elapsed_time = ((end_time - start_time) * 1000).to_i
64
64
  puts("[#{self.class.name}] took #{elapsed_time} ms")
65
+
66
+ raw_request = raw || Mangadex::Api::Context.force_raw_requests
65
67
 
66
- if @response.body
67
- raw ? @response.body : Mangadex::Api::Response.coerce(JSON.parse(@response.body))
68
+ if (body = @response.body)
69
+ raw_request ? try_json(body) : Mangadex::Api::Response.coerce(try_json(body))
68
70
  end
69
71
  rescue RestClient::Exception => error
70
- if error.response.body
71
- raw ? error.response.body : Mangadex::Api::Response.coerce(JSON.parse(error.response.body)) rescue raise error
72
+ if (body = error.response.body)
73
+ raw_request ? try_json(body) : Mangadex::Api::Response.coerce(JSON.parse(body)) rescue raise error
72
74
  else
73
75
  raise error
74
76
  end
@@ -116,6 +118,12 @@ module Mangadex
116
118
 
117
119
  raise "Invalid method: #{method}. Must be one of: #{ALLOWED_METHODS}"
118
120
  end
121
+
122
+ def try_json(body)
123
+ JSON.parse(body)
124
+ rescue JSON::ParserError
125
+ body
126
+ end
119
127
  end
120
128
  end
121
129
  end
@@ -11,7 +11,8 @@ module Mangadex
11
11
  :id,
12
12
  :type,
13
13
  :attributes,
14
- :relationships
14
+ :relationships,
15
+ :related_type
15
16
 
16
17
  class_methods do
17
18
  USING_ATTRIBUTES = {}
@@ -30,7 +31,7 @@ module Mangadex
30
31
  self.name.split('::').last.underscore
31
32
  end
32
33
 
33
- def from_data(data)
34
+ def from_data(data, related_type: nil)
34
35
  base_class_name = self.name.gsub('::', '_')
35
36
  klass_name = self.name
36
37
  target_attributes_class_name = "#{base_class_name}_Attributes"
@@ -65,6 +66,7 @@ module Mangadex
65
66
  id: data['id'],
66
67
  type: data['type'] || self.type,
67
68
  attributes: attributes,
69
+ related_type: related_type,
68
70
  }
69
71
 
70
72
  initialize_hash.merge!({relationships: relationships}) if relationships.present?
@@ -110,6 +112,13 @@ module Mangadex
110
112
  else
111
113
  super
112
114
  end
115
+ elsif !related_type.nil?
116
+ return super unless method_name.end_with?("?")
117
+
118
+ looking_for_related = method_name.to_s.split("?").first
119
+ return super unless Mangadex::Relationship::RELATED_VALUES.include?(looking_for_related)
120
+
121
+ related_type == looking_for_related
113
122
  else
114
123
  super
115
124
  end
@@ -66,6 +66,8 @@ module Mangadex
66
66
 
67
67
  sig { params(id: String, args: T::Api::Arguments).returns(T::Api::MangaResponse) }
68
68
  def self.view(id, **args)
69
+ Mangadex::Internal::Definition.must(id)
70
+
69
71
  Mangadex::Internal::Request.get(
70
72
  '/manga/%{id}' % {id: id},
71
73
  Mangadex::Internal::Definition.validate(args, {
@@ -76,6 +78,8 @@ module Mangadex
76
78
 
77
79
  sig { params(id: String).returns(T.any(Hash, Mangadex::Api::Response)) }
78
80
  def self.unfollow(id)
81
+ Mangadex::Internal::Definition.must(id)
82
+
79
83
  Mangadex::Internal::Request.delete(
80
84
  '/manga/%{id}/follow' % {id: id},
81
85
  )
@@ -83,6 +87,8 @@ module Mangadex
83
87
 
84
88
  sig { params(id: String).returns(T.any(Hash, Mangadex::Api::Response)) }
85
89
  def self.follow(id)
90
+ Mangadex::Internal::Definition.must(id)
91
+
86
92
  Mangadex::Internal::Request.post(
87
93
  '/manga/%{id}/follow' % {id: id},
88
94
  )
@@ -90,6 +96,8 @@ module Mangadex
90
96
 
91
97
  sig { params(id: String, args: T::Api::Arguments).returns(T::Api::ChapterResponse) }
92
98
  def self.feed(id, **args)
99
+ Mangadex::Internal::Definition.must(id)
100
+
93
101
  Mangadex::Internal::Request.get(
94
102
  '/manga/%{id}/feed' % {id: id},
95
103
  Mangadex::Internal::Definition.chapter_list(args),
@@ -128,6 +136,8 @@ module Mangadex
128
136
 
129
137
  sig { params(id: String).returns(T::Api::GenericResponse) }
130
138
  def self.reading_status(id)
139
+ Mangadex::Internal::Definition.must(id)
140
+
131
141
  Mangadex::Internal::Request.get(
132
142
  '/manga/%{id}/status' % {id: id},
133
143
  )
@@ -135,6 +145,8 @@ module Mangadex
135
145
 
136
146
  sig { params(id: String, status: String).returns(T::Api::GenericResponse) }
137
147
  def self.update_reading_status(id, status)
148
+ Mangadex::Internal::Definition.must(id)
149
+
138
150
  Mangadex::Internal::Request.post(
139
151
  '/manga/%{id}/status' % {id: id},
140
152
  payload: Mangadex::Internal::Definition.validate({status: status}, {
@@ -149,11 +161,15 @@ module Mangadex
149
161
  # Untested API endpoints
150
162
  sig { params(id: String, args: T::Api::Arguments).returns(T::Api::MangaResponse) }
151
163
  def self.update(id, **args)
164
+ Mangadex::Internal::Definition.must(id)
165
+
152
166
  Mangadex::Internal::Request.put('/manga/%{id}' % {id: id}, payload: args)
153
167
  end
154
168
 
155
169
  sig { params(id: String).returns(Hash) }
156
170
  def self.delete(id)
171
+ Mangadex::Internal::Definition.must(id)
172
+
157
173
  Mangadex::Internal::Request.delete(
158
174
  '/manga/%{id}' % {id: id},
159
175
  )
@@ -169,6 +185,8 @@ module Mangadex
169
185
 
170
186
  class << self
171
187
  alias_method :aggregate, :volumes_and_chapters
188
+ alias_method :get, :view
189
+ alias_method :edit, :update
172
190
  end
173
191
 
174
192
  sig { returns(T.nilable(ContentRating)) }
@@ -1,33 +1,45 @@
1
1
  # typed: false
2
2
  module Mangadex
3
3
  class Relationship < MangadexObject
4
- attr_accessor :id, :type, :attributes
4
+ attr_accessor :id, :type, :related, :attributes
5
+
6
+ RELATED_VALUES = %w(
7
+ monochrome
8
+ main_story
9
+ adapted_from
10
+ based_on
11
+ prequel
12
+ side_story
13
+ doujinshi
14
+ same_franchise
15
+ shared_universe
16
+ sequel
17
+ spin_off
18
+ alternate_story
19
+ preserialization
20
+ colored
21
+ serialization
22
+ ).freeze
5
23
 
6
24
  class << self
7
25
  def from_data(data)
8
26
  data = data.with_indifferent_access
9
27
  klass = class_for_relationship_type(data['type'])
10
28
 
11
- return klass.from_data(data) if klass && data['attributes']&.any?
29
+ if klass && data['attributes']&.any?
30
+ return klass.from_data(data, related_type: data['related'])
31
+ end
12
32
 
13
33
  new(
14
34
  id: data['id'],
15
35
  type: data['type'],
16
36
  attributes: OpenStruct.new(data['attributes']),
37
+ related: data['related'],
17
38
  )
18
39
  end
19
40
 
20
41
  private
21
42
 
22
- def build_attributes(data)
23
- klass = class_for_relationship_type(data['type'])
24
- if klass.present?
25
- klass.from_data(data)
26
- else
27
- OpenStruct.new(data['attributes'])
28
- end
29
- end
30
-
31
43
  def class_for_relationship_type(type)
32
44
  module_parts = self.name.split('::')
33
45
  module_name = module_parts.take(module_parts.size - 1).join('::')
@@ -39,8 +51,18 @@ module Mangadex
39
51
  end
40
52
  end
41
53
 
42
- def inspect
43
- "#<#{self.class} id=#{id.inspect} type=#{type.inspect}>"
54
+ def self.attributes_to_inspect
55
+ [:id, :type, :related]
56
+ end
57
+
58
+
59
+ def method_missing(value)
60
+ return super unless value.end_with?("?")
61
+
62
+ looking_for_related = value.to_s.split("?").first
63
+ return super unless RELATED_VALUES.include?(looking_for_related)
64
+
65
+ !related.nil? && related == looking_for_related
44
66
  end
45
67
  end
46
68
  end
@@ -48,6 +48,8 @@ module Mangadex
48
48
  end
49
49
 
50
50
  def view(id)
51
+ Mangadex::Internal::Definition.must(id)
52
+
51
53
  Mangadex::Internal::Request.get(
52
54
  '/group/%{id}' % {id: id},
53
55
  Mangadex::Internal::Definition.validate(args, {
@@ -92,6 +94,11 @@ module Mangadex
92
94
  end
93
95
  end
94
96
 
97
+ class << self
98
+ alias_method :get, :view
99
+ alias_method :edit, :update
100
+ end
101
+
95
102
  def self.inspect_attributes
96
103
  self.attributes - [:version, :created_at, :updated_at]
97
104
  end
@@ -17,7 +17,8 @@ module T
17
17
  MangaResponse = T.type_alias do
18
18
  T.any(
19
19
  Mangadex::Api::Response[Mangadex::Manga],
20
- Mangadex::Api::Response[T::Array[Mangadex::Manga]]
20
+ Mangadex::Api::Response[T::Array[Mangadex::Manga]],
21
+ Hash,
21
22
  )
22
23
  end
23
24
  ChapterResponse = T.type_alias do
@@ -28,6 +28,8 @@ module Mangadex
28
28
  alias_method :begin, :start
29
29
 
30
30
  def upload_images(upload_session_id)
31
+ Mangadex::Internal::Definition.must(upload_session_id)
32
+
31
33
  Mangadex::Internal::Request.post(
32
34
  '/upload/%{upload_session_id}' % {upload_session_id: upload_session_id},
33
35
  payload: Mangadex::Internal::Definition.validate(args, {
@@ -37,6 +39,8 @@ module Mangadex
37
39
  end
38
40
 
39
41
  def abandon(upload_session_id)
42
+ Mangadex::Internal::Definition.must(upload_session_id)
43
+
40
44
  Mangadex::Internal::Request.delete(
41
45
  '/upload/%{upload_session_id}' % {upload_session_id: upload_session_id},
42
46
  )
@@ -44,6 +48,8 @@ module Mangadex
44
48
  alias_method :stop, :abandon
45
49
 
46
50
  def commit(upload_session_id, **args)
51
+ Mangadex::Internal::Definition.must(upload_session_id)
52
+
47
53
  Mangadex::Internal::Request.post(
48
54
  '/upload/%{upload_session_id}/commit' % {upload_session_id: upload_session_id},
49
55
  payload: Mangadex::Internal::Definition.validate(args, {
@@ -54,6 +60,8 @@ module Mangadex
54
60
  end
55
61
 
56
62
  def delete_uploaded_image(upload_session_id, upload_session_file_id)
63
+ Mangadex::Internal::Definition.must(upload_session_id)
64
+
57
65
  Mangadex::Internal::Request.delete(
58
66
  '/upload/%{upload_session_id}/%{upload_session_file_id}' % {
59
67
  upload_session_id: upload_session_id,
@@ -63,6 +71,8 @@ module Mangadex
63
71
  end
64
72
 
65
73
  def delete_uploaded_images(upload_session_id, upload_session_file_ids)
74
+ Mangadex::Internal::Definition.must(upload_session_id)
75
+
66
76
  Mangadex::Internal::Request.delete(
67
77
  '/upload/%{upload_session_id}' % {upload_session_id: upload_session_id},
68
78
  payload: Array(upload_session_file_id),
data/lib/mangadex/user.rb CHANGED
@@ -30,6 +30,8 @@ module Mangadex
30
30
 
31
31
  sig { params(id: String).returns(T::Boolean) }
32
32
  def self.follows_group(id)
33
+ Mangadex::Internal::Definition.must(id)
34
+
33
35
  data = Mangadex::Internal::Request.get(
34
36
  '/user/follows/group/%{id}' % {id: id},
35
37
  raw: true,
@@ -55,6 +57,8 @@ module Mangadex
55
57
 
56
58
  sig { params(id: String).returns(T::Boolean) }
57
59
  def self.follows_user(id)
60
+ Mangadex::Internal::Definition.must(id)
61
+
58
62
  return if Mangadex::Api::Context.user.nil?
59
63
 
60
64
  data = Mangadex::Internal::Request.get(
@@ -83,6 +87,8 @@ module Mangadex
83
87
 
84
88
  sig { params(id: String).returns(T::Boolean) }
85
89
  def self.follows_manga(id)
90
+ Mangadex::Internal::Definition.must(id)
91
+
86
92
  return if Mangadex::Api::Context.user.nil?
87
93
 
88
94
  data = Mangadex::Internal::Request.get(
@@ -3,7 +3,7 @@ module Mangadex
3
3
  module Version
4
4
  MAJOR = "5"
5
5
  MINOR = "3"
6
- TINY = "2"
6
+ TINY = "3"
7
7
  PATCH = nil
8
8
 
9
9
  STRING = [MAJOR, MINOR, TINY].compact.join('.')
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.2
4
+ version: 5.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akinyele Cafe-Febrissy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-26 00:00:00.000000000 Z
11
+ date: 2021-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: psych