holivia 0.14.0 → 0.18.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 +4 -4
- data/CHANGELOG.md +30 -0
- data/README.md +41 -1
- data/SKILL.md +84 -2
- data/lib/holivia/cli/help.rb +34 -1
- data/lib/holivia/cli.rb +4 -0
- data/lib/holivia/commands/appointment.rb +15 -0
- data/lib/holivia/commands/credit_consumption_alert.rb +90 -0
- data/lib/holivia/commands/hr_access_grant.rb +69 -0
- data/lib/holivia/commands/selfcare.rb +30 -3
- data/lib/holivia/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 271aaa000a9c26152473b0b6cb693a8897ceca2da7ca2fd53a1e8a3beb6335a2
|
|
4
|
+
data.tar.gz: 69220c288809bceb7a8ed8c8873b1fbb57831d11049a371a18cd8c5d84626ae9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3c682d5f11d12ca60ea9c07337a3587f3426859497c9af2c11eabe3b663124c5437a5e0f2d000b804c4d6d556d9c4d4bb7c0ed40f942382a66e1a8e9b0e7265a
|
|
7
|
+
data.tar.gz: 79ce0864fe511c0e75fb47f07e511376e0d35e99b412b248a103753eb21bb22b1bfb5a124a328fde5f92550a177b14bc1dab64788ad1a0a82543d108e3d25156
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.18.0] - 2026-11-03
|
|
4
|
+
|
|
5
|
+
- Add `holivia credit-consumption-alert index` with `--enterprise-id`, `--page`, and `--per-page`, listing alerts with their `employees_count` and `consumption`
|
|
6
|
+
- Add `holivia credit-consumption-alert show <id>` with the followed `employee_ids`
|
|
7
|
+
- Add `holivia credit-consumption-alert create` with `--enterprise-id`, `--name`, `--starts-on`, `--ends-on`, `--threshold`, repeatable `--recipient-email`, and employee IDs from repeatable `--employee-ids ID,ID` or `--employee-ids-file PATH` (one per line or comma separated), plus piped JSON
|
|
8
|
+
- Add `holivia credit-consumption-alert delete <id>`
|
|
9
|
+
- Requires an enterprise manager role
|
|
10
|
+
- Requires the matching Holivia backoffice API deployment
|
|
11
|
+
|
|
12
|
+
## [0.17.0] - 2026-11-02
|
|
13
|
+
|
|
14
|
+
- Add `holivia hr-access-grant show <employee_id>` to print an employee's `hr_manager` and `hr_space_only` flags and HR access grants, with each resource's type, id, and label
|
|
15
|
+
- Add `holivia hr-access-grant update <employee_id>` with repeatable `--feature KEY=ID,ID` flags (each listed feature gets exactly those resource IDs, `KEY=` clears one, omitted features keep their grants), `--hr-manager true|false`, and piped JSON
|
|
16
|
+
- `hr_space_only` cannot be changed through the CLI, and demo employees cannot be updated
|
|
17
|
+
- Requires an enterprise manager or dev role
|
|
18
|
+
- Requires the matching Holivia backoffice API deployment
|
|
19
|
+
|
|
20
|
+
## [0.16.0] - 2026-10-30
|
|
21
|
+
|
|
22
|
+
- Add `holivia appointment logs <id>` with `--page` and `--per-page` for an appointment's history (bookings, reschedules, cancellations, payments), newest first: log type, raw data, the backoffice title and content, and the author
|
|
23
|
+
- Requires an appointment viewer or limited appointment viewer role
|
|
24
|
+
- Requires the matching Holivia backoffice API deployment
|
|
25
|
+
|
|
26
|
+
## [0.15.0] - 2026-10-29
|
|
27
|
+
|
|
28
|
+
- Add `--query`, `--locale`, `--state`, `--content-type`, `--page`, and `--per-page` to `holivia selfcare index`; it previously ignored its arguments and only returned the first page
|
|
29
|
+
- Add `--all` to `holivia selfcare index` to fetch every page of matching contents and print one JSON array
|
|
30
|
+
- `holivia selfcare index` lists each content's `topic_slugs`, `tag_codes`, and `format_types`; `holivia selfcare show` adds `tag_codes` and `format_types`
|
|
31
|
+
- Requires the matching Holivia backoffice API deployment for the new fields
|
|
32
|
+
|
|
3
33
|
## [0.14.0] - 2026-10-23
|
|
4
34
|
|
|
5
35
|
- Add `holivia enterprise show <id>` for enterprise details: settings, headquarter, CSM, countries, employees count, and the current contract summary for contract viewers and managers
|
data/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Ruby client and command-line interface for the Holivia API.
|
|
4
4
|
|
|
5
|
-
The `holivia` executable is primarily used to manage Holivia backoffice data from the terminal: environments, authentication, selfcare content, objectives, enterprises, employees, contracts, communication library items, HR intervention catalog items, HR home highlights, crises, collective interventions, and appointment diagnostics.
|
|
5
|
+
The `holivia` executable is primarily used to manage Holivia backoffice data from the terminal: environments, authentication, selfcare content, objectives, enterprises, employees, HR access grants, contracts, credit consumption alerts, communication library items, HR intervention catalog items, HR home highlights, crises, collective interventions, and appointment diagnostics and history.
|
|
6
6
|
|
|
7
7
|
Coding agents can use [`SKILL.md`](SKILL.md) as a downloadable usage guide for operating this CLI safely.
|
|
8
8
|
|
|
@@ -115,6 +115,21 @@ List selfcare contents:
|
|
|
115
115
|
holivia selfcare index
|
|
116
116
|
```
|
|
117
117
|
|
|
118
|
+
Search and filter contents (`--query` matches titles, descriptions, goals, and tag names; at most 100 per page):
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
holivia selfcare index --query "communication non violente" --locale fr --state published
|
|
122
|
+
holivia selfcare index --content-type exercise --page 2 --per-page 100
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Fetch every matching content as one JSON array (`--all` ignores `--page` and `--per-page`):
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
holivia selfcare index --all --locale fr --state published
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Each listed content includes its `topic_slugs`, `tag_codes`, and `format_types`; `selfcare show` adds `tag_codes` and `format_types` next to its full `topics`.
|
|
132
|
+
|
|
118
133
|
Show one selfcare content:
|
|
119
134
|
|
|
120
135
|
```bash
|
|
@@ -180,6 +195,13 @@ Show video diagnostics for an appointment:
|
|
|
180
195
|
holivia appointment video-diagnostics 42
|
|
181
196
|
```
|
|
182
197
|
|
|
198
|
+
Show an appointment's history (bookings, reschedules, cancellations, payments), newest first:
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
holivia appointment logs 42
|
|
202
|
+
holivia appointment logs 42 --page 2 --per-page 50
|
|
203
|
+
```
|
|
204
|
+
|
|
183
205
|
Find an enterprise id:
|
|
184
206
|
|
|
185
207
|
```bash
|
|
@@ -205,6 +227,13 @@ holivia employee index --enterprise-id 123 --query durand --left false
|
|
|
205
227
|
holivia employee show 42
|
|
206
228
|
```
|
|
207
229
|
|
|
230
|
+
Show and update an employee's HR access grants (omitted features are kept; `KEY=` clears one):
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
holivia hr-access-grant show 42
|
|
234
|
+
holivia hr-access-grant update 42 --feature crisis_management=3,4 --hr-manager true
|
|
235
|
+
```
|
|
236
|
+
|
|
208
237
|
List and inspect contracts of an enterprise:
|
|
209
238
|
|
|
210
239
|
```bash
|
|
@@ -212,6 +241,17 @@ holivia contract index --enterprise-id 123 --status active
|
|
|
212
241
|
holivia contract show 7
|
|
213
242
|
```
|
|
214
243
|
|
|
244
|
+
Follow the credits consumed by a fixed group of employees, and email recipients once when they reach a threshold:
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
holivia credit-consumption-alert create --enterprise-id 99 --name "Pavillon du Lac" \
|
|
248
|
+
--starts-on 2027-06-01 --ends-on 2028-06-01 --threshold 15 \
|
|
249
|
+
--recipient-email oceane@holivia.fr --employee-ids-file ids.txt
|
|
250
|
+
holivia credit-consumption-alert index --enterprise-id 99
|
|
251
|
+
holivia credit-consumption-alert show 5
|
|
252
|
+
holivia credit-consumption-alert delete 5
|
|
253
|
+
```
|
|
254
|
+
|
|
215
255
|
List crises for an enterprise:
|
|
216
256
|
|
|
217
257
|
```bash
|
data/SKILL.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Use this skill when you need to operate the Holivia API through the `holivia` command-line tool.
|
|
4
4
|
|
|
5
|
-
The CLI manages Holivia backoffice data: environments, authentication, selfcare contents, objectives, selfcare-objective associations, enterprises, employees, contracts, HR intervention catalog items, HR home highlights, crises, collective interventions, and appointment video diagnostics.
|
|
5
|
+
The CLI manages Holivia backoffice data: environments, authentication, selfcare contents, objectives, selfcare-objective associations, enterprises, employees, HR access grants, contracts, credit consumption alerts, HR intervention catalog items, HR home highlights, crises, collective interventions, and appointment video diagnostics and history.
|
|
6
6
|
|
|
7
7
|
## Preconditions
|
|
8
8
|
|
|
@@ -20,7 +20,7 @@ Use `holivia` in examples below. If working from a checkout before installation,
|
|
|
20
20
|
- Before creating or updating content, run `holivia selfcare schema` and use its returned enum values and permitted item params as the source of truth.
|
|
21
21
|
- Before creating or updating intervention catalog items, run `holivia intervention schema` and use its returned enum values and locales as the source of truth.
|
|
22
22
|
- Before creating or updating HR home highlights, run `holivia highlight schema` and use its returned enum values and locales as the source of truth.
|
|
23
|
-
- For destructive actions such as `holivia env remove`, `holivia selfcare objective delete`, `holivia crisis delete`, or `holivia collective-intervention delete`, confirm the target environment and ID first unless the user explicitly requested that exact action.
|
|
23
|
+
- For destructive actions such as `holivia env remove`, `holivia selfcare objective delete`, `holivia crisis delete`, `holivia credit-consumption-alert delete`, or `holivia collective-intervention delete`, confirm the target environment and ID first unless the user explicitly requested that exact action.
|
|
24
24
|
- Employee data is personal data. Query only the employees a task needs, do not copy employee lists into unrelated output, and never try to infer whether an employee has a Holivia account.
|
|
25
25
|
- Treat all command output as JSON except informational commands such as `holivia env`, `holivia env list`, `holivia login`, `holivia logout`, `holivia version`, and `holivia --help`.
|
|
26
26
|
|
|
@@ -157,6 +157,21 @@ List contents:
|
|
|
157
157
|
holivia selfcare index
|
|
158
158
|
```
|
|
159
159
|
|
|
160
|
+
Search and filter contents (`--query` matches titles, descriptions, goals, and tag names; at most 100 per page):
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
holivia selfcare index --query "communication non violente" --locale fr --state published
|
|
164
|
+
holivia selfcare index --content-type exercise --page 2 --per-page 100
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Fetch every matching content as one JSON array (`--all` ignores `--page` and `--per-page`):
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
holivia selfcare index --all --locale fr --state published
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Each listed content includes its `topic_slugs`, `tag_codes`, and `format_types`; `selfcare show` adds `tag_codes` and `format_types` next to its full `topics`.
|
|
174
|
+
|
|
160
175
|
Show one content:
|
|
161
176
|
|
|
162
177
|
```bash
|
|
@@ -404,6 +419,27 @@ Show one employee:
|
|
|
404
419
|
holivia employee show 42
|
|
405
420
|
```
|
|
406
421
|
|
|
422
|
+
## HR Access Grants
|
|
423
|
+
|
|
424
|
+
Requires an enterprise manager role or `dev`. Grants decide which HR space features an employee can use, and for which resource: a data scope for `usage`, a segment for `segment_summary`, an enterprise for every other feature.
|
|
425
|
+
|
|
426
|
+
Show an employee's `hr_manager` and `hr_space_only` flags and their grants, with each resource's type, id, and label:
|
|
427
|
+
|
|
428
|
+
```bash
|
|
429
|
+
holivia hr-access-grant show 42
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
Update grants. Each `--feature KEY=ID,ID` gets exactly those resource IDs; features you leave out keep their current grants, and `KEY=` clears a feature. Run `hr-access-grant show` first and pass back the IDs you want to keep:
|
|
433
|
+
|
|
434
|
+
```bash
|
|
435
|
+
holivia hr-access-grant update 42 --feature crisis_management=3,4 --feature employees_list= --hr-manager true
|
|
436
|
+
echo '{"features": {"usage": [12]}}' | holivia hr-access-grant update 42
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
Piped JSON is merged after flags, and stdin wins on duplicate keys: a stdin `features` object replaces every `--feature` flag.
|
|
440
|
+
|
|
441
|
+
The API answers 422 with details and changes nothing when a feature key is unknown, a resource ID is outside the employee's enterprise group, or the employee is a demo employee. `hr_space_only` cannot be changed through the CLI; ask for it to be changed in the backoffice.
|
|
442
|
+
|
|
407
443
|
## Contracts
|
|
408
444
|
|
|
409
445
|
Requires a contract viewer or manager role.
|
|
@@ -428,6 +464,43 @@ Show every setting of one contract, including notes:
|
|
|
428
464
|
holivia contract show 7
|
|
429
465
|
```
|
|
430
466
|
|
|
467
|
+
## Credit Consumption Alerts
|
|
468
|
+
|
|
469
|
+
Requires an enterprise manager role. An alert follows a fixed list of employees of one enterprise and counts the enterprise credits they consume from `starts_on` (and until `ends_on` when given). Once the consumption reaches `threshold`, recipients get one email and `triggered_at` is set. Employees stay followed after they leave or their details change.
|
|
470
|
+
|
|
471
|
+
List alerts, most recent first, with `employees_count` and `consumption`:
|
|
472
|
+
|
|
473
|
+
```bash
|
|
474
|
+
holivia credit-consumption-alert index --enterprise-id 99
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
Show one alert with its followed `employee_ids`:
|
|
478
|
+
|
|
479
|
+
```bash
|
|
480
|
+
holivia credit-consumption-alert show 5
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
Create an alert. Employee IDs are the backoffice employee IDs (`holivia employee index --enterprise-id 99`); pass them with repeatable `--employee-ids 12,13` or with `--employee-ids-file` (one ID per line, or comma separated). `--recipient-email` is repeatable:
|
|
484
|
+
|
|
485
|
+
```bash
|
|
486
|
+
holivia credit-consumption-alert create \
|
|
487
|
+
--enterprise-id 99 \
|
|
488
|
+
--name "Pavillon du Lac" \
|
|
489
|
+
--starts-on 2027-06-01 \
|
|
490
|
+
--ends-on 2028-06-01 \
|
|
491
|
+
--threshold 15 \
|
|
492
|
+
--recipient-email oceane@holivia.fr \
|
|
493
|
+
--employee-ids-file ids.txt
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
Piped JSON is merged after flags, and stdin wins on duplicate keys. The API answers 422 and creates nothing when an ID is not an employee of the enterprise (the unknown IDs are listed), when no employee ID is given, or when a field is invalid.
|
|
497
|
+
|
|
498
|
+
Delete an alert (its employees are kept):
|
|
499
|
+
|
|
500
|
+
```bash
|
|
501
|
+
holivia credit-consumption-alert delete 5
|
|
502
|
+
```
|
|
503
|
+
|
|
431
504
|
## Crises
|
|
432
505
|
|
|
433
506
|
List crises:
|
|
@@ -691,6 +764,15 @@ Show video diagnostics for an appointment:
|
|
|
691
764
|
holivia appointment video-diagnostics 42
|
|
692
765
|
```
|
|
693
766
|
|
|
767
|
+
Show an appointment's history, newest first:
|
|
768
|
+
|
|
769
|
+
```bash
|
|
770
|
+
holivia appointment logs 42
|
|
771
|
+
holivia appointment logs 42 --page 2 --per-page 50
|
|
772
|
+
```
|
|
773
|
+
|
|
774
|
+
Each log has `log_type` (`appointment_booked`, `appointment_rescheduled`, `appointment_rescheduled_last_minute`, `appointment_canceled`, `appointment_payed`, `unconfirmed_appointment_booked`), `created_at` (UTC), raw `data` (UTC `logged_start_time`/`previous_start_time`, durations in minutes, `patient_credits` after the operation), the French `title` and `content` shown in the backoffice (dates in your time zone), and `user` (`type`, `id`, `name`) for who triggered it, or `null`. `title` and `content` are `null` for log types the backoffice cannot render. Logs contain patient names; treat them as personal data. Requires an appointment viewer or limited appointment viewer role.
|
|
775
|
+
|
|
694
776
|
## Errors
|
|
695
777
|
|
|
696
778
|
- `401` means authentication failed or credentials could not be refreshed. Re-run `holivia login` for the active environment.
|
data/lib/holivia/cli/help.rb
CHANGED
|
@@ -22,7 +22,9 @@ module Holivia
|
|
|
22
22
|
Tokens are stored at ~/.holivia/credentials.<env>.json and refreshed automatically on 401.
|
|
23
23
|
|
|
24
24
|
Selfcare Contents:
|
|
25
|
-
holivia selfcare index
|
|
25
|
+
holivia selfcare index [options] List selfcare contents
|
|
26
|
+
(--query TEXT --locale LOCALE --state STATE
|
|
27
|
+
--content-type TYPE --page N --per-page N --all)
|
|
26
28
|
holivia selfcare show <id> Show a selfcare content by id
|
|
27
29
|
holivia selfcare create [options] Create a selfcare content
|
|
28
30
|
(--state draft|ongoing_translation|translation_to_be_reviewed|
|
|
@@ -91,11 +93,40 @@ module Holivia
|
|
|
91
93
|
Demo employees are excluded unless --demo is given
|
|
92
94
|
holivia employee show <id> Show one employee with its enterprise
|
|
93
95
|
|
|
96
|
+
HR Access Grants:
|
|
97
|
+
holivia hr-access-grant show <employee_id>
|
|
98
|
+
Show an employee's hr_manager and hr_space_only flags
|
|
99
|
+
and HR feature grants with their resources
|
|
100
|
+
holivia hr-access-grant update <employee_id> [--feature KEY=ID,ID ... --hr-manager true|false]
|
|
101
|
+
Grant exactly the given resource IDs for each listed feature;
|
|
102
|
+
omitted features keep their grants and KEY= clears one
|
|
103
|
+
Features: usage (data scope IDs), segment_summary (segment IDs), employees_list,
|
|
104
|
+
crisis_management, intervention_catalog, intervention_tracking, communication_library
|
|
105
|
+
(enterprise IDs). IDs outside the employee's enterprise group are rejected (422).
|
|
106
|
+
hr_space_only can only be changed in the backoffice. Demo employees cannot be updated.
|
|
107
|
+
Piped JSON ({"features": {...}, "hr_manager": true}) is merged after flags; stdin wins.
|
|
108
|
+
Requires enterprise_manager or dev.
|
|
109
|
+
|
|
94
110
|
Contracts:
|
|
95
111
|
holivia contract index [--enterprise-id ID --status active|expiring_soon|low_remaining --page N --per-page N]
|
|
96
112
|
List contracts, most recent first
|
|
97
113
|
holivia contract show <id> Show every setting of one contract with its enterprise
|
|
98
114
|
|
|
115
|
+
Credit Consumption Alerts:
|
|
116
|
+
holivia credit-consumption-alert index [--enterprise-id ID --page N --per-page N]
|
|
117
|
+
List alerts, most recent first, with consumption
|
|
118
|
+
holivia credit-consumption-alert show <id>
|
|
119
|
+
Show one alert with its followed employee IDs
|
|
120
|
+
holivia credit-consumption-alert create --enterprise-id ID --name NAME --starts-on YYYY-MM-DD
|
|
121
|
+
[--ends-on YYYY-MM-DD] --threshold N --recipient-email EMAIL ...
|
|
122
|
+
(--employee-ids ID,ID ... | --employee-ids-file PATH)
|
|
123
|
+
Follow these employees of the enterprise; an email is sent
|
|
124
|
+
once when their consumed credits reach the threshold
|
|
125
|
+
holivia credit-consumption-alert delete <id>
|
|
126
|
+
Delete an alert (employees are kept)
|
|
127
|
+
IDs that are not employees of the enterprise are rejected (422).
|
|
128
|
+
Piped JSON is merged after flags; stdin wins. Requires enterprise_manager.
|
|
129
|
+
|
|
99
130
|
Communication Items:
|
|
100
131
|
holivia communication index [--page N --per-page N --query TEXT --locale LOCALE --document-type TYPE]
|
|
101
132
|
List communication library items
|
|
@@ -163,6 +194,8 @@ module Holivia
|
|
|
163
194
|
|
|
164
195
|
Appointments:
|
|
165
196
|
holivia appointment video-diagnostics <id> Show video diagnostics for an appointment
|
|
197
|
+
holivia appointment logs <id> [--page N --per-page N]
|
|
198
|
+
Show an appointment's history, newest first
|
|
166
199
|
|
|
167
200
|
Selfcare Content Objectives:
|
|
168
201
|
holivia selfcare objective index [--page N --per-page N --selfcare-content-id ID --objective-id ID]
|
data/lib/holivia/cli.rb
CHANGED
|
@@ -17,7 +17,9 @@ require_relative "commands/intervention_item"
|
|
|
17
17
|
require_relative "commands/hr_home_highlight"
|
|
18
18
|
require_relative "commands/enterprise"
|
|
19
19
|
require_relative "commands/employee"
|
|
20
|
+
require_relative "commands/hr_access_grant"
|
|
20
21
|
require_relative "commands/contract"
|
|
22
|
+
require_relative "commands/credit_consumption_alert"
|
|
21
23
|
require_relative "commands/crisis"
|
|
22
24
|
require_relative "commands/collective_intervention"
|
|
23
25
|
require_relative "commands/support_phone_number"
|
|
@@ -40,7 +42,9 @@ module Holivia
|
|
|
40
42
|
when "highlight" then Commands::HrHomeHighlight.route(args)
|
|
41
43
|
when "enterprise" then Commands::Enterprise.route(args)
|
|
42
44
|
when "employee" then Commands::Employee.route(args)
|
|
45
|
+
when "hr-access-grant" then Commands::HrAccessGrant.route(args)
|
|
43
46
|
when "contract" then Commands::Contract.route(args)
|
|
47
|
+
when "credit-consumption-alert" then Commands::CreditConsumptionAlert.route(args)
|
|
44
48
|
when "crisis" then Commands::Crisis.route(args)
|
|
45
49
|
when "collective-intervention", "collective_intervention", "collective" then Commands::CollectiveIntervention.route(args)
|
|
46
50
|
when "support-phone-numbers" then Commands::SupportPhoneNumber.route(args)
|
|
@@ -11,6 +11,7 @@ module Holivia
|
|
|
11
11
|
subcommand = args.shift
|
|
12
12
|
case subcommand
|
|
13
13
|
when "video-diagnostics" then new.video_diagnostics(args)
|
|
14
|
+
when "logs" then new.logs(args)
|
|
14
15
|
else warn "Unknown appointment command: #{subcommand}"
|
|
15
16
|
exit 1
|
|
16
17
|
end
|
|
@@ -22,6 +23,20 @@ module Holivia
|
|
|
22
23
|
|
|
23
24
|
output(client.get("#{BASE_PATH}/#{id}/video_diagnostics"))
|
|
24
25
|
end
|
|
26
|
+
|
|
27
|
+
def logs(args = [])
|
|
28
|
+
id = args.shift
|
|
29
|
+
abort "Usage: holivia appointment logs <id> [--page N --per-page N]" unless id
|
|
30
|
+
|
|
31
|
+
params = {}
|
|
32
|
+
OptionParser.new do |opts|
|
|
33
|
+
opts.banner = "Usage: holivia appointment logs <id> [options]"
|
|
34
|
+
opts.on("--page N", Integer) { |v| params[:page] = v }
|
|
35
|
+
opts.on("--per-page N", Integer) { |v| params[:per_page] = v }
|
|
36
|
+
end.parse!(args)
|
|
37
|
+
|
|
38
|
+
output(client.get("#{BASE_PATH}/#{id}/logs", params: params))
|
|
39
|
+
end
|
|
25
40
|
end
|
|
26
41
|
end
|
|
27
42
|
end
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "base"
|
|
4
|
+
|
|
5
|
+
module Holivia
|
|
6
|
+
module Commands
|
|
7
|
+
class CreditConsumptionAlert < Base
|
|
8
|
+
BASE_PATH = "/api/v1/backoffice/credit_consumption_alerts"
|
|
9
|
+
CREATE_BANNER = "Usage: holivia credit-consumption-alert create --enterprise-id ID --name NAME " \
|
|
10
|
+
"--starts-on YYYY-MM-DD [--ends-on YYYY-MM-DD] --threshold N --recipient-email EMAIL " \
|
|
11
|
+
"(--employee-ids ID,ID | --employee-ids-file PATH)"
|
|
12
|
+
EMPLOYEE_IDS_SEPARATOR = /[\s,]+/
|
|
13
|
+
|
|
14
|
+
def self.route(args)
|
|
15
|
+
subcommand = args.shift
|
|
16
|
+
case subcommand
|
|
17
|
+
when "index" then new.index(args)
|
|
18
|
+
when "show" then new.show(args)
|
|
19
|
+
when "create" then new.create(args)
|
|
20
|
+
when "delete" then new.delete(args)
|
|
21
|
+
else warn "Unknown credit-consumption-alert command: #{subcommand}"
|
|
22
|
+
exit 1
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def index(args = [])
|
|
27
|
+
params = {}
|
|
28
|
+
OptionParser.new do |opts|
|
|
29
|
+
opts.banner = "Usage: holivia credit-consumption-alert index [options]"
|
|
30
|
+
opts.on("--enterprise-id ID", Integer) { |v| params[:enterprise_id] = v }
|
|
31
|
+
opts.on("--page N", Integer) { |v| params[:page] = v }
|
|
32
|
+
opts.on("--per-page N", Integer) { |v| params[:per_page] = v }
|
|
33
|
+
end.parse!(args)
|
|
34
|
+
|
|
35
|
+
output(client.get(BASE_PATH, params: params))
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def show(args = [])
|
|
39
|
+
id = args.shift
|
|
40
|
+
abort "Usage: holivia credit-consumption-alert show <id>" unless id
|
|
41
|
+
|
|
42
|
+
output(client.get("#{BASE_PATH}/#{id}"))
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def create(args = [])
|
|
46
|
+
options = parse_create_options(args).merge(piped_json)
|
|
47
|
+
abort "No options provided. Use --help for usage." if options.empty?
|
|
48
|
+
|
|
49
|
+
output(client.post(BASE_PATH, body: options))
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def delete(args = [])
|
|
53
|
+
id = args.shift
|
|
54
|
+
abort "Usage: holivia credit-consumption-alert delete <id>" unless id
|
|
55
|
+
|
|
56
|
+
client.delete("#{BASE_PATH}/#{id}")
|
|
57
|
+
output(deleted: true, id: id.to_i)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
private
|
|
61
|
+
|
|
62
|
+
def parse_create_options(args) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
|
63
|
+
options = {}
|
|
64
|
+
OptionParser.new do |opts|
|
|
65
|
+
opts.banner = CREATE_BANNER
|
|
66
|
+
opts.on("--enterprise-id ID", Integer) { |v| options[:enterprise_id] = v }
|
|
67
|
+
opts.on("--name NAME") { |v| options[:name] = v }
|
|
68
|
+
opts.on("--starts-on DATE") { |v| options[:starts_on] = v }
|
|
69
|
+
opts.on("--ends-on DATE") { |v| options[:ends_on] = v }
|
|
70
|
+
opts.on("--threshold N", Integer) { |v| options[:threshold] = v }
|
|
71
|
+
opts.on("--recipient-email EMAIL", "Repeatable") { |v| (options[:recipient_emails] ||= []) << v }
|
|
72
|
+
opts.on("--employee-ids IDS", "Comma separated employee IDs; repeatable") do |v|
|
|
73
|
+
(options[:employee_ids] ||= []).concat(parse_employee_ids(v))
|
|
74
|
+
end
|
|
75
|
+
opts.on("--employee-ids-file PATH", "One employee ID per line, or comma separated") do |v|
|
|
76
|
+
(options[:employee_ids] ||= []).concat(parse_employee_ids(File.read(v)))
|
|
77
|
+
end
|
|
78
|
+
end.parse!(args)
|
|
79
|
+
options[:employee_ids]&.uniq!
|
|
80
|
+
options
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def parse_employee_ids(value)
|
|
84
|
+
value.split(EMPLOYEE_IDS_SEPARATOR).reject(&:empty?).map { |id| Integer(id, 10) }
|
|
85
|
+
rescue ArgumentError
|
|
86
|
+
raise OptionParser::InvalidArgument, value.strip
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "base"
|
|
4
|
+
|
|
5
|
+
module Holivia
|
|
6
|
+
module Commands
|
|
7
|
+
class HrAccessGrant < Base
|
|
8
|
+
EMPLOYEES_PATH = "/api/v1/backoffice/employees"
|
|
9
|
+
UPDATE_BANNER = "Usage: holivia hr-access-grant update <employee_id> [--feature KEY=ID,ID ...] " \
|
|
10
|
+
"[--hr-manager true|false]"
|
|
11
|
+
BOOLEANS = { "true" => true, "false" => false }.freeze
|
|
12
|
+
|
|
13
|
+
def self.route(args)
|
|
14
|
+
subcommand = args.shift
|
|
15
|
+
case subcommand
|
|
16
|
+
when "show" then new.show(args)
|
|
17
|
+
when "update" then new.update(args)
|
|
18
|
+
else warn "Unknown hr-access-grant command: #{subcommand}"
|
|
19
|
+
exit 1
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def show(args = [])
|
|
24
|
+
employee_id = args.shift
|
|
25
|
+
abort "Usage: holivia hr-access-grant show <employee_id>" unless employee_id
|
|
26
|
+
|
|
27
|
+
output(client.get(grants_path(employee_id)))
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def update(args = [])
|
|
31
|
+
employee_id = args.shift
|
|
32
|
+
abort UPDATE_BANNER unless employee_id
|
|
33
|
+
|
|
34
|
+
options = parse_update_options(args).merge(piped_json)
|
|
35
|
+
abort "No options provided. Use --help for usage." if options.empty?
|
|
36
|
+
|
|
37
|
+
output(client.patch(grants_path(employee_id), body: options))
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
private
|
|
41
|
+
|
|
42
|
+
def parse_update_options(args)
|
|
43
|
+
options = {}
|
|
44
|
+
OptionParser.new do |opts|
|
|
45
|
+
opts.banner = UPDATE_BANNER
|
|
46
|
+
opts.on("--feature KEY=IDS", "Grant exactly these resource IDs for a feature; KEY= clears it") do |v|
|
|
47
|
+
key, ids = parse_feature(v)
|
|
48
|
+
(options[:features] ||= {})[key] = ids
|
|
49
|
+
end
|
|
50
|
+
opts.on("--hr-manager BOOL", BOOLEANS) { |v| options[:hr_manager] = v }
|
|
51
|
+
end.parse!(args)
|
|
52
|
+
options
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def parse_feature(value)
|
|
56
|
+
key, ids = value.split("=", 2)
|
|
57
|
+
raise OptionParser::InvalidArgument, value if key.to_s.empty? || ids.nil?
|
|
58
|
+
|
|
59
|
+
[key.to_sym, ids.split(",").map { |id| Integer(id) }]
|
|
60
|
+
rescue ArgumentError
|
|
61
|
+
raise OptionParser::InvalidArgument, value
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def grants_path(employee_id)
|
|
65
|
+
"#{EMPLOYEES_PATH}/#{employee_id}/hr_access_grants"
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
@@ -5,8 +5,9 @@ require_relative "selfcare_objective"
|
|
|
5
5
|
|
|
6
6
|
module Holivia
|
|
7
7
|
module Commands
|
|
8
|
-
class Selfcare < Base
|
|
8
|
+
class Selfcare < Base # rubocop:disable Metrics/ClassLength
|
|
9
9
|
BASE_PATH = "/api/v1/backoffice/selfcare_contents"
|
|
10
|
+
MAX_PER_PAGE = 100
|
|
10
11
|
COMPOSE_EXAMPLE_PATH = Holivia.root.join("examples", "compose.json").to_s
|
|
11
12
|
IMAGE_MIME_TYPES = {
|
|
12
13
|
".jpg" => "image/jpeg",
|
|
@@ -34,8 +35,21 @@ module Holivia
|
|
|
34
35
|
end
|
|
35
36
|
end
|
|
36
37
|
|
|
37
|
-
def index(
|
|
38
|
-
|
|
38
|
+
def index(args = []) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
|
39
|
+
params = {}
|
|
40
|
+
all = false
|
|
41
|
+
OptionParser.new do |opts|
|
|
42
|
+
opts.banner = "Usage: holivia selfcare index [options]"
|
|
43
|
+
opts.on("--query TEXT") { |v| params[:query] = v }
|
|
44
|
+
opts.on("--locale LOCALE") { |v| params[:locale] = v }
|
|
45
|
+
opts.on("--state STATE") { |v| params[:state] = v }
|
|
46
|
+
opts.on("--content-type TYPE") { |v| params[:content_type] = v }
|
|
47
|
+
opts.on("--page N", Integer) { |v| params[:page] = v }
|
|
48
|
+
opts.on("--per-page N", Integer) { |v| params[:per_page] = v }
|
|
49
|
+
opts.on("--all", "Fetch every page and print one JSON array (ignores --page and --per-page)") { all = true }
|
|
50
|
+
end.parse!(args)
|
|
51
|
+
|
|
52
|
+
output(all ? all_pages(params.except(:page, :per_page)) : client.get(BASE_PATH, params: params))
|
|
39
53
|
end
|
|
40
54
|
|
|
41
55
|
def show(args = [])
|
|
@@ -110,6 +124,19 @@ module Holivia
|
|
|
110
124
|
|
|
111
125
|
private
|
|
112
126
|
|
|
127
|
+
def all_pages(params)
|
|
128
|
+
contents = []
|
|
129
|
+
page = 1
|
|
130
|
+
loop do
|
|
131
|
+
response = client.get(BASE_PATH, params: params.merge(page: page, per_page: MAX_PER_PAGE))
|
|
132
|
+
contents.concat(response.fetch("selfcare_contents"))
|
|
133
|
+
break if page >= response.dig("meta", "total_pages").to_i
|
|
134
|
+
|
|
135
|
+
page += 1
|
|
136
|
+
end
|
|
137
|
+
contents
|
|
138
|
+
end
|
|
139
|
+
|
|
113
140
|
def build_body(options)
|
|
114
141
|
image_path = options.delete(:image)
|
|
115
142
|
return options unless image_path
|
data/lib/holivia/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: holivia
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.18.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Holivia
|
|
@@ -67,11 +67,13 @@ files:
|
|
|
67
67
|
- lib/holivia/commands/collective_intervention.rb
|
|
68
68
|
- lib/holivia/commands/communication_item.rb
|
|
69
69
|
- lib/holivia/commands/contract.rb
|
|
70
|
+
- lib/holivia/commands/credit_consumption_alert.rb
|
|
70
71
|
- lib/holivia/commands/crisis.rb
|
|
71
72
|
- lib/holivia/commands/employee.rb
|
|
72
73
|
- lib/holivia/commands/enterprise.rb
|
|
73
74
|
- lib/holivia/commands/env.rb
|
|
74
75
|
- lib/holivia/commands/format.rb
|
|
76
|
+
- lib/holivia/commands/hr_access_grant.rb
|
|
75
77
|
- lib/holivia/commands/hr_home_highlight.rb
|
|
76
78
|
- lib/holivia/commands/intervention_item.rb
|
|
77
79
|
- lib/holivia/commands/item.rb
|
|
@@ -109,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
109
111
|
- !ruby/object:Gem::Version
|
|
110
112
|
version: '0'
|
|
111
113
|
requirements: []
|
|
112
|
-
rubygems_version: 4.0.
|
|
114
|
+
rubygems_version: 4.0.23
|
|
113
115
|
specification_version: 4
|
|
114
116
|
summary: Ruby client and CLI for the Holivia API
|
|
115
117
|
test_files: []
|