Sha256: 404d8fdcd77aa83329f9acb7eb5acd5a5037459e1ed37586d10c3f81714d87f5
Contents?: true
Size: 814 Bytes
Versions: 1
Compression:
Stored size: 814 Bytes
Contents
module RDStation class ErrorHandler class ExpiredAccessToken attr_reader :api_response, :response_headers, :error EXCEPTION_CLASS = RDStation::Error::ExpiredAccessToken def initialize(api_response) @api_response = api_response @error = JSON.parse(api_response.body)['errors'] @response_headers = api_response.headers end def raise_error return unless expired_token? raise EXCEPTION_CLASS.new(error['error_message'], api_response) end private def expired_token? auth_header = response_headers['x-amzn-remapped-www-authenticate'] || response_headers['www-authenticate'] return unless auth_header auth_header.include?('error="expired_token"') 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/expired_access_token.rb |