Sha256: e1adc91a9a9b30c3e5fd390a36e85568d5dfb4abc94e05737e285fc24057535c

Contents?: true

Size: 1021 Bytes

Versions: 1

Compression:

Stored size: 1021 Bytes

Contents

require 'httparty'
require 'hashie'

directory = File.expand_path(File.dirname(__FILE__))

Hash.send :include, Hashie::HashExtensions

module Plancast
  
  VERSION = "0.1.0".freeze
  
  def self.configure
    yield self
    true
  end
  
  def self.api_url(endpoint, version = self.api_version)
    "http://api.plancast.com/#{version}#{endpoint}.json"
  end

  # class << self
  #   attr_accessor :api_key
  #   attr_accessor :api_version
  # end
  
  def self.api_version
    @api_version || "02"
  end
  
  def self.api_version=(value)
    @api_version = value
  end
  
  class PlancastError < StandardError
    attr_reader :data

    def initialize(data)
      @data = data
      super
    end
  end
  
  class ClientError < StandardError; end
  class ServerError < PlancastError; end
  class General     < PlancastError; end
  
  class Unauthorized      < ClientError; end
  class NotFound          < ClientError; end

  class Unavailable   < StandardError; end
end

require File.join(directory, 'plancast', 'client')

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
plancast-0.1.0 lib/plancast.rb