Class: ModernTreasury::PaperItemController

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

Overview

PaperItemController

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_paper_item(id) ⇒ ApiResponse

Get details on a single paper item.

Parameters:

  • id (String)

    Required parameter: id

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/modern_treasury/controllers/paper_item_controller.rb', line 49

def get_paper_item(id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/paper_items/{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(PaperItem.method(:from_hash))
                .is_api_response(true)
                .local_error('403',
                             'forbidden',
                             ErrorMessageException)
                .local_error('404',
                             'not found',
                             ErrorMessageException))
    .execute
end

#list_paper_items(lockbox_number: nil, deposit_date_start: nil, deposit_date_end: nil, after_cursor: nil, per_page: nil) ⇒ ApiResponse

Get a list of all paper items. ‘lockbox_number` if you wish to see paper items that are associated with a specific lockbox number. start date (YYYY-MM-DD) when filtering by deposit_date end date (YYYY-MM-DD) when filtering by deposit_date here here

Parameters:

  • lockbox_number (String) (defaults to: nil)

    Optional parameter: Specify

  • deposit_date_start (Date) (defaults to: nil)

    Optional parameter: Specify an inclusive

  • deposit_date_end (Date) (defaults to: nil)

    Optional parameter: Specify an inclusive

  • after_cursor (String) (defaults to: nil)

    Optional parameter: TODO: type description

  • per_page (Integer) (defaults to: nil)

    Optional parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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

def list_paper_items(lockbox_number: nil,
                     deposit_date_start: nil,
                     deposit_date_end: nil,
                     after_cursor: nil,
                     per_page: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/paper_items',
                                 Server::DEFAULT)
               .query_param(new_parameter(lockbox_number, key: 'lockbox_number'))
               .query_param(new_parameter(deposit_date_start, key: 'deposit_date_start'))
               .query_param(new_parameter(deposit_date_end, key: 'deposit_date_end'))
               .query_param(new_parameter(after_cursor, key: 'after_cursor'))
               .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(PaperItem.method(:from_hash))
                .is_api_response(true)
                .is_response_array(true))
    .execute
end