Class: Fountain::Api::AvailableSlots

Inherits:
Object
  • Object
show all
Extended by:
RequestHelper
Defined in:
lib/fountain/api/available_slots.rb

Overview

Fountain Slot Management API

Constant Summary

Constants included from RequestHelper

RequestHelper::DEFAULT_REQUEST_OPTIONS

Class Method Summary collapse

Methods included from RequestHelper

request, request_json

Class Method Details

.cancel(booked_slot_id) ⇒ Fountain::Slot

Cancel a booked session

Parameters:

  • booked_slot_id (String)

    ID of the Fountain slot

  • applicant_id (String)

    ID of the Fountain applicant

Returns:



42
43
44
45
46
47
48
49
# File 'lib/fountain/api/available_slots.rb', line 42

def self.cancel(booked_slot_id)
  response = request(
    "/v2/booked_slots/#{booked_slot_id}/cancel",
    method: :post
  )
  check_response response
  true
end

.confirm(available_slot_id, applicant_id) ⇒ Fountain::Slot

Confirm an available slot

Parameters:

  • available_slot_id (String)

    ID of the Fountain slot

  • applicant_id (String)

    ID of the Fountain applicant

Returns:



16
17
18
19
20
21
22
23
# File 'lib/fountain/api/available_slots.rb', line 16

def self.confirm(available_slot_id, applicant_id)
  response = request_json(
    "/v2/available_slots/#{available_slot_id}/confirm",
    method: :post,
    body: { applicant_id: applicant_id }
  )
  Fountain::Slot.new response
end

.list(stage_id, list_options = {}) ⇒ [Fountain::Slots]

List Available Slots

Parameters:

  • stage_id (String)

    ID of the Fountain stage

Returns:



29
30
31
32
33
34
35
# File 'lib/fountain/api/available_slots.rb', line 29

def self.list(stage_id, list_options = {})
  page_query = list_options[:page] ? "?page=#{list_options[:page]}" : ''
  response = request_json(
    "/v2/stages/#{stage_id}/available_slots#{page_query}"
  )
  Fountain::Slots.new response
end