Sha256: 8a28b73613410834f5d54a020df0aaf6069c955f340a39aca69999da504963c0

Contents?: true

Size: 1.48 KB

Versions: 1

Compression:

Stored size: 1.48 KB

Contents

require 'rubygems'
gem 'httparty'
require 'httparty'

dir = File.dirname(__FILE__)
require dir + '/songkickr/performance'
require dir + '/songkickr/artist'
require dir + '/songkickr/location'
require dir + '/songkickr/location_result'
require dir + '/songkickr/venue'
require dir + '/songkickr/event'
require dir + '/songkickr/setlist_item'
require dir + '/songkickr/setlist'
require dir + '/songkickr/event_result'
require dir + '/songkickr/concert_setlist_result'
require dir + '/songkickr/remote'
require dir + '/songkickr/artist_result'

class APIKeyNotSet < StandardError;
  # Warns of missing API key
  def to_s
    'API key not set!'
  end
end

class ResouceNotFound < StandardError;
  def to_s
    "Resource not found"
  end
end

module Songkickr
  # Returns the Songkick API key
  # In order to use the Songkick API, you must have a Songkick API (their rule, not mine).
  # Get an API key for your app from http://developer.songkick.com/
  # 
  # ==== Example
  #
  #   require 'songkickr'
  #   remote = Songkickr::Remote.new XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  #   remote.api_key
  #   XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  def self.api_key
    raise APIKeyNotSet if @api_key.nil?

    @api_key
  end

  # Set the API key. In the event you need to set the API key after initializing the the remote.
  # === Parameters
  #
  # * +api_key+ - A developer key from Songkick. Get an API key for your app from http://developer.songkick.com/
  def self.api_key=(api_key)
    @api_key = api_key
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
songkickr-0.2.2 lib/songkickr.rb