Skip to content

Instantly share code, notes, and snippets.

@havenwood
Last active September 12, 2017 16:24
Show Gist options
  • Save havenwood/eac4b183d33a2d489b5578ac685cbe9f to your computer and use it in GitHub Desktop.
Save havenwood/eac4b183d33a2d489b5578ac685cbe9f to your computer and use it in GitHub Desktop.
craysiii
require 'net/http'
require 'uri'
uri = URI.parse 'https://api.twitch.tv/kraken'
request = Net::HTTP::Get.new uri
request['Accept'] = 'application/vnd.twitchtv.v5+json'
request['Client-Id'] = '<client_id>'
request['Authorization'] = 'OAuth <oauth_token>'
req_options = {use_ssl: uri.scheme == 'https'}
response = Net::HTTP.start uri.hostname, uri.port, req_options do |http|
http.request request
end
# response.code
# response.body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment