riveter-sdk 1.0.1 → 1.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 867ffe82023d427f6584d46ad9d0e0e1799bbab22ac173a66eb542859d13fd7d
4
- data.tar.gz: 6906da4985f0795a6074d4b3891f02cb27ccd02009165a13e9a550bb962449a6
3
+ metadata.gz: c11eb2e15de73602df663800326a931a9300daf4ccc615a761e761e1ed776a71
4
+ data.tar.gz: '092c593d7aac42080efd1ea487822e36eae8218f2095f3cbb706950048fb011b'
5
5
  SHA512:
6
- metadata.gz: 2663f0f05a85eb76a748775bae906427513d103d259ff9bab9cb7a8661ad8237bfbb65e3ce35c1cf94a39215749decd733640a8e739423a1358890f88c889bad
7
- data.tar.gz: 45ef4e0f5b33e003ca0bc9916d0105f23d15a7fbd03280f5cd5ab84001884e86202673e48632f3e8100eee0e5fde2f8b58a8f17852aa7df0081f4c3c6375870d
6
+ metadata.gz: 60c2971793274fdaa1ed1ed545ac3c0ce389ece4f408eee7e79131b3d0d4f59d2988460a1f90e432cb7d48ad4bb440b909b40fec7f5873ce4d75c445d7dd8184
7
+ data.tar.gz: 586e72eb77cdf4fd1818cfa75285a02bf9df60ef8331f4fd0542baf1a636be79e92fbca855957cc9741e3b01148417ed6dcb15333a5e0940e4099870eb7ad4ae
@@ -120,6 +120,36 @@ module Riveter
120
120
  end
121
121
  end
122
122
 
123
+ # A row as compact: true answers it: the values alone. #cells is each output column's value
124
+ # (nil when the cell has none). Address the row by #position elsewhere.
125
+ class CompactDatasetRow < Model
126
+ field :position, :input, :cells
127
+ end
128
+
129
+ # One of a column's most common values (a string is cut at 200 characters) and its row count.
130
+ class DatasetColumnValueCount < Model
131
+ field :value, :count
132
+ end
133
+
134
+ # One column's counts over every row: #states (output columns only: cells by state, pending /
135
+ # stale / failed / not_found / ok / manual), #filled, #distinct_values, the most common #values.
136
+ class DatasetColumnSummary < Model
137
+ field :name, :kind, :states, :filled, :distinct_values
138
+
139
+ def values
140
+ (@raw["values"] || []).map { |item| DatasetColumnValueCount.new(item) }
141
+ end
142
+ end
143
+
144
+ # Per-column counts over every row of a dataset (Datasets#summary).
145
+ class DatasetSummary < Model
146
+ field :row_count
147
+
148
+ def columns
149
+ (@raw["columns"] || []).map { |item| DatasetColumnSummary.new(item) }
150
+ end
151
+ end
152
+
123
153
  # A run on a dataset as the dataset lists it; #type is dataset_build or enrichment.
124
154
  class DatasetRunSummary < Model
125
155
  field :id, :type, :status, :created_at, :finished_at
data/lib/riveter/page.rb CHANGED
@@ -41,18 +41,20 @@ module Riveter
41
41
  end
42
42
 
43
43
  # One page of dataset rows (cursor-paginated). #each iterates the page;
44
- # #auto_paging_each walks every following page too.
44
+ # #auto_paging_each walks every following page too. Rows are DatasetRow, or
45
+ # CompactDatasetRow for a compact: true read (row_class).
45
46
  class DatasetRowsPage
46
47
  include Enumerable
47
48
 
48
49
  attr_reader :rows, :next_cursor, :row_count
49
50
 
50
- def initialize(data, fetch_page)
51
+ def initialize(data, fetch_page, row_class: DatasetRow)
51
52
  data = data.is_a?(Hash) ? data : {}
52
- @rows = (data["rows"] || []).map { |item| DatasetRow.new(item) }
53
+ @rows = (data["rows"] || []).map { |item| row_class.new(item) }
53
54
  @next_cursor = data["next_cursor"]
54
55
  @row_count = data["row_count"]
55
56
  @fetch_page = fetch_page
57
+ @row_class = row_class
56
58
  end
57
59
 
58
60
  def each(&block)
@@ -66,7 +68,7 @@ module Riveter
66
68
  def next_page
67
69
  raise Error, "No next page" unless next_page?
68
70
 
69
- DatasetRowsPage.new(@fetch_page.call(next_cursor), @fetch_page)
71
+ DatasetRowsPage.new(@fetch_page.call(next_cursor), @fetch_page, row_class: @row_class)
70
72
  end
71
73
 
72
74
  def auto_paging_each(&block)
@@ -135,12 +135,28 @@ module Riveter
135
135
  end
136
136
 
137
137
  # A page of rows in position order (`limit:`, `cursor:`, `updated_since:`);
138
- # #auto_paging_each walks every following page. (operationId: listDatasetRows)
139
- def list_rows(dataset_id, **params)
138
+ # #auto_paging_each walks every following page. `columns:` (an Array of names) keeps only
139
+ # those columns; `compact: true` answers CompactDatasetRow (the values alone), so a
140
+ # 1,000-row page of one column is one small call. (operationId: listDatasetRows)
141
+ def list_rows(dataset_id, columns: nil, compact: false, **params)
142
+ query = params.merge(columns: columns && Array(columns).join(","), compact: compact ? "true" : nil)
140
143
  fetch_page = lambda do |cursor|
141
- @client.request(:get, "/datasets/#{dataset_id}/rows", query: params.merge(cursor: cursor))
144
+ @client.request(:get, "/datasets/#{dataset_id}/rows", query: query.merge(cursor: cursor))
142
145
  end
143
- DatasetRowsPage.new(fetch_page.call(params[:cursor]), fetch_page)
146
+ row_class = compact ? CompactDatasetRow : DatasetRow
147
+ DatasetRowsPage.new(fetch_page.call(params[:cursor]), fetch_page, row_class: row_class)
148
+ end
149
+
150
+ # Per-column counts over every row, no rows read: an output column's cells by state and its
151
+ # most common values; an input column's filled rows and values. `columns:` picks the columns,
152
+ # `top_values:` how many values per column (1–100, default 20). (operationId: getDatasetSummary)
153
+ def summary(dataset_id, columns: nil, top_values: nil)
154
+ DatasetSummary.new(
155
+ @client.request(
156
+ :get, "/datasets/#{dataset_id}/summary",
157
+ query: { columns: columns && Array(columns).join(","), top_values: top_values }
158
+ )
159
+ )
144
160
  end
145
161
 
146
162
  # Append rows (≤ 100 per call) keyed by input column name; duplicates on the index
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Riveter
4
- VERSION = "1.0.1"
4
+ VERSION = "1.1.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riveter-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Riveter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-10-27 00:00:00.000000000 Z
11
+ date: 2026-10-30 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Client for the Riveter API — enrich data, build datasets, scrape pages,
14
14
  and run web searches. https://docs.riveterhq.com