Class: FreightFinancialsWebhookIngestionApi::InvoicesApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/freight_financials_webhook_ingestion_api/apis/invoices_api.rb

Overview

InvoicesApi

Constant Summary

Constants inherited from BaseApi

BaseApi::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseApi

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

Constructor Details

This class inherits a constructor from FreightFinancialsWebhookIngestionApi::BaseApi

Instance Method Details

#get_invoice_status(invoice_number, x_tenant_id, api_version: nil) ⇒ ApiResponse

TODO: type endpoint description here invoice number. by APIM. Required on all requests. here

Parameters:

  • invoice_number (String)

    Required parameter: The factoring company's

  • x_tenant_id (String)

    Required parameter: Tenant identifier stamped

  • api_version (String) (defaults to: nil)

    Optional parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/freight_financials_webhook_ingestion_api/apis/invoices_api.rb', line 83

def get_invoice_status(invoice_number,
                       x_tenant_id,
                       api_version: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/v1/Invoices/{invoiceNumber}',
                                 Server::DEFAULT)
               .template_param(new_parameter(invoice_number, key: 'invoiceNumber')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(x_tenant_id, key: 'X-Tenant-Id')
                              .is_required(true))
               .query_param(new_parameter(api_version, key: 'api-version'))
               .header_param(new_parameter('application/json', key: 'accept')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(InvoiceStatusResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('404',
                             'No invoice exists with the specified invoice number.',
                             ProblemDetailsException))
    .execute
end

#search_invoices(x_tenant_id, body, api_version: nil) ⇒ ApiResponse

TODO: type endpoint description here by APIM. Required on all requests. here

Parameters:

  • x_tenant_id (String)

    Required parameter: Tenant identifier stamped

  • body (SearchRequest)

    Required parameter: Cancellation token.

  • api_version (String) (defaults to: nil)

    Optional parameter: TODO: type description

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
66
67
68
69
70
71
72
73
# File 'lib/freight_financials_webhook_ingestion_api/apis/invoices_api.rb', line 50

def search_invoices(x_tenant_id,
                    body,
                    api_version: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/api/v1/Invoices/search',
                                 Server::DEFAULT)
               .header_param(new_parameter(x_tenant_id, key: 'X-Tenant-Id')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .query_param(new_parameter(api_version, key: 'api-version'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SearchResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Invalid filter criteria or pagination parameters.',
                             ProblemDetailsException))
    .execute
end

#submit_invoice(x_tenant_id, body, api_version: nil) ⇒ ApiResponse

TODO: type endpoint description here by APIM. Required on all requests. token. here

Parameters:

  • x_tenant_id (String)

    Required parameter: Tenant identifier stamped

  • body (SubmitInvoiceRequest)

    Required parameter: Cancellation

  • api_version (String) (defaults to: nil)

    Optional parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/freight_financials_webhook_ingestion_api/apis/invoices_api.rb', line 17

def submit_invoice(x_tenant_id,
                   body,
                   api_version: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/api/v1/Invoices',
                                 Server::DEFAULT)
               .header_param(new_parameter(x_tenant_id, key: 'X-Tenant-Id')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .query_param(new_parameter(api_version, key: 'api-version'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SubmitInvoiceResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'The request body is missing required fields or contains'\
                              ' invalid data.',
                             ProblemDetailsException))
    .execute
end