Skip to content

feat: v0.18.1 — examples: diagramming, reporting, and CRM exports#27

Merged
scarver2 merged 5 commits into
masterfrom
0.18.1
Apr 5, 2026
Merged

feat: v0.18.1 — examples: diagramming, reporting, and CRM exports#27
scarver2 merged 5 commits into
masterfrom
0.18.1

Conversation

@scarver2
Copy link
Copy Markdown
Owner

@scarver2 scarver2 commented Apr 5, 2026

Summary

Standalone runnable examples — no new gem dependencies added to the library itself.

examples/diagramming/workflow_diagram.rb

  • Fetches client.statuses.all and renders the shop's workflow in 4 formats
  • :ascii — zero-dependency terminal output
  • :mermaid — GitHub-renderable flowchart (paste between ```mermaid fences)
  • :dot — Graphviz DOT source written to workflow.dot; pipe to dot -Tsvg for any format
  • :svg — written via dot CLI (brew install graphviz) or ruby-graphviz gem; both optional, both skip gracefully
  • Hex status colors from Printavo with automatic black/white text contrast

examples/reporting/sales_report.rb

  • Pages all invoices via client.invoices.all_pages, filters by period in Ruby
  • Periods: today, this week, this month, this quarter, YTD, last year, custom range (REPORT_START / REPORT_END)
  • Metrics: gross revenue, amount paid, outstanding, paid-in-full count, average, largest, YTD breakdown by status

examples/reporting/sales_tax_report.rb

  • Approach 1 — invoice-level estimate using TAX_RATE env var (fast, no extra API calls)
  • Approach 2 — fee-level detail fetching taxable: true fees per invoice; MemoryStore cache wired in

examples/reporting/customers_export.rb — 11 formats

File Format
customers.csv Universal CSV (stdlib)
customers.vcf vCard 3.0 — any CRM, email client, or phone
customers_hubspot.csv HubSpot Contacts import
customers_salesforce.csv Salesforce Leads/Contacts import
customers_mailchimp.csv Mailchimp audience import
customers_constantcontact.csv Constant Contact contact import
customers_beehiiv.csv Beehiiv subscriber import (with UTM tagging)
customers_brevo.csv Brevo (Sendinblue) attribute-named import
customers_activecampaign.csv ActiveCampaign import (auto-tags printavo-customer)
customers.xlsx Excel workbook — gem install caxlsx
customers.xls Legacy Excel 97–2003 — gem install spreadsheet

Optional gem exports skip gracefully with a gem install hint.

examples/reporting/outstanding_tasks.rb

  • Terminal report: overdue (bold red), due today (yellow), this week (cyan), upcoming (green), no due date
  • By-assignee summary with overdue count highlighted
  • HTML calendar (tasks_calendar.html) — self-contained, no CDN, printable
    • Monthly grid (Mon–Sun), up to 3 months per row
    • Color-coded task chips with hover tooltips (full body + assignee)
    • No-due-date tasks in a table below the calendars
    • Range: span of task due dates by default; override with CALENDAR_START / CALENDAR_END

docs/FUTURE.md

Workflow Diagram section replaced with examples-folder reference and rationale for keeping graphviz out of the gem.

Test plan

  • All example files have file-path prolog + # frozen_string_literal: true
  • .env.example in both example directories
  • docs/FUTURE.md and docs/TODO.md updated
  • Pre-push hook passes (Gemfile.lock version ✓, x86_64-linux platform ✓)
  • Smoke-test: cp .env.example .env && ruby examples/diagramming/workflow_diagram.rb
  • Smoke-test: ruby examples/reporting/customers_export.rb
  • Smoke-test: ruby examples/reporting/outstanding_tasks.rb && open tasks_calendar.html

🤖 Generated with Claude Code

scarver2 and others added 3 commits April 5, 2026 08:09
Add standalone runnable examples rather than baking diagram/reporting
logic into the gem itself — no new gem dependencies required.

examples/diagramming/workflow_diagram.rb:
  - Fetches statuses via client.statuses.all
  - Renders workflow as Mermaid (default), Graphviz DOT, ASCII, and SVG
  - SVG via dot CLI (brew install graphviz) or ruby-graphviz gem — both optional
  - Hex status colors + automatic text contrast for all renderers

examples/reporting/sales_report.rb:
  - Pages all invoices, filters by period in Ruby
  - Periods: today, this week, this month, this quarter, YTD, last year, custom range
  - Computes: gross revenue, amount paid, outstanding, paid-in-full count, average, largest

examples/reporting/sales_tax_report.rb:
  - Approach 1: invoice-level estimate using configurable TAX_RATE env var
  - Approach 2: fee-level detail — fetches fees per invoice, sums taxable: true amounts
  - MemoryStore cache wired in to protect the rate limit on fee fetches

docs/FUTURE.md: Workflow Diagram section replaced with examples reference + rationale
docs/TODO.md: v0.18.1 entry added

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
examples/reporting/customers_export.rb:
  - CSV (Ruby stdlib, no gem), XLSX (caxlsx), XLS (spreadsheet)
  - vCard 3.0 (.vcf) — imports into any CRM, email client, or phone
  - HubSpot CSV, Salesforce CSV, Mailchimp CSV
  - Optional gem exports gracefully skip with gem install hint if unavailable

examples/reporting/outstanding_tasks.rb:
  - Buckets: overdue, due today, due this week, upcoming, no due date
  - Sorted oldest-first for overdue, soonest-first for upcoming
  - ANSI color coding per urgency level
  - By-assignee summary with overdue count highlighted

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
customers_export.rb — four new CRM/email platform exporters:
  - Constant Contact CSV (contact import with note field)
  - Beehiiv CSV (subscriber import with UTM source tagging)
  - Brevo CSV (attribute-named columns: EMAIL, FIRSTNAME, LASTNAME, SMS, COMPANY, PRINTAVO_ID)
  - ActiveCampaign CSV (contact import with auto-tag 'printavo-customer')

outstanding_tasks.rb — HTML calendar export:
  - Self-contained HTML file (no external CDN), printable via @media print
  - Monthly grid layout, up to 3 months per row
  - Color-coded chips per urgency: red=overdue, amber=today, blue=this week, green=upcoming
  - Chip tooltips show full task body + assignee
  - No-due-date tasks in a table below the calendars
  - Range defaults to span of all task due dates; override with
    CALENDAR_START / CALENDAR_END env vars
  - Output path configurable via CALENDAR_FILE env var

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@scarver2 scarver2 changed the title feat: v0.18.1 — examples/diagramming and examples/reporting feat: v0.18.1 — examples: diagramming, reporting, and CRM exports Apr 5, 2026
scarver2 and others added 2 commits April 5, 2026 12:24
Style/FormatStringToken:
  - Replaced format('%-Ns %s', label, val) alignment calls with
    string interpolation + ljust/rjust throughout all example files
  - fmt_currency: replaced format('$%,.2f') with a manual comma-grouping
    helper (Ruby's %,f flag triggers Lint/FormatParameterMismatch in RuboCop)
  - fmt_pct: converted to annotated token format('%<rate>.4f%%', rate:)

Metrics/MethodLength:
  - workflow_diagram: extract dot_node_defs, configure_graphviz helpers
  - outstanding_tasks: extract month_header_html, day_chips_html, day_cell_html,
    legend_html, no_date_section_html, month_grids_html from render_month
    and build_html_calendar

Targeted rubocop:disable (intrinsically complex reporting/display methods):
  - build_report, print_report — Metrics/AbcSize (hash-heavy aggregation)
  - render_month — Metrics/AbcSize, Metrics/MethodLength (HTML grid builder)
  - to_vcard — Metrics/AbcSize (branchy vCard field construction)
  - build_html_calendar — Metrics/MethodLength (multi-section HTML template)

Naming/MethodParameterName: configure_graphviz(g) → (gviz)
Style/StringConcatenation: month_header_html converted to interpolation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
FUTURE.md now has a short cross-reference link.
VISUALIZATION.md expands the section with Quick Start, output file table,
DOT rendering commands, and Mermaid embedding instructions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@scarver2 scarver2 merged commit d638656 into master Apr 5, 2026
4 checks passed
@scarver2 scarver2 deleted the 0.18.1 branch April 5, 2026 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant