qube_rails 0.2.0 → 0.3.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.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +321 -0
  3. data/README.md +406 -76
  4. data/app/assets/javascripts/qube_rails/question.js +469 -43
  5. data/app/assets/stylesheets/qube_rails.css +1349 -912
  6. data/app/controllers/qube_rails/connections_controller.rb +42 -9
  7. data/app/controllers/qube_rails/questions_controller.rb +39 -7
  8. data/app/controllers/qube_rails/runs_controller.rb +4 -3
  9. data/app/controllers/qube_rails/storyboard_controller.rb +1 -1
  10. data/app/models/qube_rails/connection.rb +131 -9
  11. data/app/models/qube_rails/quickbooks_record.rb +22 -0
  12. data/app/models/qube_rails/run.rb +28 -10
  13. data/app/views/qube_rails/_error.html.erb +2 -2
  14. data/app/views/qube_rails/_manage_connection.html.erb +19 -0
  15. data/app/views/qube_rails/_question.html.erb +4 -1
  16. data/app/views/qube_rails/question/_choice.html.erb +34 -11
  17. data/app/views/qube_rails/question/_disclosure.html.erb +7 -0
  18. data/app/views/qube_rails/question/_exit_button.html.erb +8 -0
  19. data/app/views/qube_rails/question/_field.html.erb +4 -3
  20. data/app/views/qube_rails/question/_footer.html.erb +12 -4
  21. data/app/views/qube_rails/question/_inline_search.html.erb +12 -0
  22. data/app/views/qube_rails/question/_pick.html.erb +29 -6
  23. data/app/views/qube_rails/question/_picks.html.erb +2 -1
  24. data/app/views/qube_rails/question/_question.html.erb +31 -7
  25. data/app/views/qube_rails/question/_submit.html.erb +9 -0
  26. data/app/views/qube_rails/question/fields/_boolean.html.erb +2 -2
  27. data/app/views/qube_rails/question/fields/_number.html.erb +2 -2
  28. data/app/views/qube_rails/question/fields/_rows.html.erb +17 -4
  29. data/app/views/qube_rails/question/fields/_search.html.erb +6 -3
  30. data/app/views/qube_rails/question/fields/_select.html.erb +6 -5
  31. data/app/views/qube_rails/question/fields/_text.html.erb +2 -2
  32. data/app/views/qube_rails/question/rows/_segmented.html.erb +3 -1
  33. data/app/views/qube_rails/run_status/_detail.html.erb +5 -1
  34. data/app/views/qube_rails/run_status/_status.html.erb +5 -2
  35. data/app/views/qube_rails/storyboard/show.html.erb +4 -3
  36. data/config/locales/en.yml +30 -1
  37. data/config/routes.rb +2 -0
  38. data/db/migrate/20261031000000_add_qube_connection_type_and_run_headline.rb +12 -0
  39. data/db/migrate/20261124000000_add_qube_company_file_change.rb +17 -0
  40. data/lib/generators/qube_rails/templates/connection_events.rb.tt +17 -1
  41. data/lib/generators/qube_rails/templates/initializer.rb.tt +12 -4
  42. data/lib/qube_rails/configuration.rb +5 -2
  43. data/lib/qube_rails/connection_events.rb +70 -7
  44. data/lib/qube_rails/engine.rb +1 -0
  45. data/lib/qube_rails/link_check.rb +274 -0
  46. data/lib/qube_rails/operation.rb +116 -32
  47. data/lib/qube_rails/question_view.rb +293 -35
  48. data/lib/qube_rails/request.rb +2 -0
  49. data/lib/qube_rails/rows_view.rb +18 -5
  50. data/lib/qube_rails/run_status_view.rb +12 -7
  51. data/lib/qube_rails/storyboard/ask_about_add.json +9 -11
  52. data/lib/qube_rails/storyboard/choose.json +10 -7
  53. data/lib/qube_rails/storyboard/enum_select.json +5 -4
  54. data/lib/qube_rails/storyboard/missing_record.json +11 -14
  55. data/lib/qube_rails/storyboard/name_clash.json +51 -21
  56. data/lib/qube_rails/storyboard/near_match.json +18 -15
  57. data/lib/qube_rails/storyboard/number_boolean.json +5 -4
  58. data/lib/qube_rails/storyboard/record_search.json +15 -16
  59. data/lib/qube_rails/storyboard/refusal.json +15 -18
  60. data/lib/qube_rails/storyboard/rows.json +45 -31
  61. data/lib/qube_rails/storyboard.rb +28 -7
  62. data/lib/qube_rails/sync_status.rb +16 -3
  63. data/lib/qube_rails/version.rb +1 -1
  64. data/lib/qube_rails/view_helpers.rb +4 -2
  65. data/lib/qube_rails.rb +11 -2
  66. metadata +10 -2
@@ -1,6 +1,6 @@
1
1
  {
2
- "title": "A pick from a list",
3
- "note": "resolve_transaction's ask: an option whose field has choose becomes one choice per item (use:1, use:2, ...), each with its detail; the server fills the field.",
2
+ "title": "More than one match",
3
+ "note": "More than one invoice could be the one your app meant. Your user picks one, says none of these is it, or cancels.",
4
4
  "prompt": {
5
5
  "id": "resolve_transaction / ask",
6
6
  "kind": "decision",
@@ -15,35 +15,38 @@
15
15
  "value": "1042"
16
16
  }
17
17
  ],
18
- "options": [],
19
18
  "choices": [
20
19
  {
21
20
  "id": "use:1",
22
21
  "label": "1042",
23
22
  "description": null,
24
23
  "detail": "2026-10-20 · Riverbend Electric · 1250.00",
25
- "fields": []
24
+ "fields": [],
25
+ "role": "pick"
26
26
  },
27
27
  {
28
28
  "id": "use:2",
29
29
  "label": "1042-B",
30
30
  "description": null,
31
31
  "detail": "2026-10-21 · Riverbend Electric · 310.50",
32
- "fields": []
32
+ "fields": [],
33
+ "role": "pick"
33
34
  },
34
35
  {
35
36
  "id": "none",
36
37
  "label": "None of these",
37
38
  "description": null,
38
39
  "detail": null,
39
- "fields": []
40
+ "fields": [],
41
+ "role": "decline"
40
42
  },
41
43
  {
42
44
  "id": "cancel",
43
45
  "label": "Cancel",
44
46
  "description": null,
45
47
  "detail": null,
46
- "fields": []
48
+ "fields": [],
49
+ "role": "cancel"
47
50
  }
48
51
  ]
49
52
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "title": "A fixed list",
3
- "note": "A string field with an enum shows as a select, a blank first; the answer is the picked value. No shipped template asks one; a chart of your own can.",
3
+ "note": "A question can ask for one value from a fixed list, shown as a dropdown. No shipped workflow asks this yet. A custom workflow can.",
4
4
  "prompt": {
5
5
  "id": "route_order / ask_route",
6
6
  "kind": "decision",
@@ -13,7 +13,6 @@
13
13
  "value": "SO-2207"
14
14
  }
15
15
  ],
16
- "options": [],
17
16
  "choices": [
18
17
  {
19
18
  "id": "route",
@@ -41,14 +40,16 @@
41
40
  }
42
41
  ]
43
42
  }
44
- ]
43
+ ],
44
+ "role": "answer"
45
45
  },
46
46
  {
47
47
  "id": "cancel",
48
48
  "label": "Cancel",
49
49
  "description": null,
50
50
  "detail": null,
51
- "fields": []
51
+ "fields": [],
52
+ "role": "cancel"
52
53
  }
53
54
  ]
