The problem is that helpscout gem does not capture this information. If you look at the source code
https://github.com/hramos/helpscout/blob/db8da936853c8df694186ab11100d4482f74d302/lib/helpscout/models.rb#L44
# Error Envelope class ErrorEnvelope attr_reader :status, :message # Creates a new ErrorEnvelope object from a Hash of attributes def initialize(object) @status = object["status"] @message = object["message"] end end
If an error occurs, they only capture status and message . You can raise the class below if you want additional header values
# Error Envelope class ErrorEnvelope attr_reader :status, :message, :limit # Creates a new ErrorEnvelope object from a Hash of attributes def initialize(object) @status = object["status"] @message = object["message"] @limit = object["header"]["X-RateLimit-...."] end end
But this will only inform you when you receive an error message. You can improve the library to fix these restrictions for each call. You will need to change client.rb
https://github.com/hramos/helpscout/blob/2449bc2604667edfca5ed934c8e61cd129b17af5/lib/helpscout/client.rb
module HelpScout class Client include HTTParty @@last_headers def self.get(*more) response = HTTParty.get(*more) @@last_headers = response.headers return response end def self.last_headers @@last_headers end .... .... end
So doing HelpScout.last_headers will give you the headers from the last answer, and then you can grab whatever field you need from the same
Tarun lalwani
source share