Sha256: 2483aba5341379720fbaba670c915967f54b444bddc13cf10e3018196a630fc9
Contents?: true
Size: 614 Bytes
Versions: 1
Compression:
Stored size: 614 Bytes
Contents
module RDStation class ErrorHandler class InvalidCredentials attr_reader :api_response, :error ERROR_CODE = 'ACCESS_DENIED'.freeze EXCEPTION_CLASS = RDStation::Error::InvalidCredentials def initialize(api_response) @api_response = api_response @error = JSON.parse(api_response.body)['errors'] end def raise_error return unless credentials_errors? raise EXCEPTION_CLASS.new(error['error_message'], api_response) end private def credentials_errors? error['error_type'] == ERROR_CODE end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rdstation-ruby-client-1.0.0 | lib/rdstation/error_handler/invalid_credentials.rb |