ServizeHub SDK

Install

Install using RubyGems:

gem install servizehub

Or add it to your Gemfile:

gem "servizehub"

Requires Ruby 2.7+. The SDK uses only the standard library (net/http, uri, json, date) — no runtime dependencies.

Usage

require "servizehub"

client = Servizehub::Client.new("encryptedkey")

response = client.send_booking(
  date: "2026-04-15",
  service_type: "Photography",
  status: "available"
)
puts response

Configuration

Argument Required Default Description
api_key Yes Your ServizeHub vendor API key.
base_url: No https://service.servizehub.com/external API base URL. Override to target another environment.

Environments

Leave base_url: out and the SDK talks to production:

# production — https://service.servizehub.com/external
client = Servizehub::Client.new("vnd_live_key")

Pass base_url: to point the SDK at another environment, such as dev:

# dev — https://servizehubuserdev.notasco.in/external
client = Servizehub::Client.new(
  "vnd_test_key",
  base_url: "https://servizehubuserdev.notasco.in/external"
)

Notes:

  • base_url: is the full base including the /external path segment. Endpoints are appended to it, e.g. #{base_url}/capture-availability.
  • Trailing slashes are stripped, so .../external/ and .../external behave the same.
  • The default is exposed as Servizehub::Client::DEFAULT_BASE_URL, and the resolved value as client.base_url.

Keep the URL out of your source by reading it from the environment:

client = Servizehub::Client.new(
  ENV.fetch("SERVIZEHUB_API_KEY"),
  base_url: ENV["SERVIZEHUB_BASE_URL"] # nil -> production
)

Methods

send_booking(date:, service_type:, status:)

Sends a single availability update. date must be YYYY-MM-DD and status must be available or unavailable. Returns { statusCode:, data: }, or a validation message string.

send_multiple_bookings(bookings)

Sends an array of booking hashes and returns { message:, successfulBookings:, failedBookings: }.

response = client.send_multiple_bookings([
  { date: "2026-04-15", service_type: "Photography", status: "available" },
  { date: "2026-04-16", service_type: "Videography", status: "unavailable" }
])

Tests

rake test
# or: ruby test/client_test.rb

Uses minitest with Net::HTTP.start stubbed — the suite makes no network calls.

📩 License

Created by Notasco Dev Team

Happy Coding! 🎯