Skip to content

Commit

Permalink
Merge pull request #4 from Parad0X/https
Browse files Browse the repository at this point in the history
Use the new HTTPS API
  • Loading branch information
jgorset committed Mar 12, 2016
2 parents 2b21e14 + 595efcb commit efee6ee
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
language: ruby
rvm:
- 1.9.2
- 1.9.3
- 2.0.0
- 2.1
- 2.2
script: bundle exec rspec
before_install:
- gem install bundler -v '~> 1.11'
4 changes: 2 additions & 2 deletions lib/gitio.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module Gitio
# to use it in place of a random value for the
# shortened URL.
def self.shorten(url, code=nil)
Net::HTTP.start "git.io", 80 do |http|
Net::HTTP.start "git.io", 443, :use_ssl => true do |http|
request = Net::HTTP::Post.new "/"
request.content_type = "application/x-www-form-urlencoded"

Expand All @@ -37,7 +37,7 @@ def self.shorten(url, code=nil)
def self.lengthen(url)
url = URI(url)

Net::HTTP.start url.host, 80 do |http|
Net::HTTP.start url.host, 443, :use_ssl => true do |http|
request = Net::HTTP::Get.new url.path

response = http.request(request)
Expand Down
2 changes: 1 addition & 1 deletion lib/gitio/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Gitio
VERSION = "0.0.3"
VERSION = "0.0.4"
end
4 changes: 2 additions & 2 deletions spec/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
Gitio::CLI.new ["https://github.com/jgorset/git.io"]
end

output.should eq "http://git.io/Vhp6yw\n"
output.should eq "https://git.io/Vhp6yw\n"
end

it "accepts an URL with a code" do
output = capture_stdout do
Gitio::CLI.new ["https://github.com/jgorset/git.io", "git.io"]
end

output.should eq "http://git.io/Vhp6yw\n"
output.should eq "https://git.io/Vhp6yw\n"
end

end
2 changes: 1 addition & 1 deletion spec/gitio_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

short_url = Gitio.shorten(original_url, "git.io")

short_url.should eq "http://git.io/Vhp6yw"
short_url.should eq "https://git.io/Vhp6yw"
end

it "should raise an exception upon trying to shorten an invalid URL" do
Expand Down

0 comments on commit efee6ee

Please sign in to comment.