urlshort 0.0.1 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 Doug P.
1
+ Copyright (c) 2010 Doug P.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.rdoc CHANGED
@@ -1,6 +1,6 @@
1
1
  = urlshort
2
2
 
3
- Description goes here.
3
+ Makes URLs short using services like is.gd and TinyUrl.
4
4
 
5
5
  == Note on Patches/Pull Requests
6
6
 
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{Shortens URLs}
9
- gem.description = %Q{Shortens URL}
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.0.1
1
+ 0.1.1
data/lib/urlshort.rb CHANGED
@@ -6,12 +6,21 @@
6
6
  require 'rubygems'
7
7
  require 'httpclient'
8
8
 
9
- class URLShort
10
- end
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 Isgd < URLShort
13
- def short(link)
14
- clnt = HTTPClient.new
15
- clnt.get('http://is.gd/api.php', {:longurl => link} ).content
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
@@ -1,7 +1,12 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
- describe "Urlshort" do
4
- it "tests is.gd" do
5
- Isgd.new.short('google.com').should match(/is.gd\/\w+/)
6
- end
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
- version: 0.0.1
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-19 00:00:00 -04:00
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: Shortens URL
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: Shortens URLs
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