retab 0.1.10 → 0.1.11

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.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/lib/retab/client.rb +4 -0
  3. data/lib/retab/paginated_list.rb +1 -1
  4. data/lib/retab/splits/reconstruct_document_ref.rb +28 -0
  5. data/lib/retab/splits/reconstruct_enriched_row.rb +20 -0
  6. data/lib/retab/splits/reconstruct_enriched_table.rb +31 -0
  7. data/lib/retab/splits/reconstruct_enrichment_options.rb +28 -0
  8. data/lib/retab/splits/reconstruct_request.rb +25 -0
  9. data/lib/retab/splits/reconstruct_response.rb +20 -0
  10. data/lib/retab/splits/reconstruct_subdocument.rb +31 -0
  11. data/lib/retab/splits/sheet_region.rb +40 -0
  12. data/lib/retab/splits/split_result.rb +5 -2
  13. data/lib/retab/splits.rb +30 -0
  14. data/lib/retab/types/usage_order.rb +9 -0
  15. data/lib/retab/usage/usage_block_record.rb +49 -0
  16. data/lib/retab/usage/usage_primitive_document.rb +25 -0
  17. data/lib/retab/usage/usage_primitive_record.rb +73 -0
  18. data/lib/retab/usage/usage_primitive_triggered_by.rb +37 -0
  19. data/lib/retab/usage/usage_run_record.rb +55 -0
  20. data/lib/retab/usage.rb +267 -0
  21. data/lib/retab/version.rb +1 -1
  22. data/lib/retab/workflow_experiments.rb +5 -1
  23. data/lib/retab/workflow_reviews/review.rb +0 -2
  24. data/lib/retab/workflow_reviews/review_all_of.rb +0 -2
  25. data/lib/retab/workflow_reviews/review_any_of.rb +0 -2
  26. data/lib/retab/workflow_runs/create_workflow_run_request.rb +5 -2
  27. data/lib/retab/workflow_runs/workflow_run.rb +5 -2
  28. data/lib/retab/workflow_runs.rb +9 -1
  29. data/lib/retab/workflow_steps.rb +5 -0
  30. data/lib/retab/workflows/workflow.rb +2 -8
  31. data/lib/retab.rb +1 -0
  32. data/rbi/retab/client.rbi +3 -0
  33. data/rbi/retab/create_workflow_run_request.rbi +6 -0
  34. data/rbi/retab/{review_field_confidence_lt.rbi → reconstruct_document_ref.rbi} +11 -11
  35. data/rbi/retab/reconstruct_enriched_row.rbi +24 -0
  36. data/rbi/retab/reconstruct_enriched_table.rbi +42 -0
  37. data/rbi/retab/reconstruct_enrichment_options.rbi +36 -0
  38. data/rbi/retab/reconstruct_request.rbi +30 -0
  39. data/rbi/retab/reconstruct_response.rbi +24 -0
  40. data/rbi/retab/reconstruct_subdocument.rbi +42 -0
  41. data/rbi/retab/review.rbi +2 -2
  42. data/rbi/retab/review_all_of.rbi +2 -2
  43. data/rbi/retab/review_any_of.rbi +2 -2
  44. data/rbi/retab/sheet_region.rbi +60 -0
  45. data/rbi/retab/split_result.rbi +6 -0
  46. data/rbi/retab/splits.rbi +9 -0
  47. data/rbi/retab/usage.rbi +68 -0
  48. data/rbi/retab/usage_block_record.rbi +78 -0
  49. data/rbi/retab/usage_primitive_document.rbi +30 -0
  50. data/rbi/retab/usage_primitive_record.rbi +126 -0
  51. data/rbi/retab/usage_primitive_triggered_by.rbi +54 -0
  52. data/rbi/retab/usage_run_record.rbi +90 -0
  53. data/rbi/retab/workflow.rbi +0 -12
  54. data/rbi/retab/workflow_experiment.rbi +2 -2
  55. data/rbi/retab/workflow_experiments.rbi +2 -1
  56. data/rbi/retab/workflow_run.rbi +6 -0
  57. data/rbi/retab/workflow_runs.rbi +4 -2
  58. data/rbi/retab/workflow_steps.rbi +2 -1
  59. metadata +31 -6
  60. data/lib/retab/types/workflow_authz_status.rb +0 -16
  61. data/lib/retab/types/workflow_capabilities.rb +0 -26
  62. 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: 6d8f00bc26ed73aa5d559ff12a8903bc8e0902d16aa47ee5bacdc174face30ad
4
- data.tar.gz: c152d02486ec700e26c0a59c1ff51e07f15567516bfd06e19899ce1619771e30
3
+ metadata.gz: 38b6a8e2e340f9d1cb96c2eceb39489eef534c6a0ab109c734825e5ac751560e
4
+ data.tar.gz: 5faa19319e8b1cc05d8c2ab87dc8cfa66fa5edfb263b57c838a856d3338eb333
5
5
  SHA512:
