0.0
The project is in a healthy, maintained state
Fetch events, register attendees, and verify Razorpay payments on the Vihaya Events platform with a fully-typed Ruby client. Feature parity with the JavaScript, Flutter, and Python SDKs.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

Vihaya SDK for Ruby โ€” Official vihaya-events Gem

Gem Version Gem Downloads License: MIT Ruby Version

vihaya-events is the official Ruby SDK for the Vihaya Events platform. Build event listings, attendee registration flows, Razorpay payment verification, ticketing dashboards, Rails apps, Sinatra apps, Hanami services, Sidekiq background jobs, and CLI tools โ€” all with idiomatic Ruby ergonomics and zero runtime dependencies.

Vihaya is the modern events platform for India โ€” a single stack for event organisers, ticketing, sponsor management, attendee registration, live check-in, and real-time analytics. This gem is the fastest way to integrate the Vihaya Events API (https://events.vihaya.app) into any Ruby 3.0+ codebase.


Table of contents

  • What is Vihaya?
  • Why the Vihaya Ruby SDK?
  • The Vihaya SDK family
  • Installation
  • Get your Vihaya API key
  • Quick start
  • Configuration
  • Core concepts
  • Usage guide
  • Framework integrations
  • Mega events & sub-events
  • Razorpay payment flow
  • API reference
  • Error handling
  • Security best practices
  • FAQ
  • Keywords
  • Development
  • Contributing
  • License

๐Ÿ‡ฎ๐Ÿ‡ณ What is Vihaya?

Vihaya is an all-in-one events platform for India, built for organisers who run college fests, hackathons, conferences, workshops, meetups, bootcamps, summits, and corporate events. The Vihaya platform provides:

  • ๐ŸŽŸ๏ธ Event creation & ticketing with pricing tiers, promo codes, and a hosted checkout.
  • ๐Ÿข Mega events โ€” bundle dozens of sub-events under one parent fest.
  • ๐Ÿ’ณ Razorpay payments โ€” end-to-end with server-side signature verification.
  • ๐Ÿ“‹ Custom registration fields โ€” T-shirt size, college, team members, dietary preferences, accommodation.
  • ๐Ÿ‘ฅ Attendee management โ€” real-time registrations, broadcasts, CSV exports.
  • ๐Ÿ“ฑ Live check-in with mobile QR scanning.
  • ๐Ÿ‘ฉโ€๐Ÿซ Speakers, agenda, sponsors, FAQs.
  • ๐Ÿ“Š Analytics โ€” registrations, revenue, funnel tracking.

This vihaya-events Ruby gem lets developers embed the Vihaya Events API into Rails apps, Sinatra microservices, Hanami projects, Sidekiq jobs, Jekyll plugins, Bridgetown sites, Pakyow apps, and any Ruby script.

Production URL: https://events.vihaya.app ยท Marketing site: https://vihaya.app ยท Developer dashboard: https://events.vihaya.app/profile/developer


โœจ Why the Vihaya Ruby SDK?

  • ๐Ÿ“ฆ Zero runtime dependencies โ€” built entirely on the Ruby standard library (net/http + json). No Faraday, no HTTParty, no Typhoeus, no transitive dependency tree to audit.
  • ๐Ÿ’Ž Idiomatic Ruby โ€” snake_case everywhere, predicate methods (event.mega_event?, sub.free?), keyword arguments, blocks-friendly.
  • ๐Ÿช„ Tiny โ€” 10 tests, 44 assertions, runs in milliseconds against an in-process TCP stub server.
  • ๐Ÿ” Type-safe-ish โ€” every response is a typed value object with attribute readers.
  • ๐Ÿงฉ Rails ready โ€” drop into a Rails initializer or Sidekiq worker without ceremony.
  • ๐Ÿ›ก๏ธ MFA-protected โ€” rubygems_mfa_required = true so every release is two-factor authenticated.
  • ๐Ÿ’ณ Razorpay ready โ€” vh.events.register โ†’ Razorpay โ†’ vh.payments.verify.

๐ŸŒ The Vihaya SDK family (7 languages)

Language Package Repository Install
๐Ÿ’Ž Ruby vihaya-events Vishnu252005/vihaya-sdk-ruby gem install vihaya-events
๐ŸŸจ JavaScript / TypeScript vihaya-sdk Vishnu252005/vihaya-sdk npm install vihaya-sdk
๐Ÿ Python vihaya-events Vishnu252005/vihaya-sdk-python pip install vihaya-events
๐Ÿฆซ Go vihaya-sdk-go Vishnu252005/vihaya-sdk-go go get github.com/Vishnu252005/vihaya-sdk-go
โ˜• Java vihaya-sdk-java Vishnu252005/vihaya-sdk-java JitPack / Gradle / Maven
๐Ÿ˜ PHP vihaya/events Vishnu252005/vihaya-sdk-php composer require vihaya/events
๐Ÿ“ฑ Flutter / Dart vihaya_sdk_flutter Vishnu252005/vihaya-sdk-flutter flutter pub add vihaya_sdk_flutter

All Vihaya SDKs target the same API base URL (https://events.vihaya.app), authenticate with the same x-api-key header, and expose the same methods.


๐Ÿ“ฆ Installation

Install the gem directly:

gem install vihaya-events

Or add it to your Gemfile:

gem "vihaya-events"

Then run:

bundle install

Requirements:

  • Ruby 3.0, 3.1, 3.2, 3.3, 3.4+
  • No other dependencies โ€” pure stdlib

Gem name: vihaya-events. Require path: vihaya.

require "vihaya"

๐Ÿ”‘ Get your Vihaya API key

  1. Sign up or log in at events.vihaya.app.
  2. Open the Developer Dashboard.
  3. Click Generate API Key and copy the vh_live_... token.
  4. Store it in ENV["VIHAYA_API_KEY"], Rails credentials, or a secrets manager โ€” never commit it.

๐Ÿš€ Quick start

require "vihaya"

vh = Vihaya::Client.new(ENV.fetch("VIHAYA_API_KEY"))

vh.events.list.each do |event|
  puts "#{event.title} โ€” #{event.location} on #{event.date}"
end

Register an attendee

registration = Vihaya::RegisterData.new(
  name: "Anjali Mehta",
  email: "anjali@example.com",
  phone: "+919820012345",
  custom_fields: {
    "T-Shirt Size" => "L",
    "College"      => "Vihaya Institute"
  }
)

result = vh.events.register("evt_8x42j9", registration)

if result[:isPaid]
  puts "Razorpay order: #{result[:orderId]}"
else
  puts "Free registration: #{result[:registrationId]}"
end

Verify a Razorpay payment

vh.payments.verify(
  payment_id: "pay_O8K2...",
  order_id:   result[:orderId],
  signature:  "signature_from_razorpay"
)

โš™๏ธ Configuration

vh = Vihaya::Client.new(
  ENV.fetch("VIHAYA_API_KEY"),
  base_url: "https://events.vihaya.app",   # override for staging
  headers:  { "X-Trace-Id" => "abc123" },
  timeout:  60                              # seconds
)
Option Default Description
api_key (positional) โ€” Required. Sent as x-api-key.
base_url: https://events.vihaya.app API base URL. Override for staging.
headers: {} Extra headers attached to every request.
timeout: 30 Per-request timeout in seconds.

๐Ÿงญ Core concepts

  • Events โ€” the root record. Title, description, date, venue, tiers, custom fields, speakers, agenda, sponsors, FAQs, sub-events.
  • Mega events โ€” parent events containing sub-events. Detect with event.mega_event?, iterate via event.sub_events.
  • Registrations โ€” free or paid attendee entries with optional custom fields and team members.
  • Payments โ€” Razorpay orders created during events.register, verified via payments.verify.
  • API key โ€” vh_live_... token from the developer dashboard.

๐Ÿ“š Usage guide

Fetch a full event

event = vh.events.get("evt_8x42j9")

puts event.title
puts "Mode: #{event.event_mode}  Timezone: #{event.timezone}"
puts "Location: #{event.location}"
puts "Date: #{event.date} #{event.time}"

event.speaker_list.each do |speaker|
  puts "- #{speaker.name} (#{speaker.role}) @ #{speaker.company}"
end

event.agenda_list.each do |item|
  puts "[#{item.time}] #{item.title}"
end

event.sponsors.each do |sponsor|
  puts "#{sponsor.name} (#{sponsor.tier})"
end

event.faqs.each do |faq|
  puts "Q: #{faq.question}\nA: #{faq.answer}\n\n"
end

event.special_prices.each do |tier|
  puts "  #{tier.name}: โ‚น#{tier.amount}"
end

event.custom_fields.each do |field|
  puts "  #{field.name} [#{field.type}] required=#{field.required}"
end

List & filter events

events = vh.events.list

upcoming = events.select { |e| Date.parse(e.date) > Date.today }
mega     = events.select(&:mega_event?)
free     = events.select(&:free?)
online   = events.select { |e| e.event_mode == "online" }

Register with tiers, promo codes, and custom fields

data = Vihaya::RegisterData.new(
  name:  "Priya Raj",
  email: "priya@example.com",
  phone: "+919820012345",
  tier:  "Early Bird",
  promo_code: "LAUNCH10",
  custom_fields: {
    "College"       => "IIT Bombay",
    "T-Shirt Size"  => "M",
    "Year of Study" => "3rd"
  }
)

vh.events.register("evt_conf_2026", data)

Register a hackathon team

result = vh.events.register("evt_hackathon_2026",
  name:  "Team Lead",
  email: "lead@example.com",
  phone: "+919820012345",
  teamName: "Byte Squad",
  teamMembers: [
    { name: "Alice", email: "alice@example.com", phone: "+91..." },
    { name: "Bob",   email: "bob@example.com",   phone: "+91..." },
    { name: "Carol", email: "carol@example.com", phone: "+91..." }
  ]
)

You can pass a plain Hash instead of RegisterData โ€” use camelCase keys for that path since the SDK sends it as-is.


๐ŸŽจ Framework integrations

Rails โ€” initializer

# config/initializers/vihaya.rb
require "vihaya"

VIHAYA = Vihaya::Client.new(Rails.application.credentials.vihaya[:api_key])

Rails โ€” controller

class EventsController < ApplicationController
  def index
    @events = VIHAYA.events.list
  end

  def show
    @event = VIHAYA.events.get(params[:id])
  rescue Vihaya::Error => e
    redirect_to events_path, alert: e.message
  end

  def register
    result = VIHAYA.events.register(
      params[:id],
      Vihaya::RegisterData.new(**registration_params)
    )
    render json: result
  rescue Vihaya::Error => e
    render json: { error: e.message }, status: e.status || 500
  end

  private

  def registration_params
    params.permit(:name, :email, :phone, custom_fields: {})
  end
end

Sinatra

require "sinatra"
require "vihaya"
require "json"

vh = Vihaya::Client.new(ENV.fetch("VIHAYA_API_KEY"))

get "/events" do
  content_type :json
  vh.events.list.map(&:to_h).to_json
end

post "/events/:id/register" do
  content_type :json
  data = JSON.parse(request.body.read, symbolize_names: true)
  vh.events.register(params[:id], Vihaya::RegisterData.new(**data)).to_json
end

Sidekiq background job

class ProcessRegistrationJob
  include Sidekiq::Job

  def perform(event_id, payload)
    vh = Vihaya::Client.new(ENV.fetch("VIHAYA_API_KEY"))
    vh.events.register(event_id, Vihaya::RegisterData.new(**payload.symbolize_keys))
  end
end

Hanami action

module Web
  module Actions
    module Events
      class Register < Web::Action
        def handle(req, res)
          vh = Vihaya::Client.new(ENV.fetch("VIHAYA_API_KEY"))
          result = vh.events.register(req.params[:id], req.params.to_h)
          res.body = result.to_json
        end
      end
    end
  end
end

Standalone CLI script

#!/usr/bin/env ruby
require "vihaya"

vh = Vihaya::Client.new(ENV.fetch("VIHAYA_API_KEY"))

vh.events.list.each do |event|
  puts "#{event.title.ljust(40)} #{event.date}  #{event.location}"
end

๐Ÿข Mega events & sub-events

fest = vh.events.get("evt_mega_fest_2026")

if fest.mega_event?
  puts "#{fest.title} โ€” #{fest.sub_events.size} sub-events"

  fest.sub_events.each do |sub|
    price = sub.free? ? "Free" : "โ‚น#{sub.price}"
    puts "  - #{sub.title} (#{price})"

    sub.custom_fields.each do |field|
      puts "    * #{field.name} [#{field.type}]"
    end
  end
end

Register for a specific sub-event:

vh.events.register("evt_sub_workshop_ml",
  Vihaya::RegisterData.new(
    name:  "Rahul",
    email: "rahul@example.com",
    phone: "+91..."
  )
)

๐Ÿ’ณ Razorpay payment flow

  1. Backend โ€” vh.events.register(id, data) โ†’ Vihaya creates a Razorpay order and returns :orderId.
  2. Frontend โ€” launch Razorpay Checkout with that order ID.
  3. Razorpay callback โ€” hands back razorpay_payment_id, razorpay_order_id, razorpay_signature.
  4. Backend โ€” vh.payments.verify(...) confirms the signature and marks the registration paid.
result = vh.events.register("evt_conf_2026",
  Vihaya::RegisterData.new(
    name:  "Attendee",
    email: "a@example.com",
    phone: "+91..."
  )
)
order_id = result[:orderId]

# Frontend: Razorpay Checkout with order_id ...

vh.payments.verify(
  payment_id: razorpay_payment_id,
  order_id:   razorpay_order_id,
  signature:  razorpay_signature
)

โš ๏ธ Always verify payments on the server. Never trust a signature checked only in the browser.


๐Ÿ“– API reference

Vihaya::Client.new(api_key, base_url: ..., headers: {}, timeout: 30)

The main client. api_key is required and positional; everything else is keyword.

vh.events

Method Returns Description
list Array<Vihaya::Event> All events on the authenticated account.
get(event_id) Vihaya::Event Full metadata for one event โ€” tiers, custom fields, speakers, agenda, sponsors, FAQs, sub-events.
register(event_id, data) Hash Submit a registration. data can be RegisterData or Hash.

vh.payments

Method Returns Description
verify(payment_id:, order_id:, signature:, amount: nil) Hash Server-side Razorpay signature verification.

Models (module Vihaya)

  • Vihaya::Event โ€” root event with all metadata + predicate methods (mega_event?, free?, online?)
  • Vihaya::Speaker, Vihaya::Sponsor, Vihaya::AgendaItem, Vihaya::FAQItem, Vihaya::Contact
  • Vihaya::CustomField, Vihaya::SpecialPrice, Vihaya::PromoCode
  • Vihaya::RegisterData โ€” registration payload with keyword constructor
  • Vihaya::Error โ€” raised on every API failure

๐Ÿšจ Error handling

All API failures raise Vihaya::Error with the HTTP status and raw body:

begin
  vh.events.get("evt_does_not_exist")
rescue Vihaya::Error => e
  puts "#{e.message} (status=#{e.status})"
  puts e.data.inspect

  case e.status
  when 404 then puts "Not found"
  when 401, 403 then puts "Auth error"
  when 429 then puts "Rate limited"
  end
end

๐Ÿ›ก๏ธ Security best practices

Never hard-code a vh_live_... key in code that ships to a client.

  • Use ENV, Rails encrypted credentials (Rails.application.credentials.vihaya), dotenv, or a secrets manager.
  • Call events.register and payments.verify from backend code only.
  • Always verify Razorpay signatures server-side.
  • Rotate keys via the Vihaya developer dashboard if you suspect a leak.
  • Use separate keys for staging and production.

โ“ FAQ

What is Vihaya?

Vihaya is an events platform for India โ€” ticketing, registrations, payments, check-in, analytics, and attendee management. Platform: vihaya.app. Dashboard: events.vihaya.app.

Why does the gem name differ from the require path?

You install with gem install vihaya-events but require with require "vihaya". The gem name reflects what it does on the platform; the require path is short and ergonomic.

Does the SDK support Faraday / HTTParty / Typhoeus?

No โ€” and that's intentional. Pure stdlib means no transitive dependencies, smaller install footprint, and no version conflicts with whatever HTTP library your Rails app already uses.

Does it work with Sidekiq, Resque, GoodJob?

Yes โ€” the client is just a Ruby object. Build it once at startup, share it across workers.

Does Vihaya support Razorpay test mode?

Yes โ€” use a test API key from the Vihaya developer dashboard.

Can I pass a plain Hash instead of RegisterData?

Yes. RegisterData is a convenience wrapper. A plain Hash works too โ€” just use camelCase keys (teamMembers, customFields, etc.) on that path.


๐Ÿ”Ž Keywords

vihaya ยท vihaya sdk ยท vihaya ruby ยท vihaya events ยท vihaya gem ยท vihaya-events ยท vihaya rails ยท vihaya sinatra ยท vihaya hanami ยท ruby events api ยท ruby ticketing gem ยท rails events sdk ยท ruby razorpay events ยท vihaya razorpay ruby ยท events api india ruby ยท event management gem ยท sidekiq vihaya ยท vihaya client ruby ยท rubygems vihaya ยท events.vihaya.app ruby ยท vihaya official ruby sdk


๐Ÿ› ๏ธ Development

git clone https://github.com/Vishnu252005/vihaya-sdk-ruby.git
cd vihaya-sdk-ruby
ruby test/test_client.rb               # Minitest suite (10 tests, 44 assertions)
gem build vihaya-events.gemspec        # build the .gem file

The test suite uses an in-process TCP stub server โ€” no Bundler, WebMock, or VCR required, no network calls.

Ruby version note: the gemspec requires Ruby โ‰ฅ 3.0. Use /opt/homebrew/opt/ruby/bin/ruby on macOS โ€” system Ruby (/usr/bin/ruby 2.6) is too old.


๐Ÿค Contributing

Contributions to the Vihaya Ruby SDK are very welcome. The project is open source and MIT-licensed.

  1. Fork Vishnu252005/vihaya-sdk-ruby.
  2. Create a feature branch.
  3. Run ruby test/test_client.rb.
  4. Commit, push, and open a Pull Request.

Reporting issues

Found a bug or have a feature request? Open an issue at github.com/Vishnu252005/vihaya-sdk-ruby/issues.


๐Ÿ“„ License

MIT ยฉ Vihaya. See LICENSE.


๐Ÿ’ฌ Support

Built with โค๏ธ by the Vihaya team.


Related Vihaya SDK repositories