Sha256: dfff9e34caf1932e8c72e654e6da1d94477865569866a5f2f8ac16894695e416

Contents?: true

Size: 408 Bytes

Versions: 2

Compression:

Stored size: 408 Bytes

Contents

require 'cgi'
require 'open-uri'
require 'spotify_to_mp3/spotify/track'

module SpotifyToMp3
  class Spotify
    def get_track(uri)
      content = open('http://ws.spotify.com/lookup/1/.json?uri=' + CGI.escape(uri))
      json = JSON.parse(content.string)
      Track.new(json)
    end

    def resolvable_uri?(uri)
      uri.start_with?('http://open.spotify.com/track/', 'spotify:track:')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spotify-to-mp3-0.6.1 lib/spotify_to_mp3/spotify.rb
spotify-to-mp3-0.6.0 lib/spotify_to_mp3/spotify.rb