pusher / pusher-platform-ruby

Sample authorizer component in Ruby
0 stars 4 forks source link

ErrorResponse gets 3 instead of 1 parameters #18

Closed stebo closed 6 years ago

stebo commented 6 years ago

What?

There seems to be a small bug in the ErrorResponse Class, whenever the API returns an Error :

ArgumentError: wrong number of arguments (given 3, expected 1)
from .../lib/pusher-platform/error_response.rb:7:in `initialize'

thats because ErrorResponse.initialize only takes 1 param (options) but in the BaseClient you call it with

raise ErrorResponse.new(response.status, response.headers, error_description)

Suggested improvements

options = {
  status: response.status,
  headers: response.headers,
  error_description: error_description
}
raise ErrorResponse.new(options)

CC @pusher/sigsdk

hamchapman commented 6 years ago

Thanks @stebo - are you using this library directly or are you using it as part of Chatkit?

stebo commented 6 years ago

@hamchapman using it with/for Chatkit - always ran into that error when the API was returning an error (e.g. because user was already created).

hamchapman commented 6 years ago

Published 0.8.1 which fixes this error. I'll publish a new version of the Chatkit gem which bumps its dependency to 0.8.1.

Thanks again for the report!