Skip to content

Instantly share code, notes, and snippets.

@nafidurmus
Created August 8, 2018 21:01
Show Gist options
  • Save nafidurmus/61492f6e2fa19e368212d2a0e87aa83d to your computer and use it in GitHub Desktop.
Save nafidurmus/61492f6e2fa19e368212d2a0e87aa83d to your computer and use it in GitHub Desktop.
def index
require ‘uri’
require ‘net/http’
url = URI(“https://api.hurriyet.com.tr/v1/articles?$top=20")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request[“apikey”] = ‘kendi apikeyinizi buraya yapıştırın’
request[“accept”] = ‘application/json’
@response = http.request(request)
@hurriyet = JSON.parse(@response.body)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment