Class: Bambora::V1::BatchPaymentResource
- Inherits:
-
Object
- Object
- Bambora::V1::BatchPaymentResource
- Defined in:
- lib/bambora/v1/batch_payment_resource.rb
Overview
Bank Electronic Funds Transfer (CAD) and Automatic Clearing House (USD)
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#sub_path ⇒ Object
readonly
Returns the value of attribute sub_path.
Instance Method Summary collapse
-
#create(transactions, opts = { process_now: 1 }) ⇒ Object
Post batch payment data.
-
#initialize(client:, api_key:) ⇒ BatchPaymentResource
constructor
A new instance of BatchPaymentResource.
Constructor Details
#initialize(client:, api_key:) ⇒ BatchPaymentResource
Returns a new instance of BatchPaymentResource.
9 10 11 12 13 |
# File 'lib/bambora/v1/batch_payment_resource.rb', line 9 def initialize(client:, api_key:) @client = client @api_key = api_key @sub_path = '/v1/batchpayments' end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
7 8 9 |
# File 'lib/bambora/v1/batch_payment_resource.rb', line 7 def api_key @api_key end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
7 8 9 |
# File 'lib/bambora/v1/batch_payment_resource.rb', line 7 def client @client end |
#sub_path ⇒ Object (readonly)
Returns the value of attribute sub_path.
7 8 9 |
# File 'lib/bambora/v1/batch_payment_resource.rb', line 7 def sub_path @sub_path end |
Instance Method Details
#create(transactions, opts = { process_now: 1 }) ⇒ Object
Post batch payment data. Transaction objects must have keys that match the order of the columns defined in the Bambora documentation.dev.na.bambora.com/docs/references/batch_payment/#format-of-data-in-file The values of each object are used to create one row of a CSV.
42 43 44 45 46 47 48 49 |
# File 'lib/bambora/v1/batch_payment_resource.rb', line 42 def create(transactions, opts = { process_now: 1 }) client.post( path: sub_path, file_contents: Bambora::Builders::BatchPaymentCSV.build(transactions), options: opts.merge(sub_merchant_id: client.sub_merchant_id), api_key: api_key, ) end |