From bd024dcc57c3bef965980f4ffe836d8d3573ce1b Mon Sep 17 00:00:00 2001 From: Johnny Shields Date: Sat, 22 Nov 2014 17:15:41 +0900 Subject: [PATCH 01/14] Gem cleanup: - Relax version dependency on httparty, RSpec and Jeweler gems - Gemfile.lock should be gitignored - Add Ruby 2.1.0 to Travis --- .gitignore | 1 + .travis.yml | 1 + Gemfile | 7 +++-- Gemfile.lock | 74 ---------------------------------------------------- 4 files changed, 5 insertions(+), 78 deletions(-) delete mode 100644 Gemfile.lock diff --git a/.gitignore b/.gitignore index 016916a..402de30 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ spec/dummy/tmp/ .rspec .rvmrc .rbenv-version +Gemfile.lock diff --git a/.travis.yml b/.travis.yml index bb6d718..90866ba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ rvm: - 1.9.2 - 1.9.3 - 2.0.0 + - 2.1.0 branches: only: - master diff --git a/Gemfile b/Gemfile index 75ec925..66497bb 100644 --- a/Gemfile +++ b/Gemfile @@ -1,11 +1,10 @@ source "http://rubygems.org" -gem "httparty", "~> 0.10.0" +gem "httparty", "~> 0.10" gem "json", ">= 1.4.6" group :development do - gem "rspec", "~> 2.10.0" - gem "bundler", "~> 1.3.5" - gem "jeweler", "~> 1.8.3" + gem "rspec", "~> 2.10" + gem "jeweler", ">= 1.8.3" gem "webmock", "~> 1.8.6" end diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index a982026..0000000 --- a/Gemfile.lock +++ /dev/null @@ -1,74 +0,0 @@ -GEM - remote: http://rubygems.org/ - specs: - addressable (2.3.5) - builder (3.2.2) - crack (0.4.1) - safe_yaml (~> 0.9.0) - diff-lcs (1.1.3) - faraday (0.8.8) - multipart-post (~> 1.2.0) - git (1.2.5) - github_api (0.10.1) - addressable - faraday (~> 0.8.1) - hashie (>= 1.2) - multi_json (~> 1.4) - nokogiri (~> 1.5.2) - oauth2 - hashie (2.0.5) - highline (1.6.19) - httparty (0.10.2) - multi_json (~> 1.0) - multi_xml (>= 0.5.2) - httpauth (0.2.0) - jeweler (1.8.6) - builder - bundler (~> 1.0) - git (>= 1.2.5) - github_api (= 0.10.1) - highline (>= 1.6.15) - nokogiri (= 1.5.10) - rake - rdoc - json (1.8.0) - jwt (0.1.8) - multi_json (>= 1.5) - multi_json (1.7.7) - multi_xml (0.5.4) - multipart-post (1.2.0) - nokogiri (1.5.10) - oauth2 (0.9.2) - faraday (~> 0.8) - httpauth (~> 0.2) - jwt (~> 0.1.4) - multi_json (~> 1.0) - multi_xml (~> 0.5) - rack (~> 1.2) - rack (1.5.2) - rake (10.1.0) - rdoc (4.0.1) - json (~> 1.4) - rspec (2.10.0) - rspec-core (~> 2.10.0) - rspec-expectations (~> 2.10.0) - rspec-mocks (~> 2.10.0) - rspec-core (2.10.1) - rspec-expectations (2.10.0) - diff-lcs (~> 1.1.3) - rspec-mocks (2.10.1) - safe_yaml (0.9.4) - webmock (1.8.11) - addressable (>= 2.2.7) - crack (>= 0.1.7) - -PLATFORMS - ruby - -DEPENDENCIES - bundler (~> 1.3.5) - httparty (~> 0.10.0) - jeweler (~> 1.8.3) - json (>= 1.4.6) - rspec (~> 2.10.0) - webmock (~> 1.8.6) From 821e453c62efab1dbea57771c2b8299d15b28974 Mon Sep 17 00:00:00 2001 From: johnnyshields Date: Mon, 22 Dec 2014 17:16:17 +0900 Subject: [PATCH 02/14] Regenerate gemspec --- googl.gemspec | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/googl.gemspec b/googl.gemspec index ae4f496..b79efa6 100644 --- a/googl.gemspec +++ b/googl.gemspec @@ -1,15 +1,17 @@ # Generated by jeweler # DO NOT EDIT THIS FILE DIRECTLY -# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' +# Instead, edit Jeweler::Tasks in rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- +# stub: googl 0.6.3 ruby lib Gem::Specification.new do |s| s.name = "googl" s.version = "0.6.3" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.require_paths = ["lib"] s.authors = ["Jesus Lopes"] - s.date = "2013-01-21" + s.date = "2014-12-22" s.description = "Small library for Google URL Shortener API" s.email = "jlopes@zigotto.com.br" s.extra_rdoc_files = [ @@ -18,7 +20,6 @@ Gem::Specification.new do |s| s.files = [ ".travis.yml", "Gemfile", - "Gemfile.lock", "MIT-LICENSE", "README.rdoc", "Rakefile", @@ -65,37 +66,30 @@ Gem::Specification.new do |s| ] s.homepage = "http://github.com/zigotto/googl" s.licenses = ["MIT"] - s.require_paths = ["lib"] - s.rubygems_version = "1.8.23" + s.rubygems_version = "2.2.2" s.summary = "Wrapper for Google URL Shortener API" if s.respond_to? :specification_version then - s.specification_version = 3 + s.specification_version = 4 if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then - s.add_runtime_dependency(%q, ["~> 0.10.0"]) + s.add_runtime_dependency(%q, ["~> 0.10"]) s.add_runtime_dependency(%q, [">= 1.4.6"]) - s.add_development_dependency(%q, ["~> 2.10.0"]) - s.add_development_dependency(%q, ["~> 1.2.3"]) - s.add_development_dependency(%q, ["~> 1.8.3"]) - s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, ["~> 2.10"]) + s.add_development_dependency(%q, [">= 1.8.3"]) s.add_development_dependency(%q, ["~> 1.8.6"]) else - s.add_dependency(%q, ["~> 0.10.0"]) + s.add_dependency(%q, ["~> 0.10"]) s.add_dependency(%q, [">= 1.4.6"]) - s.add_dependency(%q, ["~> 2.10.0"]) - s.add_dependency(%q, ["~> 1.2.3"]) - s.add_dependency(%q, ["~> 1.8.3"]) - s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 2.10"]) + s.add_dependency(%q, [">= 1.8.3"]) s.add_dependency(%q, ["~> 1.8.6"]) end else - s.add_dependency(%q, ["~> 0.10.0"]) + s.add_dependency(%q, ["~> 0.10"]) s.add_dependency(%q, [">= 1.4.6"]) - s.add_dependency(%q, ["~> 2.10.0"]) - s.add_dependency(%q, ["~> 1.2.3"]) - s.add_dependency(%q, ["~> 1.8.3"]) - s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 2.10"]) + s.add_dependency(%q, [">= 1.8.3"]) s.add_dependency(%q, ["~> 1.8.6"]) end end From 1715d924c8c18d2be4dfe883f7584ea22d332267 Mon Sep 17 00:00:00 2001 From: Yok Date: Thu, 29 Jan 2015 14:47:08 +0200 Subject: [PATCH 03/14] Shorten now supports Google's API Key and userIP request parameters. Used to bypass Google's request rate limits. --- lib/googl.rb | 4 ++-- lib/googl/shorten.rb | 16 +++++++++++++--- spec/googl/shorten_spec.rb | 30 ++++++++++++++++++++++++++++++ spec/spec_helper.rb | 24 ++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 5 deletions(-) diff --git a/lib/googl.rb b/lib/googl.rb index e31ab12..5be68d2 100644 --- a/lib/googl.rb +++ b/lib/googl.rb @@ -23,9 +23,9 @@ module Googl # url.short_url # => "http://goo.gl/ump4S" # - def shorten(url=nil) + def shorten(url=nil, user_ip = nil, api_key = nil) raise ArgumentError.new("URL to shorten is required") if url.nil? || url.strip.empty? - Googl::Shorten.new(url) + Googl::Shorten.new(url, user_ip, api_key) end # Expands a short URL or gets creation time and analytics diff --git a/lib/googl/shorten.rb b/lib/googl/shorten.rb index 5227e81..1ed938a 100644 --- a/lib/googl/shorten.rb +++ b/lib/googl/shorten.rb @@ -8,10 +8,20 @@ class Shorten < Base # Creates a new short URL, see Googl.shorten # - def initialize(long_url) + def initialize(long_url, user_ip = nil, api_key = nil) modify_headers('Content-Type' => 'application/json') - options = {"longUrl" => long_url}.to_json - resp = post(API_URL, :body => options) + options = {"longUrl" => long_url} + shorten_url = API_URL + + if (user_ip != nil && !user_ip.empty?) + options["userIp"] = user_ip + end + if (api_key != nil && !api_key.empty?) + shorten_url += "?key=#{api_key}" + end + + options_json = options.to_json + resp = post(shorten_url, :body => options_json) if resp.code == 200 self.short_url = resp['id'] self.long_url = resp['longUrl'] diff --git a/spec/googl/shorten_spec.rb b/spec/googl/shorten_spec.rb index b005c25..3d16d4d 100644 --- a/spec/googl/shorten_spec.rb +++ b/spec/googl/shorten_spec.rb @@ -53,6 +53,36 @@ end + context "with user_ip" do + subject { Googl.shorten('http://www.zigotto.com', "54.154.97.74") } + + describe "#short_url" do + it "should return a short URL" do + subject.short_url.should == 'http://goo.gl/ump4S' + end + end + end + + context "with api_key" do + subject { Googl.shorten('http://www.zigotto.com', nil, "Abc123") } + + describe "#short_url" do + it "should return a short URL" do + subject.short_url.should == 'http://goo.gl/ump4S' + end + end + end + + context "with user_ip and api_key" do + subject { Googl.shorten('http://www.zigotto.com', nil, "Abc123") } + + describe "#short_url" do + it "should return a short URL" do + subject.short_url.should == 'http://goo.gl/ump4S' + end + end + end + end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 1486f27..17e43ee 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -30,6 +30,30 @@ def fake_urls?(status) with(:body => params). to_return(load_fixture('shorten_invalid_content_type.json')) + # Shorten with user_ip + url_shorten = "https://www.googleapis.com/urlshortener/v1/url" + params = "{\"longUrl\":\"http://www.zigotto.com\",\"userIp\":\"54.154.97.74\"}" #json + stub_request(:post, url_shorten). + with(:body => params, + :headers => {'Content-Type'=>'application/json'}). + to_return(load_fixture('shorten.json')) + + # Shorten with api_key + url_shorten_with_key = "https://www.googleapis.com/urlshortener/v1/url?key=Abc123" + params = "{\"longUrl\":\"http://www.zigotto.com\"}" #json + stub_request(:post, url_shorten_with_key). + with(:body => params, + :headers => {'Content-Type'=>'application/json'}). + to_return(load_fixture('shorten.json')) + + # Shorten with user_ip and api_key + url_shorten_with_key = "https://www.googleapis.com/urlshortener/v1/url?key=Abc123" + params = "{\"longUrl\":\"http://www.zigotto.com\",\"userIp\":\"54.154.97.74\"}" #json + stub_request(:post, url_shorten_with_key). + with(:body => params, + :headers => {'Content-Type'=>'application/json'}). + to_return(load_fixture('shorten.json')) + # Expand url_expand = "https://www.googleapis.com/urlshortener/v1/url?shortUrl=http://goo.gl/7lob" stub_request(:get, url_expand).to_return(load_fixture('expand.json')) From 75b21f169d9650ea0171468084c8cedef8953517 Mon Sep 17 00:00:00 2001 From: Jesus Lopes Date: Tue, 3 Feb 2015 10:06:10 -0200 Subject: [PATCH 04/14] Remove ruby 1.8.7 and 1.9.2 from travis --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 90866ba..b2b0ec6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,9 @@ language: ruby rvm: - - 1.8.7 - - 1.9.2 - 1.9.3 - 2.0.0 - - 2.1.0 + - 2.1 + - 2.2 branches: only: - master From 401b01086992d622d647812c34d63317c57babed Mon Sep 17 00:00:00 2001 From: Jesus Lopes Date: Fri, 6 Feb 2015 17:12:27 -0200 Subject: [PATCH 05/14] Removed rspec deprecation warning --- spec/googl/client_spec.rb | 2 +- spec/googl/oauth2/native_spec.rb | 14 +++++++------- spec/googl/oauth2/server_spec.rb | 14 +++++++------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/spec/googl/client_spec.rb b/spec/googl/client_spec.rb index 0d4e341..c327b72 100644 --- a/spec/googl/client_spec.rb +++ b/spec/googl/client_spec.rb @@ -44,7 +44,7 @@ describe "#short_url" do it "should return a short URL" do - subject.short_url.start_with?("http://goo.gl/").should be_true + subject.short_url.start_with?("http://goo.gl/").should be true end end diff --git a/spec/googl/oauth2/native_spec.rb b/spec/googl/oauth2/native_spec.rb index 0377618..32f6e62 100644 --- a/spec/googl/oauth2/native_spec.rb +++ b/spec/googl/oauth2/native_spec.rb @@ -85,7 +85,7 @@ before do @now = Time.now - Time.stub!(:now).and_return(@now) + Time.stub(:now).and_return(@now) end let(:native) { subject.request_access_token("4/SuSud6RqPojUXsPpeh-wSVCwnmTQ") } @@ -99,17 +99,17 @@ describe "#expires?" do before :each do - Time.stub!(:now).and_return(Time.parse("2011-04-23 15:30:00")) + Time.stub(:now).and_return(Time.parse("2011-04-23 15:30:00")) subject.request_access_token("4/SuSud6RqPojUXsPpeh-wSVCwnmTQ") end it "should be true if access token expires" do - Time.stub!(:now).and_return(Time.parse("2011-04-23 18:30:00")) - subject.expires?.should be_true + Time.stub(:now).and_return(Time.parse("2011-04-23 18:30:00")) + subject.expires?.should be true end it "should be false if access token not expires" do - subject.expires?.should be_false + subject.expires?.should be false end end @@ -117,13 +117,13 @@ describe "#authorized?" do it "should return false if client is not authorized" do - subject.authorized?.should be_false + subject.authorized?.should be false end let(:native) { subject.request_access_token("4/SuSud6RqPojUXsPpeh-wSVCwnmTQ") } it "should return true if client is authorized" do - native.authorized?.should be_true + native.authorized?.should be true end end diff --git a/spec/googl/oauth2/server_spec.rb b/spec/googl/oauth2/server_spec.rb index c8e7dcc..89b97d4 100644 --- a/spec/googl/oauth2/server_spec.rb +++ b/spec/googl/oauth2/server_spec.rb @@ -89,7 +89,7 @@ before do @now = Time.now - Time.stub!(:now).and_return(@now) + Time.stub(:now).and_return(@now) end let(:server) { subject.request_access_token("4/z43CZpNmqd0IO3dR1Y_ouase13CH") } @@ -103,17 +103,17 @@ describe "#expires?" do before :each do - Time.stub!(:now).and_return(Time.parse("2011-04-23 15:30:00")) + Time.stub(:now).and_return(Time.parse("2011-04-23 15:30:00")) subject.request_access_token("4/z43CZpNmqd0IO3dR1Y_ouase13CH") end it "should be true if access token expires" do - Time.stub!(:now).and_return(Time.parse("2011-04-23 18:30:00")) - subject.expires?.should be_true + Time.stub(:now).and_return(Time.parse("2011-04-23 18:30:00")) + subject.expires?.should be true end it "should be false if access token not expires" do - subject.expires?.should be_false + subject.expires?.should be false end end @@ -121,13 +121,13 @@ describe "#authorized?" do it "should return false if client is not authorized" do - subject.authorized?.should be_false + subject.authorized?.should be false end let(:server) { subject.request_access_token("4/z43CZpNmqd0IO3dR1Y_ouase13CH") } it "should return true if client is authorized" do - server.authorized?.should be_true + server.authorized?.should be true end end From 2e3d281bf723c077db313c49eef8e2c76908b302 Mon Sep 17 00:00:00 2001 From: Jesus Lopes Date: Fri, 6 Feb 2015 17:44:24 -0200 Subject: [PATCH 06/14] Time freezing with Timecop --- Gemfile | 1 + spec/googl/oauth2/native_spec.rb | 13 ++++++++----- spec/googl/oauth2/server_spec.rb | 17 +++++++++++------ spec/spec_helper.rb | 1 + 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/Gemfile b/Gemfile index 66497bb..31ca2d6 100644 --- a/Gemfile +++ b/Gemfile @@ -7,4 +7,5 @@ group :development do gem "rspec", "~> 2.10" gem "jeweler", ">= 1.8.3" gem "webmock", "~> 1.8.6" + gem "timecop", "~> 0.7.1" end diff --git a/spec/googl/oauth2/native_spec.rb b/spec/googl/oauth2/native_spec.rb index 32f6e62..84e2b72 100644 --- a/spec/googl/oauth2/native_spec.rb +++ b/spec/googl/oauth2/native_spec.rb @@ -97,21 +97,24 @@ end describe "#expires?" do - - before :each do - Time.stub(:now).and_return(Time.parse("2011-04-23 15:30:00")) + before do + Timecop.freeze(DateTime.parse("2011-04-23 15:30:00")) subject.request_access_token("4/SuSud6RqPojUXsPpeh-wSVCwnmTQ") end it "should be true if access token expires" do - Time.stub(:now).and_return(Time.parse("2011-04-23 18:30:00")) - subject.expires?.should be true + Timecop.freeze(DateTime.parse("2011-04-23 18:30:00")) do + subject.expires?.should be true + end end it "should be false if access token not expires" do subject.expires?.should be false end + after do + Timecop.return + end end describe "#authorized?" do diff --git a/spec/googl/oauth2/server_spec.rb b/spec/googl/oauth2/server_spec.rb index 89b97d4..1dfc238 100644 --- a/spec/googl/oauth2/server_spec.rb +++ b/spec/googl/oauth2/server_spec.rb @@ -86,10 +86,9 @@ end describe "#expires_at" do - before do @now = Time.now - Time.stub(:now).and_return(@now) + Timecop.freeze(@now) end let(:server) { subject.request_access_token("4/z43CZpNmqd0IO3dR1Y_ouase13CH") } @@ -98,24 +97,30 @@ server.expires_at.should == (@now + 3600) end + after do + Timecop.return + end end describe "#expires?" do - before :each do - Time.stub(:now).and_return(Time.parse("2011-04-23 15:30:00")) + Timecop.freeze(DateTime.parse("2011-04-23 15:30:00")) subject.request_access_token("4/z43CZpNmqd0IO3dR1Y_ouase13CH") end it "should be true if access token expires" do - Time.stub(:now).and_return(Time.parse("2011-04-23 18:30:00")) - subject.expires?.should be true + Timecop.freeze(DateTime.parse("2011-04-23 18:30:00")) do + subject.expires?.should be true + end end it "should be false if access token not expires" do subject.expires?.should be false end + after do + Timecop.return + end end describe "#authorized?" do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 1486f27..9281866 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -4,6 +4,7 @@ require "rubygems" require "rspec" require 'webmock/rspec' +require 'timecop' require 'googl' require 'shared_examples' From db6216fb1b013fc507538b1e46974cc7b806120d Mon Sep 17 00:00:00 2001 From: Yok Date: Fri, 6 Feb 2015 21:46:30 +0200 Subject: [PATCH 07/14] Updated README with a usage sample of shorten with user_ip and google api_key --- README.markdown | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.markdown b/README.markdown index 30767ee..aa3a63c 100644 --- a/README.markdown +++ b/README.markdown @@ -14,6 +14,9 @@ Google URL Shortener API in Ruby ``` ruby url = Googl.shorten('http://www.zigotto.com') +// Optional - provide a user_ip and your google api_key to bypass Google's request rate limits +url = Googl.shorten('http://www.zigotto.com', "213.57.23.49", "google_api_key") + url.short_url #=> "http://goo.gl/ump4S" From a9cca02c376153d51098fb87c2154166fe856529 Mon Sep 17 00:00:00 2001 From: Jesus Lopes Date: Fri, 6 Feb 2015 17:55:43 -0200 Subject: [PATCH 08/14] Updated readme --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 30767ee..df5ab6d 100644 --- a/README.markdown +++ b/README.markdown @@ -246,4 +246,4 @@ gem install googl ## License -MIT License. Copyright 2011-2014 Zigotto®. http://www.zigotto.com.br +MIT License. Copyright 2011-2015 Zigotto®. http://www.zigotto.com.br From 831680471d447bdab47672d9efb57eba6f854f8a Mon Sep 17 00:00:00 2001 From: Yok Date: Fri, 6 Feb 2015 21:58:34 +0200 Subject: [PATCH 09/14] Fixed wrong comment syntax in README file. --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index aa3a63c..f98144b 100644 --- a/README.markdown +++ b/README.markdown @@ -14,7 +14,7 @@ Google URL Shortener API in Ruby ``` ruby url = Googl.shorten('http://www.zigotto.com') -// Optional - provide a user_ip and your google api_key to bypass Google's request rate limits +# Optional - provide a user_ip and your google api_key to bypass Google's request rate limits url = Googl.shorten('http://www.zigotto.com', "213.57.23.49", "google_api_key") url.short_url From 66b2951ddcc1f8448461b1a70c4aad78f501a1ed Mon Sep 17 00:00:00 2001 From: Jesus Lopes Date: Fri, 6 Feb 2015 18:01:35 -0200 Subject: [PATCH 10/14] Version bump to 0.7.0 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index a0a1517..bcaffe1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.6.3 \ No newline at end of file +0.7.0 \ No newline at end of file From 34926f33cd127304946c6a03e2d59ae9d7abad5f Mon Sep 17 00:00:00 2001 From: Jesus Lopes Date: Fri, 6 Feb 2015 18:01:40 -0200 Subject: [PATCH 11/14] Regenerate gemspec for version 0.7.0 --- googl.gemspec | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/googl.gemspec b/googl.gemspec index b79efa6..cf85722 100644 --- a/googl.gemspec +++ b/googl.gemspec @@ -1,27 +1,27 @@ # Generated by jeweler # DO NOT EDIT THIS FILE DIRECTLY -# Instead, edit Jeweler::Tasks in rakefile, and run 'rake gemspec' +# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- -# stub: googl 0.6.3 ruby lib +# stub: googl 0.7.0 ruby lib Gem::Specification.new do |s| s.name = "googl" - s.version = "0.6.3" + s.version = "0.7.0" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.require_paths = ["lib"] s.authors = ["Jesus Lopes"] - s.date = "2014-12-22" + s.date = "2015-02-06" s.description = "Small library for Google URL Shortener API" s.email = "jlopes@zigotto.com.br" s.extra_rdoc_files = [ - "README.rdoc" + "README.markdown" ] s.files = [ ".travis.yml", "Gemfile", "MIT-LICENSE", - "README.rdoc", + "README.markdown", "Rakefile", "VERSION", "googl.gemspec", @@ -66,7 +66,7 @@ Gem::Specification.new do |s| ] s.homepage = "http://github.com/zigotto/googl" s.licenses = ["MIT"] - s.rubygems_version = "2.2.2" + s.rubygems_version = "2.4.5" s.summary = "Wrapper for Google URL Shortener API" if s.respond_to? :specification_version then @@ -78,12 +78,14 @@ Gem::Specification.new do |s| s.add_development_dependency(%q, ["~> 2.10"]) s.add_development_dependency(%q, [">= 1.8.3"]) s.add_development_dependency(%q, ["~> 1.8.6"]) + s.add_development_dependency(%q, ["~> 0.7.1"]) else s.add_dependency(%q, ["~> 0.10"]) s.add_dependency(%q, [">= 1.4.6"]) s.add_dependency(%q, ["~> 2.10"]) s.add_dependency(%q, [">= 1.8.3"]) s.add_dependency(%q, ["~> 1.8.6"]) + s.add_dependency(%q, ["~> 0.7.1"]) end else s.add_dependency(%q, ["~> 0.10"]) @@ -91,6 +93,7 @@ Gem::Specification.new do |s| s.add_dependency(%q, ["~> 2.10"]) s.add_dependency(%q, [">= 1.8.3"]) s.add_dependency(%q, ["~> 1.8.6"]) + s.add_dependency(%q, ["~> 0.7.1"]) end end From d4dcb6e1955a1a71750b12ec17ff3694f19c5679 Mon Sep 17 00:00:00 2001 From: Thomah Date: Wed, 20 May 2015 16:19:21 +0200 Subject: [PATCH 12/14] Add a specific class for Googl error for better handling when using the gem --- lib/googl.rb | 1 + lib/googl/error.rb | 4 ++++ lib/googl/utils.rb | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 lib/googl/error.rb diff --git a/lib/googl.rb b/lib/googl.rb index 5be68d2..aa0e357 100644 --- a/lib/googl.rb +++ b/lib/googl.rb @@ -2,6 +2,7 @@ require 'ostruct' require 'json' +require 'googl/error' require 'googl/utils' require 'googl/base' require 'googl/request' diff --git a/lib/googl/error.rb b/lib/googl/error.rb new file mode 100644 index 0000000..da7125d --- /dev/null +++ b/lib/googl/error.rb @@ -0,0 +1,4 @@ +module Googl + class Error < StandardError + end +end \ No newline at end of file diff --git a/lib/googl/utils.rb b/lib/googl/utils.rb index 9e09abf..fc2c204 100644 --- a/lib/googl/utils.rb +++ b/lib/googl/utils.rb @@ -22,7 +22,7 @@ def get(url, params={}) end def exception(msg) - Exception.new(msg) + Googl::Error.new(msg) end end From 6a99687951fdb6c85299b5e4af5a4bbfd0102a16 Mon Sep 17 00:00:00 2001 From: Jesus Lopes Date: Thu, 21 May 2015 11:39:09 -0300 Subject: [PATCH 13/14] Version bump to 0.7.1 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index bcaffe1..7deb86f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.7.0 \ No newline at end of file +0.7.1 \ No newline at end of file From cb917a05c70bebb0deda556f2c931dd0830a4f2e Mon Sep 17 00:00:00 2001 From: Jesus Lopes Date: Thu, 21 May 2015 11:39:16 -0300 Subject: [PATCH 14/14] Regenerate gemspec for version 0.7.1 --- googl.gemspec | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/googl.gemspec b/googl.gemspec index cf85722..554c60f 100644 --- a/googl.gemspec +++ b/googl.gemspec @@ -2,16 +2,16 @@ # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- -# stub: googl 0.7.0 ruby lib +# stub: googl 0.7.1 ruby lib Gem::Specification.new do |s| s.name = "googl" - s.version = "0.7.0" + s.version = "0.7.1" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.require_paths = ["lib"] s.authors = ["Jesus Lopes"] - s.date = "2015-02-06" + s.date = "2015-05-21" s.description = "Small library for Google URL Shortener API" s.email = "jlopes@zigotto.com.br" s.extra_rdoc_files = [ @@ -28,6 +28,7 @@ Gem::Specification.new do |s| "lib/googl.rb", "lib/googl/base.rb", "lib/googl/client_login.rb", + "lib/googl/error.rb", "lib/googl/expand.rb", "lib/googl/oauth2/native.rb", "lib/googl/oauth2/server.rb",