goshortener 1.2 → 1.2.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/README.rdoc +13 -3
- data/lib/goshortener.rb +0 -3
- metadata +3 -19
data/README.rdoc
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
= GoShortener
|
1
|
+
= GoShortener http://dl.dropbox.com/u/2735646/still-maintained.png
|
2
2
|
|
3
3
|
Uses Google URL shortener API service to shorten/expand given URLs.
|
4
4
|
|
@@ -7,7 +7,7 @@ Uses Google URL shortener API service to shorten/expand given URLs.
|
|
7
7
|
=== Installation
|
8
8
|
gem install goshortener
|
9
9
|
|
10
|
-
of if you are using bundler, add the following line to your Gemfile.
|
10
|
+
of if you are using bundler in your project, add the following line to your Gemfile.
|
11
11
|
gem "goshortener"
|
12
12
|
|
13
13
|
=== Initialize
|
@@ -15,7 +15,8 @@ of if you are using bundler, add the following line to your Gemfile.
|
|
15
15
|
or
|
16
16
|
go = GoShortener.new
|
17
17
|
|
18
|
-
Using Google API keys will increase the usage quota.
|
18
|
+
Using Google API keys will increase the usage quota.
|
19
|
+
|
19
20
|
|
20
21
|
=== Shorten urls
|
21
22
|
short_url = go.shorten "http://github.com/luckydev"
|
@@ -33,6 +34,15 @@ Using Google API keys will increase the usage quota.
|
|
33
34
|
ruby-1.9.2-p136 :004 > go.lengthen "http://goo.gl/TCZHi"
|
34
35
|
=> "http://github.com/luckydev"
|
35
36
|
|
37
|
+
== Usage in Rails project
|
38
|
+
|
39
|
+
If you are using goshortener in a rails project, you can put the following lines in an initializer file.
|
40
|
+
For example, in config/initializers/goshortener.rb
|
41
|
+
|
42
|
+
GO = GoShortener.new(YOUR_API_KEY)
|
43
|
+
|
44
|
+
And anywhere in your rails project, you can call GO.shorten or GO.lengthen
|
45
|
+
|
36
46
|
== Author
|
37
47
|
|
38
48
|
lakshmanan (lucky.developer@gmail.com)
|
data/lib/goshortener.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require "rubygems"
|
2
|
-
|
3
2
|
require "rest_client"
|
4
3
|
require "json"
|
5
4
|
|
@@ -10,8 +9,6 @@ class GoShortener
|
|
10
9
|
def initialize(api_key="")
|
11
10
|
unless api_key == ""
|
12
11
|
@api_key = api_key
|
13
|
-
else
|
14
|
-
puts "[GoShortener] Use Google API key to increase your usage quota."
|
15
12
|
end
|
16
13
|
@base_url = "https://www.googleapis.com/urlshortener/v1/url"
|
17
14
|
end
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: goshortener
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 11
|
5
4
|
prerelease:
|
6
|
-
|
7
|
-
- 1
|
8
|
-
- 2
|
9
|
-
version: "1.2"
|
5
|
+
version: 1.2.1
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- lakshmanan
|
@@ -14,7 +10,7 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date: 2011-
|
13
|
+
date: 2011-05-22 00:00:00 +05:30
|
18
14
|
default_executable:
|
19
15
|
dependencies:
|
20
16
|
- !ruby/object:Gem::Dependency
|
@@ -25,9 +21,6 @@ dependencies:
|
|
25
21
|
requirements:
|
26
22
|
- - ">="
|
27
23
|
- !ruby/object:Gem::Version
|
28
|
-
hash: 3
|
29
|
-
segments:
|
30
|
-
- 0
|
31
24
|
version: "0"
|
32
25
|
type: :runtime
|
33
26
|
version_requirements: *id001
|
@@ -39,9 +32,6 @@ dependencies:
|
|
39
32
|
requirements:
|
40
33
|
- - ">="
|
41
34
|
- !ruby/object:Gem::Version
|
42
|
-
hash: 3
|
43
|
-
segments:
|
44
|
-
- 0
|
45
35
|
version: "0"
|
46
36
|
type: :runtime
|
47
37
|
version_requirements: *id002
|
@@ -71,23 +61,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
71
61
|
requirements:
|
72
62
|
- - ">="
|
73
63
|
- !ruby/object:Gem::Version
|
74
|
-
hash: 3
|
75
|
-
segments:
|
76
|
-
- 0
|
77
64
|
version: "0"
|
78
65
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
66
|
none: false
|
80
67
|
requirements:
|
81
68
|
- - ">="
|
82
69
|
- !ruby/object:Gem::Version
|
83
|
-
hash: 3
|
84
|
-
segments:
|
85
|
-
- 0
|
86
70
|
version: "0"
|
87
71
|
requirements: []
|
88
72
|
|
89
73
|
rubyforge_project:
|
90
|
-
rubygems_version: 1.
|
74
|
+
rubygems_version: 1.6.2
|
91
75
|
signing_key:
|
92
76
|
specification_version: 3
|
93
77
|
summary: GoShortener uses Google URL shortener service to shorten/expand urls.
|