Skip to content

Instantly share code, notes, and snippets.

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 bcackerman/3e955726289c320d811cbb028881a484 to your computer and use it in GitHub Desktop.
Save bcackerman/3e955726289c320d811cbb028881a484 to your computer and use it in GitHub Desktop.
uri = URI('https://api.catalog.com/v2/products')
Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
request = Net::HTTP::Get.new uri
request.basic_auth 'user', 'pass'
http.request request do |response|
open 'temp_file_name', 'wb' do |io|
response.read_body do |chunk|
io.write chunk
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment