Class: ModernTreasury::TransactionLineItemController

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

Overview

TransactionLineItemController

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

Constructor Details

This class inherits a constructor from ModernTreasury::BaseController

Instance Method Details

#list_transaction_line_items(transaction_id, after_cursor: nil, type: nil, per_page: nil) ⇒ Array[TransactionLineItem]

TODO: type endpoint description here here here

Parameters:

  • transaction_id (String)

    Required parameter: transaction_id

  • after_cursor (String) (defaults to: nil)

    Optional parameter: TODO: type description

  • type (Type16Enum) (defaults to: nil)

    Optional parameter: Example:

  • per_page (Integer) (defaults to: nil)

    Optional parameter: TODO: type description

Returns:



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/modern_treasury/controllers/transaction_line_item_controller.rb', line 17

def list_transaction_line_items(transaction_id,
                                after_cursor: nil,
                                type: nil,
                                per_page: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/transactions/{transaction_id}/line_items',
                                 Server::DEFAULT)
               .template_param(new_parameter(transaction_id, key: 'transaction_id')
                                .should_encode(true))
               .query_param(new_parameter(after_cursor, key: 'after_cursor'))
               .query_param(new_parameter(type, key: 'type'))
               .query_param(new_parameter(per_page, key: 'per_page'))
               .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(TransactionLineItem.method(:from_hash))
                .is_response_array(true))
    .execute
end