Class: OSC::Reservations::Adapter

Inherits:
Object
  • Object
show all
Defined in:
lib/osc/reservations/adapter.rb

Overview

Adapters are the glue between Reservations API and the scheduling service. This provides a scheduler independent interface.

Direct Known Subclasses

OSC::Reservations::Adapters::OSCMoab

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Adapter

Returns a new instance of Adapter.

Parameters:

  • opts (Hash) (defaults to: {})

    The options to create an adapter with.



7
8
# File 'lib/osc/reservations/adapter.rb', line 7

def initialize(opts = {})
end

Instance Method Details

#query_reservation(batch, id) ⇒ Reservation?

This method is abstract.

This should be implemented by the adapter.

Queries the batch server for a given reservation.

Parameters:

  • batch (Batch)

    The batch server to query for the reservation.

  • id (String)

    The ID of the reservation.

Returns:

Raises:

  • (NotImplementedError)


15
16
17
# File 'lib/osc/reservations/adapter.rb', line 15

def query_reservation(batch, id)
  raise NotImplementedError
end

#query_reservations(batch) ⇒ Array<Reservation>

This method is abstract.

This should be implemented by the adapter.

Queries the batch server for a list of reservations.

Parameters:

  • batch (Batch)

    The batch server to query for reservations.

Returns:

Raises:

  • (NotImplementedError)


23
24
25
# File 'lib/osc/reservations/adapter.rb', line 23

def query_reservations(batch)
  raise NotImplementedError
end

#submit_reservation(batch, reservation) ⇒ Reservation

This method is abstract.

This should be implemented by the adapter.

Submits a given reservation to the batch server.

Parameters:

  • batch (Batch)

    The batch server to submit the reservation at.

  • reservation (Reservation)

    A reservation with necessary information.

Returns:

Raises:

  • (NotImplementedError)


33
34
35
# File 'lib/osc/reservations/adapter.rb', line 33

def submit_reservation(batch, reservation)
  raise NotImplementedError
end