If you are using a version of plaid-ruby older than 14.0.0 (released August 2021), you must update your integration to accommodate significant interface changes. Key changes include a new client initialization pattern using Plaid::Configuration, renamed endpoint methods that include underscores (e.g., auth_get instead of auth.get), and a change in how errors are handled via Plaid::ApiError.
### Client initialization
From:
```ruby
client = Plaid::Client.new(env: :sandbox,
client_id: client_id,
secret: secret)
To:
configuration = Plaid::Configuration.new
configuration.server_index = Plaid::Configuration::Environment["sandbox"]
configuration.api_key["PLAID-CLIENT-ID"] = ENV["PLAID_RUBY_CLIENT_ID"]
configuration.api_key["PLAID-SECRET"] = ENV["PLAID_RUBY_SECRET"]
configuration.api_key["Plaid-Version"] = "2020-09-14"
api_client = Plaid::ApiClient.new(
configuration
)
client = Plaid::PlaidApi.new(api_client)
Endpoints
From:
response = client.auth.get(access_token)
To:
auth_get_request = Plaid::AuthGetRequest.new
auth_get_request.access_token = access_token
or
auth_get_request = Plaid::AuthGetRequest.new({:access_token => access_token})
response = client.auth_get(auth_get_request)
Errors
From:
begin
client.auth.get(auth_get_request)
rescue Plaid::PlaidAPIError => e
raise e if e.error_code != 'PRODUCT_NOT_READY'
sleep 1
end
To:
begin
client.auth_get(auth_get_request)
rescue Plaid::ApiError => e
json_response = JSON.parse(e.response_body)
if json_response["error_code"] != "PRODUCT_NOT_READY"
end