Skip to content

Instantly share code, notes, and snippets.

@julesfern
Created March 18, 2009 19:38
Show Gist options
  • Select an option

  • Save julesfern/81339 to your computer and use it in GitHub Desktop.

Select an option

Save julesfern/81339 to your computer and use it in GitHub Desktop.
>> url = URI.parse("http://spreedly.com/api/v4/tails-test/subscribers/9/stop_auto_renew.xml")
=> #<URI::HTTP:0x10353c6 URL:http://spreedly.com/api/v4/tails-test/subscribers/9/stop_auto_renew.xml>
>> req = Net::HTTP::Post.new(url.path)
=> #<Net::HTTP::Post POST>
>> req.basic_auth 'sdfsdf', 'sdfsdf'
=> ["Basic MWJjMjlmNDc3NGRhZjYyZTJkN2E0MWQ4NzU4M2FiYjc4MmM4M2Q3MTptb2NoaW1vY2hp"]
>> res = Net::HTTP.new(url.host, url.port).start {|http| http.request(req) }
=> #<Net::HTTPFound 302 Found readbody=true>
>> res.body
=> "<html><body>You are being <a href=\"https://spreedly.com/api/v4/tails-test/subscribers/9/stop_auto_renew.xml\">redirected</a>.</body></html>"
>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment