Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RestClient undefined method `delete_if' for #<String:0x4b699a8>

OK so, I'm using RestClient and sending this:

{"x_select_params":["account.*"],"domain":"thedomain"}

Via

response = RestClient.get servername, @payload

And I get

undefined method `delete_if' for #<String:0x4b699a8>

In response.

I know that the request is good as it works fine when I use the Chrome rest client extension, I'm thinking that RestClient is having an issue in parsing the response, which is supposed to look like this:

{
    "user": {
        "id": 4035,
        "first_name": "Chris",
        "last_name": "Penta",
        "status": "PENDING",
        "domain": "thedomain",
        "default_account_id": 111315004004010,
        "primary_alias_id": 131090,
        "accounts": [
        {
            "id": 111315004004010,
            "urn": "111315004004010",
            "balance": 0,
            "status": 0,
            "currency_code": 840
        }
    ]
    }
}

Is this a bug in RestClient that needs patching? And if so, anyone know how to fix?

Thanks...Chris

like image 978
thinkfuture Avatar asked Mar 28 '26 23:03

thinkfuture


1 Answers

I found this error when the headers were in a json format. They needed to be a hash to work.

like image 181
Mark Swardstrom Avatar answered Apr 03 '26 17:04

Mark Swardstrom