The Faraday middleware used to catch errors.
Sections
Methods
Instance Public methods
on_complete(env)
Link
Source: show
# File lib/plaid/middleware.rb, line 18 def on_complete(env) return unless Faraday::Response::RaiseError::ClientErrorStatuses .include?(env[:status]) error_class = Plaid::Error.error_from_type(env.body['error_type']) raise error_class.new(env.body['error_type'], env.body['error_code'], env.body['error_message'], env.body['display_message'], env.body['request_id']) end
Internal
Constants
NETWORK_HEADERS | = | { 'User-Agent' => "Plaid Ruby v#{Plaid::VERSION}", 'Content-Type' => 'application/json', 'Plaid-Version' => Plaid::API_VERSION }.freeze |
Headers used for correct request and SDK tracking. |
||
NETWORK_TIMEOUT | = | 600 |
Default read timeout for HTTP calls in seconds. |