Closed sebfie closed 11 years ago
It's my first pull request, do no hesitate to make me a feedback.
I am using your gem and I got an error trying to get CpCodes, so, I decided to fix it and share my fix. I did not written tests because you already tested this code but tests failed.
My patch fix tests and code.
Thank you for your pull request :)
Instead of doing all that changes, couldn't you convert the result in an array with Array::wrap
?
Something like:
response = client.request('getCPCodes').body[:multi_ref]
Array.wrap(response).map do |hash|
...
end
For me specs are working. Can you open an issue with the error you are receiving and your ruby version ?
Thank you again
Did you try when the response has only one CpCode? Look my second commit : https://github.com/Ditchou/akamai_api/commit/598995f9fda57a9b4da9d153de74dedd5640a3b7
Yes, I saw it. I would use Array::wrap
exactly for this purpose: Array::wrap doc
In practice Array.wrap(response)
will return response
if response is an Array. If response
is an hash (like in your case, with only one cpcode), it will return [response]
I will do that tomorrow :) Thx
Le 26 févr. 2013 à 23:14, Nicola Racco notifications@github.com a écrit :
Yes, I saw it. I would use Array::wrap exactly for this purpose: Array::wrap doc In practice Array.wrap(response) will return response if response is an Array. If response is an hash (like in your case, with only one cpcode), it will return [response]
— Reply to this email directly or view it on GitHub.
...e and return it. (Also fixed tests)