Class: SpotifyWebApi::ChaptersController
- Inherits:
-
BaseController
- Object
- BaseController
- SpotifyWebApi::ChaptersController
- Defined in:
- lib/spotify_web_api/controllers/chapters_controller.rb
Overview
ChaptersController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#get_a_chapter(id, market: nil) ⇒ ChapterObject
Get Spotify catalog information for a single audiobook chapter.
-
#get_several_chapters(ids, market: nil) ⇒ ManyChapters
Get Spotify catalog information for several audiobook chapters identified by their Spotify IDs.
Methods inherited from BaseController
#initialize, #new_api_call_builder, #new_parameter, #new_request_builder, #new_response_handler, user_agent
Constructor Details
This class inherits a constructor from SpotifyWebApi::BaseController
Instance Method Details
#get_a_chapter(id, market: nil) ⇒ ChapterObject
Get Spotify catalog information for a single audiobook chapter. Chapters are only available within the US, UK, Canada, Ireland, New Zealand and Australia markets.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/spotify_web_api/controllers/chapters_controller.rb', line 15 def get_a_chapter(id, market: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/chapters/{id}', Server::DEFAULT) .template_param(new_parameter(id, key: 'id') .should_encode(true)) .query_param(new_parameter(market, key: 'market')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('oauth_2_0'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(ChapterObject.method(:from_hash)) .is_api_response(true) .local_error('401', "Bad or expired token. This can happen if the user revoked a'\ ' token or\nthe access token has expired. You should'\ ' re-authenticate the user.\n", UnauthorizedException) .local_error('403', "Bad OAuth request (wrong consumer key, bad nonce, expired'\ '\ntimestamp...). Unfortunately, re-authenticating the user'\ ' won't help here.\n", ForbiddenException) .local_error('429', "The app has exceeded its rate limits.\n", TooManyRequestsException)) .execute end |
#get_several_chapters(ids, market: nil) ⇒ ManyChapters
Get Spotify catalog information for several audiobook chapters identified by their Spotify IDs. Chapters are only available within the US, UK, Canada, Ireland, New Zealand and Australia markets.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/spotify_web_api/controllers/chapters_controller.rb', line 52 def get_several_chapters(ids, market: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/chapters', Server::DEFAULT) .query_param(new_parameter(ids, key: 'ids')) .query_param(new_parameter(market, key: 'market')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('oauth_2_0'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(ManyChapters.method(:from_hash)) .is_api_response(true) .local_error('401', "Bad or expired token. This can happen if the user revoked a'\ ' token or\nthe access token has expired. You should'\ ' re-authenticate the user.\n", UnauthorizedException) .local_error('403', "Bad OAuth request (wrong consumer key, bad nonce, expired'\ '\ntimestamp...). Unfortunately, re-authenticating the user'\ ' won't help here.\n", ForbiddenException) .local_error('429', "The app has exceeded its rate limits.\n", TooManyRequestsException)) .execute end |