Ruby library
The Onvo gem provides utilities to seamlessly communicate with the Onvo platform, allowing developers to integrate AI-powered dashboards into their products. This README provides an overview of the package's features, installation, and usage instructions.
Installation
You can install the gem using :
gem install onvo
Getting Started
To begin using the Onvo gem, you'll need an API key from the Onvo platform and an endpoint.
You can store your API key as an environment variable named ONVO_API_KEY
.
ONVO_API_KEY="your_api_key"
Usage
Here's an example of how to use the gem to interact with the Onvo platform:
require 'onvo'
# Initialize the Onvo class with your API key, will default to ENV variables if not given.
onvo = Onvo.new("https://dashboard.onvo.ai/api", "your_api_key_here")
# Identify/Create a user
sample_user_id = onvo.embed_users.upsert(
{
id: 'sample-embed-user-id',
name: "John Appleseed",
email: "john@appleseed.com",
metadata: {
phone_number: "+1 234 5678",
organisation_id: "87dfty9872ydq8tg",
},
}
)["id"]
# Create a dashboard
sample_dashboard_id = onvo.dashboards.create({
description: "Sample Description of a Sample Dashboard.",
title: "Sample Dashboard"
})
# Create a session
session_url = onvo.sessions.upsert(
sample_dashboard_id,
sample_user_id
)["url"]
Library Reference
YARD documentation will soon be added.
Global Variables
.api_key
: Your API key for authentication..endpoint
: The base URL to the Onvo platform or your self-hosted endpoint.
Accounts
.accounts.list()
.accounts.get(id:str)
Automations
.automations.list()
.automations.get(id:str)
.automations.create(data:dict)
.automations.update(id:str, data:dict)
.automations.delete(id:str)
Dashboards
-
.dashboards.list()
-
.dashboards.get(id:str)
-
.dashboards.create(data:dict)
-
.dashboards.update(id:str, data:dict)
-
.dashboards.delete(id:str)
-
.dashboard(dashboard_id:str).datasources.list()
-
.dashboard(dashboard_id:str).datasources.link(datasource_id:str)
-
.dashboard(dashboard_id:str).datasources.unlink(datasource_id:str)
Datasources
-
.datasources.list()
-
.datasources.get(id:str)
-
.datasources.create(data:dict)
-
.datasources.update(id:str, data:dict)
-
.datasources.delete(id:str)
-
.datasources.populate_columns(id:str)
-
.datasources.get_data(id:str)
Embed Users
-
.embed_users.list()
-
.embed_users.get(id:str)
-
.embed_users.upsert(id:str, data:dict)
-
.embed_users.delete(id:str)
-
.embed_users.get_access_token(id:str)
Sessions
.sessions.list(dashboard_id:str)
.sessions.upsert(dashboard_id:str, user_id:dict)
.sessions.delete(dashboard_id:str)
Teams
.teams.list()
.teams.get(id:str)
Questions
.questions.list(dashboard_id:str)
.questions.create(dashboard_id:str, query:str)
.questions.delete(question_id:str)
Widgets
-
.widgets.list(dashboard_id:str)
-
.widgets.get(id:str)
-
.widgets.create(dashboard_id:str, query:str)
-
.widgets.update(id:str, data:dict)
-
.widgetss.delete(id:str)
-
.widgets.get_image(id:str)