Sha256: 5732d5a649dba44b9489138f0f72f6c313f3e1be3df17de0d95e3b070e36a682

Contents?: true

Size: 487 Bytes

Versions: 1

Compression:

Stored size: 487 Bytes

Contents

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

module Pixy
  extend self

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

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

  def stats(key=nil, url='^')
    pixy = Pixy.shorten(key, url)
    {
      :calls => pixy.counter,
      :limit => 1000 - pixy.counter
    }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pixy-0.1.1 lib/pixy.rb