googleurlshortener 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +29 -1
- data/googleurlshortener.gemspec +1 -2
- data/lib/googleurlshortener/version.rb +1 -1
- data/test/test_url_shortener.rb +12 -19
- metadata +4 -3
data/README.md
CHANGED
@@ -34,4 +34,32 @@ Assuming a Googleurlshortener instance named `s`, one can do the following
|
|
34
34
|
|
35
35
|
- `s.shorten(long_url)`
|
36
36
|
- `s.expand(short_url)`
|
37
|
-
- `s.analytics(short_url)` (Authenticated only) Returns an object in the structure of the JSON object sent by Google.
|
37
|
+
- `s.analytics(short_url)` (Authenticated only) Returns an object, in the structure of the JSON object sent by Google, with a bunch of analytics data such as number of clicks.
|
38
|
+
|
39
|
+
Additional Documentation
|
40
|
+
------------------------
|
41
|
+
|
42
|
+
[RubyGems rubydocs](http://rubydoc.info/gems/googleurlshortener)
|
43
|
+
|
44
|
+
License
|
45
|
+
-------
|
46
|
+
|
47
|
+
Copyright (C) 2011 Martin Kraft
|
48
|
+
|
49
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
50
|
+
this software and associated documentation files (the "Software"), to deal in
|
51
|
+
the Software without restriction, including without limitation the rights to
|
52
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
53
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
54
|
+
so, subject to the following conditions:
|
55
|
+
|
56
|
+
The above copyright notice and this permission notice shall be included in all
|
57
|
+
copies or substantial portions of the Software.
|
58
|
+
|
59
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
60
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
61
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
62
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
63
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
64
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
65
|
+
SOFTWARE.
|
data/googleurlshortener.gemspec
CHANGED
@@ -10,9 +10,8 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.homepage = "https://github.com/mkraft/GoogleUrlShortener"
|
11
11
|
s.summary = %q{Shorten and expand URL's with Google's shortener API.}
|
12
12
|
s.description = %q{Shorten a long URL, get click analylitcs about it, and re-expand it again using Google's URL shortening API.}
|
13
|
-
|
13
|
+
s.license = 'MIT'
|
14
14
|
s.rubyforge_project = "googleurlshortener"
|
15
|
-
|
16
15
|
s.files = `git ls-files`.split("\n")
|
17
16
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
17
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
data/test/test_url_shortener.rb
CHANGED
@@ -1,35 +1,28 @@
|
|
1
1
|
require 'test/unit'
|
2
|
-
require 'shoulda'
|
3
2
|
require_relative '../lib/googleurlshortener'
|
4
3
|
|
5
4
|
module GoogleUrlShortener
|
6
5
|
class TestUrlShortener < Test::Unit::TestCase
|
7
6
|
|
8
|
-
|
7
|
+
def test_shorten_a_url
|
9
8
|
url_shortener = Googleurlshortener::Default.new
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
assert long_url.size > short_url.size
|
14
|
-
end
|
9
|
+
long_url = "https://github.com/mkraft/GoogleAPIs"
|
10
|
+
short_url = url_shortener.shorten(long_url)
|
11
|
+
assert long_url.size > short_url.size
|
15
12
|
end
|
16
13
|
|
17
|
-
|
14
|
+
def test_expand_a_url
|
18
15
|
url_shortener = Googleurlshortener::Default.new
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
assert long_url.size > short_url.size
|
23
|
-
end
|
16
|
+
short_url = "http://goo.gl/cQJ6o"
|
17
|
+
long_url = url_shortener.expand(short_url)
|
18
|
+
assert long_url.size > short_url.size
|
24
19
|
end
|
25
20
|
|
26
|
-
|
21
|
+
def test_get_analytics_object
|
27
22
|
url_shortener = Googleurlshortener::Authenticated.new("apitest33@gmail.com", "ruhak23A")
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
assert analytics["kind"] == "urlshortener#url"
|
32
|
-
end
|
23
|
+
short_url = "http://goo.gl/cQJ6o"
|
24
|
+
analytics = url_shortener.analytics(short_url)
|
25
|
+
assert analytics["kind"] == "urlshortener#url"
|
33
26
|
end
|
34
27
|
|
35
28
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: googleurlshortener
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-12-
|
12
|
+
date: 2011-12-22 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Shorten a long URL, get click analylitcs about it, and re-expand it again
|
15
15
|
using Google's URL shortening API.
|
@@ -28,7 +28,8 @@ files:
|
|
28
28
|
- lib/googleurlshortener/version.rb
|
29
29
|
- test/test_url_shortener.rb
|
30
30
|
homepage: https://github.com/mkraft/GoogleUrlShortener
|
31
|
-
licenses:
|
31
|
+
licenses:
|
32
|
+
- MIT
|
32
33
|
post_install_message:
|
33
34
|
rdoc_options: []
|
34
35
|
require_paths:
|