Skip to content

Instantly share code, notes, and snippets.

@tanatana
Last active December 30, 2015 00:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tanatana/7749176 to your computer and use it in GitHub Desktop.
Save tanatana/7749176 to your computer and use it in GitHub Desktop.
im.kayac.com を Ruby からつかう
require 'openssl'
require 'net/http'
require 'uri'
IM_KAYAC_SECRET = "YOUR SECRET KEY"
IM_KAYAC_USER_ID = "YOUR USER ID"
def sendMessage(msg)
sha1builder = OpenSSL::Digest.new('sha1')
Net::HTTP.post_form(URI.parse("http://im.kayac.com/api/post/#{IM_KAYAC_USER_ID}"),
{'message'=>msg, 'sig'=>sha1builder.hexdigest(""+msg+IM_KAYAC_SECRET)})
end
sendMessage('Hello!')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment