Skip to content

ig3io/spof

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spof

Ruby wrapper for the Spotify Search & Lookup API. Under development.

Build Status

Gem Version

Stories in Ready

Usage

require 'spof'

Search

Spof::Search.artist('nine inch nails') # or album or track

Returns:

{
  :info => {
    :num_results => 1,
    :limit => 100,
    :offset => 0,
    :query => "nine inch nails",
    :type => "artist",
    :page => 1
    },
  :artists => [
    { :href =>"spotify:artist:0X380XXQSNBYuleKzav5UO", :name => "Nine Inch Nails", :popularity => "0.64"}
    ]
}

Lookup

r = Spof::Lookup.get('spotify:uri:album:xy...z')

# extras can be specified
r = Spof::Lookup.get('spotify:uri:album:xy...z', :track)

# convenience methods Lookup.album/artist/track check the provided extras
r = Spof::Lookup.artist('spotify:uri:artist:ab...c', :trackdetail)
# raises Spof::SpofError, "Illegal extra"

For both Lookup and Search methods, the result contains the parsed JSON response. For now it's like:

r = JSON.parse(spotify_api_json_response, :symbolize_names => true) # hash with symbols as keys

Wrapper

w = Spof::Wrapper.new
w.artist.search('nine inch nails') # album/artist/track. First page album results
# => [{:href=>"spotify:artist:0X380XXQSNBYuleKzav5UO", :name=>"Nine Inch Nails", :popularity=>"0.64"}]
w.all.album.search('nine inch nails')
# => list of all found albums

License

See LICENSE file.

About

Spotify Search & Lookup API Ruby Wrapper

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages