CommitMsgUrlShortener::Service.define do |commit_message| def call_isgd_api long_url error_safe_request do uri = URI "http://is.gd/create.php?format=simple&url=#{long_url}" Net::HTTP.get uri end end each_long_url(commit_message) {|url| call_isgd_api url} end