We currently have no publicly accessible Ruby SDK library, so it may be beneficial for you to use one of the various GraphQL clients as provided through the link below, or to setup your own.
For our examples in Ruby, we’re going to be using a very simple custom client to make our calls to the Kana GraphQL API - specify the following as its own class:
Copy
Ask AI
# Install the following gems beforehand and require themrequire 'httparty'require 'json'# Setup the GraphQL API client in Rubyclass KanaGraphqlClient def initialize(api_key) @api_key = api_key end def execute(query:, variables: nil) HTTParty.post( "https://api.usekana.com/graphql", headers: { 'Content-Type' => 'application/json', 'Authorization' => @api_key }, body: { query: query, variables: variables }.to_json ) endend
We can now initialize this when required by providing a Kana API Key - we’ll tie this initialized object to the client variable like so: