long_url 0.0.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.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in long_url.gemspec
4
+ gemspec
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,15 @@
1
+ require "net/http"
2
+
3
+ require "long_url/version"
4
+
5
+ module LongURL
6
+ def self.find(url)
7
+ response = Net::HTTP.get_response(URI.parse(url))
8
+ case response
9
+ when Net::HTTPRedirection
10
+ find(response['location'])
11
+ else
12
+ url
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ module LongURL
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/long_url/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Utkarsh Kukreti"]
6
+ gem.email = ["utkarshkukreti@gmail.com"]
7
+ gem.description = %q{Longens urls like bit.ly, t.co, etc.}
8
+ gem.summary = %q{Longens urls like bit.ly, t.co, etc.}
9
+ gem.homepage = ""
10
+
11
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
+ gem.files = `git ls-files`.split("\n")
13
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ gem.name = "long_url"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = LongURL::VERSION
17
+
18
+ gem.add_development_dependency 'rspec'
19
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe LongURL do
4
+ it "should have a version" do
5
+ LongURL::VERSION.should be_a(String)
6
+ end
7
+
8
+ it "should work" do
9
+ LongURL.find("http://t.co/ttI9YPQ").should eq("http://twitter.com/fxn/status/112541008784408576/photo/1")
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ require 'bundler/setup'
2
+
3
+ require 'long_url'
4
+
5
+ RSpec.configure do |config|
6
+
7
+ end
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: long_url
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Utkarsh Kukreti
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-09-26 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: &70341582426940 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *70341582426940
25
+ description: Longens urls like bit.ly, t.co, etc.
26
+ email:
27
+ - utkarshkukreti@gmail.com
28
+ executables: []
29
+ extensions: []
30
+ extra_rdoc_files: []
31
+ files:
32
+ - .gitignore
33
+ - Gemfile
34
+ - Rakefile
35
+ - lib/long_url.rb
36
+ - lib/long_url/version.rb
37
+ - long_url.gemspec
38
+ - spec/long_url_spec.rb
39
+ - spec/spec_helper.rb
40
+ homepage: ''
41
+ licenses: []
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ! '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ requirements: []
59
+ rubyforge_project:
60
+ rubygems_version: 1.8.10
61
+ signing_key:
62
+ specification_version: 3
63
+ summary: Longens urls like bit.ly, t.co, etc.
64
+ test_files:
65
+ - spec/long_url_spec.rb
66
+ - spec/spec_helper.rb