shorturl 0.3.0 → 0.4.0

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/ChangeLog CHANGED
@@ -1,3 +1,9 @@
1
+ 0.4.0:
2
+ - Added minilink.org
3
+ - More tests for the Service class
4
+ - Changed the ArgumentError exception for an InvalidService exception in ShortURL.shorten
5
+ - Created examples/shorten.rb
6
+ - Added a stats task to the Rakefile. Requires code_statistics, provided by Rails.
1
7
  0.3.0:
2
8
  - Added linktrim.com and shorterlink.com
3
9
  - Replaced get_short_url and all the private class methods in favor of a Service class, which makes things clearer
data/README CHANGED
@@ -27,6 +27,7 @@ The second parameter represents the service you want to use. These are:
27
27
  - <tt>:skinnylink</tt>
28
28
  - <tt>:linktrim</tt>
29
29
  - <tt>:shorterlink</tt>
30
+ - <tt>:minilink</tt>
30
31
 
31
32
  Note that you can use <tt>ShortURL.valid_services</tt> to obtain a
32
33
  list of the valid services (in case I forget to update the
data/TODO CHANGED
@@ -1,4 +1,3 @@
1
1
  = Todo
2
2
 
3
- * Make services an instance of a Service class
4
3
  * Check out WWW::Mecanize
@@ -0,0 +1,111 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: InvalidService</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">InvalidService</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/shorturl_rb.html">
59
+ lib/shorturl.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Exception
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+
82
+
83
+ </div>
84
+
85
+
86
+ </div>
87
+
88
+
89
+ <!-- if includes -->
90
+
91
+ <div id="section">
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+ <!-- if method_list -->
101
+
102
+
103
+ </div>
104
+
105
+
106
+ <div id="validator-badges">
107
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
108
+ </div>
109
+
110
+ </body>
111
+ </html>
@@ -167,20 +167,20 @@ long URL and the block of what to do with the HTML code you get.
167
167
  onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
168
168
  <div class="method-source-code" id="M000003-source">
169
169
  <pre>
170
- <span class="ruby-comment cmt"># File lib/shorturl.rb, line 18</span>
171
- 18: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">hostname</span>) <span class="ruby-comment cmt"># :yield: service</span>
172
- 19: <span class="ruby-ivar">@hostname</span> = <span class="ruby-identifier">hostname</span>
173
- 20: <span class="ruby-ivar">@port</span> = <span class="ruby-value">80</span>
174
- 21: <span class="ruby-ivar">@code</span> = <span class="ruby-value">200</span>
175
- 22: <span class="ruby-ivar">@method</span> = <span class="ruby-identifier">:post</span>
176
- 23: <span class="ruby-ivar">@action</span> = <span class="ruby-value str">&quot;/&quot;</span>
177
- 24: <span class="ruby-ivar">@field</span> = <span class="ruby-value str">&quot;url&quot;</span>
178
- 25: <span class="ruby-ivar">@block</span> = <span class="ruby-identifier">lambda</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">body</span><span class="ruby-operator">|</span> }
179
- 26:
180
- 27: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
181
- 28: <span class="ruby-keyword kw">yield</span> <span class="ruby-keyword kw">self</span>
182
- 29: <span class="ruby-keyword kw">end</span>
183
- 30: <span class="ruby-keyword kw">end</span>
170
+ <span class="ruby-comment cmt"># File lib/shorturl.rb, line 21</span>
171
+ 21: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">hostname</span>) <span class="ruby-comment cmt"># :yield: service</span>
172
+ 22: <span class="ruby-ivar">@hostname</span> = <span class="ruby-identifier">hostname</span>
173
+ 23: <span class="ruby-ivar">@port</span> = <span class="ruby-value">80</span>
174
+ 24: <span class="ruby-ivar">@code</span> = <span class="ruby-value">200</span>
175
+ 25: <span class="ruby-ivar">@method</span> = <span class="ruby-identifier">:post</span>
176
+ 26: <span class="ruby-ivar">@action</span> = <span class="ruby-value str">&quot;/&quot;</span>
177
+ 27: <span class="ruby-ivar">@field</span> = <span class="ruby-value str">&quot;url&quot;</span>
178
+ 28: <span class="ruby-ivar">@block</span> = <span class="ruby-identifier">lambda</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">body</span><span class="ruby-operator">|</span> }
179
+ 29:
180
+ 30: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
181
+ 31: <span class="ruby-keyword kw">yield</span> <span class="ruby-keyword kw">self</span>
182
+ 32: <span class="ruby-keyword kw">end</span>
183
+ 33: <span class="ruby-keyword kw">end</span>
184
184
  </pre>
185
185
  </div>
186
186
  </div>
@@ -206,18 +206,18 @@ Now that our service is set up, call it with all the parameters to
206
206
  onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
207
207
  <div class="method-source-code" id="M000004-source">
208
208
  <pre>
209
- <span class="ruby-comment cmt"># File lib/shorturl.rb, line 34</span>
210
- 34: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">url</span>)
211
- 35: <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">start</span>(<span class="ruby-ivar">@hostname</span>, <span class="ruby-ivar">@port</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">http</span><span class="ruby-operator">|</span>
212
- 36: <span class="ruby-identifier">response</span> = <span class="ruby-keyword kw">case</span> <span class="ruby-ivar">@method</span>
213
- 37: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:post</span><span class="ruby-operator">:</span> <span class="ruby-identifier">http</span>.<span class="ruby-identifier">send</span>(<span class="ruby-ivar">@method</span>, <span class="ruby-ivar">@action</span>, <span class="ruby-node">&quot;#@field=#{url}&quot;</span>)
214
- 38: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:get</span><span class="ruby-operator">:</span> <span class="ruby-identifier">http</span>.<span class="ruby-identifier">send</span>(<span class="ruby-ivar">@method</span>, <span class="ruby-node">&quot;#@action?#@field=#{CGI.escape(url)}&quot;</span>)
215
- 39: <span class="ruby-keyword kw">end</span>
216
- 40: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">code</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@code</span>.<span class="ruby-identifier">to_s</span>
217
- 41: <span class="ruby-ivar">@block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">response</span>.<span class="ruby-identifier">read_body</span>)
218
- 42: <span class="ruby-keyword kw">end</span>
219
- 43: }
220
- 44: <span class="ruby-keyword kw">end</span>
209
+ <span class="ruby-comment cmt"># File lib/shorturl.rb, line 37</span>
210
+ 37: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">url</span>)
211
+ 38: <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">start</span>(<span class="ruby-ivar">@hostname</span>, <span class="ruby-ivar">@port</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">http</span><span class="ruby-operator">|</span>
212
+ 39: <span class="ruby-identifier">response</span> = <span class="ruby-keyword kw">case</span> <span class="ruby-ivar">@method</span>
213
+ 40: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:post</span><span class="ruby-operator">:</span> <span class="ruby-identifier">http</span>.<span class="ruby-identifier">send</span>(<span class="ruby-ivar">@method</span>, <span class="ruby-ivar">@action</span>, <span class="ruby-node">&quot;#@field=#{url}&quot;</span>)
214
+ 41: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:get</span><span class="ruby-operator">:</span> <span class="ruby-identifier">http</span>.<span class="ruby-identifier">send</span>(<span class="ruby-ivar">@method</span>, <span class="ruby-node">&quot;#@action?#@field=#{CGI.escape(url)}&quot;</span>)
215
+ 42: <span class="ruby-keyword kw">end</span>
216
+ 43: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">code</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@code</span>.<span class="ruby-identifier">to_s</span>
217
+ 44: <span class="ruby-ivar">@block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">response</span>.<span class="ruby-identifier">read_body</span>)
218
+ 45: <span class="ruby-keyword kw">end</span>
219
+ 46: }
220
+ 47: <span class="ruby-keyword kw">end</span>
221
221
  </pre>
222
222
  </div>
223
223
  </div>
@@ -155,6 +155,9 @@ Valid <tt>service</tt> values:
155
155
  </li>
156
156
  <li><tt>:shorterlink</tt>
157
157
 
158
+ </li>
159
+ <li><tt>:minlink</tt>
160
+
158
161
  </li>
159
162
  </ul>
160
163
  <p>
@@ -168,14 +171,14 @@ call-seq:
168
171
  onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
169
172
  <div class="method-source-code" id="M000002-source">
170
173
  <pre>
171
- <span class="ruby-comment cmt"># File lib/shorturl.rb, line 137</span>
172
- 137: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">shorten</span>(<span class="ruby-identifier">url</span>, <span class="ruby-identifier">service</span> = <span class="ruby-identifier">:rubyurl</span>)
173
- 138: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@@valid_services</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">service</span>
174
- 139: <span class="ruby-ivar">@@services</span>[<span class="ruby-identifier">service</span>].<span class="ruby-identifier">call</span>(<span class="ruby-identifier">url</span>)
175
- 140: <span class="ruby-keyword kw">else</span>
176
- 141: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;Invalid service&quot;</span>
177
- 142: <span class="ruby-keyword kw">end</span>
178
- 143: <span class="ruby-keyword kw">end</span>
174
+ <span class="ruby-comment cmt"># File lib/shorturl.rb, line 148</span>
175
+ 148: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">shorten</span>(<span class="ruby-identifier">url</span>, <span class="ruby-identifier">service</span> = <span class="ruby-identifier">:rubyurl</span>)
176
+ 149: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@@valid_services</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">service</span>
177
+ 150: <span class="ruby-ivar">@@services</span>[<span class="ruby-identifier">service</span>].<span class="ruby-identifier">call</span>(<span class="ruby-identifier">url</span>)
178
+ 151: <span class="ruby-keyword kw">else</span>
179
+ 152: <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidService</span>
180
+ 153: <span class="ruby-keyword kw">end</span>
181
+ 154: <span class="ruby-keyword kw">end</span>
179
182
  </pre>
180
183
  </div>
181
184
  </div>
@@ -198,10 +201,10 @@ Returns @@<a href="ShortURL.html#M000001">valid_services</a>
198
201
  onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
199
202
  <div class="method-source-code" id="M000001-source">
200
203
  <pre>
201
- <span class="ruby-comment cmt"># File lib/shorturl.rb, line 113</span>
202
- 113: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">valid_services</span>
203
- 114: <span class="ruby-ivar">@@valid_services</span>
204
- 115: <span class="ruby-keyword kw">end</span>
204
+ <span class="ruby-comment cmt"># File lib/shorturl.rb, line 123</span>
205
+ 123: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">valid_services</span>
206
+ 124: <span class="ruby-ivar">@@valid_services</span>
207
+ 125: <span class="ruby-keyword kw">end</span>
205
208
  </pre>
206
209
  </div>
207
210
  </div>
data/doc/created.rid CHANGED
@@ -1 +1 @@
1
- Sun Jun 05 15:37:07 EDT 2005
1
+ Tue Jun 07 15:30:52 EDT 2005
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Sun Jun 05 15:31:15 EDT 2005</td>
59
+ <td>Tue Jun 07 15:30:33 EDT 2005</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -70,6 +70,16 @@
70
70
 
71
71
  <div id="description">
72
72
  <p>
73
+ 0.4.0:
74
+ </p>
75
+ <pre>
76
+ - Added minilink.org
77
+ - More tests for the Service class
78
+ - Changed the ArgumentError exception for an InvalidService exception in ShortURL.shorten
79
+ - Created examples/shorten.rb
80
+ - Added a stats task to the Rakefile. Requires code_statistics, provided by Rails.
81
+ </pre>
82
+ <p>
73
83
  0.3.0:
74
84
  </p>
75
85
  <pre>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Sun Jun 05 15:37:02 EDT 2005</td>
59
+ <td>Tue Jun 07 01:17:24 EDT 2005</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -124,6 +124,9 @@ The second parameter represents the service you want to use. These are:
124
124
  </li>
125
125
  <li><tt>:shorterlink</tt>
126
126
 
127
+ </li>
128
+ <li><tt>:minilink</tt>
129
+
127
130
  </li>
128
131
  </ul>
129
132
  <p>
data/doc/files/TODO.html CHANGED
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Sat Jun 04 23:12:24 EDT 2005</td>
59
+ <td>Sun Jun 05 23:59:51 EDT 2005</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -71,10 +71,6 @@
71
71
  <div id="description">
72
72
  <h1>Todo</h1>
73
73
  <ul>
74
- <li>Make services an instance of a <a
75
- href="../classes/Service.html">Service</a> class
76
-
77
- </li>
78
74
  <li>Check out WWW::Mecanize
79
75
 
80
76
  </li>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Sun Jun 05 15:32:04 EDT 2005</td>
59
+ <td>Tue Jun 07 15:20:28 EDT 2005</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -20,6 +20,7 @@
20
20
  <div id="index">
21
21
  <h1 class="section-bar">Classes</h1>
22
22
  <div id="index-entries">
23
+ <a href="classes/InvalidService.html">InvalidService</a><br />
23
24
  <a href="classes/Service.html">Service</a><br />
24
25
  <a href="classes/ShortURL.html">ShortURL</a><br />
25
26
  </div>
@@ -0,0 +1,27 @@
1
+ require "rubygems"
2
+ require "shorturl"
3
+
4
+
5
+ def usage
6
+ puts "Usage: #$0 <url> [<service>]"
7
+ puts "Valid services:"
8
+ ShortURL.valid_services.map { |s| s.to_s }.sort.each { |s| puts "\t#{s}" }
9
+ end
10
+
11
+ def main
12
+ begin
13
+ case ARGV.length
14
+ when 0: usage
15
+ when 1: puts ShortURL.shorten(ARGV[0])
16
+ else puts ShortURL.shorten(ARGV[0], ARGV[1].to_sym)
17
+ end
18
+ rescue InvalidService
19
+ puts "Invalid service"
20
+ usage
21
+ end
22
+ end
23
+
24
+
25
+ if $0 == __FILE__
26
+ main
27
+ end
data/lib/shorturl.rb CHANGED
@@ -7,6 +7,9 @@ require "net/http"
7
7
  require "cgi"
8
8
  require "uri"
9
9
 
10
+ class InvalidService < Exception
11
+ end
12
+
10
13
  class Service
11
14
  attr_accessor :port, :code, :method, :action, :field, :block
12
15
 
@@ -45,7 +48,11 @@ class Service
45
48
  end
46
49
 
47
50
  class ShortURL
48
-
51
+ # Hash table of all the supported services. The key is a symbol
52
+ # representing the service (usually the hostname minus the .com,
53
+ # .net, etc.) The value is an instance of Service with all the
54
+ # parameters set so that when +instance+.call is invoked, the
55
+ # shortened URL is returned.
49
56
  @@services = {
50
57
  :rubyurl => Service.new("rubyurl.com") { |s|
51
58
  s.code = 302
@@ -79,9 +86,7 @@ class ShortURL
79
86
  :metamark => Service.new("metamark.net") { |s|
80
87
  s.action = "/add"
81
88
  s.field = "long_url"
82
- s.block = lambda { |body|
83
- URI.extract(body).grep(/xrl.us/)[0]
84
- }
89
+ s.block = lambda { |body| URI.extract(body).grep(/xrl.us/)[0] }
85
90
  },
86
91
 
87
92
  :makeashorterlink => Service.new("makeashorterlink.com") { |s|
@@ -103,6 +108,11 @@ class ShortURL
103
108
  s.method = :get
104
109
  s.action = "/add_url.html"
105
110
  s.block = lambda { |body| URI.extract(body).grep(/shorterlink/)[0] }
111
+ },
112
+
113
+ :minilink => Service.new("minilink.org") { |s|
114
+ s.method = :get
115
+ s.block = lambda { |body| URI.extract(body)[-1] }
106
116
  }
107
117
  }
108
118
  # Array containing symbols representing all the implemented URL
@@ -130,6 +140,7 @@ class ShortURL
130
140
  # * <tt>:skinnylink</tt>
131
141
  # * <tt>:linktrim</tt>
132
142
  # * <tt>:shorterlink</tt>
143
+ # * <tt>:minlink</tt>
133
144
  #
134
145
  # call-seq:
135
146
  # ShortURL.shorten("http://mypage.com") => Uses RubyURL
@@ -138,7 +149,7 @@ class ShortURL
138
149
  if @@valid_services.include? service
139
150
  @@services[service].call(url)
140
151
  else
141
- raise ArgumentError, "Invalid service"
152
+ raise InvalidService
142
153
  end
143
154
  end
144
155
  end
data/test/tc_service.rb CHANGED
@@ -1,4 +1,4 @@
1
- # tc_ervicerb
1
+ # tc_service.rb
2
2
  #
3
3
  # Created by Vincent Foley on 2005-06-01
4
4
 
@@ -14,6 +14,15 @@ class TestService < Test::Unit::TestCase
14
14
  def test_call
15
15
  service = Service.new("oasdasobf")
16
16
  assert_raise(SocketError) { service.call(nil) }
17
+
18
+ service = Service.new("tinyurl.com") { |s|
19
+ s.code = 404
20
+ s.action = "/create.php"
21
+ s.block = lambda { |body|
22
+ URI.extract(body).grep(/tinyurl/)[-1]
23
+ }
24
+ }
25
+ assert_nil service.call("http://www.google.com")
17
26
  end
18
27
 
19
28
  def test_initialize
data/test/tc_shorturl.rb CHANGED
@@ -25,7 +25,8 @@ class TestShortURL < Test::Unit::TestCase
25
25
  assert ShortURL.shorten(@url, :skinnylink) == "http://skinnylink.com?nqvcce"
26
26
  assert ShortURL.shorten(@url, :linktrim) =~ /http:\/\/linktrim/ # Never the same URL
27
27
  assert ShortURL.shorten(@url, :shorterlink) == "http://shorterlink.com/?PQD096"
28
+ assert ShortURL.shorten(@url, :minilink) == "http://lnk.nu/darkhost.mine.nu:81/2zr.html"
28
29
 
29
- assert_raise(ArgumentError) { ShortURL.shorten(@url, :foobar) }
30
+ assert_raise(InvalidService) { ShortURL.shorten(@url, :foobar) }
30
31
  end
31
32
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.10
3
3
  specification_version: 1
4
4
  name: shorturl
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.3.0
7
- date: 2005-06-05
6
+ version: 0.4.0
7
+ date: 2005-06-07
8
8
  summary: Shortens URLs using services such as TinyURL and RubyURL
9
9
  require_paths:
10
10
  - lib
@@ -36,6 +36,7 @@ files:
36
36
  - doc/fr_method_index.html
37
37
  - doc/index.html
38
38
  - doc/rdoc-style.css
39
+ - doc/classes/InvalidService.html
39
40
  - doc/classes/Service.html
40
41
  - doc/classes/ShortURL.html
41
42
  - doc/files/ChangeLog.html
@@ -47,6 +48,7 @@ files:
47
48
  - test/tc_service.rb
48
49
  - test/tc_shorturl.rb
49
50
  - test/ts_all.rb
51
+ - examples/shorten.rb
50
52
  - README
51
53
  - TODO
52
54
  - MIT-LICENSE