wiq-cli 0.1.0 → 0.2.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: cac3732fa4c286907bce03d6ac62765477d828507719a29074873a9f9b90bde2
4
- data.tar.gz: c686b4e1fb901e6554727c7030eb63d66cd70f659ca95345db2124b0ec6c9138
3
+ metadata.gz: b8732206776c88ba1c9d5630407e3a7a4ba6386e528cb5a7a36b2b7c8bcda3dc
4
+ data.tar.gz: 499116e3d7977c22e0f44759ea59406c49265e865def76300353de0052dbf5b0
5
5
  SHA512:
6
- metadata.gz: 970cfd866b44f27e8be608f8ddb40b147521bc241557637e545b21e23ec490d6e5a6ca8b6252b9f1c5f5a0ece7d1ad4a12f6457b80e1131c0beef691a5e65a3d
7
- data.tar.gz: 22e94b802d4b4209c32131919733b68937775515a0b089ce764c1496758b281562e5532b708258351bac66c78f2db138eaefa9b55987dcb68671112ef2272ca5
6
+ metadata.gz: 34f253c3bfcf4a7702348287da3a3e8c2458dbc818d20a73849e1b14574b9d7b38767113dd099ea065142d80e1415669813ca54199e9d61326452a6daf6f6b04
7
+ data.tar.gz: 80df40a51028efe1926961e2c556a8fab8a46d28757f28360ef12d258003fbdaea031ea2933690e07a33f7729f6e165cea4db33a5491722d44eaa8e7d323498e
@@ -246,6 +246,29 @@ file with the WIQ team.
246
246
 
247
247
  - `POST /api/v1/reports`
248
248
  - Body: `{ "report": { "type": "<ReportClass>", "version": "v1"|"vrow", "name": "...", "start_at": "YYYY-MM-DD", "end_at": "YYYY-MM-DD", "args": { ... } } }`
249
+ - **`version` — v1 vs vrow.** `:version` is in the controller permit
250
+ list (`reports_controller.rb#report_params`). Despite both being
251
+ accepted everywhere, version only changes output for three reports —
252
+ `RosterReport`, `UsawReport`, `PaidSessionAccountingReport` — which
253
+ branch in `generate_ver_result!` (`v1?` → structured JSON objects,
254
+ `vrow?` → row/CSV with a leading header row). All three implement
255
+ both; no report is v1-only. Every other report overrides
256
+ `generate_ver_result!` and emits rows regardless of version. vrow is
257
+ the de facto standard, so the CLI defaults to it (uniform row shape
258
+ across all reports) and exposes the legacy structured shape via
259
+ `wiq reports run … --v1`.
260
+ - **`RosterReport` "Added to roster at" lives only in vrow.** The vrow
261
+ path calls `get_wrestlers_and_roster(include_roster_memberships: true)`
262
+ (`report.rb`), which `.select`s
263
+ `roster_memberships.created_at as added_to_roster_at` and emits it as
264
+ the `"Added to roster at"` column. The v1 path renders wrestlers via
265
+ `_wrestler_profile.json.jbuilder`, which has no such field. The join
266
+ only happens for a specific roster (`roster_id > 0`); `roster_id: 0`
267
+ ("all wrestlers") takes the else branch and the value is nil — a
268
+ wrestler can be on multiple rosters, so the join date is per-roster.
269
+ The roster index/show jbuilder (`_roster.json.jbuilder`) exposes only
270
+ `stats.roster_memberships_count`, never per-membership timestamps, so
271
+ vrow RosterReport is the sole API path to this data.
249
272
  - Permitted `args` keys (`reports_controller.rb#report_params`):
250
273
  `paid_session_id, roster_id, fundraiser_id, online_store_id, event_id,
251
274
  include_archived_roster_tags, append_property_ids[]`.
@@ -36,8 +36,14 @@ module Wiq
36
36
  "--visibility private if admin) to surface intake data as " \
37
37
  "extra columns. Skip questions with a deleted_at — they're " \
38
38
  "still in the index payload but won't render. roster_id=0 " \
39
- "means \"all rosters\". Each appended question becomes a column.",
40
- example: "wiq reports run RosterReport --roster 42 --append-properties 17 23"
39
+ "means \"all rosters\". Each appended question becomes a column. " \
40
+ "The default row/CSV shape (web Download) carries the \"Added " \
41
+ "to roster at\" column (roster_memberships.created_at — when the " \
42
+ "wrestler landed on the roster, NOT their registration date), " \
43
+ "populated only for a specific --roster <id> (id > 0), not " \
44
+ "--roster 0. --v1 returns fuller per-wrestler objects but drops " \
45
+ "that column.",
46
+ example: "wiq reports run RosterReport --roster 42"
41
47
  },
42
48
  "FullExportWrestlerReport" => {
43
49
  args: %w[],
@@ -341,6 +347,24 @@ module Wiq
341
347
  cap, default 5-minute timeout. Pass --no-wait to return the
342
348
  report row immediately after submission (status=queued or
343
349
  processing) and poll later with `wiq reports show <id> --wait`.
350
+
351
+ Result shape (vrow default / --v1):
352
+ The CLI requests the row/CSV shape (version "vrow") by default —
353
+ `result.rows.objects` with the first row being the headers, the
354
+ exact layout behind the "Download" buttons in the WIQ web UI.
355
+ Most reports emit only this shape and ignore the version.
356
+
357
+ For RosterReport, vrow is the ONLY shape carrying the "Added to
358
+ roster at" column (roster_memberships.created_at — when a
359
+ wrestler landed on that roster, distinct from their registration
360
+ date). That column is populated only for a specific roster: pass
361
+ --roster <id> with id > 0, NOT --roster 0 ("all wrestlers"),
362
+ since a wrestler can sit on multiple rosters.
363
+
364
+ Pass --v1 for the legacy structured-JSON shape. Only
365
+ RosterReport, UsawReport, and PaidSessionAccountingReport differ
366
+ under it (fuller per-wrestler objects); for those reports v1
367
+ drops the "Added to roster at" column.
344
368
  DESC
345
369
  method_option :start, type: :string, desc: "YYYY-MM-DD"
346
370
  method_option :end, type: :string, desc: "YYYY-MM-DD"
@@ -358,6 +382,11 @@ module Wiq
358
382
  desc: "args.days_threshold (ChurnRiskReport)"
359
383
  method_option :name, type: :string, desc: "Display name (default: CLI <type> <range>)"
360
384
  method_option :season, type: :numeric, desc: "Resolve to paid_session_id via overlap with calendar year"
385
+ method_option :v1, type: :boolean, default: false,
386
+ desc: "Request the legacy v1 structured-JSON shape instead of the default " \
387
+ "row/CSV (vrow). Only RosterReport/UsawReport/PaidSessionAccountingReport " \
388
+ "differ; v1 returns fuller per-wrestler objects but drops RosterReport's " \
389
+ "\"Added to roster at\" column."
361
390
  method_option :wait, type: :boolean, default: true
362
391
  method_option :timeout, type: :numeric, default: 300
363
392
  map "run" => :run_report
@@ -367,7 +396,7 @@ module Wiq
367
396
  body = {
368
397
  report: {
369
398
  type: type,
370
- version: "v1",
399
+ version: report_version,
371
400
  name: options[:name] || default_name(type),
372
401
  start_at: options[:start],
373
402
  end_at: options[:end],
@@ -469,6 +498,18 @@ module Wiq
469
498
  end
470
499
 
471
500
  no_commands do
501
+ # The API recognizes two report versions: "vrow" (the row/CSV shape
502
+ # behind the web Download buttons) and "v1" (legacy structured JSON).
503
+ # Only RosterReport/UsawReport/PaidSessionAccountingReport branch on
504
+ # it; every other report emits rows regardless. vrow is the de facto
505
+ # standard and is the only shape carrying RosterReport's "Added to
506
+ # roster at" column, so the CLI defaults to it for a uniform surface.
507
+ # --v1 is an escape hatch to the fuller structured objects on those
508
+ # three reports.
509
+ def report_version
510
+ options[:v1] ? "v1" : "vrow"
511
+ end
512
+
472
513
  def build_args(type)
473
514
  if options[:season]
474
515
  resolver = Wiq::SeasonResolver.new(client)
data/lib/wiq/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Wiq
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
@@ -172,6 +172,11 @@ Key reports an agent should know by heart:
172
172
  within N days (7, 14, 30, 60, 90). Requires `--days-threshold`.
173
173
  - **`RosterReport`** — Roster snapshot with optional custom columns via
174
174
  `--append-properties <q_ids>`. Discover ids via `wiq registrations questions`.
175
+ The default (row/CSV) shape carries the **"Added to roster at"** column
176
+ (`roster_memberships.created_at` — when a wrestler landed on that roster,
177
+ NOT their registration date). Requires a specific `--roster <id>` (id > 0);
178
+ it's blank for `--roster 0`. `--v1` returns fuller per-wrestler objects but
179
+ drops that column.
175
180
  - **`LastPracticeAttendedReport`** — "Who hasn't been to practice in a
176
181
  while?"
177
182
  - **`PaidSessionAccountingReport`** (admin_only) — Line-item charges for
@@ -194,6 +199,18 @@ wiq reports run <Type> --start <date> --end <date> [args]
194
199
  processing → ready` (terminal) | `failed` (terminal). `result` is the
195
200
  type-specific jsonb payload.
196
201
 
202
+ **Result shape — vrow default (`--v1` escape hatch).** The CLI requests
203
+ the row/CSV shape (`version: "vrow"`) by default: `result.rows.objects`
204
+ with the first row being the header — identical to the web "Download"
205
+ buttons, and a uniform shape across every report type. Most reports emit
206
+ only this shape and ignore the version. Only `RosterReport`, `UsawReport`,
207
+ and `PaidSessionAccountingReport` also support a legacy v1 shape
208
+ (structured JSON objects) via `--v1`, which returns fuller per-wrestler
209
+ data but drops RosterReport's **"Added to roster at"** column. If a user
210
+ asks when a wrestler joined a roster (e.g. roster-join → first-practice
211
+ latency), `wiq reports run RosterReport --roster <id>` is the answer — the
212
+ join date is in the default output.
213
+
197
214
  ## Common gotchas
198
215
 
199
216
  - **`roster_id=0` = "all rosters"** in report args. UI convention; if
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wiq-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - WrestlingIQ
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-05-22 00:00:00.000000000 Z
11
+ date: 2026-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor