Sha256: 69599291c2e0e6356029a61447151a226fe359817f92a41590c394798c1f6f51

Contents?: true

Size: 479 Bytes

Versions: 1

Compression:

Stored size: 479 Bytes

Contents

CommitMsgUrlShortener::Service.define do |commit_message|
  def call_googl_api long_url
    error_safe_request do
      uri = URI 'http://svel.to/links'
      http = Net::HTTP.new uri.host
      http.read_timeout = 3
      resp = http.post uri.path, "{'link': '#{long_url}'}", {"content-type" => "application/json", "accept" => "application/json"}
      json = JSON.parse resp.body
      json['url']
    end
  end
  
  each_long_url(commit_message) {|url| call_googl_api url}
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
commit-msg-url-shortener-0.0.2 lib/commit-msg-url-shortener/services/svel.to.rb