tiny_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.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source "http://rubygems.org"
2
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,3 @@
1
+ module TinyUrl
2
+ VERSION = "0.0.1"
3
+ end
data/lib/tiny_url.rb ADDED
@@ -0,0 +1,18 @@
1
+ require "tiny_url/version"
2
+ require 'net/http'
3
+
4
+ module TinyUrl
5
+ def self.tinify(url)
6
+
7
+ uri = URI.parse "http://tinyurl.com/api-create.php?url=http://#{url}"
8
+ http = Net::HTTP.new(uri.host, uri.port)
9
+ request = Net::HTTP::Get.new(uri.request_uri)
10
+
11
+ response = http.request(request)
12
+
13
+ tiny_url = response.body
14
+ puts "The generated tiny url is #{tiny_url}, you're gonna see the page..."
15
+ sleep 1
16
+ `open #{tiny_url}`
17
+ end
18
+ end
data/tiny_url.gemspec ADDED
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "tiny_url/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "tiny_url"
7
+ s.version = TinyUrl::VERSION
8
+ s.authors = ["Rodrigo Alves Vieira"]
9
+ s.email = ["rodrigovieira1994@gmail.com"]
10
+ s.homepage = "http://rodrigoalvesvieira.com/tiny_url"
11
+ s.summary = %q{A gem for tinifying urls}
12
+ s.description = %q{A gem for tinifying urls}
13
+
14
+ s.rubyforge_project = "tiny_url"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+ end
metadata ADDED
@@ -0,0 +1,51 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tiny_url
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Rodrigo Alves Vieira
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-12-12 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: A gem for tinifying urls
15
+ email:
16
+ - rodrigovieira1994@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - .gitignore
22
+ - Gemfile
23
+ - Rakefile
24
+ - lib/tiny_url.rb
25
+ - lib/tiny_url/version.rb
26
+ - tiny_url.gemspec
27
+ homepage: http://rodrigoalvesvieira.com/tiny_url
28
+ licenses: []
29
+ post_install_message:
30
+ rdoc_options: []
31
+ require_paths:
32
+ - lib
33
+ required_ruby_version: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ required_rubygems_version: !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ requirements: []
46
+ rubyforge_project: tiny_url
47
+ rubygems_version: 1.8.11
48
+ signing_key:
49
+ specification_version: 3
50
+ summary: A gem for tinifying urls
51
+ test_files: []