Sha256: f594ef8002809904e1b8bb3470f117350ac173ec4e7951fbff981ca851b1321f

Contents?: true

Size: 806 Bytes

Versions: 2

Compression:

Stored size: 806 Bytes

Contents

require_relative 'beanstream_send_batch'

module Bambora::BatchUpload
  class SendSingleBatch

    attr_accessor :file_path
    attr_accessor :process_date
    
    def initialize(file_path,process_date) 
      @file_path    = file_path
      @process_date = process_date
    end
  
    def call
      service          = BeanstreamSendBatch.new(file_path, 
                                                 process_date,
                                                 process_now)
      batch_id         = service.send
      unless batch_id.nil?
        yield(batch_id) if block_given?
      else
        raise "Batch Scheduling Failed: #{service.failure_message}"
      end
    end
  
    private
  
    def process_now
      if process_date
        0
      else
        1
      end
    end
  
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bambora-batch_upload-0.1.1 lib/bambora/batch_upload/send_single_batch.rb
bambora-batch_upload-0.1.0 lib/bambora/batch_upload/send_single_batch.rb