Skip to content

Commit

Permalink
add section on deleting a resource to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Doug Black committed Sep 25, 2013
1 parent 10fdaa8 commit fdcdade
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs/usage/basics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,24 @@ Provide the :attr:`sid` of the resource you'd like to get.
@call = @client.account.calls.get("CA123")
puts @call.to
Deleting a Resource
-------------------------------

Resources can only be deleted via their instance object. This means
you must retrieve an individual object using :meth:`ListResource.get`
and then call :meth:`delete` on it.

.. code-block:: ruby
require 'twilio-ruby'
# To find these visit https://www.twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXX"
auth_token = "YYYYYYYYYYYYYYYYYY"
@client = Twilio::REST::Client.new account_sid, auth_token
@recording = @client.account.recordings.get("RC123")
@recording.delete()

2 comments on commit fdcdade

@andrewmbenton
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a quick note on this: the word retrieve may be misleading. There is no server round trip when #get is called. So if you happen to have a deletable object's sid already, calling something like @client.account.recordings.get("RC1213").delete() only performs a single HTTP round trip for the DELETE request.

Technically it is accurate as written, since a ruby object is "retrieved" when #get is called, but most people may think that this does more HTTP work than necessary.

@dougblack
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I'll reword.

Please sign in to comment.