Class: TochkaCyclopsApi::DataProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/tochka_cyclops_api/data_processor.rb

Overview

Module for input data validation and subsequent request invocation

Class Method Summary collapse

Class Method Details

.send_request(method:, data:, layer:) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/tochka_cyclops_api/data_processor.rb', line 15

def self.send_request(method:, data:, layer: )
  @method = method
  @data = data
  @layer = layer
  @errors = {}
  @url = url_for
  @request_id = SecureRandom.uuid
  schemas
  validation = @request_schema&.call(@data.deep_symbolize_keys)
  @validation_errors = validation&.errors.to_h

  call
end