jnc_api 0.3.0 → 0.4.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3974d29ba88445303cbe19210402f6b3acfb1ad8aa9ca9ee5f662025f04a9ab0
4
- data.tar.gz: b50c7ba9e5ff1666565241497a974c35fef74ba957037d476d0a169d317b4ad9
3
+ metadata.gz: 3cc8b9a4788d4fe6726d1cec821cb60e0ff1ff88640780181f164b07ce3903e4
4
+ data.tar.gz: b033790ad81e3c75241892bf20a5d43ba4ae173bd62d9518700bb16d231e3a65
5
5
  SHA512:
6
- metadata.gz: f5849dc5efaf3877966a24d1d399e41b1aaacece2969a9e1dcd05924c38712b1906f24d249b3a11144fb888f3edfaea4de1f6e96180463aab5cf64555a875901
7
- data.tar.gz: 0ed4905c22b8ae2ea72d125bab66df8ff544879ecb6f8196afa853457aab45bf5246220c423066566422963d6fbde0bca0fb0775d67f496f757d36f5c25b423a
6
+ metadata.gz: ef496111d1b2ee30d79ccdddac655248238b2d28e14f1ad75e2527af6479461ed5bbdfd2f4eb2481e085c55dd7bb09fc9b7807a37a93a1e74d07704d06cadedc
7
+ data.tar.gz: f382cbb24bf21f55d2f70d9a224d872d3cd729fb948bf5f5abae2cbf38bad101407f15a30600d5df223291c035fe81661f282a442e1b9f654df06086b6be1b1b
@@ -82,7 +82,7 @@ if options[:slug]
82
82
 
83
83
  part.save!
84
84
 
85
- e = api.embed(p["partLegacyId"])
85
+ e = api.embed(p["partId"])
86
86
 
87
87
  part.data = e
88
88
  part.crypt_data = p["cryptData"]
@@ -101,7 +101,7 @@ else
101
101
 
102
102
  # skip items if the feed item is already seen
103
103
  if part.date_published &&
104
- item["date_published"].to_datetime == part.date_published.to_datetime
104
+ item["date_published"].to_datetime == part.date_published.to_datetime
105
105
  puts "Skipping part #{part.slug} (feed item already seen)"
106
106
 
107
107
  next
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JncApi
4
- VERSION = "0.3.0"
4
+ VERSION = "0.4.1"
5
5
  end
data/lib/jnc_api.rb CHANGED
@@ -22,6 +22,19 @@ require "httparty"
22
22
  module JncApi
23
23
  class Error < StandardError
24
24
  end
25
+ V2_ROUTES = {
26
+ login: "https://labs.j-novel.club/app/v2/auth/login",
27
+ logout: "https://labs.j-novel.club/app/v2/auth/logout",
28
+ series: "https://labs.j-novel.club/app/v2/series",
29
+ me: "https://labs.j-novel.club/app/v2/me",
30
+ feed: "https://labs.j-novel.club/feed/user",
31
+ parts: "https://labs.j-novel.club/app/v2/parts",
32
+ embed: "https://labs.j-novel.club/embed/v2",
33
+ completion: "https://labs.j-novel.club/app/v2/me/completion",
34
+ manga_parts: "https://api.j-novel.club/api/mangaParts",
35
+ webpub: "https://m11.j-novel.club/nebel/wp"
36
+ }
37
+
25
38
  V1_ROUTES = {
26
39
  login: "https://labs.j-novel.club/app/v1/auth/login",
27
40
  logout: "https://labs.j-novel.club/app/v1/auth/logout",
@@ -38,13 +51,13 @@ module JncApi
38
51
  class Api
39
52
  attr_reader :token
40
53
 
41
- def self.login(login, password, routes = V1_ROUTES)
54
+ def self.login(login, password, routes = V2_ROUTES)
42
55
  response =
43
56
  HTTParty.post(
44
57
  routes[:login] + "?format=json",
45
58
  body:
46
59
  JSON.generate(
47
- { "login" => login, "password" => password, "slim" => true }
60
+ {"login" => login, "password" => password, "slim" => true}
48
61
  ),
49
62
  headers: {
50
63
  "Content-Type" => "application/json"
@@ -58,7 +71,7 @@ module JncApi
58
71
  end
59
72
  end
60
73
 
61
- def initialize(routes: V1_ROUTES, token: nil)
74
+ def initialize(routes: V2_ROUTES, token: nil)
62
75
  @routes = routes
63
76
  @token = token
64
77
  @default_headers = {
@@ -69,7 +82,7 @@ module JncApi
69
82
  "Accept-Language" => "en-US,en;q=0.5",
70
83
  "Content-Type" => "application/json"
71
84
  }
72
- @bearer = { "Authorization" => "Bearer #{@token}" }
85
+ @bearer = {"Authorization" => "Bearer #{@token}"}
73
86
  end
74
87
 
75
88
  def series_list(limit: 500, skip: 0)
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jnc_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - parasquid
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-07-04 00:00:00.000000000 Z
10
+ date: 2025-05-30 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: httparty
@@ -56,7 +55,6 @@ metadata:
56
55
  homepage_uri: https://codeberg.org/parasquid/jnc_api
57
56
  source_code_uri: https://codeberg.org/parasquid/jnc_api
58
57
  changelog_uri: https://codeberg.org/parasquid/jnc_api/src/branch/main/CHANGELOG.md
59
- post_install_message:
60
58
  rdoc_options: []
61
59
  require_paths:
62
60
  - lib
@@ -71,8 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
69
  - !ruby/object:Gem::Version
72
70
  version: '0'
73
71
  requirements: []
74
- rubygems_version: 3.4.20
75
- signing_key:
72
+ rubygems_version: 3.6.2
76
73
  specification_version: 4
77
74
  summary: Light wrapper for the J-Novel Club API.
78
75
  test_files: []