class OSC::Reservations::Adapter

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

Public Class Methods

new(opts = {}) click to toggle source

@param opts [Hash] The options to create an adapter with.

# File lib/osc/reservations/adapter.rb, line 7
def initialize(opts = {})
end

Public Instance Methods

query_reservation(batch, id) click to toggle source

Queries the batch server for a given reservation. @param batch [Batch] The batch server to query for the reservation. @param id [String] The ID of the reservation. @return [Reservation, nil] @abstract This should be implemented by the adapter.

# File lib/osc/reservations/adapter.rb, line 15
def query_reservation(batch, id)
  raise NotImplementedError
end
query_reservations(batch) click to toggle source

Queries the batch server for a list of reservations. @param batch [Batch] The batch server to query for reservations. @return [Array<Reservation>] @abstract This should be implemented by the adapter.

# File lib/osc/reservations/adapter.rb, line 23
def query_reservations(batch)
  raise NotImplementedError
end
submit_reservation(batch, reservation) click to toggle source

@!method submit_reservation(batch, reservation) Submits a given reservation to the batch server. @param batch [Batch] The batch server to submit the reservation at. @param reservation [Reservation] A reservation with necessary information. @return [Reservation] @abstract This should be implemented by the adapter.

# File lib/osc/reservations/adapter.rb, line 33
def submit_reservation(batch, reservation)
  raise NotImplementedError
end