Solving the SSL issue with the Rapleaf API

Posted on Apr 25, 2011

While working with the Rapleaf API, I encountered some major issues with SSL on production and staging servers.

Discarding what I did, the application just couldn’t get through to the external service using SSL and kept giving me errors regarding SSL communication.

After reading the Rapleaf gem documentation I found that you should reference your certificate file, this “telling” the service where your certificate file is.

I am working with Amazon EC2 for deployment of my application, both for production and for staging, I had some trouble finding the file, so I executed a *nix command and found the files in no time.

Here’s how you find the file:

[shell]

find / -name ‘*.pem’

[/shell]

Once you find the file, you just create the API instance and refer to it’s path like so:

[ruby]

@api = RapleafApi::Api.new(“YOUR_API_KEY”, :timeout => 10, :ca_file => “path_to_pem_file”)

[/ruby]

Have fun!