class ShortURL::Services::Bitly

Public Class Methods

new() click to toggle source
Calls superclass method ShortURL::Service::new
   # File lib/shorturl/services/bitly.rb
 7 def initialize
 8   super("api-ssl.bitly.com")
 9 
10   @method = :get
11   @port = 443
12   @ssl = true
13   @action = "/v3/shorten/"
14 
15   creds = ShortURL.credentials_for('bitly')
16   username = creds['username'] 
17   key = creds['key'] 
18 
19   @field = "format=txt&login=#{username}&apiKey=#{key}&longUrl"
20 end

Public Instance Methods

on_body(body) click to toggle source
   # File lib/shorturl/services/bitly.rb
22 def on_body(body)
23   body
24 end