Module: Jikanrb
- Defined in:
- lib/jikanrb.rb,
lib/jikanrb/utils.rb,
lib/jikanrb/client.rb,
lib/jikanrb/errors.rb,
lib/jikanrb/version.rb,
lib/jikanrb/pagination.rb,
lib/jikanrb/configuration.rb
Overview
Jikanrb is a modern Ruby wrapper for the Jikan REST API v4. Provides easy access to anime, manga, characters, and more from MyAnimeList.
Defined Under Namespace
Modules: Pagination
Classes: BadRequestError, Client, ClientError, Configuration, ConfigurationError, ConnectionError, Error, IndifferentHash, MethodNotAllowedError, NotFoundError, ParseError, RateLimitError, ServerError
Constant Summary
collapse
- VERSION =
'0.2.2'
Class Attribute Summary collapse
Class Method Summary
collapse
-
.anime(id, full: false) ⇒ Object
-
.character(id, full: false) ⇒ Object
-
.client ⇒ Client
Default client using global configuration.
-
.configure {|config| ... } ⇒ Object
Configures the gem with a block.
-
.manga(id, full: false) ⇒ Object
-
.person(id, full: false) ⇒ Object
-
.reset_client! ⇒ nil
Resets the client (useful after changing configuration).
-
.reset_configuration! ⇒ Configuration
Resets configuration to default values.
-
.schedules(day: nil) ⇒ Object
-
.search_anime(query, **params) ⇒ Object
-
.search_manga(query, **params) ⇒ Object
-
.season(year, season, page: 1) ⇒ Object
-
.season_now(page: 1) ⇒ Object
-
.top_anime(type: nil, filter: nil, page: 1) ⇒ Object
-
.top_manga(type: nil, filter: nil, page: 1) ⇒ Object
Class Attribute Details
Global configuration for the gem
29
30
31
|
# File 'lib/jikanrb.rb', line 29
def configuration
@configuration ||= Configuration.new
end
|
Class Method Details
.anime(id, full: false) ⇒ Object
72
73
74
|
# File 'lib/jikanrb.rb', line 72
def anime(id, full: false)
client.anime(id, full: full)
end
|
.character(id, full: false) ⇒ Object
82
83
84
|
# File 'lib/jikanrb.rb', line 82
def character(id, full: false)
client.character(id, full: full)
end
|
Default client using global configuration
57
58
59
|
# File 'lib/jikanrb.rb', line 57
def client
@client ||= Client.new { |config| configure_client(config) }
end
|
Configures the gem with a block
43
44
45
|
# File 'lib/jikanrb.rb', line 43
def configure
yield(configuration)
end
|
.manga(id, full: false) ⇒ Object
77
78
79
|
# File 'lib/jikanrb.rb', line 77
def manga(id, full: false)
client.manga(id, full: full)
end
|
.person(id, full: false) ⇒ Object
87
88
89
|
# File 'lib/jikanrb.rb', line 87
def person(id, full: false)
client.person(id, full: full)
end
|
.reset_client! ⇒ nil
Resets the client (useful after changing configuration)
64
65
66
|
# File 'lib/jikanrb.rb', line 64
def reset_client!
@client = nil
end
|
Resets configuration to default values
50
51
52
|
# File 'lib/jikanrb.rb', line 50
def reset_configuration!
@configuration = Configuration.new
end
|
.schedules(day: nil) ⇒ Object
122
123
124
|
# File 'lib/jikanrb.rb', line 122
def schedules(day: nil)
client.schedules(day: day)
end
|
.search_anime(query, **params) ⇒ Object
92
93
94
|
# File 'lib/jikanrb.rb', line 92
def search_anime(query, **params)
client.search_anime(query, **params)
end
|
.search_manga(query, **params) ⇒ Object
97
98
99
|
# File 'lib/jikanrb.rb', line 97
def search_manga(query, **params)
client.search_manga(query, **params)
end
|
.season(year, season, page: 1) ⇒ Object
112
113
114
|
# File 'lib/jikanrb.rb', line 112
def season(year, season, page: 1)
client.season(year, season, page: page)
end
|
.season_now(page: 1) ⇒ Object
117
118
119
|
# File 'lib/jikanrb.rb', line 117
def season_now(page: 1)
client.season_now(page: page)
end
|
.top_anime(type: nil, filter: nil, page: 1) ⇒ Object
102
103
104
|
# File 'lib/jikanrb.rb', line 102
def top_anime(type: nil, filter: nil, page: 1)
client.top_anime(type: type, filter: filter, page: page)
end
|
.top_manga(type: nil, filter: nil, page: 1) ⇒ Object
107
108
109
|
# File 'lib/jikanrb.rb', line 107
def top_manga(type: nil, filter: nil, page: 1)
client.top_manga(type: type, filter: filter, page: page)
end
|