Class: Spotted::Resources::Me::Audiobooks

Inherits:
Object
  • Object
show all
Defined in:
lib/spotted/resources/me/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:



133
134
135
# File 'lib/spotted/resources/me/audiobooks.rb', line 133

def initialize(client:)
  @client = client
end

Instance Method Details

#check(ids:, request_options: {}) ⇒ Array<Boolean>

Deprecated.

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

Check if one or more audiobooks are already saved in the current Spotify user’s library.

Note: This endpoint is deprecated. Use [Check User’s Saved Items](/documentation/web-api/reference/check-library-contains) instead.

Parameters:

  • ids (String)

    A comma-separated list of the [Spotify IDs](/documentation/web-api/concepts/spot

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

Returns:

  • (Array<Boolean>)

See Also:



57
58
59
60
61
62
63
64
65
66
# File 'lib/spotted/resources/me/audiobooks.rb', line 57

def check(params)
  parsed, options = Spotted::Me::AudiobookCheckParams.dump_request(params)
  @client.request(
    method: :get,
    path: "me/audiobooks/contains",
    query: parsed,
    model: Spotted::Internal::Type::ArrayOf[Spotted::Internal::Type::Boolean],
    options: options
  )
end

#list(limit: nil, offset: nil, request_options: {}) ⇒ Spotted::Internal::CursorURLPage<Spotted::Models::Me::AudiobookListResponse>

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

Get a list of the audiobooks saved in the current Spotify user’s ‘Your Music’ library.

Parameters:

  • limit (Integer)

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

  • 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:



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

def list(params = {})
  parsed, options = Spotted::Me::AudiobookListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "me/audiobooks",
    query: parsed,
    page: Spotted::Internal::CursorURLPage,
    model: Spotted::Models::Me::AudiobookListResponse,
    options: options
  )
end

#remove(ids:, request_options: {}) ⇒ nil

Deprecated.

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

Remove one or more audiobooks from the Spotify user’s library.

Note: This endpoint is deprecated. Use [Remove Items from Library](/documentation/web-api/reference/remove-library-items) instead.

Parameters:

  • ids (String)

    A comma-separated list of the [Spotify IDs](/documentation/web-api/concepts/spot

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

Returns:

  • (nil)

See Also:



88
89
90
91
92
93
94
95
96
97
# File 'lib/spotted/resources/me/audiobooks.rb', line 88

def remove(params)
  parsed, options = Spotted::Me::AudiobookRemoveParams.dump_request(params)
  @client.request(
    method: :delete,
    path: "me/audiobooks",
    query: parsed,
    model: NilClass,
    options: options
  )
end

#save(ids:, request_options: {}) ⇒ nil

Deprecated.

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

Save one or more audiobooks to the current Spotify user’s library.

Note: This endpoint is deprecated. Use [Save Items to Library](/documentation/web-api/reference/save-library-items) instead.

Parameters:

  • ids (String)

    A comma-separated list of the [Spotify IDs](/documentation/web-api/concepts/spot

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

Returns:

  • (nil)

See Also:



119
120
121
122
123
124
125
126
127
128
# File 'lib/spotted/resources/me/audiobooks.rb', line 119

def save(params)
  parsed, options = Spotted::Me::AudiobookSaveParams.dump_request(params)
  @client.request(
    method: :put,
    path: "me/audiobooks",
    query: parsed,
    model: NilClass,
    options: options
  )
end