jikan.rb 0.0.5 → 0.0.6

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: 971bed76b2d5470bd3a9d57a1cae05ced806330eb140821655e434852943f513
4
- data.tar.gz: 2b4cf04b02844c80949e147d05c106cb622d0d9657bdeaf1429c67bc96a167d3
3
+ metadata.gz: 19f299401ccc7d1e37ae43e6939c51ad0e77c403a84c2fb93fae10b34b4c54c0
4
+ data.tar.gz: d507dfe58305d28540442ac844e8c3960ee1226276c5177283e57d0aa44c2b32
5
5
  SHA512:
6
- metadata.gz: 5106a49bf5dd64b88c015c211917d07a5aefcb5562b1f327a5754986af1e0ef962cf5bfcb5c2884ef663a04b466dbed0a59a20123f3460f3ef7e73b9c2ebc9e4
7
- data.tar.gz: 1bd220aa56539cf7eef6244cfcb154204ec2e899bc29a2a4401863f853eb54b19f5f7bfaffb6a87d460068f3799e81bb2d3d2bbe971b50986e3e805de73253b6
6
+ metadata.gz: 025d063394b40b9f60fa6a4733e2f382d0954133abb0ef431f184beb37dc4c1d90dc5e44501710901b7474fd97e7595ccf79741b76604b92f540976360fe58e6
7
+ data.tar.gz: d1dadb6d7f71e0d5cdbdaac9387862daa204553577f51552599e0287d1275ec79e02edb10a46dae55e1fa8d99ededf1ae0a77a2e2661e36a5f39930aceb74027
data/.gitignore CHANGED
@@ -1,14 +1,17 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
-
10
- # rspec failure tracking
11
- .rspec_status
12
-
13
- # swap files
14
- *.swp
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+ # swap files
14
+ *.swp
15
+
16
+ # gem files
17
+ *.gem
data/.rspec CHANGED
@@ -1,3 +1,3 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -1,5 +1,5 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.5.0
5
- before_install: gem install bundler
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.5.0
5
+ before_install: gem install bundler
@@ -1,74 +1,74 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at slaveration@gmail.com. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at slaveration@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
- source "https://rubygems.org"
2
-
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
-
5
- # Specify your gem's dependencies in jikan.gemspec
6
- gemspec
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in jikan.gemspec
6
+ gemspec
@@ -1,8 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jikan.rb (0.0.4)
4
+ jikan.rb (0.0.5)
5
5
  http (~> 3.0.0)
6
+ require_all (~> 2.0.0)
6
7
 
7
8
  GEM
8
9
  remote: https://rubygems.org/
@@ -13,7 +14,7 @@ GEM
13
14
  crack (0.4.3)
14
15
  safe_yaml (~> 1.0.0)
15
16
  diff-lcs (1.3)
16
- domain_name (0.5.20170404)
17
+ domain_name (0.5.20180417)
17
18
  unf (>= 0.0.5, < 1.0.0)
18
19
  hashdiff (0.3.7)
19
20
  http (3.0.0)
@@ -23,14 +24,15 @@ GEM
23
24
  http_parser.rb (~> 0.6.0)
24
25
  http-cookie (1.0.3)
25
26
  domain_name (~> 0.5)
26
- http-form_data (2.0.0)
27
+ http-form_data (2.1.1)
27
28
  http_parser.rb (0.6.0)
28
29
  method_source (0.9.0)
29
30
  pry (0.11.3)
30
31
  coderay (~> 1.1.0)
31
32
  method_source (~> 0.9.0)
32
- public_suffix (3.0.1)
33
+ public_suffix (3.0.2)
33
34
  rake (10.5.0)
35
+ require_all (2.0.0)
34
36
  rspec (3.7.0)
35
37
  rspec-core (~> 3.7.0)
36
38
  rspec-expectations (~> 3.7.0)
@@ -43,19 +45,21 @@ GEM
43
45
  rspec-mocks (3.7.0)
44
46
  diff-lcs (>= 1.2.0, < 2.0)
45
47
  rspec-support (~> 3.7.0)
