philnash-bitly 0.1.4 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +10 -0
- data/README.txt +4 -0
- data/Rakefile +3 -1
- data/bitly.gemspec +7 -8
- data/lib/bitly.rb +4 -0
- data/lib/bitly/client.rb +0 -1
- data/lib/bitly/utils.rb +5 -1
- data/lib/bitly/version.rb +1 -1
- data/test/test_bitly.rb +1 -0
- metadata +6 -6
data/History.txt
CHANGED
data/README.txt
CHANGED
@@ -33,6 +33,10 @@ u.hash #=> "2V6CFi"
|
|
33
33
|
u.info #=> a ruby hash of the JSON returned from the API
|
34
34
|
u.stats #=> a ruby hash of the JSON returned from the API
|
35
35
|
|
36
|
+
You should be able to specify a keyword when shortening (though at last test, this didn't seem to be working http://code.google.com/p/bitly-api/issues/detail?id=5). To do so, just add a keyword parameter:
|
37
|
+
|
38
|
+
bitly.shorten('http://www.google.com', 'keyword')
|
39
|
+
|
36
40
|
== LICENSE:
|
37
41
|
|
38
42
|
(The MIT License)
|
data/Rakefile
CHANGED
@@ -5,12 +5,14 @@ require 'rake'
|
|
5
5
|
require 'echoe'
|
6
6
|
require './lib/bitly.rb'
|
7
7
|
|
8
|
+
# modified by coryosborn to remove native JSON dependency
|
9
|
+
|
8
10
|
Echoe.new('bitly', Bitly::VERSION) do |p|
|
9
11
|
p.description = "Use the bit.ly API to shorten or expand URLs"
|
10
12
|
p.url = "http://github.com/philnash/bitly"
|
11
13
|
p.author = "Phil Nash"
|
12
14
|
p.email = "philnash@gmail.com"
|
13
|
-
p.
|
15
|
+
p.extra_deps = [['crack', '>= 0.1.1']]
|
14
16
|
p.development_dependencies = []
|
15
17
|
end
|
16
18
|
|
data/bitly.gemspec
CHANGED
@@ -2,34 +2,33 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{bitly}
|
5
|
-
s.version = "0.
|
5
|
+
s.version = "0.2"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Phil Nash"]
|
9
|
-
s.date = %q{2009-
|
9
|
+
s.date = %q{2009-06-23}
|
10
10
|
s.description = %q{Use the bit.ly API to shorten or expand URLs}
|
11
11
|
s.email = %q{philnash@gmail.com}
|
12
12
|
s.extra_rdoc_files = ["lib/bitly/client.rb", "lib/bitly/url.rb", "lib/bitly/utils.rb", "lib/bitly/version.rb", "lib/bitly.rb", "README.txt"]
|
13
13
|
s.files = ["bitly.gemspec", "History.txt", "lib/bitly/client.rb", "lib/bitly/url.rb", "lib/bitly/utils.rb", "lib/bitly/version.rb", "lib/bitly.rb", "Manifest", "Rakefile", "README.txt", "test/test_bitly.rb"]
|
14
|
-
s.has_rdoc = true
|
15
14
|
s.homepage = %q{http://github.com/philnash/bitly}
|
16
15
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Bitly", "--main", "README.txt"]
|
17
16
|
s.require_paths = ["lib"]
|
18
17
|
s.rubyforge_project = %q{bitly}
|
19
|
-
s.rubygems_version = %q{1.3.
|
18
|
+
s.rubygems_version = %q{1.3.4}
|
20
19
|
s.summary = %q{Use the bit.ly API to shorten or expand URLs}
|
21
20
|
s.test_files = ["test/test_bitly.rb"]
|
22
21
|
|
23
22
|
if s.respond_to? :specification_version then
|
24
23
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
25
|
-
s.specification_version =
|
24
|
+
s.specification_version = 3
|
26
25
|
|
27
26
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
28
|
-
s.add_runtime_dependency(%q<
|
27
|
+
s.add_runtime_dependency(%q<crack>, [">= 0.1.1"])
|
29
28
|
else
|
30
|
-
s.add_dependency(%q<
|
29
|
+
s.add_dependency(%q<crack>, [">= 0.1.1"])
|
31
30
|
end
|
32
31
|
else
|
33
|
-
s.add_dependency(%q<
|
32
|
+
s.add_dependency(%q<crack>, [">= 0.1.1"])
|
34
33
|
end
|
35
34
|
end
|
data/lib/bitly.rb
CHANGED
data/lib/bitly/client.rb
CHANGED
data/lib/bitly/utils.rb
CHANGED
@@ -39,7 +39,11 @@ module Bitly
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def get_result(request)
|
42
|
-
|
42
|
+
begin
|
43
|
+
result = Crack::JSON.parse(Net::HTTP.get(request))
|
44
|
+
rescue
|
45
|
+
result = {'statusCode' => 'JSON Parse Error(Bit.ly messed up)', 'errorCode' => 69}
|
46
|
+
end
|
43
47
|
if result['statusCode'] == "OK"
|
44
48
|
result = result['results']
|
45
49
|
else
|
data/lib/bitly/version.rb
CHANGED
data/test/test_bitly.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: philnash-bitly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: "0.2"
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Phil Nash
|
@@ -9,18 +9,18 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-06-23 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
16
|
+
name: crack
|
17
17
|
type: :runtime
|
18
18
|
version_requirement:
|
19
19
|
version_requirements: !ruby/object:Gem::Requirement
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version:
|
23
|
+
version: 0.1.1
|
24
24
|
version:
|
25
25
|
description: Use the bit.ly API to shorten or expand URLs
|
26
26
|
email: philnash@gmail.com
|
@@ -47,7 +47,7 @@ files:
|
|
47
47
|
- Rakefile
|
48
48
|
- README.txt
|
49
49
|
- test/test_bitly.rb
|
50
|
-
has_rdoc:
|
50
|
+
has_rdoc: false
|
51
51
|
homepage: http://github.com/philnash/bitly
|
52
52
|
post_install_message:
|
53
53
|
rdoc_options:
|
@@ -76,7 +76,7 @@ requirements: []
|
|
76
76
|
rubyforge_project: bitly
|
77
77
|
rubygems_version: 1.2.0
|
78
78
|
signing_key:
|
79
|
-
specification_version:
|
79
|
+
specification_version: 3
|
80
80
|
summary: Use the bit.ly API to shorten or expand URLs
|
81
81
|
test_files:
|
82
82
|
- test/test_bitly.rb
|