Search code examples
ruby-on-railsmailchimpgibbon

Gibbon GEM: API wrapper for MailChimp's API - How to implement with a DELETE method


The Gibbon Gem seems quite versatile. I managed to use it and create GET requests. For example, I am able to do a GET request and get all information on an order on Mailchimp. But I somehow can't make a request with the method DELETE.

So here is my code:

gibbon.ecommerce.stores("YourStoreName")
                .orders("orderNumber")
                .retrieve(headers: {"method": "delete"})

The result is a GET request and a huge JSON with all information on the order. If I run the exact same request again, I get the same information back (even though I wanted to delete it)

Anyone have a good idea?


Solution

  • By writing this answer I just found the solution myself.

    The correct solution would be to use the .delete method (and not trying to specify the method in the header)

    gibbon.ecommerce.stores("YourStoreName")
                    .orders("orderNumber")
                    .delete
    

    Keeping the answer here, because maybe someone else will find this useful.