urlshort 0.0.1 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +1 -1
- data/README.rdoc +1 -1
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/lib/urlshort.rb +15 -6
- data/spec/urlshort_spec.rb +9 -4
- metadata +5 -5
data/LICENSE
CHANGED
data/README.rdoc
CHANGED
data/Rakefile
CHANGED
@@ -5,8 +5,8 @@ begin
|
|
5
5
|
require 'jeweler'
|
6
6
|
Jeweler::Tasks.new do |gem|
|
7
7
|
gem.name = "urlshort"
|
8
|
-
gem.summary = %Q{
|
9
|
-
gem.description = %Q{
|
8
|
+
gem.summary = %Q{Makes URLs short using services like is.gd and TinyUrl.}
|
9
|
+
gem.description = %Q{Makes URLs short using services like is.gd and TinyUrl.}
|
10
10
|
gem.email = "dougtko@gmail.com"
|
11
11
|
gem.homepage = "http://github.com/dougsko/urlshort"
|
12
12
|
gem.authors = ["Doug P."]
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.1.1
|
data/lib/urlshort.rb
CHANGED
@@ -6,12 +6,21 @@
|
|
6
6
|
require 'rubygems'
|
7
7
|
require 'httpclient'
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
module UrlShort
|
10
|
+
|
11
|
+
class IsGd
|
12
|
+
def self.shorten(link)
|
13
|
+
clnt = HTTPClient.new
|
14
|
+
clnt.get('http://is.gd/api.php', {:longurl => link} ).content
|
15
|
+
end
|
16
|
+
end
|
11
17
|
|
12
|
-
class
|
13
|
-
|
14
|
-
|
15
|
-
|
18
|
+
class TinyUrl
|
19
|
+
def self.shorten(link)
|
20
|
+
clnt = HTTPClient.new
|
21
|
+
clnt.get('http://tinyurl.com/api-create.php', {:url => link} ).content
|
22
|
+
end
|
16
23
|
end
|
24
|
+
|
25
|
+
|
17
26
|
end
|
data/spec/urlshort_spec.rb
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
2
|
|
3
|
-
describe "
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
describe "UrlShort" do
|
4
|
+
it "tests is.gd" do
|
5
|
+
UrlShort::IsGd.shorten('google.com').should match /http:\/\/is\.gd\/\w+/
|
6
|
+
end
|
7
|
+
|
8
|
+
it "tests TinyUrl" do
|
9
|
+
UrlShort::TinyUrl.shorten('google.com').should match /http:\/\/tinyurl\.com\/\w+/
|
10
|
+
end
|
11
|
+
|
7
12
|
end
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
- 0
|
8
7
|
- 1
|
9
|
-
|
8
|
+
- 1
|
9
|
+
version: 0.1.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Doug P.
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-05-
|
17
|
+
date: 2010-05-22 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: "0"
|
44
44
|
type: :runtime
|
45
45
|
version_requirements: *id002
|
46
|
-
description:
|
46
|
+
description: Makes URLs short using services like is.gd and TinyUrl.
|
47
47
|
email: dougtko@gmail.com
|
48
48
|
executables: []
|
49
49
|
|
@@ -92,7 +92,7 @@ rubyforge_project:
|
|
92
92
|
rubygems_version: 1.3.6
|
93
93
|
signing_key:
|
94
94
|
specification_version: 3
|
95
|
-
summary:
|
95
|
+
summary: Makes URLs short using services like is.gd and TinyUrl.
|
96
96
|
test_files:
|
97
97
|
- spec/urlshort_spec.rb
|
98
98
|
- spec/spec_helper.rb
|