Skip to content

Instantly share code, notes, and snippets.

@JesseHerrick
Created November 9, 2013 01:56
Show Gist options
  • Save JesseHerrick/7380532 to your computer and use it in GitHub Desktop.
Save JesseHerrick/7380532 to your computer and use it in GitHub Desktop.
Basic HTTParty post command.
require 'json'
require 'httparty'
class Googl
include HTTParty
base_uri "https://www.googleapis.com"
headers "Content-Type" => "application/json"
def self.shorten(url)
post("/urlshortener/v1/url", :body => {:longUrl => url}.to_json)["id"]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment