holivia 0.5.0 → 0.6.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: 83d3ab262bb3fc4381d4ca420e6186ef577ce8e40db802b0658209e2ea0599b5
4
- data.tar.gz: 36813fba6ea7c7cdb25d6b5cbfc97905226959e956fa02a146c9d60a54357898
3
+ metadata.gz: 88e7b483f29ede5b8d719e09e0e64014979b01fbe4f46e3476131d5f04cf6dd4
4
+ data.tar.gz: 51142c7c75c2917c065e7eb99b9c5162d3c08e435722acdf2f532bcc4b17d2e7
5
5
  SHA512:
6
- metadata.gz: 36d0c89c7d469290018d121ada800c8bf4da4fcc6af6918930c5907c283786b5aded11979050a0f6ef9fb19c127bdebb789e3b014eb09c842c568eb404421f05
7
- data.tar.gz: 8e9086a2a046deec0170ec502391c8cda726963933d8597159aa98ce498e21d88a0e6aebe059606ae07387cad8655be6f88449ed3035cee1d6a161dfff316044
6
+ metadata.gz: 2b35a23633a3f1fd43dd849297c49f2bf836d237575ccd797fdd63274743b06cabd66a8c082cb82b14992270cb1f5c1048c0fce32cd7f8c1c12032dca529ae9e
7
+ data.tar.gz: 4fd44133555a0453e2e21b4daad51d1ba5a7e5e42bfba0f8bce98f0b1c245af8bbcc0913a0e74964ed2c690506d12ad3fbee4a15138c52f7bcc2a5478c8aa446
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.6.0] - 2026-06-05
4
+
5
+ - Add `holivia appointment video-diagnostics <id>` for appointment video diagnostics
6
+
3
7
  ## [0.5.0] - 2026-05-06
4
8
 
5
9
  - Add `--state` flag on `selfcare create` and `selfcare update` for AASM-driven lifecycle transitions
data/README.md CHANGED
@@ -1,43 +1,229 @@
1
1
  # Holivia
2
2
 
3
- TODO: Delete this and the text below, and describe your gem
3
+ Ruby client and command-line interface for the Holivia API.
4
4
 
5
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/holivia`. To experiment with that code, run `bin/console` for an interactive prompt.
5
+ The `holivia` executable is primarily used to manage Holivia backoffice data from the terminal: environments, authentication, selfcare content, objectives, and appointment diagnostics.
6
+
7
+ Coding agents can use [`SKILL.md`](SKILL.md) as a downloadable usage guide for operating this CLI safely.
8
+
9
+ ## Requirements
10
+
11
+ - Ruby 3.1 or newer
12
+ - A Holivia account with API access
6
13
 
7
14
  ## Installation
8
15
 
9
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
16
+ Install the CLI from RubyGems:
17
+
18
+ ```bash
19
+ gem install holivia
20
+ ```
21
+
22
+ If you want to use the gem from a Ruby application, add it to your bundle:
23
+
24
+ ```bash
25
+ bundle add holivia
26
+ ```
27
+
28
+ After installation, verify the executable is available:
29
+
30
+ ```bash
31
+ holivia version
32
+ ```
33
+
34
+ ## Setup
35
+
36
+ The CLI stores environment configuration in `~/.holivia/config.yml`.
37
+
38
+ Show the current environment:
39
+
40
+ ```bash
41
+ holivia env
42
+ ```
43
+
44
+ Add an API environment:
45
+
46
+ ```bash
47
+ holivia env add staging --url https://staging.example.com
48
+ ```
49
+
50
+ Switch to an environment:
51
+
52
+ ```bash
53
+ holivia env use staging
54
+ ```
55
+
56
+ List configured environments:
57
+
58
+ ```bash
59
+ holivia env list
60
+ ```
61
+
62
+ Enable debug logging for the current environment when troubleshooting requests:
63
+
64
+ ```bash
65
+ holivia env debug --true
66
+ ```
67
+
68
+ Disable it again with:
69
+
70
+ ```bash
71
+ holivia env debug --false
72
+ ```
73
+
74
+ ## Authentication
75
+
76
+ Log in interactively:
77
+
78
+ ```bash
79
+ holivia login
80
+ ```
81
+
82
+ Or pass credentials directly:
83
+
84
+ ```bash
85
+ holivia login --email user@example.com --password secret
86
+ ```
87
+
88
+ Credentials are stored per environment in `~/.holivia/credentials.<env>.json`. Access tokens are sent as bearer tokens, and the CLI automatically refreshes credentials after a `401` response when a refresh token is available.
89
+
90
+ Log out and remove stored credentials for the current environment:
91
+
92
+ ```bash
93
+ holivia logout
94
+ ```
95
+
96
+ ## Basic Usage
97
+
98
+ Show all available commands:
99
+
100
+ ```bash
101
+ holivia --help
102
+ ```
103
+
104
+ Discover valid selfcare enum values and item parameters:
105
+
106
+ ```bash
107
+ holivia selfcare schema
108
+ ```
109
+
110
+ List selfcare contents:
111
+
112
+ ```bash
113
+ holivia selfcare index
114
+ ```
115
+
116
+ Show one selfcare content:
117
+
118
+ ```bash
119
+ holivia selfcare show 123
120
+ ```
121
+
122
+ Create a selfcare content from flags:
123
+
124
+ ```bash
125
+ holivia selfcare create \
126
+ --title "Breathing exercise" \
127
+ --locale fr \
128
+ --content-type exercise \
129
+ --duration 300 \
130
+ --state draft
131
+ ```
132
+
133
+ Create a full selfcare content tree from JSON:
134
+
135
+ ```bash
136
+ holivia selfcare compose --file examples/compose.json
137
+ ```
10
138
 
11
- Install the gem and add to the application's Gemfile by executing:
139
+ You can print a compose template with:
12
140
 
13
141
  ```bash
