What's New

New updates and improvements to Jumpstart Pro

← Back

API Clients

New
Jumpstart Pro now ships with a built-in API client generator. You can use it to create your own API clients for integrations with any API you would like.

As developers, it's easy to reach for Rubygems, but each dependency we add makes it harder to maintain your application. We've found that we need to fork most API Rubygems to fix bugs or implement API features that aren't supported yet in the library. 

Now, our default is to build an API client ourselves. It's easy to maintain, doesn't break from external changes, and only implements the features we need. We've made this available to Jumpstart Pro users to more easily take advantage of building their own API clients.

It's customizable so you can override the authentication or response parsers to work however you need.

You can generate an API client using the following command:
rails g api_client OpenAi
This will generate your API client and test file. You can then implement methods for API endpoints.

Here's an example integrating with the OpenAI API:
class OpenAiClient < ApplicationClient
 BASE_URI = "https://api.openai.com/v1"

 def models
   get("/models")
 end

 def completions
   post("/completions", body: {model: "text-davinci-003", prompt: "Say this is a test", max_tokens: 7})
 end
end
Usage of it would look like this:
OpenAiClient.new(token: "sk-1234").models