retab 0.1.10 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/retab/client.rb +8 -0
- data/lib/retab/consensus/create_consensus_request.rb +28 -0
- data/lib/retab/consensus/reconciliation_alignment.rb +30 -0
- data/lib/retab/consensus/reconciliation_field.rb +34 -0
- data/lib/retab/consensus/reconciliation_path_alignment.rb +25 -0
- data/lib/retab/consensus/reconciliation_result.rb +31 -0
- data/lib/retab/consensus.rb +46 -0
- data/lib/retab/experiment_run_metrics/experiment_summary_metrics_response.rb +6 -0
- data/lib/retab/extractions/extraction_request.rb +3 -3
- data/lib/retab/extractions.rb +6 -6
- data/lib/retab/paginated_list.rb +1 -1
- data/lib/retab/splits/reconstruct_document_ref.rb +28 -0
- data/lib/retab/splits/reconstruct_enriched_row.rb +20 -0
- data/lib/retab/splits/reconstruct_enriched_table.rb +31 -0
- data/lib/retab/splits/reconstruct_enrichment_options.rb +28 -0
- data/lib/retab/splits/reconstruct_request.rb +25 -0
- data/lib/retab/splits/reconstruct_response.rb +20 -0
- data/lib/retab/splits/reconstruct_subdocument.rb +31 -0
- data/lib/retab/splits/sheet_region.rb +40 -0
- data/lib/retab/splits/split_result.rb +5 -2
- data/lib/retab/splits.rb +30 -0
- data/lib/retab/types/usage_order.rb +9 -0
- data/lib/retab/usage/usage_block_record.rb +49 -0
- data/lib/retab/usage/usage_primitive_document.rb +25 -0
- data/lib/retab/usage/usage_primitive_record.rb +73 -0
- data/lib/retab/usage/usage_primitive_triggered_by.rb +40 -0
- data/lib/retab/usage/usage_run_record.rb +58 -0
- data/lib/retab/usage/v_1_usage_usage_run_triggered_by.rb +28 -0
- data/lib/retab/usage.rb +267 -0
- data/lib/retab/version.rb +1 -1
- data/lib/retab/workflow_experiments.rb +5 -1
- data/lib/retab/workflow_reviews/review.rb +0 -2
- data/lib/retab/workflow_reviews/review_all_of.rb +0 -2
- data/lib/retab/workflow_reviews/review_any_of.rb +0 -2
- data/lib/retab/workflow_runs/create_workflow_run_request.rb +5 -2
- data/lib/retab/workflow_runs/workflow_run.rb +5 -2
- data/lib/retab/workflow_runs.rb +9 -1
- data/lib/retab/workflow_steps.rb +5 -0
- data/lib/retab/workflows/workflow.rb +2 -8
- data/lib/retab.rb +2 -0
- data/rbi/retab/client.rbi +6 -0
- data/rbi/retab/consensus.rbi +23 -0
- data/rbi/retab/create_consensus_request.rbi +36 -0
- data/rbi/retab/create_workflow_run_request.rbi +6 -0
- data/rbi/retab/experiment_summary_metrics_response.rbi +12 -0
- data/rbi/retab/extraction_request.rbi +4 -4
- data/rbi/retab/extractions.rbi +4 -4
- data/rbi/retab/reconciliation_alignment.rbi +36 -0
- data/rbi/retab/reconciliation_field.rbi +48 -0
- data/rbi/retab/reconciliation_path_alignment.rbi +30 -0
- data/rbi/retab/reconciliation_result.rbi +42 -0
- data/rbi/retab/{review_field_confidence_lt.rbi → reconstruct_document_ref.rbi} +11 -11
- data/rbi/retab/reconstruct_enriched_row.rbi +24 -0
- data/rbi/retab/reconstruct_enriched_table.rbi +42 -0
- data/rbi/retab/reconstruct_enrichment_options.rbi +36 -0
- data/rbi/retab/reconstruct_request.rbi +30 -0
- data/rbi/retab/reconstruct_response.rbi +24 -0
- data/rbi/retab/reconstruct_subdocument.rbi +42 -0
- data/rbi/retab/review.rbi +2 -2
- data/rbi/retab/review_all_of.rbi +2 -2
- data/rbi/retab/review_any_of.rbi +2 -2
- data/rbi/retab/sheet_region.rbi +60 -0
- data/rbi/retab/split_result.rbi +6 -0
- data/rbi/retab/splits.rbi +9 -0
- data/rbi/retab/usage.rbi +68 -0
- data/rbi/retab/usage_block_record.rbi +78 -0
- data/rbi/retab/usage_primitive_document.rbi +30 -0
- data/rbi/retab/usage_primitive_record.rbi +126 -0
- data/rbi/retab/usage_primitive_triggered_by.rbi +60 -0
- data/rbi/retab/usage_run_record.rbi +96 -0
- data/rbi/retab/v_1_usage_usage_run_triggered_by.rbi +36 -0
- data/rbi/retab/workflow.rbi +0 -12
- data/rbi/retab/workflow_experiment.rbi +2 -2
- data/rbi/retab/workflow_experiments.rbi +2 -1
- data/rbi/retab/workflow_run.rbi +6 -0
- data/rbi/retab/workflow_runs.rbi +4 -2
- data/rbi/retab/workflow_steps.rbi +2 -1
- metadata +45 -6
- data/lib/retab/types/workflow_authz_status.rb +0 -16
- data/lib/retab/types/workflow_capabilities.rb +0 -26
- data/lib/retab/workflow_reviews/review_field_confidence_lt.rb +0 -28
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 42b59c6b5a798c010207cd26417fffd501f4fcfab09c0c26c72e4b8a913774d4
|
|
4
|
+
data.tar.gz: c72d4edba45cb7a74dc0d730d9d5eb9bea9070119e7dfee6fa79825c55ca87ea
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 11f68093fdd2b39eccde81b522e0d876af633a41d81ffe4b987b7b43575c3ee0c311f64b89955610068bafe261268a10907c80a0c219b31cc2ee45507fc7e00f
|
|
7
|
+
data.tar.gz: 6d6a30db0bbd8a0a23c232535299850755cd46baf4fd2fa953441435d1e36d989972d41faa8228573705179645f94fec6e40c4b8733ecf38e92eaaa49a104d86
|
data/lib/retab/client.rb
CHANGED
|
@@ -9,6 +9,10 @@ module Retab
|
|
|
9
9
|
@classifications ||= Retab::Classifications.new(self)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
+
def consensus
|
|
13
|
+
@consensus ||= Retab::Consensus.new(self)
|
|
14
|
+
end
|
|
15
|
+
|
|
12
16
|
def edits
|
|
13
17
|
@edits ||= Retab::Edits.new(self)
|
|
14
18
|
end
|
|
@@ -45,6 +49,10 @@ module Retab
|
|
|
45
49
|
@tables ||= Retab::Tables.new(self)
|
|
46
50
|
end
|
|
47
51
|
|
|
52
|
+
def usage
|
|
53
|
+
@usage ||= Retab::Usage.new(self)
|
|
54
|
+
end
|
|
55
|
+
|
|
48
56
|
def workflows
|
|
49
57
|
@workflows ||= Retab::Workflows.new(self)
|
|
50
58
|
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is auto-generated by oagen. Do not edit.
|
|
4
|
+
|
|
5
|
+
module Retab
|
|
6
|
+
class CreateConsensusRequest < Retab::Types::BaseModel
|
|
7
|
+
|
|
8
|
+
HASH_ATTRS = {
|
|
9
|
+
include_alignment: :include_alignment,
|
|
10
|
+
inputs: :inputs,
|
|
11
|
+
json_schema: :json_schema
|
|
12
|
+
}.freeze
|
|
13
|
+
|
|
14
|
+
attr_accessor(
|
|
15
|
+
:include_alignment,
|
|
16
|
+
:inputs,
|
|
17
|
+
:json_schema
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
def initialize(json)
|
|
21
|
+
super()
|
|
22
|
+
hash = self.class.normalize(json)
|
|
23
|
+
@include_alignment = hash[:include_alignment]
|
|
24
|
+
@inputs = (hash[:inputs] || []).map { |item| item || {} }
|
|
25
|
+
@json_schema = hash[:json_schema] || {}
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is auto-generated by oagen. Do not edit.
|
|
4
|
+
|
|
5
|
+
module Retab
|
|
6
|
+
class ReconciliationAlignment < Retab::Types::BaseModel
|
|
7
|
+
|
|
8
|
+
HASH_ATTRS = {
|
|
9
|
+
aligned_inputs: :aligned_inputs,
|
|
10
|
+
path_alignments: :path_alignments,
|
|
11
|
+
reference_index: :reference_index
|
|
12
|
+
}.freeze
|
|
13
|
+
|
|
14
|
+
attr_accessor(
|
|
15
|
+
:aligned_inputs,
|
|
16
|
+
:path_alignments,
|
|
17
|
+
:reference_index
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
def initialize(json)
|
|
21
|
+
super()
|
|
22
|
+
hash = self.class.normalize(json)
|
|
23
|
+
@aligned_inputs = (hash[:aligned_inputs] || []).map { |item| item || {} }
|
|
24
|
+
@path_alignments = (hash[:path_alignments] || []).map { |item|
|
|
25
|
+
item ? Retab::ReconciliationPathAlignment.new(item) : nil
|
|
26
|
+
}
|
|
27
|
+
@reference_index = hash[:reference_index]
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is auto-generated by oagen. Do not edit.
|
|
4
|
+
|
|
5
|
+
module Retab
|
|
6
|
+
class ReconciliationField < Retab::Types::BaseModel
|
|
7
|
+
|
|
8
|
+
HASH_ATTRS = {
|
|
9
|
+
likelihood: :likelihood,
|
|
10
|
+
path: :path,
|
|
11
|
+
supporting_input_count: :supporting_input_count,
|
|
12
|
+
total_input_count: :total_input_count,
|
|
13
|
+
value: :value
|
|
14
|
+
}.freeze
|
|
15
|
+
|
|
16
|
+
attr_accessor(
|
|
17
|
+
:likelihood,
|
|
18
|
+
:path,
|
|
19
|
+
:supporting_input_count,
|
|
20
|
+
:total_input_count,
|
|
21
|
+
:value
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
def initialize(json)
|
|
25
|
+
super()
|
|
26
|
+
hash = self.class.normalize(json)
|
|
27
|
+
@likelihood = hash[:likelihood]
|
|
28
|
+
@path = hash[:path]
|
|
29
|
+
@supporting_input_count = hash[:supporting_input_count]
|
|
30
|
+
@total_input_count = hash[:total_input_count]
|
|
31
|
+
@value = hash[:value]
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is auto-generated by oagen. Do not edit.
|
|
4
|
+
|
|
5
|
+
module Retab
|
|
6
|
+
class ReconciliationPathAlignment < Retab::Types::BaseModel
|
|
7
|
+
|
|
8
|
+
HASH_ATTRS = {
|
|
9
|
+
canonical_path: :canonical_path,
|
|
10
|
+
source_paths: :source_paths
|
|
11
|
+
}.freeze
|
|
12
|
+
|
|
13
|
+
attr_accessor(
|
|
14
|
+
:canonical_path,
|
|
15
|
+
:source_paths
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
def initialize(json)
|
|
19
|
+
super()
|
|
20
|
+
hash = self.class.normalize(json)
|
|
21
|
+
@canonical_path = hash[:canonical_path]
|
|
22
|
+
@source_paths = (hash[:source_paths] || [])
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is auto-generated by oagen. Do not edit.
|
|
4
|
+
|
|
5
|
+
module Retab
|
|
6
|
+
class ReconciliationResult < Retab::Types::BaseModel
|
|
7
|
+
|
|
8
|
+
HASH_ATTRS = {
|
|
9
|
+
alignment: :alignment,
|
|
10
|
+
consensus: :consensus,
|
|
11
|
+
fields: :fields,
|
|
12
|
+
likelihoods: :likelihoods
|
|
13
|
+
}.freeze
|
|
14
|
+
|
|
15
|
+
attr_accessor(
|
|
16
|
+
:alignment,
|
|
17
|
+
:consensus,
|
|
18
|
+
:fields,
|
|
19
|
+
:likelihoods
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
def initialize(json)
|
|
23
|
+
super()
|
|
24
|
+
hash = self.class.normalize(json)
|
|
25
|
+
@alignment = hash[:alignment] ? Retab::ReconciliationAlignment.new(hash[:alignment]) : nil
|
|
26
|
+
@consensus = hash[:consensus] || {}
|
|
27
|
+
@fields = (hash[:fields] || []).map { |item| item ? Retab::ReconciliationField.new(item) : nil }
|
|
28
|
+
@likelihoods = hash[:likelihoods] || {}
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is auto-generated by oagen. Do not edit.
|
|
4
|
+
|
|
5
|
+
require "json"
|
|
6
|
+
|
|
7
|
+
module Retab
|
|
8
|
+
class Consensus
|
|
9
|
+
def initialize(client)
|
|
10
|
+
@client = client
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Create Consensus
|
|
14
|
+
# @param include_alignment [Boolean, nil]
|
|
15
|
+
# @param inputs [Array<Hash{String => Object}>, nil]
|
|
16
|
+
# @param json_schema [Hash{String => Object}, nil]
|
|
17
|
+
# @param request_options [Hash] (see Retab::Types::RequestOptions)
|
|
18
|
+
# @return [Retab::ReconciliationResult]
|
|
19
|
+
def create(
|
|
20
|
+
inputs:,
|
|
21
|
+
include_alignment: nil,
|
|
22
|
+
json_schema: nil,
|
|
23
|
+
request_options: {}
|
|
24
|
+
)
|
|
25
|
+
body = {
|
|
26
|
+
"include_alignment" => include_alignment,
|
|
27
|
+
"inputs" => inputs,
|
|
28
|
+
"json_schema" => json_schema
|
|
29
|
+
}.compact
|
|
30
|
+
response = @client.request(
|
|
31
|
+
method: :post,
|
|
32
|
+
path: "/v1/consensus",
|
|
33
|
+
auth: true,
|
|
34
|
+
body: body,
|
|
35
|
+
request_options: request_options
|
|
36
|
+
)
|
|
37
|
+
result = Retab::ReconciliationResult.new(response.body)
|
|
38
|
+
result.last_response = Retab::Types::ApiResponse.new(
|
|
39
|
+
http_status: response.code.to_i,
|
|
40
|
+
http_headers: response.each_header.to_h,
|
|
41
|
+
request_id: response["x-request-id"]
|
|
42
|
+
)
|
|
43
|
+
result
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -15,6 +15,8 @@ module Retab
|
|
|
15
15
|
score: :score,
|
|
16
16
|
prior_score: :prior_score,
|
|
17
17
|
documents: :documents,
|
|
18
|
+
scored_document_count: :scored_document_count,
|
|
19
|
+
total_document_count: :total_document_count,
|
|
18
20
|
aggregate: :aggregate,
|
|
19
21
|
prior_run_id: :prior_run_id
|
|
20
22
|
}.freeze
|
|
@@ -29,6 +31,8 @@ module Retab
|
|
|
29
31
|
:score,
|
|
30
32
|
:prior_score,
|
|
31
33
|
:documents,
|
|
34
|
+
:scored_document_count,
|
|
35
|
+
:total_document_count,
|
|
32
36
|
:aggregate,
|
|
33
37
|
:prior_run_id
|
|
34
38
|
)
|
|
@@ -47,6 +51,8 @@ module Retab
|
|
|
47
51
|
@documents = (hash[:documents] || []).map { |item|
|
|
48
52
|
item ? Retab::ExperimentSummaryMetricDocument.new(item) : nil
|
|
49
53
|
}
|
|
54
|
+
@scored_document_count = hash[:scored_document_count]
|
|
55
|
+
@total_document_count = hash[:total_document_count]
|
|
50
56
|
@aggregate = hash[:aggregate] ? Retab::ExperimentExtractSummaryAggregate.new(hash[:aggregate]) : nil
|
|
51
57
|
@prior_run_id = hash[:prior_run_id]
|
|
52
58
|
end
|
|
@@ -16,7 +16,7 @@ module Retab
|
|
|
16
16
|
bust_cache: :bust_cache,
|
|
17
17
|
stream: :stream,
|
|
18
18
|
background: :background,
|
|
19
|
-
|
|
19
|
+
deep_extraction: :deep_extraction
|
|
20
20
|
}.freeze
|
|
21
21
|
|
|
22
22
|
attr_accessor(
|
|
@@ -30,7 +30,7 @@ module Retab
|
|
|
30
30
|
:bust_cache,
|
|
31
31
|
:stream,
|
|
32
32
|
:background,
|
|
33
|
-
:
|
|
33
|
+
:deep_extraction
|
|
34
34
|
)
|
|
35
35
|
|
|
36
36
|
def initialize(json)
|
|
@@ -46,7 +46,7 @@ module Retab
|
|
|
46
46
|
@bust_cache = hash[:bust_cache].nil? ? false : hash[:bust_cache]
|
|
47
47
|
@stream = hash[:stream].nil? ? false : hash[:stream]
|
|
48
48
|
@background = hash[:background].nil? ? false : hash[:background]
|
|
49
|
-
@
|
|
49
|
+
@deep_extraction = hash[:deep_extraction].nil? ? false : hash[:deep_extraction]
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
52
|
end
|
data/lib/retab/extractions.rb
CHANGED
|
@@ -109,7 +109,7 @@ module Retab
|
|
|
109
109
|
# @param bust_cache [Boolean, nil] If true, skip the LLM cache and force a fresh completion
|
|
110
110
|
# @param stream [Boolean, nil]
|
|
111
111
|
# @param background [Boolean, nil] If true, run asynchronously: returns immediately with status 'queued' and an empty output. Poll GET /v1/<primitive>/{id} until status is terminal. Mutually exclusive with stream.
|
|
112
|
-
# @param
|
|
112
|
+
# @param deep_extraction [Boolean, nil] Optimizes for accuracy over latency in documents with very large arrays.
|
|
113
113
|
# @param request_options [Hash] (see Retab::Types::RequestOptions)
|
|
114
114
|
# @return [Retab::Extraction]
|
|
115
115
|
def create(
|
|
@@ -123,7 +123,7 @@ module Retab
|
|
|
123
123
|
bust_cache: nil,
|
|
124
124
|
stream: nil,
|
|
125
125
|
background: nil,
|
|
126
|
-
|
|
126
|
+
deep_extraction: nil,
|
|
127
127
|
request_options: {}
|
|
128
128
|
)
|
|
129
129
|
document = Retab::MimeData.coerce(document, client: @client) unless document.nil?
|
|
@@ -138,7 +138,7 @@ module Retab
|
|
|
138
138
|
"bust_cache" => bust_cache,
|
|
139
139
|
"stream" => stream,
|
|
140
140
|
"background" => background,
|
|
141
|
-
"
|
|
141
|
+
"deep_extraction" => deep_extraction
|
|
142
142
|
}.compact
|
|
143
143
|
response = @client.request(
|
|
144
144
|
method: :post,
|
|
@@ -167,7 +167,7 @@ module Retab
|
|
|
167
167
|
# @param bust_cache [Boolean, nil] If true, skip the LLM cache and force a fresh completion
|
|
168
168
|
# @param stream [Boolean, nil]
|
|
169
169
|
# @param background [Boolean, nil] If true, run asynchronously: returns immediately with status 'queued' and an empty output. Poll GET /v1/<primitive>/{id} until status is terminal. Mutually exclusive with stream.
|
|
170
|
-
# @param
|
|
170
|
+
# @param deep_extraction [Boolean, nil] Optimizes for accuracy over latency in documents with very large arrays.
|
|
171
171
|
# @param request_options [Hash] (see Retab::Types::RequestOptions)
|
|
172
172
|
# @return [void]
|
|
173
173
|
def create_stream(
|
|
@@ -181,7 +181,7 @@ module Retab
|
|
|
181
181
|
bust_cache: nil,
|
|
182
182
|
stream: nil,
|
|
183
183
|
background: nil,
|
|
184
|
-
|
|
184
|
+
deep_extraction: nil,
|
|
185
185
|
request_options: {}
|
|
186
186
|
)
|
|
187
187
|
document = Retab::MimeData.coerce(document, client: @client) unless document.nil?
|
|
@@ -196,7 +196,7 @@ module Retab
|
|
|
196
196
|
"bust_cache" => bust_cache,
|
|
197
197
|
"stream" => stream,
|
|
198
198
|
"background" => background,
|
|
199
|
-
"
|
|
199
|
+
"deep_extraction" => deep_extraction
|
|
200
200
|
}.compact
|
|
201
201
|
@client.request(
|
|
202
202
|
method: :post,
|
data/lib/retab/paginated_list.rb
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
# @oagen-ignore-file
|
|
6
6
|
#
|
|
7
7
|
# Cross-language paginated-list wrapper. See
|
|
8
|
-
#
|
|
8
|
+
# docs/blueprints/sdk-pagination-contract.md for the full contract.
|
|
9
9
|
#
|
|
10
10
|
# Every `def list` method on a Retab service returns one of these. The
|
|
11
11
|
# class includes `Enumerable`, so callers can iterate every page
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is auto-generated by oagen. Do not edit.
|
|
4
|
+
|
|
5
|
+
module Retab
|
|
6
|
+
class ReconstructDocumentRef < Retab::Types::BaseModel
|
|
7
|
+
|
|
8
|
+
HASH_ATTRS = {
|
|
9
|
+
filename: :filename,
|
|
10
|
+
id: :id,
|
|
11
|
+
mime_type: :mime_type
|
|
12
|
+
}.freeze
|
|
13
|
+
|
|
14
|
+
attr_accessor(
|
|
15
|
+
:filename,
|
|
16
|
+
:id,
|
|
17
|
+
:mime_type
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
def initialize(json)
|
|
21
|
+
super()
|
|
22
|
+
hash = self.class.normalize(json)
|
|
23
|
+
@filename = hash[:filename]
|
|
24
|
+
@id = hash[:id]
|
|
25
|
+
@mime_type = hash[:mime_type]
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is auto-generated by oagen. Do not edit.
|
|
4
|
+
|
|
5
|
+
module Retab
|
|
6
|
+
class ReconstructEnrichedRow < Retab::Types::BaseModel
|
|
7
|
+
|
|
8
|
+
HASH_ATTRS = {
|
|
9
|
+
cells: :cells
|
|
10
|
+
}.freeze
|
|
11
|
+
|
|
12
|
+
attr_accessor :cells
|
|
13
|
+
|
|
14
|
+
def initialize(json)
|
|
15
|
+
super()
|
|
16
|
+
hash = self.class.normalize(json)
|
|
17
|
+
@cells = (hash[:cells] || [])
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is auto-generated by oagen. Do not edit.
|
|
4
|
+
|
|
5
|
+
module Retab
|
|
6
|
+
class ReconstructEnrichedTable < Retab::Types::BaseModel
|
|
7
|
+
|
|
8
|
+
HASH_ATTRS = {
|
|
9
|
+
csv: :csv,
|
|
10
|
+
header: :header,
|
|
11
|
+
label: :label,
|
|
12
|
+
rows: :rows
|
|
13
|
+
}.freeze
|
|
14
|
+
|
|
15
|
+
attr_accessor(
|
|
16
|
+
:csv,
|
|
17
|
+
:header,
|
|
18
|
+
:label,
|
|
19
|
+
:rows
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
def initialize(json)
|
|
23
|
+
super()
|
|
24
|
+
hash = self.class.normalize(json)
|
|
25
|
+
@csv = hash[:csv]
|
|
26
|
+
@header = (hash[:header] || [])
|
|
27
|
+
@label = hash[:label]
|
|
28
|
+
@rows = (hash[:rows] || []).map { |item| item ? Retab::ReconstructEnrichedRow.new(item) : nil }
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is auto-generated by oagen. Do not edit.
|
|
4
|
+
|
|
5
|
+
module Retab
|
|
6
|
+
class ReconstructEnrichmentOptions < Retab::Types::BaseModel
|
|
7
|
+
|
|
8
|
+
HASH_ATTRS = {
|
|
9
|
+
fill_key_spans: :fill_key_spans,
|
|
10
|
+
flatten_header: :flatten_header,
|
|
11
|
+
promote_sections: :promote_sections
|
|
12
|
+
}.freeze
|
|
13
|
+
|
|
14
|
+
attr_accessor(
|
|
15
|
+
:fill_key_spans,
|
|
16
|
+
:flatten_header,
|
|
17
|
+
:promote_sections
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
def initialize(json)
|
|
21
|
+
super()
|
|
22
|
+
hash = self.class.normalize(json)
|
|
23
|
+
@fill_key_spans = hash[:fill_key_spans]
|
|
24
|
+
@flatten_header = hash[:flatten_header]
|
|
25
|
+
@promote_sections = hash[:promote_sections]
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is auto-generated by oagen. Do not edit.
|
|
4
|
+
|
|
5
|
+
module Retab
|
|
6
|
+
class ReconstructRequest < Retab::Types::BaseModel
|
|
7
|
+
|
|
8
|
+
HASH_ATTRS = {
|
|
9
|
+
document: :document,
|
|
10
|
+
subdocuments: :subdocuments
|
|
11
|
+
}.freeze
|
|
12
|
+
|
|
13
|
+
attr_accessor(
|
|
14
|
+
:document,
|
|
15
|
+
:subdocuments
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
def initialize(json)
|
|
19
|
+
super()
|
|
20
|
+
hash = self.class.normalize(json)
|
|
21
|
+
@document = hash[:document] ? Retab::ReconstructDocumentRef.new(hash[:document]) : nil
|
|
22
|
+
@subdocuments = (hash[:subdocuments] || []).map { |item| item ? Retab::ReconstructSubdocument.new(item) : nil }
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is auto-generated by oagen. Do not edit.
|
|
4
|
+
|
|
5
|
+
module Retab
|
|
6
|
+
class ReconstructResponse < Retab::Types::BaseModel
|
|
7
|
+
|
|
8
|
+
HASH_ATTRS = {
|
|
9
|
+
tables: :tables
|
|
10
|
+
}.freeze
|
|
11
|
+
|
|
12
|
+
attr_accessor :tables
|
|
13
|
+
|
|
14
|
+
def initialize(json)
|
|
15
|
+
super()
|
|
16
|
+
hash = self.class.normalize(json)
|
|
17
|
+
@tables = (hash[:tables] || []).map { |item| item ? Retab::ReconstructEnrichedTable.new(item) : nil }
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is auto-generated by oagen. Do not edit.
|
|
4
|
+
|
|
5
|
+
module Retab
|
|
6
|
+
class ReconstructSubdocument < Retab::Types::BaseModel
|
|
7
|
+
|
|
8
|
+
HASH_ATTRS = {
|
|
9
|
+
enrichment: :enrichment,
|
|
10
|
+
name: :name,
|
|
11
|
+
partition_key: :partition_key,
|
|
12
|
+
regions: :regions
|
|
13
|
+
}.freeze
|
|
14
|
+
|
|
15
|
+
attr_accessor(
|
|
16
|
+
:enrichment,
|
|
17
|
+
:name,
|
|
18
|
+
:partition_key,
|
|
19
|
+
:regions
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
def initialize(json)
|
|
23
|
+
super()
|
|
24
|
+
hash = self.class.normalize(json)
|
|
25
|
+
@enrichment = hash[:enrichment] ? Retab::ReconstructEnrichmentOptions.new(hash[:enrichment]) : nil
|
|
26
|
+
@name = hash[:name]
|
|
27
|
+
@partition_key = hash[:partition_key]
|
|
28
|
+
@regions = (hash[:regions] || []).map { |item| item ? Retab::SheetRegion.new(item) : nil }
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is auto-generated by oagen. Do not edit.
|
|
4
|
+
|
|
5
|
+
module Retab
|
|
6
|
+
class SheetRegion < Retab::Types::BaseModel
|
|
7
|
+
|
|
8
|
+
HASH_ATTRS = {
|
|
9
|
+
col_end: :col_end,
|
|
10
|
+
col_start: :col_start,
|
|
11
|
+
header_rows: :header_rows,
|
|
12
|
+
row_end: :row_end,
|
|
13
|
+
row_start: :row_start,
|
|
14
|
+
sheet_index: :sheet_index,
|
|
15
|
+
sheet_name: :sheet_name
|
|
16
|
+
}.freeze
|
|
17
|
+
|
|
18
|
+
attr_accessor(
|
|
19
|
+
:col_end,
|
|
20
|
+
:col_start,
|
|
21
|
+
:header_rows,
|
|
22
|
+
:row_end,
|
|
23
|
+
:row_start,
|
|
24
|
+
:sheet_index,
|
|
25
|
+
:sheet_name
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
def initialize(json)
|
|
29
|
+
super()
|
|
30
|
+
hash = self.class.normalize(json)
|
|
31
|
+
@col_end = hash[:col_end]
|
|
32
|
+
@col_start = hash[:col_start]
|
|
33
|
+
@header_rows = (hash[:header_rows] || [])
|
|
34
|
+
@row_end = hash[:row_end]
|
|
35
|
+
@row_start = hash[:row_start]
|
|
36
|
+
@sheet_index = hash[:sheet_index]
|
|
37
|
+
@sheet_name = hash[:sheet_name]
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -7,12 +7,14 @@ module Retab
|
|
|
7
7
|
|
|
8
8
|
HASH_ATTRS = {
|
|
9
9
|
name: :name,
|
|
10
|
-
pages: :pages
|
|
10
|
+
pages: :pages,
|
|
11
|
+
regions: :regions
|
|
11
12
|
}.freeze
|
|
12
13
|
|
|
13
14
|
attr_accessor(
|
|
14
15
|
:name,
|
|
15
|
-
:pages
|
|
16
|
+
:pages,
|
|
17
|
+
:regions
|
|
16
18
|
)
|
|
17
19
|
|
|
18
20
|
def initialize(json)
|
|
@@ -20,6 +22,7 @@ module Retab
|
|
|
20
22
|
hash = self.class.normalize(json)
|
|
21
23
|
@name = hash[:name]
|
|
22
24
|
@pages = (hash[:pages] || [])
|
|
25
|
+
@regions = (hash[:regions] || []).map { |item| item ? Retab::SheetRegion.new(item) : nil }
|
|
23
26
|
end
|
|
24
27
|
end
|
|
25
28
|
end
|
data/lib/retab/splits.rb
CHANGED
|
@@ -124,6 +124,36 @@ module Retab
|
|
|
124
124
|
result
|
|
125
125
|
end
|
|
126
126
|
|
|
127
|
+
# Reconstruct Split
|
|
128
|
+
# @param document [Retab::ReconstructDocumentRef]
|
|
129
|
+
# @param subdocuments [Array<Retab::ReconstructSubdocument>]
|
|
130
|
+
# @param request_options [Hash] (see Retab::Types::RequestOptions)
|
|
131
|
+
# @return [Retab::ReconstructResponse]
|
|
132
|
+
def create_reconstruct(
|
|
133
|
+
document:,
|
|
134
|
+
subdocuments:,
|
|
135
|
+
request_options: {}
|
|
136
|
+
)
|
|
137
|
+
body = {
|
|
138
|
+
"document" => document,
|
|
139
|
+
"subdocuments" => subdocuments
|
|
140
|
+
}
|
|
141
|
+
response = @client.request(
|
|
142
|
+
method: :post,
|
|
143
|
+
path: "/v1/splits/reconstruct",
|
|
144
|
+
auth: true,
|
|
145
|
+
body: body,
|
|
146
|
+
request_options: request_options
|
|
147
|
+
)
|
|
148
|
+
result = Retab::ReconstructResponse.new(response.body)
|
|
149
|
+
result.last_response = Retab::Types::ApiResponse.new(
|
|
150
|
+
http_status: response.code.to_i,
|
|
151
|
+
http_headers: response.each_header.to_h,
|
|
152
|
+
request_id: response["x-request-id"]
|
|
153
|
+
)
|
|
154
|
+
result
|
|
155
|
+
end
|
|
156
|
+
|
|
127
157
|
# Get Split
|
|
128
158
|
# @param split_id [String]
|
|
129
159
|
# @param include_output [Boolean, nil] When false, returns a cheap status-only projection (no output), served from cache for in-flight background runs.
|