Class: Spotted::Resources::Audiobooks

Inherits:
Object
  • Object
show all
Defined in:
lib/spotted/resources/audiobooks.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Audiobooks

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Audiobooks.

Parameters:



100
101
102
# File 'lib/spotted/resources/audiobooks.rb', line 100

def initialize(client:)
  @client = client
end

Instance Method Details

#list(ids: , market: nil, request_options: {}) ⇒ Spotted::Models::AudiobookListResponse

Some parameter documentations has been truncated, see Models::AudiobookListParams for more details.

Get Spotify catalog information for several audiobooks identified by their Spotify IDs. Audiobooks are only available within the US, UK, Canada, Ireland, New Zealand and Australia markets.

Parameters:

Returns:

See Also:



52
53
54
55
56
57
58
59
60
61
# File 'lib/spotted/resources/audiobooks.rb', line 52

def list(params)
  parsed, options = Spotted::AudiobookListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "audiobooks",
    query: parsed,
    model: Spotted::Models::AudiobookListResponse,
    options: options
  )
end

#list_chapters(id, limit: nil, market: nil, offset: nil, request_options: {}) ⇒ Spotted::Internal::CursorURLPage<Spotted::Models::SimplifiedChapterObject>

Some parameter documentations has been truncated, see Models::AudiobookListChaptersParams for more details.

Get Spotify catalog information about an audiobook’s chapters. Audiobooks are only available within the US, UK, Canada, Ireland, New Zealand and Australia markets.

Parameters:

  • id (String)

    The [Spotify ID](/documentation/web-api/concepts/spotify-uris-ids)

  • limit (Integer)

    The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50.

  • market (String)

    An [ISO 3166-1 alpha-2 country code](en.wikipedia.org/wiki/ISO_3166-1_al

  • offset (Integer)

    The index of the first item to return. Default: 0 (the first item). Use with lim

  • request_options (Spotted::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



85
86
87
88
89
90
91
92
93
94
95
# File 'lib/spotted/resources/audiobooks.rb', line 85

def list_chapters(id, params = {})
  parsed, options = Spotted::AudiobookListChaptersParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["audiobooks/%1$s/chapters", id],
    query: parsed,
    page: Spotted::Internal::CursorURLPage,
    model: Spotted::SimplifiedChapterObject,
    options: options
  )
end

#retrieve(id, market: nil, request_options: {}) ⇒ Spotted::Models::AudiobookRetrieveResponse

Some parameter documentations has been truncated, see Models::AudiobookRetrieveParams for more details.

Get Spotify catalog information for a single audiobook. Audiobooks are only available within the US, UK, Canada, Ireland, New Zealand and Australia markets.

Parameters:

Returns:

See Also:



23
24
25
26
27
28
29
30
31
32
# File 'lib/spotted/resources/audiobooks.rb', line 23

def retrieve(id, params = {})
  parsed, options = Spotted::AudiobookRetrieveParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["audiobooks/%1$s", id],
    query: parsed,
    model: Spotted::Models::AudiobookRetrieveResponse,
    options: options
  )
end