title: How to fire Delete method in HTTP request using Net::HTTP class in rails 4
body: <p>I am working with google calendar in rails app. I have fetch all the events and now I want to delete the event from rails app. for that I get <code>calendar.events.delete</code> method from google calendar api. But I am not aware hot to fire <code>delete</code> request in http. I have tried <a href="https://stackoverflow.com/questions/12821197/unable-to-make-http-delete-request-in-my-ruby-code-using-nethttp">all these answers</a>
   From <a href="https://developers.google.com/apis-explorer/#p/calendar/v3/calendar.events.delete?calendarId=my_calendar_id%2540gmail.com&amp;eventId=mycalendar%27seventID&amp;_h=2&amp;" rel="nofollow noreferrer">Google APIs Explorer</a> I could successfully delete the specific event from my google calendar. </p>
  
  <p>When I execute in google apis explorer by providing required details I got this url for delete the event:</p>
  
  <pre><code>DELETE https://www.googleapis.com/calendar/v3/calendars/{MY_CALENDAR_ID}%40gmail.com/events/mycalendar'seventID?key={MY_API_KEY}
  </code></pre>
  
  <p>For this I tried:</p>
  
  <pre><code>url = URI(url_path)
  request = Net::HTTP.new(url)
  request.delete
  </code></pre>
  
  <p>and</p>
  
  <pre><code>  uri = URI.parse(url_path)
    http = Net::HTTP.new(uri.host, uri.port)
    request = Net::HTTP::Delete.new(uri.request_uri) 
    http.request(request)
   =&gt; #Error : end of file reached
  </code></pre>
  
  <p>I had also look this class library: <a href="http://ruby-doc.org/stdlib-2.1.1/libdoc/net/http/rdoc/Net/HTTP/Delete.html" rel="nofollow noreferrer">Net::HTTP::Delete</a>  but here <code>Delete</code> is a class not method.</p>
  
  <p>This way I am getting calendar's all events:</p>
  
  <pre><code>    source = 'https://www.googleapis.com/calendar/v3/calendars/my_calendar_ido%40gmail.com/events?key={MY_KEY}'
      gcalendar_resp = Net::HTTP.get_response(URI.parse(source))
      data = gcalendar_resp.body
      result = JSON.parse(data)
  </code></pre>
  
  <p>Can any one help me How can I fire delete request?</p>