Class: ModernTreasury::PaymentReferenceController

Inherits:
BaseController show all
Defined in:
lib/modern_treasury/controllers/payment_reference_controller.rb

Overview

PaymentReferenceController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseController

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from ModernTreasury::BaseController

Instance Method Details

#get_payment_reference(id) ⇒ ApiResponse

TODO: type endpoint description here

Parameters:

  • id (String)

    Required parameter: id

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/modern_treasury/controllers/payment_reference_controller.rb', line 50

def get_payment_reference(id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/payment_references/{id}',
                                 Server::DEFAULT)
               .template_param(new_parameter(id, key: 'id')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('basic_auth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PaymentReferenceObject.method(:from_hash))
                .is_api_response(true))
    .execute
end

#list_payment_references(after_cursor: nil, per_page: nil, referenceable_id: nil, referenceable_type: nil, reference_number: nil) ⇒ ApiResponse

TODO: type endpoint description here here here referenceable to search for. Must be accompanied by the referenceable_type or will return an error. the referenceable types. This must be accompanied by the id of the referenceable or will return an error. number assigned by the bank.

Parameters:

  • after_cursor (String) (defaults to: nil)

    Optional parameter: TODO: type description

  • per_page (Integer) (defaults to: nil)

    Optional parameter: TODO: type description

  • referenceable_id (String) (defaults to: nil)

    Optional parameter: The id of the

  • referenceable_type (ReferenceableType1) (defaults to: nil)

    Optional parameter: One of

  • reference_number (String) (defaults to: nil)

    Optional parameter: The actual reference

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/modern_treasury/controllers/payment_reference_controller.rb', line 23

def list_payment_references(after_cursor: nil,
                            per_page: nil,
                            referenceable_id: nil,
                            referenceable_type: nil,
                            reference_number: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/payment_references',
                                 Server::DEFAULT)
               .query_param(new_parameter(after_cursor, key: 'after_cursor'))
               .query_param(new_parameter(per_page, key: 'per_page'))
               .query_param(new_parameter(referenceable_id, key: 'referenceable_id'))
               .query_param(new_parameter(referenceable_type, key: 'referenceable_type'))
               .query_param(new_parameter(reference_number, key: 'reference_number'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('basic_auth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PaymentReferenceObject.method(:from_hash))
                .is_api_response(true)
                .is_response_array(true))
    .execute
end