14
- bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
142
+ holivia selfcare compose --example
15
143
  ```
16
144
 
17
- If bundler is not being used to manage dependencies, install the gem by executing:
145
+ Create and update commands also accept JSON from standard input:
18
146
 
19
147
  ```bash
20
- gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
148
+ printf '{"title":"Breathing exercise","locale":"fr"}' | holivia selfcare create
21
149
  ```
22
150
 
23
- ## Usage
151
+ List objectives:
152
+
153
+ ```bash
154
+ holivia objective index
155
+ ```
24
156
 
25
- TODO: Write usage instructions here
157
+ Filter objectives by code:
158
+
159
+ ```bash
160
+ holivia objective index --code anxiety
161
+ ```
162
+
163
+ Show video diagnostics for an appointment:
164
+
165
+ ```bash
166
+ holivia appointment video-diagnostics 42
167
+ ```
168
+
169
+ ## Files And Uploads
170
+
171
+ Selfcare create and update commands can upload images with `--image <path>`.
172
+
173
+ ```bash
174
+ holivia selfcare update 123 --image cover.png
175
+ ```
176
+
177
+ Slide item create and update commands can upload audio with `--audio <path>`.
178
+
179
+ ```bash
180
+ holivia selfcare item create --slide-id 456 --item-type AudioItem --audio meditation.mp3
181
+ ```
182
+
183
+ Compose is JSON-only. To attach an image to a composed content tree, update the returned content id afterward with `holivia selfcare update <id> --image <path>`.
26
184
 
27
185
  ## Development
28
186
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
187
+ After checking out the repo, run:
188
+
189
+ ```bash
190
+ bin/setup
191
+ ```
192
+
193
+ Run the test suite with:
194
+
195
+ ```bash
196
+ rake spec
197
+ ```
198
+
199
+ Open an interactive console with:
200
+
201
+ ```bash
202
+ bin/console
203
+ ```
204
+
205
+ Install this gem onto your local machine with:
206
+
207
+ ```bash
208
+ bundle exec rake install
209
+ ```
210
+
211
+ To release a new version, update the version number in `lib/holivia/version.rb`, then run:
212
+
213
+ ```bash
214
+ bundle exec rake release
215
+ ```
30
216
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
217
+ This creates a git tag, pushes commits and tags, and publishes the `.gem` file to [RubyGems.org](https://rubygems.org).
32
218
 
33
219
  ## Contributing
34
220
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/holivia. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/holivia/blob/master/CODE_OF_CONDUCT.md).
221
+ Bug reports and pull requests are welcome on GitHub at https://github.com/Holivia-Team/holivia-ruby.
36
222
 
37
223
  ## License
38
224
 
39
225
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
226
 
41
- ## Code of Conduct
227
+ ## Code Of Conduct
42
228
 
43
- Everyone interacting in the Holivia project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/holivia/blob/master/CODE_OF_CONDUCT.md).
229
+ Everyone interacting in the Holivia project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the [code of conduct](https://github.com/Holivia-Team/holivia-ruby/blob/master/CODE_OF_CONDUCT.md).
data/SKILL.md ADDED
@@ -0,0 +1,339 @@
1
+ # Holivia CLI Skill
2
+
3
+ Use this skill when you need to operate the Holivia API through the `holivia` command-line tool.
4
+
5
+ The CLI manages Holivia backoffice data: environments, authentication, selfcare contents, objectives, selfcare-objective associations, and appointment video diagnostics.
6
+
7
+ ## Preconditions
8
+
9
+ - Ruby 3.1 or newer is available.
10
+ - The CLI is installed with `gem install holivia`, or you are running inside this repository with `bundle exec exe/holivia`.
11
+ - The user has provided the correct Holivia API base URL and account credentials, or they have already authenticated locally.
12
+
13
+ Use `holivia` in examples below. If working from a checkout before installation, replace it with `bundle exec exe/holivia`.
14
+
15
+ ## Safety Rules
16
+
17
+ - Never invent API URLs, credentials, IDs, enum values, or content model fields.
18
+ - Never print, store, or commit passwords, access tokens, refresh tokens, or files under `~/.holivia/credentials.*.json`.
19
+ - Prefer interactive `holivia login` when a human can enter credentials. Use `--password` only when the user explicitly provides it for automation.
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
+ - For destructive actions such as `holivia env remove` or `holivia selfcare objective delete`, confirm the target environment and ID first unless the user explicitly requested that exact action.
22
+ - 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`.
23
+
24
+ ## Installation
25
+
26
+ Install the released CLI:
27
+
28
+ ```bash
29
+ gem install holivia
30
+ ```
31
+
32
+ Verify it is available:
33
+
34
+ ```bash
35
+ holivia version
36
+ ```
37
+
38
+ When working from this repository without installing the gem:
39
+
40
+ ```bash
41
+ bundle install
42
+ bundle exec exe/holivia version
43
+ ```
44
+
45
+ ## Environment Setup
46
+
47
+ The CLI stores environment configuration at `~/.holivia/config.yml`.
48
+
49
+ Show the active environment:
50
+
51
+ ```bash
52
+ holivia env
53
+ ```
54
+
55
+ List environments:
56
+
57
+ ```bash
58
+ holivia env list
59
+ ```
60
+
61
+ Add or update an environment:
62
+
63
+ ```bash
64
+ holivia env add staging --url https://api.example.com
65
+ ```
66
+
67
+ Switch environments:
68
+
69
+ ```bash
70
+ holivia env use staging
71
+ ```
72
+
73
+ Enable request debug logging for troubleshooting:
74
+
75
+ ```bash
76
+ holivia env debug --true
77
+ ```
78
+
79
+ Disable request debug logging:
80
+
81
+ ```bash
82
+ holivia env debug --false
83
+ ```
84
+
85
+ Debug logging may expose request details. Do not enable it in shared logs unless needed.
86
+
87
+ ## Authentication
88
+
89
+ Credentials are stored per environment at `~/.holivia/credentials.<env>.json`. The CLI sends the access token as a bearer token and refreshes credentials automatically after a `401` response when possible.
90
+
91
+ Interactive login:
92
+
93
+ ```bash
94
+ holivia login
95
+ ```
96
+
97
+ Non-interactive login:
98
+
99
+ ```bash
100
+ holivia login --email user@example.com --password secret
101
+ ```
102
+
103
+ Logout for the current environment:
104
+
105
+ ```bash
106
+ holivia logout
107
+ ```
108
+
109
+ ## Discovery Workflow
110
+
111
+ Start with help and environment checks:
112
+
113
+ ```bash
114
+ holivia --help
115
+ holivia env
116
+ ```
117
+
118
+ For selfcare content work, always discover the live schema first:
119
+
120
+ ```bash
121
+ holivia selfcare schema
122
+ ```
123
+
124
+ Use the schema response for:
125
+
126
+ - content types
127
+ - format types
128
+ - item types
129
+ - allowed states
130
+ - objective tiers
131
+ - item-specific permitted params
132
+
133
+ ## Selfcare Content
134
+
135
+ List contents:
136
+
137
+ ```bash
138
+ holivia selfcare index
139
+ ```
140
+
141
+ Show one content:
142
+
143
+ ```bash
144
+ holivia selfcare show 123
145
+ ```
146
+
147
+ Create a content with flags:
148
+
149
+ ```bash
150
+ holivia selfcare create \
151
+ --title "Breathing exercise" \
152
+ --locale fr \
153
+ --content-type exercise \
154
+ --duration 300 \
155
+ --state draft
156
+ ```
157
+
158
+ Update a content:
159
+
160
+ ```bash
161
+ holivia selfcare update 123 --title "Updated title" --state published
162
+ ```
163
+
164
+ Upload or replace an image:
165
+
166
+ ```bash
167
+ holivia selfcare update 123 --image cover.png
168
+ ```
169
+
170
+ Accepted image extensions are `.jpg`, `.jpeg`, `.png`, `.webp`, and `.gif`.
171
+
172
+ ## Compose Workflow
173
+
174
+ Use compose to create a complete selfcare content tree atomically from JSON.
175
+
176
+ Print the built-in template:
177
+
178
+ ```bash
179
+ holivia selfcare compose --example
180
+ ```
181
+
182
+ Create from a file:
183
+
184
+ ```bash
185
+ holivia selfcare compose --file payload.json
186
+ ```
187
+
188
+ Create from stdin:
189
+
190
+ ```bash
191
+ printf '{"title":"Example","locale":"fr"}' | holivia selfcare compose
192
+ ```
193
+
194
+ Compose is JSON-only and does not upload files. To attach an image, compose first, read the returned content id, then run:
195
+
196
+ ```bash
197
+ holivia selfcare update <id> --image cover.png
198
+ ```
199
+
200
+ Audio items require file upload and must be added after compose with `holivia selfcare item create`.
201
+
202
+ ## Incremental Content Workflow
203
+
204
+ Create a content:
205
+
206
+ ```bash
207
+ holivia selfcare create --title "Example" --locale fr --content-type exercise --duration 300 --state draft
208
+ ```
209
+
210
+ Add a format:
211
+
212
+ ```bash
213
+ holivia selfcare format create --selfcare-content-id 123 --format-type text
214
+ ```
215
+
216
+ Add a slide:
217
+
218
+ ```bash
219
+ holivia selfcare slide create --content-format-id 456 --title "Intro" --duration 60
220
+ ```
221
+
222
+ Add a rich text item:
223
+
224
+ ```bash
225
+ holivia selfcare item create --slide-id 789 --item-type RichTextItem --content "Welcome"
226
+ ```
227
+
228
+ Add an audio item:
229
+
230
+ ```bash
231
+ holivia selfcare item create --slide-id 789 --item-type AudioItem --audio meditation.mp3
232
+ ```
233
+
234
+ Accepted audio extensions are `.mp3`, `.mp4`, `.wav`, `.ogg`, `.flac`, `.aac`, `.m4a`, and `.webm`.
235
+
236
+ Update an item:
237
+
238
+ ```bash
239
+ holivia selfcare item update 321 --content "Updated content"
240
+ ```
241
+
242
+ Most create and update commands accept either flags or JSON from stdin. Prefer JSON for complex payloads.
243
+
244
+ ## Objectives
245
+
246
+ List objectives:
247
+
248
+ ```bash
249
+ holivia objective index
250
+ ```
251
+
252
+ Paginate objectives:
253
+
254
+ ```bash
255
+ holivia objective index --page 1 --per-page 50
256
+ ```
257
+
258
+ Filter objectives by code:
259
+
260
+ ```bash
261
+ holivia objective index --code anxiety
262
+ ```
263
+
264
+ Show one objective:
265
+
266
+ ```bash
267
+ holivia objective show 123
268
+ ```
269
+
270
+ Objective translated fields are returned in the default locale, currently `fr`.
271
+
272
+ ## Selfcare Objective Associations
273
+
274
+ List associations:
275
+
276
+ ```bash
277
+ holivia selfcare objective index --selfcare-content-id 123
278
+ ```
279
+
280
+ Show one association:
281
+
282
+ ```bash
283
+ holivia selfcare objective show 456
284
+ ```
285
+
286
+ Associate an objective to selfcare content:
287
+
288
+ ```bash
289
+ holivia selfcare objective create --selfcare-content-id 123 --objective-id 789 --tier main
290
+ ```
291
+
292
+ Update an association tier:
293
+
294
+ ```bash
295
+ holivia selfcare objective update 456 --tier secondary
296
+ ```
297
+
298
+ Delete an association:
299
+
300
+ ```bash
301
+ holivia selfcare objective delete 456
302
+ ```
303
+
304
+ Inline alternative for compose or selfcare update JSON payloads:
305
+
306
+ ```json
307
+ {
308
+ "objectives": [
309
+ { "objective_id": 789, "tier": "main" }
310
+ ]
311
+ }
312
+ ```
313
+
314
+ On update, an empty `objectives` array clears associations. Omitting the key leaves associations unchanged.
315
+
316
+ ## Appointments
317
+
318
+ Show video diagnostics for an appointment:
319
+
320
+ ```bash
321
+ holivia appointment video-diagnostics 42
322
+ ```
323
+
324
+ ## Errors
325
+
326
+ - `401` means authentication failed or credentials could not be refreshed. Re-run `holivia login` for the active environment.
327
+ - `404` means the requested resource was not found in the active environment.
328
+ - `422` validation errors include structured details such as a payload path and field errors. Use those details to correct the request.
329
+
330
+ ## Agent Checklist
331
+
332
+ Before making API changes:
333
+
334
+ - Run `holivia env` and verify the active URL/environment.
335
+ - Run `holivia selfcare schema` before selfcare create/update/compose work.
336
+ - Use existing IDs from list/show commands or explicit user input.
337
+ - Prefer draft states unless the user explicitly requests publishing.
338
+ - Use JSON files or stdin for complex payloads.
339
+ - Summarize created or updated resource IDs after the command succeeds.
@@ -49,6 +49,9 @@ module Holivia
49
49
  holivia objective show <id> Show one objective
50
50
  Translated fields are returned in the default locale (fr).
51
51
 
52
+ Appointments:
53
+ holivia appointment video-diagnostics <id> Show video diagnostics for an appointment
54
+
52
55
  Selfcare Content Objectives:
53
56
  holivia selfcare objective index [--page N --per-page N --selfcare-content-id ID --objective-id ID]
54
57
  List a selfcare content's associated objectives
data/lib/holivia/cli.rb CHANGED
@@ -9,10 +9,11 @@ require_relative "commands/slide"
9
9
  require_relative "commands/env"
10
10
  require_relative "commands/item"
11
11
  require_relative "commands/objective"
12
+ require_relative "commands/appointment"
12
13
 
13
14
  module Holivia
14
15
  class CLI
15
- def self.start(args) # rubocop:disable Metrics/CyclomaticComplexity
16
+ def self.start(args) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/MethodLength
16
17
  command = args.shift
17
18
  case command
18
19
  when "login" then Commands::Auth.new.login(args)
@@ -20,6 +21,7 @@ module Holivia
20
21
  when "env" then Commands::Env.route(args)
21
22
  when "selfcare" then Commands::Selfcare.route(args)
22
23
  when "objective" then Commands::Objective.route(args)
24
+ when "appointment" then Commands::Appointment.route(args)
23
25
  when "version", "--version", "-v" then puts "holivia #{Holivia::VERSION}"
24
26
  when "--help", "-h", nil then puts Help::HELP_TEXT
25
27
  else warn "Unknown command: #{command}"
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base"
4
+
5
+ module Holivia
6
+ module Commands
7
+ class Appointment < Base
8
+ BASE_PATH = "/api/v1/backoffice/appointments"
9
+
10
+ def self.route(args)
11
+ subcommand = args.shift
12
+ case subcommand
13
+ when "video-diagnostics" then new.video_diagnostics(args)
14
+ else warn "Unknown appointment command: #{subcommand}"
15
+ exit 1
16
+ end
17
+ end
18
+
19
+ def video_diagnostics(args = [])
20
+ id = args.shift
21
+ abort "Usage: holivia appointment video-diagnostics <id>" unless id
22
+
23
+ output(client.get("#{BASE_PATH}/#{id}/video_diagnostics"))
24
+ end
25
+ end
26
+ end
27
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Holivia
4
- VERSION = "0.5.0"
4
+ VERSION = "0.6.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.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Holivia
@@ -52,6 +52,7 @@ files:
52
52
  - LICENSE.txt
53
53
  - README.md
54
54
  - Rakefile
55
+ - SKILL.md
55
56
  - example_content.xml
56
57
  - examples/compose.json
57
58
  - exe/holivia
@@ -61,6 +62,7 @@ files:
61
62
  - lib/holivia/cli.rb
62
63
  - lib/holivia/cli/help.rb
63
64
  - lib/holivia/client.rb
65
+ - lib/holivia/commands/appointment.rb
64
66
  - lib/holivia/commands/auth.rb
65
67
  - lib/holivia/commands/base.rb
66
68
  - lib/holivia/commands/env.rb