Sha256: 53b168859c44c3a18ea1bce445fa39a58d3bbd0f0d2a46036de6935534cae95c

Contents?: true

Size: 501 Bytes

Versions: 2

Compression:

Stored size: 501 Bytes

Contents

require 'pixy/version'
require 'pixy/shorten'
require 'pixy/errors'
require 'net/http'
require 'multi_json'

module Pixy
  def self.shorten(key=nil, url='')
    raise MissingApiKey, "API key is required" if key.nil?
    Shorten.new(key, url)
  end

  def self.shorten!(key=nil, url='')
    shorten(key, url).short_url
  end

  def self.stats(key=nil, url='^')
    pixy = shorten(key, url) # submit fake url to get API rate limit
    { :calls => pixy.counter, :limit => 1000 - pixy.counter }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pixy-0.1.3 lib/pixy.rb
pixy-0.1.2 lib/pixy.rb