Class: McAPI::Encryption::OpenAPIInterceptor

Inherits:
Object
  • Object
show all
Defined in:
lib/mcapi/encryption/openapi_interceptor.rb

Overview

Service class that provide interceptor facilities for OpenApi swagger client

Class Method Summary collapse

Class Method Details

.install_field_level_encryption(swagger_client, config) ⇒ Object

Install the field level encryption in the OpenAPI HTTP client adding encryption/decryption capabilities for the request/response payload.

Parameters:

  • swagger_client (Object)

    OpenAPI service client (it can be generated by the swagger code generator)

  • config (Object)

    configuration object describing which field to enable encryption/decryption



20
21
22
23
24
25
26
27
28
# File 'lib/mcapi/encryption/openapi_interceptor.rb', line 20

def install_field_level_encryption(swagger_client, config)
  fle = McAPI::Encryption::FieldLevelEncryption.new(config)
  # Hooking ApiClient#call_api
  hook_call_api fle
  # Hooking ApiClient#deserialize
  hook_deserialize fle
  McAPI::Encryption::OpenAPIInterceptor.init_call_api swagger_client
  McAPI::Encryption::OpenAPIInterceptor.init_deserialize swagger_client
end