6
- metadata.gz: b89d753a806f26903c1f1bd3c005a80f92d8b7d940eba048d6f78de16e5241a27a628505eb2c320144dc1eed41579eefd750488007a345ced2368d4e24dec5fa
7
- data.tar.gz: 4472ad621a070d8e80e703f3f4f4740d212ff7481966ce3094cb082361f74c648a8f0712bd43a1c34997d91ed8205c5146149b614252b4b607124ab33dba6054
6
+ metadata.gz: 2f9939d87d73b00d4be259f23312fb4bd9d601a50da1c78eeefe9a1689348a30f5cde3ec4156898de756acefc2fb18b8a8c6c4268ac919cae69bd3b9e26c0dff
7
+ data.tar.gz: 516e8423c347567277dc9caabcf35e00001d35f73b04016fe6b4bbdaa82470ba66f7b1c21b18e957967e78d38112b5837a0dff2f5dca7daffe7af67484cd955b
data/lib/retab/client.rb CHANGED
@@ -45,6 +45,10 @@ module Retab
45
45
  @tables ||= Retab::Tables.new(self)
46
46
  end
47
47
 
48
+ def usage
49
+ @usage ||= Retab::Usage.new(self)
50
+ end
51
+
48
52
  def workflows
49
53
  @workflows ||= Retab::Workflows.new(self)
50
54
  end
@@ -5,7 +5,7 @@
5
5
  # @oagen-ignore-file
6
6
  #
7
7
  # Cross-language paginated-list wrapper. See