54
55
  },
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "title": "A missing customer",
3
- "note": "add_transaction's ask_missing with one record: the invoice names a customer QuickBooks doesn't have and the app sent no add for it, so the person says whether to create it or use one QuickBooks has. Create it needs nothing more for a customer; Use an existing one shows the search.",
3
+ "note": "The invoice names a customer QuickBooks doesn't have. Your user creates it, or searches QuickBooks for an existing one to use.",
4
4
  "prompt": {
5
5
  "id": "add_transaction / ask_missing",
6
6
  "kind": "decision",
7
7
  "token": "Mc7pR4tKw2NbY9xQ",
8
- "message": "Some records this transaction uses aren't in QuickBooks yet. For each one, create it or pick one QuickBooks already has.",
8
+ "message": "This invoice names records QuickBooks doesn't have. Create each one, or use one it has.",
9
9
  "data": {
10
10
  "operation": "invoice",
11
11
  "missing": [
@@ -33,10 +33,6 @@
33
33
  ]
34
34
  },
35
35
  "details": [
36
- {
37
- "label": "Adding",
38
- "value": "Invoice"
39
- },
40
36
  {
41
37
  "label": "Number",
42
38
  "value": "1042"
@@ -46,24 +42,24 @@
46
42
  "value": "Lone Star Supply"
47
43
  }
48
44
  ],
49
- "options": [],
50
45
  "choices": [
51
46
  {
52
47
  "id": "proceed",
53
- "label": "Add the transaction",
48
+ "label": "Add the invoice",
54
49
  "description": null,
55
50
  "detail": null,
56
51
  "fields": [
57
52
  {
58
53
  "name": "records",
59
54
  "type": "rows",
60
- "label": "Not in QuickBooks yet",
55
+ "label": "",
61
56
  "required": true,
62
57
  "columns": [
63
58
  {
64
59
  "name": "action",
65
60
  "type": "string",
66
61
  "label": "What to do",
62
+ "default": "create",
67
63
  "required": true,
68
64
  "kind": null,
69
65
  "enum": [
@@ -81,7 +77,7 @@
81
77
  {
82
78
  "name": "list_id",
83
79
  "type": "record",
84
- "label": "Existing record",
80
+ "label": "Which one",
85
81
  "required": true,
86
82
  "kind": null,
87
83
  "enum": null,
@@ -108,14 +104,15 @@
108
104
  }
109
105
  ]
110
106
  }
111
- ]
107
+ ],
108
+ "role": "answer"
112
109
  },
113
110
  {
114
111
  "id": "cancel",
115
- "label": "Cancel",
116
- "description": "Stop here. Nothing is created.",
112
+ "label": "Cancel adding the invoice",
117
113
  "detail": null,
118
- "fields": []
114
+ "fields": [],
115
+ "role": "cancel"
119
116
  }
120
117
  ]
121
118
  },
@@ -1,41 +1,70 @@
1
1
  {
2
2
  "title": "A name clash",
3
- "note": "ensure's ask_use: the name is already in QuickBooks. Use that record, add this one under another name, or cancel.",
3
+ "note": "QuickBooks already has this name, and it treats names that differ only in case as the same. Your user uses the existing record or adds theirs under another name.",
4
4
  "prompt": {
5
5
  "id": "ensure / ask_use",
6
6
  "kind": "decision",
7
7
  "token": "Wg5qU7vAs3PhB5dD",
8
- "message": "\"Riverbend Electric\" is already in QuickBooks. Use that record, add this one under another name, or cancel.",
8
+ "message": "QuickBooks already has the customer “Riverbend Electric”.",
9
9
  "data": {
10
10
  "kind": "customer",
11
11
  "name": "Riverbend Electric",
12
12
  "existing": {
13
+ "list_id": "80000012-1709391240",
14
+ "time_created": "2024-03-02T09:14:00-06:00",
15
+ "time_modified": "2026-10-28T16:02:11-05:00",
16
+ "edit_sequence": "1761685331",
17
+ "name": "RIVERBEND ELECTRIC",
18
+ "full_name": "RIVERBEND ELECTRIC",
19
+ "is_active": true,
20
+ "company_name": "Riverbend Electric LLC",
21
+ "bill_address": {
22
+ "addr1": "Riverbend Electric LLC",
23
+ "addr2": "2201 E Cesar Chavez St",
24
+ "city": "Austin",
25
+ "state": "TX",
26
+ "postal_code": "78702"
27
+ },
28
+ "phone": "512-555-0142",
29
+ "email": "ap@riverbend.example",
30
+ "balance": 1250.0,
31
+ "total_balance": 1250.0,
13
32
  "list": "customer"
14
33
  }
15
34
  },
16
- "details": [
17
- {
18
- "label": "Customer",
19
- "value": "Riverbend Electric"
20
- },
21
- {
22
- "label": "Held by",
23
- "value": "Customer"
24
- }
25
- ],
26
- "options": [],
35
+ "details": [],
27
36
  "choices": [
28
37
  {
29
38
  "id": "use_existing",
30
39
  "label": "Use the existing record",
31
- "description": "Carry on with the record QuickBooks already has. Nothing new is created.",
32
- "detail": null,
33
- "fields": []
40
+ "title": "RIVERBEND ELECTRIC",
41
+ "action": "Use existing",
42
+ "description": null,
43
+ "detail": "ap@riverbend.example · 512-555-0142 · Austin · Company Riverbend Electric LLC · Balance 1,250.00 · Added Mar 2, 2024",
44
+ "lines": [
45
+ "ap@riverbend.example · 512-555-0142 · Austin"
46
+ ],
47
+ "facts": [
48
+ {
49
+ "label": "Company",
50
+ "value": "Riverbend Electric LLC"
51
+ },
52
+ {
53
+ "label": "Balance",
54
+ "value": "1,250.00"
55
+ },
56
+ {
57
+ "label": "Added",
58
+ "value": "Mar 2, 2024"
59
+ }
60
+ ],
61
+ "fields": [],
62
+ "role": "answer"
34
63
  },
35
64
  {
36
65
  "id": "rename",
37
66
  "label": "Add it under another name",
38
- "description": "Try the add again under a name you choose.",
67
+ "description": "Try the add again with a different name.",
39
68
  "detail": null,
40
69
  "fields": [
41
70
  {
@@ -44,14 +73,15 @@
44
73
  "label": "New name",
45
74
  "required": true
46
75
  }
47
- ]
76
+ ],
77
+ "role": "answer"
48
78
  },
49
79
  {
50
80
  "id": "cancel",
51
- "label": "Cancel",
52
- "description": "Stop here. Nothing is created.",
81
+ "label": "Cancel adding the invoice",
53
82
  "detail": null,
54
- "fields": []
83
+ "fields": [],
84
+ "role": "cancel"
55
85
  }
56
86
  ]
57
87
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "title": "A near match",
3
- "note": "resolve's ask: QuickBooks has no record with exactly that name. The similar ones are choices (detail says why), then a search for another one, none of these, or cancel. With an add from the caller, \"None of these\" says the record is added as new (adds: true); without one it reads just \"None of these\".",
3
+ "note": "QuickBooks has no customer with exactly this name, but it has similar ones. Your user uses one of them, adds the customer as new, or searches QuickBooks for another.",
4
4
  "prompt": {
5
5
  "choices": [
6
6
  {
@@ -8,7 +8,8 @@
8
8
  "detail": "similar name · ap@riverbend.example · 512-555-0142",
9
9
  "fields": [],
10
10
  "id": "use:1",
11
- "label": "Riverbend Electric"
11
+ "label": "Riverbend Electric",
12
+ "role": "pick"
12
13
  },
13
14
  {
14
15
  "description": null,
@@ -16,43 +17,45 @@
16
17
  "fields": [
17
18
  {
18
19
  "kind": "customer",
19
- "label": "Search for a different one",
20
+ "label": "Not listed? Search QuickBooks",
20
21
  "name": "list_id",
21
22
  "required": true,
22
23
  "type": "record"
23
24
  }
24
25
  ],
25
26
  "id": "use",
26
- "label": "Use this one"
27
+ "label": "Use this one",
28
+ "role": "search"
27
29
  },
28
30
  {
29
31
  "description": null,
30
- "detail": null,
32
+ "detail": "new customer in QuickBooks",
31
33
  "fields": [],
32
34
  "id": "none",
33
- "label": "None of these: add \"Riverbend\" as new"
35
+ "label": "It's not in QuickBooks: add \"Riverbend\" as new",
36
+ "role": "decline",
37
+ "title": "Riverbend",
38
+ "action": "Add as new",
39
+ "lines": [
40
+ "new customer in QuickBooks"
41
+ ]
34
42
  },
35
43
  {
36
44
  "description": null,
37
45
  "detail": null,
38
46
  "fields": [],
39
47
  "id": "cancel",
40
- "label": "Cancel"
48
+ "label": "Cancel adding the invoice",
49
+ "role": "cancel"
41
50
  }
42
51
  ],
43
52
  "data": {
44
53
  "name": "Riverbend"
45
54
  },
46
- "details": [
47
- {
48
- "label": "Customer",
49
- "value": "Riverbend"
50
- }
51
- ],
55
+ "details": [],
52
56
  "id": "resolve / ask",
53
57
  "kind": "decision",
54
- "message": "No record has exactly that name. Pick the one you meant, say none of these is it, or cancel.",
55
- "options": [],
58
+ "message": "QuickBooks has no customer named exactly “Riverbend”.",
56
59
  "token": "Vq3kT9xRb2LmW8sZ"
57
60
  },
58
61
  "search": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "title": "Number and yes/no fields",
3
- "note": "A number field posts what was typed and is sent as a number; a boolean is a checkbox, sent as true or false. No shipped template asks these; a chart of your own can.",
3
+ "note": "A question can ask for a number or a yes/no, shown as a number box and a checkbox. No shipped workflow asks these yet. A custom workflow can.",
4
4
  "prompt": {
5
5
  "id": "adjust / ask_quantity",
6
6
  "kind": "decision",
@@ -19,7 +19,6 @@
19
19
  "value": "3"
20
20
  }
21
21
  ],
22
- "options": [],
23
22
  "choices": [
24
23
  {
25
24
  "id": "adjust",
@@ -39,14 +38,16 @@
39
38
  "label": "Allow a negative quantity on hand",
40
39
  "required": false
41
40
  }
42
- ]
41
+ ],
42
+ "role": "answer"
43
43
  },
44
44
  {
45
45
  "id": "cancel",
46
46
  "label": "Cancel",
47
47
  "description": null,
48
48
  "detail": null,
49
- "fields": []
49
+ "fields": [],
50
+ "role": "cancel"
50
51
  }
51
52
  ]
52
53
  },
@@ -1,43 +1,40 @@
1
1
  {
2
- "title": "A pick from the records there are",
3
- "note": "resolve's ask_pick: nothing has that name and nothing may be created for it (an account here), so the person picks one: the first active records as rows, then a search over every record of the kind. The search box asks your app's search route and fills a hidden input with the pick's ListID.",
2
+ "title": "A missing account",
3
+ "note": "QuickBooks has no account with this name. Your user picks one of the accounts listed or searches QuickBooks for another.",
4
4
  "prompt": {
5
5
  "id": "resolve / ask_pick",
6
6
  "kind": "decision",
7
7
  "token": "Sb4kQ2rTn8LmV1xZ",
8
- "message": "QuickBooks has nothing named \"Consulting Income\". Pick the one to use instead, or cancel.",
8
+ "message": "QuickBooks has no account named “Consulting Income”.",
9
9
  "data": {
10
10
  "name": "Consulting Income",
11
11
  "kind": "account"
12
12
  },
13
- "details": [
14
- {
15
- "label": "Account",
16
- "value": "Consulting Income"
17
- }
18
- ],
19
- "options": [],
13
+ "details": [],
20
14
  "choices": [
21
15
  {
22
16
  "id": "use:1",
23
17
  "label": "Sales",
24
18
  "description": null,
25
19
  "detail": null,
26
- "fields": []
20
+ "fields": [],
21
+ "role": "pick"
27
22
  },
28
23
  {
29
24
  "id": "use:2",
30
25
  "label": "Sales:Signs",
31
26
  "description": null,
32
27
  "detail": null,
33
- "fields": []
28
+ "fields": [],
29
+ "role": "pick"
34
30
  },
35
31
  {
36
32
  "id": "use:3",
37
33
  "label": "Service Income",
38
34
  "description": null,
39
35
  "detail": null,
40
- "fields": []
36
+ "fields": [],
37
+ "role": "pick"
41
38
  },
42
39
  {
43
40
  "id": "use",
@@ -52,14 +49,16 @@
52
49
  "label": "Search for the one to use",
53
50
  "required": true
54
51
  }
55
- ]
52
+ ],
53
+ "role": "search"
56
54
  },
