Sha256: b8e1258f8e7b23b2f7fbe89a67a04d6b6844cc067a8cc27c6bb24de17e8dd3d2

Contents?: true

Size: 545 Bytes

Versions: 2

Compression:

Stored size: 545 Bytes

Contents

require 'rspotify/version'

require 'json'
require 'restclient'

module RSpotify

  BASE_URI = 'https://api.spotify.com/v1/'
  VERBS = %w(get post put delete)

  autoload :Base,   'rspotify/base'
  autoload :Artist, 'rspotify/artist'
  autoload :Album,  'rspotify/album'
  autoload :Track,  'rspotify/track'
  autoload :User,   'rspotify/user'

  VERBS.each do |verb|
    define_singleton_method verb do |path, *params|
      url = BASE_URI + path
      response = RestClient.send(verb, url, *params)
      JSON.parse response
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rspotify-0.1.0 lib/rspotify.rb
rspotify-0.1.1 lib/rspotify.rb