Class: Holodex
- Inherits:
-
Object
- Object
- Holodex
- Defined in:
- lib/holodex.rb,
lib/holodex/resource/live.rb,
lib/holodex/resource/error.rb,
lib/holodex/resource/video.rb,
lib/holodex/resource/videos.rb,
lib/holodex/resource/channel.rb,
lib/holodex/resource/channels.rb,
lib/holodex/resource/users_live.rb,
lib/holodex/resource/video_search.rb,
lib/holodex/resource/comment_search.rb,
lib/holodex/resource/related_videos.rb
Overview
Defined Under Namespace
Classes: ResourceError
Constant Summary collapse
- BASE_API =
'https://holodex.net/api/v2'- DEFAULT_HEADERS =
{ 'Content-Type' => 'application/json; charset=utf-8' }
Instance Method Summary collapse
- #channel(id) ⇒ Object
- #channels ⇒ Object
- #comment_search ⇒ Object
-
#initialize(api_key) ⇒ Holodex
constructor
A new instance of Holodex.
- #live ⇒ Object
- #related_videos(id:, type:) ⇒ Object
- #users_live(*channels) ⇒ Object
- #video(id, lang: nil, c: nil) ⇒ Object
- #video_search ⇒ Object
- #videos ⇒ Object
Constructor Details
#initialize(api_key) ⇒ Holodex
Returns a new instance of Holodex.
21 22 23 |
# File 'lib/holodex.rb', line 21 def initialize(api_key) @headers = DEFAULT_HEADERS.merge('X-APIKEY' => api_key) end |
Instance Method Details
#channel(id) ⇒ Object
3 |
# File 'lib/holodex/resource/channel.rb', line 3 def channel(id) = get("/channels/#{id}") |
#channels ⇒ Object
3 |
# File 'lib/holodex/resource/channels.rb', line 3 def channels(**) = get('/channels', **) |
#comment_search ⇒ Object
3 |
# File 'lib/holodex/resource/comment_search.rb', line 3 def comment_search(**) = post('/search/commentSearch', **) |
#live ⇒ Object
3 |
# File 'lib/holodex/resource/live.rb', line 3 def live(**) = get('/live', **) |
#related_videos(id:, type:) ⇒ Object
3 |
# File 'lib/holodex/resource/related_videos.rb', line 3 def (id:, type:, **) = get("channels/#{id}/#{type}", **) |
#users_live(*channels) ⇒ Object
3 |
# File 'lib/holodex/resource/users_live.rb', line 3 def users_live(*channels) = get('/users/live', channels:) |
#video(id, lang: nil, c: nil) ⇒ Object
3 |
# File 'lib/holodex/resource/video.rb', line 3 def video(id, lang: nil, c: nil) = get("/videos/#{id}", lang:, c:) |
#video_search ⇒ Object
3 |
# File 'lib/holodex/resource/video_search.rb', line 3 def video_search(**) = post('/search/videoSearch', **) |
#videos ⇒ Object
3 |
# File 'lib/holodex/resource/videos.rb', line 3 def videos(**) = get('/videos', **) |