Module: RockRMS::Client::Batch
- Included in:
- RockRMS::Client
- Defined in:
- lib/rock_rms/resources/batch.rb
Instance Method Summary collapse
- #create_batch(name:, start_time:, end_time:, foreign_key: nil, campus_id: nil, status: 1, control_amount: nil, control_count: nil) ⇒ Object
- #delete_batch(id) ⇒ Object
- #find_batch(id) ⇒ Object
- #list_batches(options = {}) ⇒ Object
- #update_batch(id, options = {}) ⇒ Object
Instance Method Details
#create_batch(name:, start_time:, end_time:, foreign_key: nil, campus_id: nil, status: 1, control_amount: nil, control_count: nil) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/rock_rms/resources/batch.rb', line 14 def create_batch( name:, start_time:, end_time:, foreign_key: nil, campus_id: nil, status: 1, control_amount: nil, control_count: nil ) = { 'Name' => name, 'BatchStartDateTime' => start_time, 'CampusId' => campus_id, 'BatchEndDateTime' => end_time, 'ForeignKey' => foreign_key, 'Status' => status } ['ControlAmount'] = control_amount if control_amount ['ControlItemCount'] = control_count if control_count post(batches_path, ) end |
#delete_batch(id) ⇒ Object
44 45 46 |
# File 'lib/rock_rms/resources/batch.rb', line 44 def delete_batch(id) delete(batches_path(id)) end |
#find_batch(id) ⇒ Object
9 10 11 12 |
# File 'lib/rock_rms/resources/batch.rb', line 9 def find_batch(id) res = get(batches_path(id)) Response::Batch.format(res) end |
#list_batches(options = {}) ⇒ Object
4 5 6 7 |
# File 'lib/rock_rms/resources/batch.rb', line 4 def list_batches( = {}) res = get(batches_path, ) Response::Batch.format(res) end |
#update_batch(id, options = {}) ⇒ Object
39 40 41 42 |
# File 'lib/rock_rms/resources/batch.rb', line 39 def update_batch(id, = {}) = .collect { |k, v| [k.to_s, v] }.to_h patch(batches_path(id), ) end |