Sha256: c049b1c34deb8bb618cd0d2f49ac9a314af9210ac43a55d7f2129fe9bf789ef2

Contents?: true

Size: 1.07 KB

Versions: 74

Compression:

Stored size: 1.07 KB

Contents

module RockRMS
  class Client
    module Batch
      def list_batches(options = {})
        res = get(batches_path, options)
        Response::Batch.format(res)
      end

      def find_batch(id)
        res = get(batches_path(id))
        Response::Batch.format(res)
      end

      def create_batch(
        name:,
        start_time:,
        end_time:,
        foreign_key: nil,
        campus_id: nil,
        status: 1
      )
        options = {
          'Name' => name,
          'BatchStartDateTime' => start_time,
          'CampusId' => campus_id,
          'BatchEndDateTime' => end_time,
          'ForeignKey' => foreign_key,
          'Status' => status
        }

        post(batches_path, options)
      end

      def update_batch(id, options = {})
        options = options.collect { |k, v| [k.to_s, v] }.to_h
        patch(batches_path(id), options)
      end

      def delete_batch(id)
        delete(batches_path(id))
      end

      private

      def batches_path(id = nil)
        id ? "FinancialBatches/#{id}" : 'FinancialBatches'
      end
    end
  end
end

Version data entries

74 entries across 74 versions & 1 rubygems

Version Path
rock_rms-7.2.0 lib/rock_rms/resources/batch.rb
rock_rms-7.1.2 lib/rock_rms/resources/batch.rb
rock_rms-7.1.1 lib/rock_rms/resources/batch.rb
rock_rms-7.1.0 lib/rock_rms/resources/batch.rb
rock_rms-7.0.3 lib/rock_rms/resources/batch.rb
rock_rms-7.0.2 lib/rock_rms/resources/batch.rb
rock_rms-7.0.1 lib/rock_rms/resources/batch.rb
rock_rms-7.0.0 lib/rock_rms/resources/batch.rb
rock_rms-6.2.0 lib/rock_rms/resources/batch.rb
rock_rms-6.1.0 lib/rock_rms/resources/batch.rb
rock_rms-6.0.8 lib/rock_rms/resources/batch.rb
rock_rms-6.0.7 lib/rock_rms/resources/batch.rb
rock_rms-6.0.6 lib/rock_rms/resources/batch.rb
rock_rms-6.0.5 lib/rock_rms/resources/batch.rb
rock_rms-6.0.4 lib/rock_rms/resources/batch.rb
rock_rms-6.0.3 lib/rock_rms/resources/batch.rb
rock_rms-6.0.1 lib/rock_rms/resources/batch.rb
rock_rms-6.0.0 lib/rock_rms/resources/batch.rb
rock_rms-5.18.0 lib/rock_rms/resources/batch.rb
rock_rms-5.17.0 lib/rock_rms/resources/batch.rb