Module: ShelbyArena::Client::Batch
- Included in:
- ShelbyArena::Client
- Defined in:
- lib/shelby_arena/resources/batch.rb
Instance Method Summary collapse
- #create_batch(name:, start_date:, end_date:) ⇒ Object
- #delete_batch(id, options = {}) ⇒ Object
- #find_batch(id, options = {}) ⇒ Object
- #list_batches(name: nil, start_date: nil, end_date: nil) ⇒ Object
Instance Method Details
#create_batch(name:, start_date:, end_date:) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/shelby_arena/resources/batch.rb', line 26 def create_batch(name:, start_date:, end_date:) path = 'batch/add' body = { BatchName: name, BatchDate: start_date, BatchDateEnd: end_date } = {} [:api_sig] = generate_api_sig(path, ) json_body = body.to_json res = json_post("#{path}?api_session=#{options[:api_session]}&api_sig=#{options[:api_sig]}", json_body) res.dig('ModifyResult', 'Link').split('/').last end |
#delete_batch(id, options = {}) ⇒ Object
43 44 45 46 47 |
# File 'lib/shelby_arena/resources/batch.rb', line 43 def delete_batch(id, = {}) path = "batch/#{id}" [:api_sig] = generate_api_sig(path, ) delete(path, .sort) end |
#find_batch(id, options = {}) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/shelby_arena/resources/batch.rb', line 18 def find_batch(id, = {}) path = "batch/#{id}" [:api_sig] = generate_api_sig(path, ) res = get(path, .sort) Response::Batch.format(res.dig('Batch')) end |
#list_batches(name: nil, start_date: nil, end_date: nil) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/shelby_arena/resources/batch.rb', line 4 def list_batches(name: nil, start_date: nil, end_date: nil) path = 'batch/list' = {} [:batchName] = name if name [:startDate] = start_date if start_date [:endDate] = end_date if end_date [:api_sig] = generate_api_sig(path, ) res = get(path, .sort) Response::Batch.format_list(res.dig('BatchListResult', 'Batches', 'Batch')) end |