Module: Bambora::BatchUpload
- Defined in:
- lib/bambora/batch_upload.rb,
lib/bambora/batch_upload/version.rb,
lib/bambora/batch_upload/exceptions.rb,
lib/bambora/batch_upload/create_batch_file.rb,
lib/bambora/batch_upload/send_single_batch.rb,
lib/bambora/batch_upload/beanstream_send_batch.rb
Defined Under Namespace
Classes: BatchUploadError, BeanstreamSendBatch, ConnectionError, CreateBatchFile, MakeArray, SendSingleBatch
Constant Summary collapse
- VERSION =
"0.2.0"
Class Attribute Summary collapse
-
.batch_file_path ⇒ Object
optional.
-
.batch_upload_api_key ⇒ Object
Returns the value of attribute batch_upload_api_key.
-
.batch_upload_api_url ⇒ Object
Returns the value of attribute batch_upload_api_url.
-
.file_path ⇒ Object
file name.
-
.merchant_id ⇒ Object
must be provided by user.
Class Method Summary collapse
- .configure {|_self| ... } ⇒ Object
- .create_array(txn_type) {|reader| ... } ⇒ Object
- .create_file(txn_type, &block) ⇒ Object
- .do_upload(process_date = Date.next_business_day, &block) ⇒ Object
- .get_batch_file_path ⇒ Object
- .get_batch_upload_api_url ⇒ Object
Class Attribute Details
.batch_file_path ⇒ Object
optional
17 18 19 |
# File 'lib/bambora/batch_upload.rb', line 17 def batch_file_path @batch_file_path end |
.batch_upload_api_key ⇒ Object
Returns the value of attribute batch_upload_api_key.
15 16 17 |
# File 'lib/bambora/batch_upload.rb', line 15 def batch_upload_api_key @batch_upload_api_key end |
.batch_upload_api_url ⇒ Object
Returns the value of attribute batch_upload_api_url.
18 19 20 |
# File 'lib/bambora/batch_upload.rb', line 18 def batch_upload_api_url @batch_upload_api_url end |
.file_path ⇒ Object
file name
20 21 22 |
# File 'lib/bambora/batch_upload.rb', line 20 def file_path @file_path end |
.merchant_id ⇒ Object
must be provided by user
14 15 16 |
# File 'lib/bambora/batch_upload.rb', line 14 def merchant_id @merchant_id end |
Class Method Details
.configure {|_self| ... } ⇒ Object
45 46 47 48 |
# File 'lib/bambora/batch_upload.rb', line 45 def self.configure &block raise ArgumentError unless block_given? yield(self) end |
.create_array(txn_type) {|reader| ... } ⇒ Object
50 51 52 53 54 |
# File 'lib/bambora/batch_upload.rb', line 50 def self.create_array txn_type, &block reader = MakeArray.new txn_type yield(reader) reader.array end |
.create_file(txn_type, &block) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/bambora/batch_upload.rb', line 27 def self.create_file txn_type, &block raise "provide a block" unless block_given? @file_path = CreateBatchFile.new(create_array(txn_type,&block)).call if @file_path.nil? raise "No file generated!!!" else @file_path end end |
.do_upload(process_date = Date.next_business_day, &block) ⇒ Object
22 23 24 25 |
# File 'lib/bambora/batch_upload.rb', line 22 def self.do_upload(process_date=Date.next_business_day,&block) raise "Configure Merchant ID and Upload API key" unless config_complete SendSingleBatch.new(file_path,process_date).call(&block) end |
.get_batch_file_path ⇒ Object
41 42 43 |
# File 'lib/bambora/batch_upload.rb', line 41 def self.get_batch_file_path batch_file_path || @default_batch_file_path end |
.get_batch_upload_api_url ⇒ Object
37 38 39 |
# File 'lib/bambora/batch_upload.rb', line 37 def self.get_batch_upload_api_url batch_upload_api_url || @default_batch_upload_api_url end |