Class: Bambora::Bank::BatchReportResource

Inherits:
Object
  • Object
show all
Includes:
BatchReportMessages
Defined in:
lib/bambora/bank/batch_report_resource.rb

Overview

For making requests to the /scripts/reporting/report.aspx endpoint

Constant Summary collapse

DEFAULT_REQUEST_PARAMS =
{
  rpt_format: 'JSON',
  rpt_version: '2.0',
  session_source: 'external',
}.freeze

Constants included from BatchReportMessages

Bambora::Bank::BatchReportMessages::MESSAGES

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:, api_key:) ⇒ BatchReportResource

Instantiate an interface to make requests against Bambora’s Profiles API.

Examples:


client = Bambora::Rest::XMLClient(base_url: '...', merchant_id: '...')
profiles = Bambora::Bank::BatchReportResource(client: client, api_key: '...')

# Start making requests ...

Parameters:

  • client (Bambora::Rest::XMLClient)

    An instance of Bambora::Rest::XMLClient, used to make network requests.

  • api_key (String)

    An API key for this endpoint. This is also known as the “Pass Code”

  • version (String)

    The Service Version you are requesting from the server.



33
34
35
36
37
# File 'lib/bambora/bank/batch_report_resource.rb', line 33

def initialize(client:, api_key:)
  @client = client
  @api_key = api_key
  @sub_path = '/scripts/reporting/report.aspx'
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



18
19
20
# File 'lib/bambora/bank/batch_report_resource.rb', line 18

def api_key
  @api_key
end

#clientObject (readonly)

Returns the value of attribute client.



18
19
20
# File 'lib/bambora/bank/batch_report_resource.rb', line 18

def client
  @client
end

#sub_pathObject (readonly)

Returns the value of attribute sub_path.



18
19
20
# File 'lib/bambora/bank/batch_report_resource.rb', line 18

def sub_path
  @sub_path
end

#versionObject (readonly)

Returns the value of attribute version.



18
19
20
# File 'lib/bambora/bank/batch_report_resource.rb', line 18

def version
  @version
end

Instance Method Details

#show(report_data) ⇒ Object

Create a Bank Payment Profile

payment_profile_resource.show(data)

@params profile_data [Hash] with values as noted in the example.

Examples:

data = {
  rpt_filter_by_1: 'batch_id',
  rpt_filter_value_1: 1,
  rpt_operation_type_1: 'EQ',
  rpt_from_date_time: '2019-12-18 00:00:00',
  rpt_to_date_time: '2019-12-18 23:59:59',
  service_name: 'BatchPaymentsEFT',
}


55
56
57
58
59
60
# File 'lib/bambora/bank/batch_report_resource.rb', line 55

def show(report_data)
  response = client.post(path: sub_path, body: batch_report_body(report_data))

  response = ensure_record_key_exists(response)
  add_messages_to_response(response)
end