HTTParty basic auth, -, digest_auth. Net: HTTP: https://codesnippets.joyent.com/posts/show/1075, , Crack http://github.com/jnunemaker/crack:
def self.decode vin
url = URI.parse(APP_CONFIG[:vinlink_url])
Net::HTTP.start(url.host) do |http|
res = http.head(url.request_uri)
req = Net::HTTP::Get.new("/report?type=basic&vin=#{vin}")
req.digest_auth(APP_CONFIG[:vinlink_login], APP_CONFIG[:vinlink_password], res)
@response = http.request(req)
end
if @response.code == "200"
hash = Crack::XML.parse(@response.body).recursive_downcase_keys!.recursive_symbolize_keys!
end
end