Module: Spotify
- Defined in:
- lib/spotify.rb,
lib/spotify/api.rb,
lib/spotify/util.rb,
lib/spotify/error.rb,
lib/spotify/types.rb,
lib/spotify/structs.rb,
lib/spotify/version.rb,
lib/spotify/api/link.rb,
lib/spotify/api/user.rb,
lib/spotify/api/album.rb,
lib/spotify/api/error.rb,
lib/spotify/api/image.rb,
lib/spotify/api/inbox.rb,
lib/spotify/api/track.rb,
lib/spotify/api/artist.rb,
lib/spotify/api/search.rb,
lib/spotify/types/link.rb,
lib/spotify/types/user.rb,
lib/spotify/api/session.rb,
lib/spotify/api_helpers.rb,
lib/spotify/types/album.rb,
lib/spotify/types/image.rb,
lib/spotify/types/inbox.rb,
lib/spotify/types/track.rb,
lib/spotify/api/playlist.rb,
lib/spotify/types/artist.rb,
lib/spotify/types/search.rb,
lib/spotify/types/session.rb,
lib/spotify/types/playlist.rb,
lib/spotify/managed_pointer.rb,
lib/spotify/api/album_browse.rb,
lib/spotify/api/artist_browse.rb,
lib/spotify/api/miscellaneous.rb,
lib/spotify/api/toplist_browse.rb,
lib/spotify/types/album_browse.rb,
lib/spotify/structs/subscribers.rb,
lib/spotify/types/artist_browse.rb,
lib/spotify/structs/audio_format.rb,
lib/spotify/types/toplist_browse.rb,
lib/spotify/api/playlist_container.rb,
lib/spotify/structs/session_config.rb,
lib/spotify/data_converters/image_id.rb,
lib/spotify/types/playlist_container.rb,
lib/spotify/monkey_patches/ffi_buffer.rb,
lib/spotify/structs/session_callbacks.rb,
lib/spotify/structs/audio_buffer_stats.rb,
lib/spotify/structs/playlist_callbacks.rb,
lib/spotify/data_converters/byte_string.rb,
lib/spotify/data_converters/type_safety.rb,
lib/spotify/data_converters/utf8_string.rb,
lib/spotify/structs/offline_sync_status.rb,
lib/spotify/data_converters/country_code.rb,
lib/spotify/data_converters/best_effort_string.rb,
lib/spotify/data_converters/utf8_string_pointer.rb,
lib/spotify/structs/playlist_container_callbacks.rb
Overview
Spotify module allows you to place calls against the Spotify::API.
Defined Under Namespace
Modules: APIHelpers, BestEffortString, ByteString, CountryCode, ImageID, MonkeyPatches, TypeSafety, UTF8String, UTF8StringPointer, Util Classes: API, APIError, APIInitializationFailedError, Album, AlbumBrowse, ApplicationBannedError, Artist, ArtistBrowse, AudioBufferStats, AudioFormat, BadAPIVersionError, BadApplicationKeyError, BadUserAgentError, BadUsernameOrPasswordError, CantOpenTraceFileError, ClientTooOldError, Error, Image, Inbox, InboxIsFullError, IndexOutOfRangeError, InvalidArgumentError, InvalidDeviceIdError, InvalidIndataError, IsLoadingError, LastfmAuthError, Link, ManagedPointer, MissingCallbackError, NetworkDisabledError, NoCacheError, NoCredentialsError, NoStreamAvailableError, NoSuchUserError, OfflineDiskCacheError, OfflineExpiredError, OfflineLicenseError, OfflineLicenseLostError, OfflineNotAllowedError, OfflineSyncStatus, OfflineTooManyTracksError, OtherPermanentError, OtherTransientError, PermissionDeniedError, Playlist, PlaylistCallbacks, PlaylistContainer, PlaylistContainerCallbacks, Search, Session, SessionCallbacks, SessionConfig, Struct, Subscribers, SystemFailureError, ToplistBrowse, Track, TrackNotPlayableError, UnableToContactServerError, User, UserBannedError, UserNeedsPremiumError
Constant Summary collapse
- API_BUILD =
Returns libspotify build ID.
Spotify::API.build_id
- VERSION =
Note:
See README for versioning policy.
Returns Spotify gem version.
'12.6.0'
- API_VERSION =
Returns Compatible libspotify API version.
'12.1.51'
Class Attribute Summary collapse
- .performer ⇒ Performer readonly
Class Method Summary collapse
-
.log(message) ⇒ Object
Print debug messages, if $DEBUG is true.
-
.method_missing(name, *args, &block) ⇒ Object
Calls the any method on the underlying API.
-
.respond_to_missing?(name, include_private = false) ⇒ Boolean
Asks the underlying Spotify API if it responds to `name`.
-
.try(name, *args, &block) ⇒ Object
Like send, but raises an error if the method returns a non-OK error.
Class Attribute Details
.performer ⇒ Performer (readonly)
33 34 35 |
# File 'lib/spotify.rb', line 33 def performer @performer end |
Class Method Details
.log(message) ⇒ Object
Print debug messages, if $DEBUG is true.
91 92 93 |
# File 'lib/spotify.rb', line 91 def log() $stdout.puts "[#{caller[0]}] #{}" if $DEBUG end |
.method_missing(name, *args, &block) ⇒ Object
80 81 82 83 84 85 86 |
# File 'lib/spotify.rb', line 80 def method_missing(name, *args, &block) if respond_to?(name) performer.sync { @__api__.public_send(name, *args, &block) } else super end end |
.respond_to_missing?(name, include_private = false) ⇒ Boolean
Asks the underlying Spotify API if it responds to `name`.
66 67 68 |
# File 'lib/spotify.rb', line 66 def respond_to_missing?(name, include_private = false) @__api__.respond_to?(name, include_private) end |
.try(name, *args, &block) ⇒ Object
Works for non-error returning methods as well, it just does not do anything interesting.
Like send, but raises an error if the method returns a non-OK error.
47 48 49 50 51 52 53 |
# File 'lib/spotify.rb', line 47 def try(name, *args, &block) public_send(name, *args, &block).tap do |error| if error.is_a?(APIError) raise error unless error.is_a?(IsLoadingError) end end end |