unshortme 0.1.1 → 0.1.2

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/CHANGELOG CHANGED
@@ -1,2 +1,3 @@
1
+ 0.1.2 - Added new tests and dependencies in the Rake file
1
2
  0.1.1 - Basic functionality
2
3
  0.1.0 - Initial Version (just structure)
data/LICENSE ADDED
@@ -0,0 +1,27 @@
1
+ Copyright (c) 2011, Julián David Duque
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification,
5
+ are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice,
8
+ this list of conditions and the following disclaimer.
9
+
10
+ * Redistributions in binary form must reproduce the above copyright notice,
11
+ this list of conditions and the following disclaimer in the documentation
12
+ and/or other materials provided with the distribution.
13
+
14
+ * The name of Julián David Duque may not be used to endorse or promote
15
+ products derived from this software without specific prior written
16
+ permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
22
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/Manifest CHANGED
@@ -1,4 +1,5 @@
1
1
  CHANGELOG
2
+ LICENSE
2
3
  README.rdoc
3
4
  Rakefile
4
5
  init.rb
data/Rakefile CHANGED
@@ -2,13 +2,14 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('unshortme', '0.1.1') do |p|
5
+ Echoe.new('unshortme', '0.1.2') do |p|
6
6
  p.description = "Use the unshort.me API"
7
7
  p.url = "http://github.com/julianduque/unshortme"
8
8
  p.author = "Julian Duque"
9
9
  p.email = "julianduquej@gmail.com"
10
10
  p.ignore_pattern = ["tmp/*", "script/*"]
11
- p.development_dependencies = []
11
+ p.dependencies = ['json', 'rest-client']
12
+ p.development_dependencies = ['rspec']
12
13
  end
13
14
 
14
15
  Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
@@ -1,16 +1,39 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'Unshortme' do
4
-
5
- it 'should not return the unshorted url' do
4
+
5
+ it "should not return the unshorted url if the url isn't short" do
6
6
  unshorted = Unshortme.unshort("the url")
7
- unshorted.should_not == nil
8
7
  unshorted.should match /the url/
9
8
  end
10
9
 
10
+ it "should not return the unshorted url if the api response isn't a valid json" do
11
+ json = "<html><body></body></html>"
12
+ json.stub(:code).and_return(200)
13
+ RestClient.stub(:get).and_return(json)
14
+ unshorted = Unshortme.unshort("http://bit.ly/lathw6")
15
+ unshorted.should == "http://bit.ly/lathw6"
16
+ end
17
+
18
+ it "should not return the unshorted url if the api response code isn't 200" do
19
+ json = "<html><body></body></html>"
20
+ json.stub(:code).and_return(500)
21
+ RestClient.stub(:get).and_return(json)
22
+ unshorted = Unshortme.unshort("http://bit.ly/lathw6")
23
+ unshorted.should == "http://bit.ly/lathw6"
24
+ end
25
+
11
26
  it 'should return the unshorted url' do
12
- unshorted = Unshortme.unshort("http://bit.ly/lathw5")
13
- unshorted.should_not == nil
27
+ json = <<-JSON
28
+ {
29
+ "requestedURL":"http:\/\/bit.ly\/lathw6",
30
+ "success":"true",
31
+ "resolvedURL":"http:\/\/get2java.blogspot.com\/2011\/07\/whats-up-in-java-17.html"
32
+ }
33
+ JSON
34
+ json.stub(:code).and_return(200)
35
+ RestClient.stub(:get).and_return(json)
36
+ unshorted = Unshortme.unshort("http://bit.ly/lathw6")
14
37
  unshorted.should == 'http://get2java.blogspot.com/2011/07/whats-up-in-java-17.html'
15
38
  end
16
39
  end
data/unshortme.gemspec CHANGED
@@ -2,15 +2,15 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{unshortme}
5
- s.version = "0.1.1"
5
+ s.version = "0.1.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 = [%q{Julian Duque}]
9
- s.date = %q{2011-07-07}
9
+ s.date = %q{2011-07-14}
10
10
  s.description = %q{Use the unshort.me API}
11
11
  s.email = %q{julianduquej@gmail.com}
12
- s.extra_rdoc_files = [%q{CHANGELOG}, %q{README.rdoc}, %q{lib/unshortme.rb}]
13
- s.files = [%q{CHANGELOG}, %q{README.rdoc}, %q{Rakefile}, %q{init.rb}, %q{lib/unshortme.rb}, %q{spec/spec_helper.rb}, %q{spec/unshortme_spec.rb}, %q{Manifest}, %q{unshortme.gemspec}]
12
+ s.extra_rdoc_files = [%q{CHANGELOG}, %q{LICENSE}, %q{README.rdoc}, %q{lib/unshortme.rb}]
13
+ s.files = [%q{CHANGELOG}, %q{LICENSE}, %q{README.rdoc}, %q{Rakefile}, %q{init.rb}, %q{lib/unshortme.rb}, %q{spec/spec_helper.rb}, %q{spec/unshortme_spec.rb}, %q{unshortme.gemspec}, %q{Manifest}]
14
14
  s.homepage = %q{http://github.com/julianduque/unshortme}
15
15
  s.rdoc_options = [%q{--line-numbers}, %q{--inline-source}, %q{--title}, %q{Unshortme}, %q{--main}, %q{README.rdoc}]
16
16
  s.require_paths = [%q{lib}]
@@ -22,8 +22,17 @@ Gem::Specification.new do |s|
22
22
  s.specification_version = 3
23
23
 
24
24
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
25
+ s.add_runtime_dependency(%q<json>, [">= 0"])
26
+ s.add_runtime_dependency(%q<rest-client>, [">= 0"])
27
+ s.add_development_dependency(%q<rspec>, [">= 0"])
25
28
  else
29
+ s.add_dependency(%q<json>, [">= 0"])
30
+ s.add_dependency(%q<rest-client>, [">= 0"])
31
+ s.add_dependency(%q<rspec>, [">= 0"])
26
32
  end
27
33
  else
34
+ s.add_dependency(%q<json>, [">= 0"])
35
+ s.add_dependency(%q<rest-client>, [">= 0"])
36
+ s.add_dependency(%q<rspec>, [">= 0"])
28
37
  end
29
38
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unshortme
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Julian Duque
@@ -15,9 +15,50 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-07 00:00:00 Z
19
- dependencies: []
20
-
18
+ date: 2011-07-14 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: json
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: rest-client
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ hash: 3
43
+ segments:
44
+ - 0
45
+ version: "0"
46
+ type: :runtime
47
+ version_requirements: *id002
48
+ - !ruby/object:Gem::Dependency
49
+ name: rspec
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ hash: 3
57
+ segments:
58
+ - 0
59
+ version: "0"
60
+ type: :development
61
+ version_requirements: *id003
21
62
  description: Use the unshort.me API
22
63
  email: julianduquej@gmail.com
23
64
  executables: []
@@ -26,18 +67,20 @@ extensions: []
26
67
 
27
68
  extra_rdoc_files:
28
69
  - CHANGELOG
70
+ - LICENSE
29
71
  - README.rdoc
30
72
  - lib/unshortme.rb
31
73
  files:
32
74
  - CHANGELOG
75
+ - LICENSE
33
76
  - README.rdoc
34
77
  - Rakefile
35
78
  - init.rb
36
79
  - lib/unshortme.rb
37
80
  - spec/spec_helper.rb
38
81
  - spec/unshortme_spec.rb
39
- - Manifest
40
82
  - unshortme.gemspec
83
+ - Manifest
41
84
  homepage: http://github.com/julianduque/unshortme
42
85
  licenses: []
43
86