46
- rspec-support (3.7.0)
48
+ rspec-support (3.7.1)
47
49
  safe_yaml (1.0.4)
48
50
  unf (0.1.4)
49
51
  unf_ext
50
52
  unf_ext (0.0.7.5)
53
+ unf_ext (0.0.7.5-x64-mingw32)
51
54
  vcr (4.0.0)
52
- webmock (3.3.0)
55
+ webmock (3.4.1)
53
56
  addressable (>= 2.3.6)
54
57
  crack (>= 0.3.2)
55
58
  hashdiff
56
59
 
57
60
  PLATFORMS
58
61
  ruby
62
+ x64-mingw32
59
63
 
60
64
  DEPENDENCIES
61
65
  bundler (~> 1.16)
@@ -67,4 +71,4 @@ DEPENDENCIES
67
71
  webmock
68
72
 
69
73
  BUNDLED WITH
70
- 1.16.1
74
+ 1.17.3
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2018 Zerocchi
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Zerocchi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,175 +1,200 @@
1
- # Jikan.rb
2
-
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
-
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.**
8
-
9
- ## Installation
10
-
11
- Add this line to your application's Gemfile:
12
-
13
- ```ruby
14
- gem 'jikan.rb'
15
- ```
16
-
17
- And then execute:
18
-
19
- $ bundle
20
-
21
- Or install it yourself as:
22
-
23
- $ gem install jikan.rb
24
-
25
- ## Usage
26
-
27
- ```diff
28
- - NOTE: As per documentation there's a rate limit of 2000 requests per IP per day, and two concurrent requests
29
- - per second. This wrapper does not have any attempt of blocking the limit so please use it wisely.
30
- - More information available at https://jikan.docs.apiary.io/#introduction/information
31
- ```
32
-
33
- **Get anime and manga information based on their ID**
34
-
35
- ```ruby
36
- # https://myanimelist.net/anime/34798/Yuru_Camp
37
- >> qry = Jikan::Query.new
38
- => <Jikan::Query:0x026ed9d0>
39
-
40
- >> yurucamp = qry.anime_id 34798 # manga_id for manga
41
- >> yurucamp = Jikan::anime 34798 # shortcut method without instaniating Query object, both are valid
42
- # You can also specify flag as second parameter to get more information
43
- # >> yurucamp = qry.anime_id 34798, :episodes
44
- # All flags are symbol, please refer https://jikan.me/docs#chaining-methods to see all available flags
45
- => <Jikan::Anime:0x0168c4e0>
46
-
47
- >> yurucamp.raw
48
- =>{
49
- "mal_id"=>34798,
50
- "link_canonical"=>"https://myanimelist.net/anime/34798/Yuru_Camp△",
51
- "title"=>"Yuru Camp△",
52
- "title_english"=>"Laid-Back Camp",
53
- "title_japanese"=>"ゆるキャン△",
54
- "title_synonyms"=>"Yurukyan, Laid-Back Camp△",
55
- ...
56
- }
57
-
58
- >> yurucamp.title
59
- => "Yuru Camp△"
60
-
61
- >> yurucamp.rating
62
- => "PG-13 - Teens 13 or older"
63
- ```
64
-
65
- **Get character and people information based on their ID**
66
-
67
- ```ruby
68
- # https://myanimelist.net/character/16521/Kagome_Ikaruga
69
- >> qry = Jikan::Query.new
70
- => <Jikan::Query:0x027554b8>
71
-
72
- >> ikaruga = qry.character_id 16521
73
- => <Jikan::Character:0x0134b080>
74
-
75
- >> ikaruga.raw # only raw method is available for now for both character and person
76
- =>{
77
- "mal_id"=>16521,
78
- "link_canonical"=>"https://myanimelist.net/character/16521/Kagome_Ikaruga",
79
- "name"=>"Kagome Ikaruga",
80
- "name_kanji"=>"(斑鳩かごめ)",
81
- "nicknames"=>"Kagome Ikaruga",
82
- "about"=>
83
- "10 years old and the youngest of the Ikaruga sisters. She has bigger breast than Ayame so she covers them. She seems to like Masashi.",
84
- ...
85
- }
86
- ```
87
-
88
- **Search**
89
- ``` ruby
90
- >> qry = Jikan::Query.new
91
- => <Jikan::Query:0x027d70e8>
92
-
93
- >> railgun = qry.search("railgun", :anime) # other flags are :manga, :character, :person
94
- => <Jikan::Search:0x016fd760>
95
-
96
- >> railgun.raw # return raw result
97
- =>{"result"=>
98
- [
99
- {
100
- "id"=>6213,
101
- "url"=>"https://myanimelist.net/anime/6213/Toaru_Kagaku_no_Railgun",
102
- "image_url"=>
103
- "https://myanimelist.cdn-dena.com/r/100x140/images/anime/8/53581.jpg?s=4003b92ef0e723389087b69a8a08d742",
104
- "title"=>"Toaru Kagaku no Railgun",
105
- ...
106
- },
107
- {
108
- "id"=>16049,
109
- "url"=>"https://myanimelist.net/anime/16049/Toaru_Kagaku_no_Railgun_S",
110
- "image_url"=>
111
- "https://myanimelist.cdn-dena.com/r/100x140/images/anime/7/75610.jpg?s=ca85d87b5ff134c73f03184d111604c0",
112
- "title"=>"Toaru Kagaku no Railgun S"
113
- ...
114
- }
115
- ]
116
- }
117
-
118
- # Return each result items wrapped in their respective object
119
- # :person and :character only return raw objects for now so this method isn't available for those flags
120
- >> res = railgun.result
121
- => [<Jikan::Anime:0x0196c968>, <Jikan::Anime:0x0196c950>, <Jikan::Anime:0x019f1610>, <Jikan::Anime:0x019f15f8>, ...]
122
-
123
- >> first_anime = res[0]
124
- => <Jikan::Anime:0x0196c968>
125
-
126
- >> first_anime.title
127
- => "Toaru Kagaku no Railgun"
128
-
129
- # Method name follow Jikan::Anime object so it will slighly differ from raw result keys
130
- # e.g. raw result key is image_url but Jikan::Anime method is image.
131
- >> first_anime.image
132
- => "https://myanimelist.cdn-dena.com/r/100x140/images/anime/8/53581.jpg?s=4003b92ef0e723389087b69a8a08d742"
133
-
134
- >> first_anime.synopsis # same goes to description which is truncated in search result. We use synopsis method instead.
135
- => "The student-filled Academy City is at the forefront of scientific advancement and home to the esper
136
- development program. The seven \"Level 5\" espers are the most powerful in Academy City, and ranked th..."
137
-
138
- # Eventhough the result method return specific objects array, it is still bound to the raw result above.
139
- # So you don't get full information the same way when you do Jikan::anime(id)
140
- >> first_anime.opening # this will return nil because search result doesn't have opening information
141
- => nil
142
-
143
- # To get detailed anime information you can assign special details method on search result object.
144
- # This method will call Jikan::Anime(id) or equivalent and get detailed information from the API and return new object.
145
- # You can also pass flag as you would do in normal Query or shortcut methods.
146
- >> full_info = first_anime.details
147
- => <Jikan::Anime:0x01ad4170>
148
-
149
- >> full_info.opening
150
- >> first_anime.details.opening # shorter way but this will call the API again if you change the rightmost method
151
- => ["#1: \"only my railgun\" by fripSide (eps 2-14)", "#2: \"LEVEL 5 -judgelight-\" by fripSide (eps 15-23)"]
152
-
153
- ```
154
-
155
- ## To-Do
156
- - [X] Add test suites
157
- - [X] Add search feature
158
- - [ ] Refactoring
159
- - [X] Break down hashes into consumable classes
160
-
161
- ## Development
162
-
163
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
164
-
165
- ## Contributing
166
-
167
- Bug reports and pull requests are welcome on GitHub at https://github.com/Zerocchi/jikan.rb. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
168
-
169
- ## License
170
-
171
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
172
-
173
- ## Code of Conduct
174
-
175
- Everyone interacting in the Jikan project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/Zerocchi/jikan/blob/master/CODE_OF_CONDUCT.md).
1
+ # Jikan.rb
2
+
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
+
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.**
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'jikan.rb'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install jikan.rb
24
+
25
+ ## Usage
26
+
27
+ ```diff
28
+ - NOTE: As per documentation there's a rate limit of 2000 requests per IP per day, and two concurrent requests
29
+ - per second. This wrapper does not have any attempt of blocking the limit so please use it wisely.
30
+ - More information available at https://jikan.docs.apiary.io/#introduction/information
31
+ ```
32
+
33
+ **Get anime and manga information based on their ID**
34
+
35
+ ```ruby
36
+ # https://myanimelist.net/anime/34798/Yuru_Camp
37
+ >> qry = Jikan::Query.new
38
+ => <Jikan::Query:0x026ed9d0>
39
+
40
+ >> yurucamp = qry.anime_id 34798 # manga_id for manga
41
+ >> yurucamp = Jikan::anime 34798 # shortcut method without instaniating Query object, both are valid
42
+ # You can also specify flag as second parameter to get more information
43
+ # >> yurucamp = qry.anime_id 34798, :episodes
44
+ # All flags are symbol, please refer https://jikan.me/docs#chaining-methods to see all available flags
45
+ => <Jikan::Anime:0x0168c4e0>
46
+
47
+ >> yurucamp.raw
48
+ =>{
49
+ "mal_id"=>34798,
50
+ "link_canonical"=>"https://myanimelist.net/anime/34798/Yuru_Camp△",
51
+ "title"=>"Yuru Camp△",
52
+ "title_english"=>"Laid-Back Camp",
53
+ "title_japanese"=>"ゆるキャン△",
54
+ "title_synonyms"=>"Yurukyan, Laid-Back Camp△",
55
+ ...
56
+ }
57
+
58
+ >> yurucamp.title
59
+ => "Yuru Camp△"
60
+
61
+ >> yurucamp.rating
62
+ => "PG-13 - Teens 13 or older"
63
+ ```
64
+
65
+ **Get character and people information based on their ID**
66
+
67
+ ```ruby
68
+ # https://myanimelist.net/character/16521/Kagome_Ikaruga
69
+ >> qry = Jikan::Query.new
70
+ => <Jikan::Query:0x027554b8>
71
+
72
+ >> ikaruga = qry.character_id 16521
73
+ => <Jikan::Character:0x0134b080>
74
+
75
+ >> ikaruga.raw # only raw method is available for now for both character and person
76
+ =>{
77
+ "mal_id"=>16521,
78
+ "link_canonical"=>"https://myanimelist.net/character/16521/Kagome_Ikaruga",
79
+ "name"=>"Kagome Ikaruga",
80
+ "name_kanji"=>"(斑鳩かごめ)",
81
+ "nicknames"=>"Kagome Ikaruga",
82
+ "about"=>
83
+ "10 years old and the youngest of the Ikaruga sisters. She has bigger breast than Ayame so she covers them. She seems to like Masashi.",
84
+ ...
85
+ }
86
+
87
+ # as of v0.0.6 you can use Person and Character object methods
88
+ >> ikaruga.name
89
+ => "Kagome Ikaruga"
90
+ ```
91
+
92
+ **Search**
93
+ ``` ruby
94
+ >> qry = Jikan::Query.new
95
+ => <Jikan::Query:0x027d70e8>
96
+
97
+ >> railgun = qry.search("railgun", :anime) # other flags are :manga, :character, :person
98
+ => <Jikan::Search:0x016fd760>
99
+
100
+ >> railgun.raw # return raw result
101
+ =>{"result"=>
102
+ [
103
+ {
104
+ "id"=>6213,
105
+ "url"=>"https://myanimelist.net/anime/6213/Toaru_Kagaku_no_Railgun",
106
+ "image_url"=>
107
+ "https://myanimelist.cdn-dena.com/r/100x140/images/anime/8/53581.jpg?s=4003b92ef0e723389087b69a8a08d742",
108
+ "title"=>"Toaru Kagaku no Railgun",
109
+ ...
110
+ },
111
+ {
112
+ "id"=>16049,
113
+ "url"=>"https://myanimelist.net/anime/16049/Toaru_Kagaku_no_Railgun_S",
114
+ "image_url"=>
115
+ "https://myanimelist.cdn-dena.com/r/100x140/images/anime/7/75610.jpg?s=ca85d87b5ff134c73f03184d111604c0",
116
+ "title"=>"Toaru Kagaku no Railgun S"
117
+ ...
118
+ }
119
+ ]
120
+ }
121
+
122
+ # Return each result items wrapped in their respective object
123
+ # :person and :character only return raw objects for now so this method isn't available for those flags
124
+ >> res = railgun.result
125
+ => [<Jikan::Anime:0x0196c968>, <Jikan::Anime:0x0196c950>, <Jikan::Anime:0x019f1610>, <Jikan::Anime:0x019f15f8>, ...]
126
+
127
+ >> first_anime = res[0]
128
+ => <Jikan::Anime:0x0196c968>
129
+
130
+ >> first_anime.title
131
+ => "Toaru Kagaku no Railgun"
132
+
133
+ # Method name follow Jikan::Anime object so it will slighly differ from raw result keys
134
+ # e.g. raw result key is image_url but Jikan::Anime method is image.
135
+ >> first_anime.image
136
+ => "https://myanimelist.cdn-dena.com/r/100x140/images/anime/8/53581.jpg?s=4003b92ef0e723389087b69a8a08d742"
137
+
138
+ >> first_anime.synopsis # same goes to description which is truncated in search result. We use synopsis method instead.
139
+ => "The student-filled Academy City is at the forefront of scientific advancement and home to the esper
140
+ development program. The seven \"Level 5\" espers are the most powerful in Academy City, and ranked th..."
141
+
142
+ # Eventhough the result method return specific objects array, it is still bound to the raw result above.
143
+ # So you don't get full information the same way when you do Jikan::anime(id)
144
+ >> first_anime.opening # this will return nil because search result doesn't have opening information
145
+ => nil
146
+
147
+ # To get detailed anime information you can assign special details method on search result object.
148
+ # This method will call Jikan::Anime(id) or equivalent and get detailed information from the API and return new object.
149
+ # You can also pass flag as you would do in normal Query or shortcut methods.
150
+ >> full_info = first_anime.details
151
+ => <Jikan::Anime:0x01ad4170>
152
+
153
+ >> full_info.opening
154
+ >> first_anime.details.opening # shorter way but this will call the API again if you change the rightmost method
155
+ => ["#1: \"only my railgun\" by fripSide (eps 2-14)", "#2: \"LEVEL 5 -judgelight-\" by fripSide (eps 15-23)"]
156
+
157
+ ```
158
+
159
+ ## RESTv3 Features
160
+ - [X] Anime
161
+ - [X] Manga
162
+ - [X] Person
163
+ - [X] Character
164
+ - [X] Search
165
+ - [ ] Advanced Search
166
+ - [X] Season
167
+ - [ ] User
168
+ - [X] Profile
169
+ - [ ] Animelist <sup>raw</sup>
170
+ - [ ] Mangalist <sup>raw</sup>
171
+ - [ ] History <sup>raw</sup>
172
+ - [ ] Friends <sup>raw</sup>
173
+ - [X] Club
174
+ - [ ] Schedule
175
+ - [ ] Top
176
+ - [ ] Genre
177
+ - [ ] Producer
178
+ - [ ] Magazine
179
+
180
+ ## To-Do
181
+ - [X] Add test suites
182
+ - [X] Add search feature
183
+ - [ ] Refactoring
184
+ - [X] Break down hashes into consumable classes
185
+
186
+ ## Development
187
+
188
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
189
+
190
+ ## Contributing
191
+
192
+ Bug reports and pull requests are welcome on GitHub at https://github.com/Zerocchi/jikan.rb. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
193
+
194
+ ## License
195
+
196
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
197
+
198
+ ## Code of Conduct
199
+
200
+ Everyone interacting in the Jikan project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/Zerocchi/jikan/blob/master/CODE_OF_CONDUCT.md).