Class: FreightFinancialsWebhookIngestionApi::FreightAuditApi

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

Overview

FreightAuditApi

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

#receive_navix_webhook(path, x_tenant_id, body, api_version: nil) ⇒ ApiResponse

The catch-all *path route parameter allows Navix to target any sub-path (e.g., /api/v1/FreightAudit/navix, /api/v1/FreightAudit/navix/invoices). The path value is captured for logging but does not affect processing. the URL (for logging only). by APIM. Required on all requests. operation. here

Parameters:

  • path (String)

    Required parameter: Optional sub-path captured from

  • x_tenant_id (String)

    Required parameter: Tenant identifier stamped

  • body (NavixWebhookRequest)

    Required parameter: Token to cancel the

  • api_version (String) (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
45
46
47
48
49
50
51
52
# File 'lib/freight_financials_webhook_ingestion_api/apis/freight_audit_api.rb', line 22

def receive_navix_webhook(path,
                          x_tenant_id,
                          body,
                          api_version: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/api/v1/FreightAudit/{path}',
                                 Server::DEFAULT)
               .template_param(new_parameter(path, key: 'path')
                                .is_required(true)
                                .should_encode(true))
               .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(:dynamic_deserializer))
                .is_api_response(true)
                .local_error('400',
                             'The request body could not be deserialized into a valid Navix'\
                              ' webhook payload.',
                             ProblemDetailsException)
                .local_error('401',
                             'The `X-Tenant-Id` header is missing or empty.',
                             ProblemDetailsException))
    .execute
end