nabeelamjad / poke-api

Poke API - A Ruby API gem for Pokémon GO.
MIT License
82 stars 22 forks source link

No way to get status_code or error #14

Closed xssc closed 8 years ago

xssc commented 8 years ago

There is no way to get the status_code of a response or the error string because the response given only includes the subresponses

xssc commented 8 years ago

Replacing These lines with something like the code below helps, but I was running into some issues when I tested it and am busy right now

@resonse = @response.to_hash.delete('returns')
@response = decoded_resp.merge(@response)
nabeelamjad commented 8 years ago

I'll add the status_code and error in, going to leave out the authentication information unless there's demand for it (it's in bytes anyhow).

xssc commented 8 years ago

Okay, thanks

nabeelamjad commented 8 years ago

Commit 8f3caa91adb07c1e636dd9e9b71cfec4ae0bde5b fixes this issue, new tag is 0.0.4 with updated readme/gpsoauth and response.

You can access the status code and error using call.response.status_code and call.response.error (if the error is empty then assume there's no error).