shortie 0.0.5 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/shortie/shorteners.rb +1 -16
- data/lib/shortie/shorteners/lns.rb +18 -0
- data/lib/shortie/shorteners/metamark.rb +12 -0
- data/lib/shortie/shorteners/minilink.rb +16 -0
- metadata +7 -4
data/lib/shortie/shorteners.rb
CHANGED
@@ -1,16 +1 @@
|
|
1
|
-
Dir[File.dirname(__FILE__) + "/shorteners/*.rb"].each {|file| require file }
|
2
|
-
|
3
|
-
#require 'shortie/shorteners/snipurl'
|
4
|
-
#require 'shortie/shorteners/bitly'
|
5
|
-
#require 'shortie/shorteners/cligs'
|
6
|
-
#require 'shortie/shorteners/cllk'
|
7
|
-
#require 'shortie/shorteners/idek'
|
8
|
-
#require 'shortie/shorteners/isgd'
|
9
|
-
#require 'shortie/shorteners/rubyurl'
|
10
|
-
#require 'shortie/shorteners/shortie'
|
11
|
-
#require 'shortie/shorteners/snim'
|
12
|
-
#require 'shortie/shorteners/snipr'
|
13
|
-
#require 'shortie/shorteners/snurl'
|
14
|
-
#require 'shortie/shorteners/tinycc'
|
15
|
-
#require 'shortie/shorteners/tinyurl'
|
16
|
-
#require 'shortie/shorteners/twurl'
|
1
|
+
Dir[File.dirname(__FILE__) + "/shorteners/*.rb"].each {|file| require file }
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Shortie
|
2
|
+
module Shorteners
|
3
|
+
class Lns < BaseShortener
|
4
|
+
def shorten
|
5
|
+
ret = SimpleHttp.post("http://ln-s.net/home/api.jsp", {
|
6
|
+
"url" => url
|
7
|
+
})
|
8
|
+
status, message = ret.split(/ /, 2)
|
9
|
+
message.chomp!
|
10
|
+
|
11
|
+
raise message unless status == "200"
|
12
|
+
|
13
|
+
message
|
14
|
+
end
|
15
|
+
end
|
16
|
+
Service.register("lns", "ln-s", Lns)
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Shortie
|
2
|
+
module Shorteners
|
3
|
+
class Metamark < BaseShortener
|
4
|
+
def shorten
|
5
|
+
url = SimpleHttp.get("http://metamark.net/api/rest/simple?long_url=#{escaped_url}")
|
6
|
+
raise url if url =~ /^ERROR:/
|
7
|
+
url
|
8
|
+
end
|
9
|
+
end
|
10
|
+
Service.register("metamark", "Metamark", Metamark)
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Shortie
|
2
|
+
module Shorteners
|
3
|
+
class Minilink < BaseShortener
|
4
|
+
def shorten
|
5
|
+
xml = SimpleHttp.get("http://minilink.org/?url=#{escaped_url}&xml=1")
|
6
|
+
doc = REXML::Document.new(xml)
|
7
|
+
|
8
|
+
url_element = doc.elements["minilink"]
|
9
|
+
raise "No URL returned from minilink." if url_element.nil?
|
10
|
+
|
11
|
+
url_element.text
|
12
|
+
end
|
13
|
+
end
|
14
|
+
Service.register("minilink", "minilink.org", Minilink)
|
15
|
+
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shortie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
|
+
- 1
|
7
8
|
- 0
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 0.0.5
|
10
|
+
version: 1.0.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Lasse Bunk
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-08-12 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -50,6 +50,9 @@ files:
|
|
50
50
|
- lib/shortie/shorteners/cllk.rb
|
51
51
|
- lib/shortie/shorteners/idek.rb
|
52
52
|
- lib/shortie/shorteners/isgd.rb
|
53
|
+
- lib/shortie/shorteners/lns.rb
|
54
|
+
- lib/shortie/shorteners/metamark.rb
|
55
|
+
- lib/shortie/shorteners/minilink.rb
|
53
56
|
- lib/shortie/shorteners/rubyurl.rb
|
54
57
|
- lib/shortie/shorteners/shortie.rb
|
55
58
|
- lib/shortie/shorteners/snim.rb
|