pinterest-api icon indicating copy to clipboard operation
pinterest-api copied to clipboard

Access response http status

Open tak1n opened this issue 9 years ago • 0 comments

For proper error handling we want to rely on the http status codes which pinterest api gives back: https://developers.pinterest.com/docs/api/overview/#errors

Currently in https://github.com/realadeel/pinterest-api/blob/master/lib/pinterest/client.rb#L60 only the response body will be returned.

An example response:

[2] pry(#<Onlim::Adapter::Publish::Link::Pinterest>)> response
=> {"status"=>"failure", "code"=>3, "host"=>"devplatform-devapi-prod-f7410648", "generated_at"=>"Wed, 26 Oct 2016 09:19:28 +0000", "message"=>"Authorization failed.", "data"=>nil}

We want to rely on the documented http return status codes instead of relying on the code which is returned in the body (didn't find documentation about this code).

Are there any problems in returning the whole response?

tak1n avatar Oct 27 '16 11:10 tak1n