Skip to content

RasepiHQ/rasepi-ruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rasepi Ruby SDK

Official Ruby client library for the Rasepi API — a multilingual-first collaborative documentation platform with forced expiry and plugin architecture.

Gem Version License: MIT Ruby 3.1+

Installation

Add to your Gemfile:

gem 'rasepi'

Or install directly:

gem install rasepi

Quick Start

require 'rasepi'

client = Rasepi::Client.new(
  base_url: 'https://your-instance.rasepi.com',
  access_token: 'your-access-token'
)

# List hubs
hubs = client.hubs.list
hubs.each { |hub| puts "#{hub['name']} (#{hub['key']})" }

# Get an entry
entry = client.entries.get(entry_id)
puts entry['title']

# Create a new entry
new_entry = client.entries.create(
  hub_key: 'engineering',
  key: 'getting-started',
  title: 'Getting Started Guide',
  content: '<p>Hello world</p>',
  original_language: 'en',
  expiry_days: 90
)

Authentication

OAuth 2.0 Flow

client = Rasepi::Client.new(base_url: 'https://your-instance.rasepi.com')

# Step 1: Get the OAuth login URL
login_url = client.auth.get_login_url('google', redirect_uri: 'https://your-app.com/callback')

# Step 2: Exchange the code
tokens = client.auth.exchange_code(auth_code)
# Client automatically stores and uses the tokens

# Tokens are refreshed automatically when expired

Token Refresh

tokens = client.auth.refresh_token(refresh_token)

Development Token

client = Rasepi::Client.new(
  base_url: 'http://localhost:5000',
  dev_token: { tenant_id: tenant_id, user_id: user_id }
)

API Reference

Hubs

client.hubs.list
client.hubs.get('engineering')
client.hubs.create(key: 'eng', name: 'Engineering', default_expiry_days: 90)
client.hubs.update('engineering', name: 'Engineering Docs')
client.hubs.delete('engineering')
client.hubs.transfer_ownership('engineering', new_owner_id)

Entries

client.entries.list_by_hub('engineering')
client.entries.get(entry_id)
client.entries.create(hub_key: 'eng', key: 'guide', title: 'Guide', content: '<p>Hi</p>', original_language: 'en', expiry_days: 90)
client.entries.update(entry_id, title: 'Updated Title', content: '<p>Updated</p>')
client.entries.publish(entry_id)
client.entries.renew(entry_id)
client.entries.delete(entry_id)

Translations

client.translations.list(entry_id)
client.translations.get(entry_id, 'de')
client.translations.create(entry_id, 'de', title: 'Titel', content: '<p>Inhalt</p>')
client.translations.get_status(entry_id, 'de')
client.translations.get_stale_blocks(entry_id, 'de')
client.translations.mark_up_to_date(entry_id, 'de')

Analytics

client.analytics.get_summary(entry_id)
client.analytics.get_events(entry_id, skip: 0, take: 50)
client.analytics.report_time_spent(entry_id, 120)

AI & Search

results = client.ai.search(query: 'how to deploy', mode: 'hybrid')
conversation = client.ai.create_conversation(title: 'My Question')
response = client.ai.send_message(conversation['id'], content: 'How to set up CI/CD?')

Knowledge Portal

client.portal.get_feed
client.portal.get_topics
client.portal.get_content('engineering', 'getting-started', language: 'en')
client.portal.search('deployment guide')

Sharing

link = client.sharing.create('getting-started', expires_at: (Time.now + 7*24*3600).iso8601)
links = client.sharing.list('getting-started')
client.sharing.revoke('getting-started', link_id)

Error Handling

begin
  hub = client.hubs.get('non-existent')
rescue Rasepi::ApiError => e
  puts "Error #{e.status_code}: #{e.message}"
end

Requirements

  • Ruby 3.1+
  • faraday gem

License

MIT — see LICENSE for details.

About

Official Ruby client library for the Rasepi API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages