holivia 0.19.0 → 0.20.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: f48cd0cfc125dae15d0ee9bcbdde6ba33bc7776a10a51491c8e604f20ebe5559
4
- data.tar.gz: 751270d4fdc10546f597e4e3f42ee478a6d9bfbcdb07e72f5598f11eac6c3d74
3
+ metadata.gz: 268213a58b9c58ce6568a167df1055d76f293b335dbbcb77fc2051faad018eff
4
+ data.tar.gz: 36f77ef89a5f69cbdd0cf90f0320e20c6f8604a394b42cda5e1e070832d1b4e4
5
5
  SHA512:
6
- metadata.gz: 584bcae6722a7f2dcd078dd0730653df07f187234eeeebb3c3175efbcdc1fc7fabff2575327a9f42eb46eee915c733f2f1f246d91374f58b884b14612f4c27bc
7
- data.tar.gz: 1847411588f4980e0820491cf78debe0b32cf7dd0f6656de617c68de5789dab93bb34b07ac63db7b3d8cadb8be23b6526fd5e58c5431d40cd9b4d3d73e213c08
6
+ metadata.gz: ff0e46b0ea6ab9f940062e3f8e68b55076656610d1a237cbb8bcc09d0d6cc593a6e100405cbd760a8ed75e5aea270b33b0672b719d05833581e6bab0fae77161
7
+ data.tar.gz: 288b374e2b2bce9fd1b999d23f7319146aaee86df3bea8ccbad6ba586f9428d4a93d8cc24f033a369654c9f5d5c083fa365458c7fc21e9eb6f40a42616033472
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.20.0] - 2026-11-12
4
+
5
+ - Add `holivia employee create` and `holivia employee update <id>` with the backoffice employee form fields (`--first-name`, `--last-name`, `--enterprise-email`, `--gender`, `--birthdate`, `--language`, `--location`, `--department`, `--segment-3` to `--segment-5`, `--hr-manager`, `--active-until`, `--kickable`, `--demo-deactivable`, `--dashboard-ids`), plus piped JSON; create also takes `--enterprise-id`. Update is partial. Requires an employee manager role
6
+ - Add `holivia segment index`, `show <id>`, and `update <id>` (all with `--enterprise-id`) to list an enterprise's segments, rename one (`--name-fr`, `--name-en`), or protect it from syncs (`--protected-from-sync true|false`). Requires an enterprise manager role
7
+ - `holivia employee index` and `show` now return `segment_3` to `segment_5`
8
+ - Requires the matching Holivia backoffice API deployment
9
+
3
10
  ## [0.19.0] - 2026-11-11
4
11
 
5
12
  - Add `holivia selfcare text <id>` to print the plain text of a selfcare content's text format: slide titles and rich text, in reading order; returns 404 when the content has no text format
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, 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.
5
+ The `holivia` executable is primarily used to manage Holivia backoffice data from the terminal: environments, authentication, selfcare content, objectives, enterprises, employees, segments, 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
 
@@ -239,6 +239,20 @@ holivia employee index --enterprise-id 123 --query durand --left false
239
239
  holivia employee show 42
240
240
  ```
241
241
 
242
+ Create or update an employee (update keeps the fields you leave out):
243
+
244
+ ```bash
245
+ holivia employee create --enterprise-id 123 --enterprise-email ada@acme.fr --first-name Ada --last-name Lovelace
246
+ holivia employee update 42 --segment-5 Lyon
247
+ ```
248
+
249
+ List an enterprise's segments, rename one, or protect it from imports and directory syncs:
250
+
251
+ ```bash
252
+ holivia segment index --enterprise-id 123
253
+ holivia segment update 5 --enterprise-id 123 --name-fr Site --protected-from-sync true
254
+ ```
255
+
242
256
  Show and update an employee's HR access grants (omitted features are kept; `KEY=` clears one):
243
257
 
244
258
  ```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, HR access grants, contracts, credit consumption alerts, HR intervention catalog items, HR home highlights, crises, collective interventions, and appointment video diagnostics and history.
5
+ The CLI manages Holivia backoffice data: environments, authentication, selfcare contents, objectives, selfcare-objective associations, enterprises, employees, segments, 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
 
@@ -431,6 +431,31 @@ Show one employee:
431
431
  holivia employee show 42
432
432
  ```
433
433
 
434
+ Create or update an employee (requires an employee manager role). Update is partial: fields you leave out keep their value. Gender and birthdate are accepted but never returned. The enterprise cannot be changed here, and `hr_space_only` only in the backoffice:
435
+
436
+ ```bash
437
+ holivia employee create --enterprise-id 123 --enterprise-email ada@acme.fr --first-name Ada --last-name Lovelace \
438
+ --birthdate 1990-12-10 --language fr --segment-5 Lyon
439
+ holivia employee update 42 --segment-5 Lyon
440
+ echo '{"segment_5": null}' | holivia employee update 42
441
+ ```
442
+
443
+ Segments protected from syncs are written by these commands: a manual edit always wins over imports and directory syncs.
444
+
445
+ ## Segments
446
+
447
+ Requires an enterprise manager role. Each enterprise has one segment per type: `location`, `department`, `segment_3`, `segment_4`, `segment_5`, and `gender`.
448
+
449
+ List them with their names and protection, then rename one or protect it from syncs:
450
+
451
+ ```bash
452
+ holivia segment index --enterprise-id 123
453
+ holivia segment show 5 --enterprise-id 123
454
+ holivia segment update 5 --enterprise-id 123 --name-fr Site --name-en Site --protected-from-sync true
455
+ ```
456
+
457
+ When a segment is protected, file imports, directory syncs, and the Saint-Gobain sync keep the current value of employees already in the enterprise; new employees and employees moved in from another enterprise still get the synced value. `gender` cannot be protected.
458
+
434
459
  ## HR Access Grants
435
460
 
436
461
  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.
@@ -94,6 +94,30 @@ module Holivia
94
94
  List employees; never includes Holivia account data.
95
95
  Demo employees are excluded unless --demo is given
96
96
  holivia employee show <id> Show one employee with its enterprise
97
+ holivia employee create --enterprise-id ID --enterprise-email EMAIL [options]
98
+ Create an employee
99
+ holivia employee update <id> [options] Update an employee; omitted fields keep their value
100
+ Write options: --first-name NAME --last-name NAME --enterprise-email EMAIL --gender male|female
101
+ --birthdate YYYY-MM-DD --language fr|en --location VALUE --department VALUE --segment-3 VALUE
102
+ --segment-4 VALUE --segment-5 VALUE --hr-manager true|false --active-until YYYY-MM-DD
103
+ --kickable true|false --demo-deactivable true|false --dashboard-ids ID,ID (replaces the list).
104
+ Segments protected from syncs are written too. Gender and birthdate are never returned.
105
+ The enterprise cannot be changed on update, and hr_space_only only in the backoffice.
106
+ Piped JSON is merged after flags; stdin wins ({"segment_5": null} clears a field).
107
+ Create and update require employee_manager.
108
+
109
+ Segments:
110
+ holivia segment index --enterprise-id ID
111
+ List the enterprise's segment types (location, department,
112
+ segment_3 to segment_5, gender) with their names and protection
113
+ holivia segment show <id> --enterprise-id ID
114
+ Show one segment
115
+ holivia segment update <id> --enterprise-id ID [--name-fr NAME --name-en NAME
116
+ --protected-from-sync true|false]
117
+ Rename a segment or protect it from syncs: file imports,
118
+ directory syncs and the Saint-Gobain sync then keep the
119
+ value of existing employees. Gender cannot be protected
120
+ Piped JSON is merged after flags; stdin wins. Requires enterprise_manager.
97
121
 
98
122
  HR Access Grants:
99
123
  holivia hr-access-grant show <employee_id>
data/lib/holivia/cli.rb CHANGED
@@ -17,6 +17,7 @@ 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/segment"
20
21
  require_relative "commands/hr_access_grant"
21
22
  require_relative "commands/contract"
22
23
  require_relative "commands/credit_consumption_alert"
@@ -42,6 +43,7 @@ module Holivia
42
43
  when "highlight" then Commands::HrHomeHighlight.route(args)
43
44
  when "enterprise" then Commands::Enterprise.route(args)
44
45
  when "employee" then Commands::Employee.route(args)
46
+ when "segment" then Commands::Segment.route(args)
45
47
  when "hr-access-grant" then Commands::HrAccessGrant.route(args)
46
48
  when "contract" then Commands::Contract.route(args)
47
49
  when "credit-consumption-alert" then Commands::CreditConsumptionAlert.route(args)
@@ -9,12 +9,17 @@ module Holivia
9
9
  BOOLEAN_VALUES = %w[true false].freeze
10
10
  DEPENDENT_STATUSES = %w[creator dependent not_dependent].freeze
11
11
  DEMO_VALUES = %w[true false all].freeze
12
+ BOOLEANS = { "true" => true, "false" => false }.freeze
13
+ CREATE_BANNER = "Usage: holivia employee create --enterprise-id ID --enterprise-email EMAIL [options]"
14
+ UPDATE_BANNER = "Usage: holivia employee update <id> [options]"
12
15
 
13
16
  def self.route(args)
14
17
  subcommand = args.shift
15
18
  case subcommand
16
19
  when "index" then new.index(args)
17
20
  when "show" then new.show(args)
21
+ when "create" then new.create(args)
22
+ when "update" then new.update(args)
18
23
  else warn "Unknown employee command: #{subcommand}"
19
24
  exit 1
20
25
  end
@@ -43,6 +48,58 @@ module Holivia
43
48
 
44
49
  output(client.get("#{BASE_PATH}/#{id}"))
45
50
  end
51
+
52
+ def create(args = [])
53
+ options = parse_write_options(args, CREATE_BANNER, create: true)
54
+ abort "No options provided. Use --help for usage." if options.empty?
55
+
56
+ output(client.post(BASE_PATH, body: options))
57
+ end
58
+
59
+ def update(args = [])
60
+ id = args.shift
61
+ abort UPDATE_BANNER unless id
62
+
63
+ options = parse_write_options(args, UPDATE_BANNER)
64
+ abort "No options provided. Use --help for usage." if options.empty?
65
+
66
+ output(client.patch("#{BASE_PATH}/#{id}", body: options))
67
+ end
68
+
69
+ private
70
+
71
+ def parse_write_options(args, banner, create: false) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
72
+ options = {}
73
+ OptionParser.new do |opts|
74
+ opts.banner = banner
75
+ opts.on("--enterprise-id ID", Integer) { |v| options[:enterprise_id] = v } if create
76
+ opts.on("--first-name NAME") { |v| options[:first_name] = v }
77
+ opts.on("--last-name NAME") { |v| options[:last_name] = v }
78
+ opts.on("--enterprise-email EMAIL") { |v| options[:enterprise_email] = v }
79
+ opts.on("--gender GENDER", "male or female") { |v| options[:gender] = v }
80
+ opts.on("--birthdate DATE", "YYYY-MM-DD") { |v| options[:birthdate] = v }
81
+ opts.on("--language LANG", "fr or en") { |v| options[:language] = v }
82
+ opts.on("--location VALUE") { |v| options[:location] = v }
83
+ opts.on("--department VALUE") { |v| options[:department] = v }
84
+ opts.on("--segment-3 VALUE") { |v| options[:segment_3] = v }
85
+ opts.on("--segment-4 VALUE") { |v| options[:segment_4] = v }
86
+ opts.on("--segment-5 VALUE") { |v| options[:segment_5] = v }
87
+ opts.on("--hr-manager BOOL", BOOLEANS) { |v| options[:hr_manager] = v }
88
+ opts.on("--active-until DATE", "YYYY-MM-DD") { |v| options[:active_until] = v }
89
+ opts.on("--kickable BOOL", BOOLEANS) { |v| options[:kickable] = v }
90
+ opts.on("--demo-deactivable BOOL", BOOLEANS) { |v| options[:demo_deactivable] = v }
91
+ opts.on("--dashboard-ids IDS", Array, "Enterprise IDs, comma separated; replaces the list") do |v|
92
+ options[:dashboard_ids] = parse_ids(v)
93
+ end
94
+ end.parse!(args)
95
+ options.merge(piped_json)
96
+ end
97
+
98
+ def parse_ids(values)
99
+ values.map { |id| Integer(id) }
100
+ rescue ArgumentError
101
+ raise OptionParser::InvalidArgument, values.join(",")
102
+ end
46
103
  end
47
104
  end
48
105
  end
@@ -0,0 +1,81 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base"
4
+
5
+ module Holivia
6
+ module Commands
7
+ class Segment < Base
8
+ ENTERPRISES_PATH = "/api/v1/backoffice/enterprises"
9
+ BOOLEANS = { "true" => true, "false" => false }.freeze
10
+ UPDATE_BANNER = "Usage: holivia segment update <id> --enterprise-id ID " \
11
+ "[--name-fr NAME --name-en NAME --protected-from-sync true|false]"
12
+
13
+ def self.route(args)
14
+ subcommand = args.shift
15
+ case subcommand
16
+ when "index" then new.index(args)
17
+ when "show" then new.show(args)
18
+ when "update" then new.update(args)
19
+ else warn "Unknown segment command: #{subcommand}"
20
+ exit 1
21
+ end
22
+ end
23
+
24
+ def index(args = [])
25
+ enterprise_id = parse_enterprise_id(args, "Usage: holivia segment index --enterprise-id ID")
26
+
27
+ output(client.get(segments_path(enterprise_id)))
28
+ end
29
+
30
+ def show(args = [])
31
+ banner = "Usage: holivia segment show <id> --enterprise-id ID"
32
+ id = args.shift
33
+ abort banner unless id
34
+
35
+ output(client.get("#{segments_path(parse_enterprise_id(args, banner))}/#{id}"))
36
+ end
37
+
38
+ def update(args = [])
39
+ id = args.shift
40
+ abort UPDATE_BANNER unless id
41
+
42
+ enterprise_id, options = parse_update_options(args)
43
+ abort UPDATE_BANNER unless enterprise_id
44
+ options = options.merge(piped_json)
45
+ abort "No options provided. Use --help for usage." if options.empty?
46
+
47
+ output(client.patch("#{segments_path(enterprise_id)}/#{id}", body: options))
48
+ end
49
+
50
+ private
51
+
52
+ def parse_enterprise_id(args, banner)
53
+ enterprise_id = nil
54
+ OptionParser.new do |opts|
55
+ opts.banner = banner
56
+ opts.on("--enterprise-id ID", Integer) { |v| enterprise_id = v }
57
+ end.parse!(args)
58
+ abort banner unless enterprise_id
59
+
60
+ enterprise_id
61
+ end
62
+
63
+ def parse_update_options(args)
64
+ enterprise_id = nil
65
+ options = {}
66
+ OptionParser.new do |opts|
67
+ opts.banner = UPDATE_BANNER
68
+ opts.on("--enterprise-id ID", Integer) { |v| enterprise_id = v }
69
+ opts.on("--name-fr NAME") { |v| options[:name_fr] = v }
70
+ opts.on("--name-en NAME") { |v| options[:name_en] = v }
71
+ opts.on("--protected-from-sync BOOL", BOOLEANS) { |v| options[:protected_from_sync] = v }
72
+ end.parse!(args)
73
+ [enterprise_id, options]
74
+ end
75
+
76
+ def segments_path(enterprise_id)
77
+ "#{ENTERPRISES_PATH}/#{enterprise_id}/segments"
78
+ end
79
+ end
80
+ end
81
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Holivia
4
- VERSION = "0.19.0"
4
+ VERSION = "0.20.0"
5
5
  end
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.19.0
4
+ version: 0.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Holivia
@@ -78,6 +78,7 @@ files:
78
78
  - lib/holivia/commands/intervention_item.rb
79
79
  - lib/holivia/commands/item.rb
80
80
  - lib/holivia/commands/objective.rb
81
+ - lib/holivia/commands/segment.rb
81
82
  - lib/holivia/commands/selfcare.rb
82
83
  - lib/holivia/commands/selfcare_objective.rb
83
84
  - lib/holivia/commands/slide.rb