Class: Retab::Consensus

Inherits:
Object
  • Object
show all
Defined in:
lib/retab/consensus.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Consensus

Returns a new instance of Consensus.



9
10
11
# File 'lib/retab/consensus.rb', line 9

def initialize(client)
  @client = client
end

Instance Method Details

#create(inputs:, include_alignment: nil, json_schema: nil, request_options: {}) ⇒ Retab::ReconciliationResult

Create Consensus

Parameters:

  • include_alignment (Boolean, nil) (defaults to: nil)
  • inputs (Array<Hash{String => Object}>, nil)
  • json_schema (Hash{String => Object}, nil) (defaults to: nil)
  • request_options (Hash) (defaults to: {})

    (see Retab::Types::RequestOptions)

Returns:



19
20
21
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/retab/consensus.rb', line 19

def create(
  inputs:,
  include_alignment: nil,
  json_schema: nil,
  request_options: {}
)
  body = {
    "include_alignment" => include_alignment,
    "inputs" => inputs,
    "json_schema" => json_schema
  }.compact
  response = @client.request(
    method: :post,
    path: "/v1/consensus",
    auth: true,
    body: body,
    request_options: request_options
  )
  result = Retab::ReconciliationResult.new(response.body)
  result.last_response = Retab::Types::ApiResponse.new(
    http_status: response.code.to_i,
    http_headers: response.each_header.to_h,
    request_id: response["x-request-id"]
  )
  result
end