57
55
  {
58
56
  "id": "cancel",
59
- "label": "Cancel",
57
+ "label": "Cancel adding the invoice",
60
58
  "description": null,
61
59
  "detail": null,
62
- "fields": []
60
+ "fields": [],
61
+ "role": "cancel"
63
62
  }
64
63
  ]
65
64
  },
@@ -1,12 +1,18 @@
1
1
  {
2
2
  "title": "An answer QuBe Sync refused (422)",
3
- "note": "The question again, with why QuBe Sync couldn't take the answer (its errors.detail), from flash[:qube_rails_error].",
4
- "error": "That answer couldn't be used: a new name is required.",
3
+ "note": "QuBe Sync couldn't take the answer, here a new name QuickBooks already has. The question comes back saying why, with what your user typed still in place.",
4
+ "error": "That answer couldn't be used: a new name can't be one QuickBooks already has.",
5
+ "refused": {
6
+ "choice": "rename",
7
+ "values": {
8
+ "name": "Riverbend Electric"
9
+ }
10
+ },
5
11
  "prompt": {
6
12
  "id": "ensure / ask_rename",
7
13
  "kind": "decision",
8
14
  "token": "Zk8tX1yDv6SmE8gG",
9
- "message": "\"Riverbend Electric\" already belongs to a record of another list (Vendor), and QuickBooks keeps names unique across customers, vendors, employees and other names, and across every type of item. Add this one under another name, or cancel.",
15
+ "message": "QuickBooks already has the vendor “Riverbend Electric”, so the customer can't have that name too.",
10
16
  "data": {
11
17
  "kind": "customer",
12
18
  "name": "Riverbend Electric",
@@ -14,17 +20,7 @@
14
20
  "list": "vendor"
15
21
  }
16
22
  },
17
- "details": [
18
- {
19
- "label": "Customer",
20
- "value": "Riverbend Electric"
21
- },
22
- {
23
- "label": "Held by",
24
- "value": "Vendor"
25
- }
26
- ],
27
- "options": [],
23
+ "details": [],
28
24
  "choices": [
29
25
  {
30
26
  "id": "rename",
@@ -38,14 +34,15 @@
38
34
  "label": "New name",
39
35
  "required": true
40
36
  }
41
- ]
37
+ ],
38
+ "role": "answer"
42
39
  },
43
40
  {
44
41
  "id": "cancel",
45
- "label": "Cancel",
46
- "description": "Stop here. Nothing is created.",
42
+ "label": "Cancel adding the invoice",
47
43
  "detail": null,
48
- "fields": []
44
+ "fields": [],
45
+ "role": "cancel"
49
46
  }
50
47
  ]
51
48
  },