Created
August 19, 2016 16:31
-
-
Save bcackerman/3e955726289c320d811cbb028881a484 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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