http2 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.0.5
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{http2}
8
- s.version = "0.0.4"
8
+ s.version = "0.0.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kasper Johansen"]
12
- s.date = %q{2012-07-14}
12
+ s.date = %q{2012-07-24}
13
13
  s.description = %q{A lightweight framework for doing http-connections in Ruby. Supports cookies, keep-alive, compressing and much more.}
14
14
  s.email = %q{k@spernj.org}
15
15
  s.extra_rdoc_files = [
@@ -16,6 +16,14 @@ class Http2
16
16
  return Http2.const_get(name)
17
17
  end
18
18
 
19
+ #Converts a URL to "is.gd"-short-URL.
20
+ def self.isgdlink(url)
21
+ Http2.new(:host => "is.gd") do |http|
22
+ resp = http.get("/api.php?longurl=#{url}")
23
+ return resp.body
24
+ end
25
+ end
26
+
19
27
  attr_reader :cookies, :args
20
28
 
21
29
  def initialize(args = {})
@@ -90,4 +90,9 @@ describe "Http2" do
90
90
  #raise "Body was empty." if res.body.to_s.length <= 0
91
91
  end
92
92
  end
93
+
94
+ it "should be able to convert URL's to 'is.gd'-short-urls" do
95
+ isgd = Http2.isgdlink("https://github.com/kaspernj/http2")
96
+ raise "Expected isgd-var to be 'http://is.gd/Z7kHSl' but it wasnt: '#{isgd}'." if isgd != "http://is.gd/Z7kHSl"
97
+ end
93
98
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: http2
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.4
5
+ version: 0.0.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Kasper Johansen
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-07-14 00:00:00 +02:00
13
+ date: 2012-07-24 00:00:00 +02:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -107,7 +107,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
- hash: -4193336568460171826
110
+ hash: -2734620261227702820
111
111
  segments:
112
112
  - 0
113
113
  version: "0"