8
- # .notes/blueprints/sdk-pagination-contract.md for the full contract.
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.
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is auto-generated by oagen. Do not edit.
4
+
5
+ module Retab
6
+ module Types
7
+ UsageOrder = ClassificationsOrder
8
+ end
9
+ end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is auto-generated by oagen. Do not edit.
4
+
5
+ module Retab
6
+ class UsageBlockRecord < Retab::Types::BaseModel
7
+
8
+ HASH_ATTRS = {
9
+ block_id: :block_id,
10
+ block_type: :block_type,
11
+ credits: :credits,
12
+ execution_count: :execution_count,
13
+ first_activity_at: :first_activity_at,
14
+ last_activity_at: :last_activity_at,
15
+ page_count: :page_count,
16
+ run_count: :run_count,
17
+ status_counts: :status_counts,
18
+ workflow_id: :workflow_id
19
+ }.freeze
20
+
21
+ attr_accessor(
22
+ :block_id,
23
+ :block_type,
24
+ :credits,
25
+ :execution_count,
26
+ :first_activity_at,
27
+ :last_activity_at,
28
+ :page_count,
29
+ :run_count,
30
+ :status_counts,
31
+ :workflow_id
32
+ )
33
+
34
+ def initialize(json)
35
+ super()
36
+ hash = self.class.normalize(json)
37
+ @block_id = hash[:block_id]
38
+ @block_type = hash[:block_type]
39
+ @credits = hash[:credits]
40
+ @execution_count = hash[:execution_count]
41
+ @first_activity_at = hash[:first_activity_at]
42
+ @last_activity_at = hash[:last_activity_at]
43
+ @page_count = hash[:page_count]
44
+ @run_count = hash[:run_count]
45
+ @status_counts = hash[:status_counts] || {}
46
+ @workflow_id = hash[:workflow_id]
47
+ end
48
+ end
49
+ 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 UsagePrimitiveDocument < Retab::Types::BaseModel
7
+
8
+ HASH_ATTRS = {
9
+ file_id: :file_id,
10
+ filename: :filename
11
+ }.freeze
12
+
13
+ attr_accessor(
14
+ :file_id,
15
+ :filename
16
+ )
17
+
18
+ def initialize(json)
19
+ super()
20
+ hash = self.class.normalize(json)
21
+ @file_id = hash[:file_id]
22
+ @filename = hash[:filename]
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is auto-generated by oagen. Do not edit.
4
+
5
+ module Retab
6
+ class UsagePrimitiveRecord < Retab::Types::BaseModel
7
+
8
+ HASH_ATTRS = {
9
+ block_id: :block_id,
10
+ completed_at: :completed_at,
11
+ created_at: :created_at,
12
+ credits: :credits,
13
+ documents: :documents,
14
+ duration_ms: :duration_ms,
15
+ environment_id: :environment_id,
16
+ metadata: :metadata,
17
+ model: :model,
18
+ operation: :operation,
19
+ page_count: :page_count,
20
+ primitive_execution_id: :primitive_execution_id,
21
+ project_id: :project_id,
22
+ resource_kind: :resource_kind,
23
+ run_id: :run_id,
24
+ status: :status,
25
+ triggered_by: :triggered_by,
26
+ workflow_id: :workflow_id
27
+ }.freeze
28
+
29
+ attr_accessor(
30
+ :block_id,
31
+ :completed_at,
32
+ :created_at,
33
+ :credits,
34
+ :documents,
35
+ :duration_ms,
36
+ :environment_id,
37
+ :metadata,
38
+ :model,
39
+ :operation,
40
+ :page_count,
41
+ :primitive_execution_id,
42
+ :project_id,
43
+ :resource_kind,
44
+ :run_id,
45
+ :status,
46
+ :triggered_by,
47
+ :workflow_id
48
+ )
49
+
50
+ def initialize(json)
51
+ super()
52
+ hash = self.class.normalize(json)
53
+ @block_id = hash[:block_id]
54
+ @completed_at = hash[:completed_at]
55
+ @created_at = hash[:created_at]
56
+ @credits = hash[:credits]
57
+ @documents = (hash[:documents] || []).map { |item| item ? Retab::UsagePrimitiveDocument.new(item) : nil }
58
+ @duration_ms = hash[:duration_ms]
59
+ @environment_id = hash[:environment_id]
60
+ @metadata = hash[:metadata] || {}
61
+ @model = hash[:model]
62
+ @operation = hash[:operation]
63
+ @page_count = hash[:page_count]
64
+ @primitive_execution_id = hash[:primitive_execution_id]
65
+ @project_id = hash[:project_id]
66
+ @resource_kind = hash[:resource_kind]
67
+ @run_id = hash[:run_id]
68
+ @status = hash[:status]
69
+ @triggered_by = hash[:triggered_by] ? Retab::UsagePrimitiveTriggeredBy.new(hash[:triggered_by]) : nil
70
+ @workflow_id = hash[:workflow_id]
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is auto-generated by oagen. Do not edit.
4
+
5
+ module Retab
6
+ class UsagePrimitiveTriggeredBy < Retab::Types::BaseModel
7
+
8
+ HASH_ATTRS = {
9
+ access_token_id: :access_token_id,
10
+ api_key_id: :api_key_id,
11
+ auth_method: :auth_method,
12
+ key_name: :key_name,
13
+ key_prefix: :key_prefix,
14
+ user_id: :user_id
15
+ }.freeze
16
+
17
+ attr_accessor(
18
+ :access_token_id,
19
+ :api_key_id,
20
+ :auth_method,
21
+ :key_name,
22
+ :key_prefix,
23
+ :user_id
24
+ )
25
+
26
+ def initialize(json)
27
+ super()
28
+ hash = self.class.normalize(json)
29
+ @access_token_id = hash[:access_token_id]
30
+ @api_key_id = hash[:api_key_id]
31
+ @auth_method = hash[:auth_method]
32
+ @key_name = hash[:key_name]
33
+ @key_prefix = hash[:key_prefix]
34
+ @user_id = hash[:user_id]
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is auto-generated by oagen. Do not edit.
4
+
5
+ module Retab
6
+ class UsageRunRecord < Retab::Types::BaseModel
7
+
8
+ HASH_ATTRS = {
9
+ completed_at: :completed_at,
10
+ created_at: :created_at,
11
+ credits: :credits,
12
+ duration_ms: :duration_ms,
13
+ execution_duration_ms: :execution_duration_ms,
14
+ page_count: :page_count,
15
+ retry_count: :retry_count,
16
+ run_id: :run_id,
17
+ started_at: :started_at,
18
+ status: :status,
19
+ trigger_type: :trigger_type,
20
+ workflow_id: :workflow_id
21
+ }.freeze
22
+
23
+ attr_accessor(
24
+ :completed_at,
25
+ :created_at,
26
+ :credits,
27
+ :duration_ms,
28
+ :execution_duration_ms,
29
+ :page_count,
30
+ :retry_count,
31
+ :run_id,
32
+ :started_at,
33
+ :status,
34
+ :trigger_type,
35
+ :workflow_id
36
+ )
37
+
38
+ def initialize(json)
39
+ super()
40
+ hash = self.class.normalize(json)
41
+ @completed_at = hash[:completed_at]
42
+ @created_at = hash[:created_at]
43
+ @credits = hash[:credits]
44
+ @duration_ms = hash[:duration_ms]
45
+ @execution_duration_ms = hash[:execution_duration_ms]
46
+ @page_count = hash[:page_count]
47
+ @retry_count = hash[:retry_count]
48
+ @run_id = hash[:run_id]
49
+ @started_at = hash[:started_at]
50
+ @status = hash[:status]
51
+ @trigger_type = hash[:trigger_type]
52
+ @workflow_id = hash[:workflow_id]
53
+ end
54
+ end
55
+ end