Actually, adding it to :headers isn't going to do what you want at
all.  Best bet seems to be to patch the gem to issue a POST request
along with _method = DELETE

   ---Mark

On Sat, Nov 28, 2009 at 1:26 PM, Mark McBride <[email protected]> wrote:
> This is the twitter gem at http://github.com/jnunemaker/twitter?  The
> problem seems to be that the list_remove_member in base.rb is trying
> to pass parameters in with :body in the last hash
>
>    def list_remove_member(list_owner_username, slug, id)
>      perform_delete("/#{list_owner_username}/#{slug}/members.json",
> :body => {:id => id})
>    end
>
> However perform_delete in request.rb completely ignores this option
>
>      def perform_delete
>        send(:delete, uri, options[:headers])
>      end
>
> You might try adding :headers => {:_method => "DELETE"} to your call,
> but the best path seems to be to get the gem fixed up.
>
>   ---Mark
>
> On Sat, Nov 28, 2009 at 10:20 AM, Michael <[email protected]> wrote:
>> I have given up with trying to make it work with DELETE and tired
>> sending "_method=DELETE" along with the body.. no success. i get
>> Unauthorized - Incorrect signature
>>
>> Any ideas?
>>
>> On Nov 28, 12:13 am, Michael <[email protected]> wrote:
>>> I know that i should post on the Twitter gem group(and i have) but
>>> that place is dead and also i think my problem is not with the gem but
>>> understanding how the oauth and REST works. I could be looking down
>>> the wrong path tho seeing as how i kinda feel like Alice down the
>>> rabbit hole.
>>>
>>> Everything dealing with lists works on the twitter gem but one thing
>>> and that's "list_remove_user" which is using the DELETE list members
>>> API.
>>>
>>> Now when i use it as planned i get this error.
>>>
>>> Twitter::RateLimitExceeded: (400): Bad Request - You must specify a
>>> member
>>>
>>> Which is the same error you get if you use the api via curl and leave
>>> off the id
>>>
>>> http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-DELETE-list-mem...
>>>
>>> It has nothing to do with the rate limit. twitter gem just returns all
>>> 400's as a ratelimitexceded. There is no rate limit for adding and
>>> removing list items and also my account is whitelisted.
>>>
>>> Then i moved on and noticed that the delete method was only passing
>>> the uri and header options meanwhile post and put had an extra body
>>> option.
>>>
>>> def perform_post
>>>   send(:post, uri, options[:body], options[:headers])
>>> end
>>>
>>> def perform_delete
>>>   send(:delete, uri, options[:headers])
>>> end
>>>
>>> From that i assumed that the id that gets passed for the users id must
>>> be inside of the options[:body] and that's why twitter was telling me
>>> "You must specify a member"
>>>
>>> When oauth gem creates the url's to query it does it like so and once
>>> again they do not include "body"
>>>
>>> def post(path, body = '', headers = {})
>>>  request(:post, path, body, headers)
>>> end
>>>
>>> def delete(path, headers = {})
>>>   request(:delete, path, headers)
>>> end
>>>
>>> But that all blows up when i add "body" to delete.
>>>
>>> So after all of this i guess what I'm wondering is.. is there
>>> something to do with oauth and REST that will not let you pass along
>>> extra params and do i need to look into using a POST method and
>>> passing _method=DELETE.
>>>
>>> I have not tried that yet because i have no idea how to attempt that
>>> in the confines of ruby using oauth. thanks for any help, this is
>>> driving me nuts.
>>>
>>> Mike.
>>
>

Reply via email to