Docs/Documentation/Quickstart

Ruby on Rails

Integrate Repull into a Rails application.

Installation

gem 'repull', path: 'packages/ruby-sdk'

Complete Example

# config/initializers/repull.rb
require 'repull'

REPULL = Repull::Client.new(
  api_key: ENV['REPULL_API_KEY'],
  workspace_id: ENV['REPULL_WORKSPACE_ID']
)

# app/controllers/reservations_controller.rb
class ReservationsController < ApplicationController
  # How do I list reservations in Rails?
  def index
    result = REPULL.reservations.list(
      status: params[:status],
      source: params[:source]
    )
    render json: result
  end

  # How do I get Airbnb reservations in Rails?
  def airbnb
    result = REPULL.reservations.list(source: "AIRBNB")
    render json: result
  end

  # How do I update availability in Rails?
  def update_availability
    result = REPULL.availability.update(
      propertyId: params[:property_id],
      updates: params[:updates]
    )
    render json: result
  end
end

# config/routes.rb
Rails.application.routes.draw do
  resources :reservations, only: [:index]
  get 'reservations/airbnb', to: 'reservations#airbnb'
  put 'properties/:property_id/availability', to: 'reservations#update_availability'
end

Environment Variables

REPULL_API_KEY=sk_test_YOUR_KEY
REPULL_WORKSPACE_ID=YOUR_WORKSPACE_ID

Start with sk_test_ keys for sandbox data. Switch to sk_live_ when ready for production.

AI