shortservice 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/shortservice.rb +2 -0
- metadata +2 -2
data/lib/shortservice.rb
CHANGED
@@ -7,6 +7,7 @@ module ShortService
|
|
7
7
|
|
8
8
|
Service = Struct.new(:key, :name)
|
9
9
|
|
10
|
+
# Get a list of all shorten services.
|
10
11
|
def self.services
|
11
12
|
xml = SimpleHttp.get("#{API_URL}/services?format=xml")
|
12
13
|
doc = REXML::Document.new(xml)
|
@@ -21,6 +22,7 @@ module ShortService
|
|
21
22
|
services
|
22
23
|
end
|
23
24
|
|
25
|
+
# Shorten a URL using the service (key) specified.
|
24
26
|
def self.shorten(url, service = "bitly")
|
25
27
|
xml = SimpleHttp.get("#{API_URL}/shorten?url=#{CGI::escape(url)}&service=#{service}&format=xml")
|
26
28
|
doc = REXML::Document.new(xml)
|