jikan.rb 0.0.6 → 0.0.7

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: 19f299401ccc7d1e37ae43e6939c51ad0e77c403a84c2fb93fae10b34b4c54c0
4
- data.tar.gz: d507dfe58305d28540442ac844e8c3960ee1226276c5177283e57d0aa44c2b32
3
+ metadata.gz: 83456420d05d7dfe1f706c2d2b29ee63131953b5bcd288f47cd202a803a6fa8a
4
+ data.tar.gz: ce97d2a21bbf3feb35bcc7afc1442012721778fc33871f232b9e87ae5b5582e6
5
5
  SHA512:
6
- metadata.gz: 025d063394b40b9f60fa6a4733e2f382d0954133abb0ef431f184beb37dc4c1d90dc5e44501710901b7474fd97e7595ccf79741b76604b92f540976360fe58e6
7
- data.tar.gz: d1dadb6d7f71e0d5cdbdaac9387862daa204553577f51552599e0287d1275ec79e02edb10a46dae55e1fa8d99ededf1ae0a77a2e2661e36a5f39930aceb74027
6
+ metadata.gz: 9eac3715a9070eee076567f29debbfa1822666d860c46670f8bc0875e97762ab668fb8bf12c15391917711f00bd828d89e5064c4b1d8edbf8889514e3ac2a312
7
+ data.tar.gz: faa4ee18f2fe33b6165a43185989e84201a0350e434aa02949f75c99c9c13e4fb89c9fe2d4b2b70c31c75032aa5582e4b460e56ff3cba77eb797d5c28454f555
@@ -1,74 +1,75 @@
1
- PATH
2
- remote: .
3
- specs:
4
- jikan.rb (0.0.5)
5
- http (~> 3.0.0)
6
- require_all (~> 2.0.0)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- addressable (2.5.2)
12
- public_suffix (>= 2.0.2, < 4.0)
13
- coderay (1.1.2)
14
- crack (0.4.3)
15
- safe_yaml (~> 1.0.0)
16
- diff-lcs (1.3)
17
- domain_name (0.5.20180417)
18
- unf (>= 0.0.5, < 1.0.0)
19
- hashdiff (0.3.7)
20
- http (3.0.0)
21
- addressable (~> 2.3)
22
- http-cookie (~> 1.0)
23
- http-form_data (>= 2.0.0.pre.pre2, < 3)
24
- http_parser.rb (~> 0.6.0)
25
- http-cookie (1.0.3)
26
- domain_name (~> 0.5)
27
- http-form_data (2.1.1)
28
- http_parser.rb (0.6.0)
29
- method_source (0.9.0)
30
- pry (0.11.3)
31
- coderay (~> 1.1.0)
32
- method_source (~> 0.9.0)
33
- public_suffix (3.0.2)
34
- rake (10.5.0)
35
- require_all (2.0.0)
36
- rspec (3.7.0)
37
- rspec-core (~> 3.7.0)
38
- rspec-expectations (~> 3.7.0)
39
- rspec-mocks (~> 3.7.0)
40
- rspec-core (3.7.1)
41
- rspec-support (~> 3.7.0)
42
- rspec-expectations (3.7.0)
43
- diff-lcs (>= 1.2.0, < 2.0)
44
- rspec-support (~> 3.7.0)
45
- rspec-mocks (3.7.0)
46
- diff-lcs (>= 1.2.0, < 2.0)
47
- rspec-support (~> 3.7.0)
48
- rspec-support (3.7.1)
49
- safe_yaml (1.0.4)
50
- unf (0.1.4)
51
- unf_ext
52
- unf_ext (0.0.7.5)
53
- unf_ext (0.0.7.5-x64-mingw32)
54
- vcr (4.0.0)
55
- webmock (3.4.1)
56
- addressable (>= 2.3.6)
57
- crack (>= 0.3.2)
58
- hashdiff
59
-
60
- PLATFORMS
61
- ruby
62
- x64-mingw32
63
-
64
- DEPENDENCIES
65
- bundler (~> 1.16)
66
- jikan.rb!
67
- pry
68
- rake (~> 10.0)
69
- rspec (~> 3.0)
70
- vcr
71
- webmock
72
-
73
- BUNDLED WITH
74
- 1.17.3
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ jikan.rb (0.0.6)
5
+ http (~> 3.0.0)
6
+ require_all (~> 2.0.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ addressable (2.5.2)
12
+ public_suffix (>= 2.0.2, < 4.0)
13
+ coderay (1.1.2)
14
+ crack (0.4.3)
15
+ safe_yaml (~> 1.0.0)
16
+ diff-lcs (1.3)
17
+ domain_name (0.5.20180417)
18
+ unf (>= 0.0.5, < 1.0.0)
19
+ hashdiff (0.3.8)
20
+ http (3.0.0)
21
+ addressable (~> 2.3)
22
+ http-cookie (~> 1.0)
23
+ http-form_data (>= 2.0.0.pre.pre2, < 3)
24
+ http_parser.rb (~> 0.6.0)
25
+ http-cookie (1.0.3)
26
+ domain_name (~> 0.5)
27
+ http-form_data (2.1.1)
28
+ http_parser.rb (0.6.0)
29
+ method_source (0.9.2)
30
+ pry (0.12.2)
31
+ coderay (~> 1.1.0)
32
+ method_source (~> 0.9.0)
33
+ public_suffix (3.0.3)
34
+ rake (10.5.0)
35
+ require_all (2.0.0)
36
+ rspec (3.8.0)
37
+ rspec-core (~> 3.8.0)
38
+ rspec-expectations (~> 3.8.0)
39
+ rspec-mocks (~> 3.8.0)
40
+ rspec-core (3.8.0)
41
+ rspec-support (~> 3.8.0)
42
+ rspec-expectations (3.8.2)
43
+ diff-lcs (>= 1.2.0, < 2.0)
44
+ rspec-support (~> 3.8.0)
45
+ rspec-mocks (3.8.0)
46
+ diff-lcs (>= 1.2.0, < 2.0)
47
+ rspec-support (~> 3.8.0)
48
+ rspec-support (3.8.0)
49
+ safe_yaml (1.0.4)
50
+ unf (0.1.4)
51
+ unf_ext
52
+ unf_ext (0.0.7.5)
53
+ unf_ext (0.0.7.5-x64-mingw32)
54
+ vcr (4.0.0)
55
+ webmock (3.5.1)
56
+ addressable (>= 2.3.6)
57
+ crack (>= 0.3.2)
58
+ hashdiff
59
+
60
+ PLATFORMS
61
+ ruby
62
+ x64-mingw32
63
+ x86_64-linux
64
+
65
+ DEPENDENCIES
66
+ bundler (~> 1.16)
67
+ jikan.rb!
68
+ pry
69
+ rake (~> 10.0)
70
+ rspec (~> 3.0)
71
+ vcr
72
+ webmock
73
+
74
+ BUNDLED WITH
75
+ 1.17.3
data/README.md CHANGED
@@ -2,9 +2,7 @@
2
2
 
3
3
  [![Build Status](https://img.shields.io/travis/Zerocchi/jikan.rb.svg)](https://github.com/Zerocchi/jikan.rb/tree/master) [![Gem Version](https://img.shields.io/gem/v/jikan.rb.svg)](https://rubygems.org/gems/jikan.rb) [![Total Downloads](https://img.shields.io/gem/dt/jikan.rb.svg?colorB=6495ed)](https://rubygems.org/gems/jikan.rb) [![License MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/mit-license.php) [![Dart](https://img.shields.io/badge/language-Ruby-red.svg)](https://www.ruby-lang.org/)
4
4
 
5
- This is a thin Ruby wrapper for [jikan.me](http://jikan.me) inspired by [JikanPy](https://github.com/AWConant/jikanpy). For more information, please refer to [Jikan.ME documentation](https://jikan.me/docs).
6
-
7
- **NOTE: Jikan API changed their base URL to *api.jikan.moe*. Old endpoints will continue to work until May 12th, 2018 ([Announcement](https://jikan.docs.apiary.io/) | [Issue #1](https://github.com/Zerocchi/jikan.rb/issues/1)) so it's strongly suggested that you update the gem to latest version.**
5
+ This is a thin Ruby wrapper for [jikan.moe](http://jikan.moe) inspired by [JikanPy](https://github.com/AWConant/jikanpy). For more information, please refer to [Jikan documentation](https://jikan.docs.apiary.io/).
8
6
 
9
7
  ## Installation
10
8
 
@@ -158,12 +156,28 @@ development program. The seven \"Level 5\" espers are the most powerful in Acade
158
156
 
159
157
  ## RESTv3 Features
160
158
  - [X] Anime
159
+ - [X] Characters Staff
160
+ - [X] Episodes
161
+ - [X] News
162
+ - [X] Pictures
163
+ - [X] Stats
164
+ - [X] Reviews <sup>v3.2</sup>
165
+ - [X] Recommendations <sup>v3.2</sup>
166
+ - [X] User Updates <sup>v3.2</sup>
161
167
  - [X] Manga
168
+ - [ ] Characters
169
+ - [X] News
170
+ - [X] Pictures
171
+ - [X] Stats
172
+ - [X] Reviews <sup>v3.2</sup>
173
+ - [X] Recommendations <sup>v3.2</sup>
174
+ - [X] User Updates <sup>v3.2</sup>
162
175
  - [X] Person
163
176
  - [X] Character
164
177
  - [X] Search
165
178
  - [ ] Advanced Search
166
179
  - [X] Season
180
+ - [X] Later <sup>v3.2</sup>
167
181
  - [ ] User
168
182
  - [X] Profile
169
183
  - [ ] Animelist <sup>raw</sup>
@@ -11,7 +11,7 @@ module Jikan
11
11
 
12
12
  FLAGS = {
13
13
  'anime' => [ :episodes, :characters_staff, :news, :pictures, :videos, :stats, :reviews, :recommendations, :userupdates ],
14
- 'manga' => [ :character, :news, :pictures, :stats, :reviews, :recommendations, :userupdates ],
14
+ 'manga' => [ :characters, :news, :pictures, :stats, :reviews, :recommendations, :userupdates ],
15
15
  'character' => [ :pictures ],
16
16
  'person' => [ :pictures ],
17
17
  'search' => [:anime, :manga, :person, :character],
@@ -52,4 +52,14 @@ module Jikan
52
52
  end
53
53
 
54
54
  class BasicCharacter < Entityography; end
55
+
56
+ class CharacterResult < BasicCharacter
57
+ def alternative_names
58
+ raw['alternative_names']
59
+ end
60
+
61
+ def details(flag=nil)
62
+ Jikan::character_id id, flag
63
+ end
64
+ end
55
65
  end
@@ -89,7 +89,7 @@ module Jikan
89
89
  end
90
90
 
91
91
  class Entityography < BaseEntity
92
- def mal_id
92
+ def id
93
93
  raw['mal_id']
94
94
  end
95
95
 
@@ -101,7 +101,7 @@ module Jikan
101
101
  raw['url']
102
102
  end
103
103
 
104
- def image_url
104
+ def image
105
105
  raw['image_url']
106
106
  end
107
107
 
@@ -58,4 +58,26 @@ module Jikan
58
58
  end
59
59
 
60
60
  class BasicPerson < Entityography; end
61
+
62
+ class PersonResult < BasicPerson
63
+ def alternative_names
64
+ raw['alternative_names']
65
+ end
66
+
67
+ def details(flag=nil)
68
+ Jikan::person_id id, flag
69
+ end
70
+
71
+ def anime
72
+ raw['anime'].map do |a|
73
+ Jikan::BasicAnime(a)
74
+ end
75
+ end
76
+
77
+ def manga
78
+ raw['manga'].map do |m|
79
+ Jikan::BasicManga(m)
80
+ end
81
+ end
82
+ end
61
83
  end
@@ -31,19 +31,23 @@ module Jikan
31
31
  when :manga
32
32
  iter { |i| Jikan::MangaResult.new(i) }
33
33
  when :character
34
- raise NoMethodError, "Character only return raw result for now."
34
+ iter { |i| Jikan::CharacterResult.new(i) }
35
35
  when :person
36
- raise NoMethodError, "Person only return raw result for now."
36
+ iter { |i| Jikan::PersonResult.new(i) }
37
37
  end
38
38
  end
39
39
 
40
40
  private
41
41
 
42
42
  def iter
43
- @raw['results'].map do |item|
44
- if block_given?
45
- yield item
43
+ if @raw.respond_to? 'each'
44
+ @raw['results'].map do |item|
45
+ if block_given?
46
+ yield item
47
+ end
46
48
  end
49
+ else
50
+ raise ClientError, "#{@raw['error']}"
47
51
  end
48
52
  end
49
53
  end
@@ -1,5 +1,5 @@
1
1
  require 'require_all'
2
- require_all 'lib/jikan/models'
2
+ require_rel 'models'
3
3
  require 'jikan/api'
4
4
 
5
5
  module Jikan
@@ -42,7 +42,7 @@ module Jikan
42
42
  elsif flag == :stats
43
43
  Jikan::Stat.new(@json)
44
44
  end
45
-
45
+
46
46
  end
47
47
 
48
48
  def manga_id(id, flag=nil)
@@ -1,3 +1,3 @@
1
1
  module Jikan
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jikan.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zerocchi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-03 00:00:00.000000000 Z
11
+ date: 2019-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http