holivia 0.4.0 → 0.5.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 +8 -0
- data/examples/compose.json +5 -0
- data/lib/holivia/cli/help.rb +21 -2
- data/lib/holivia/cli.rb +3 -1
- data/lib/holivia/commands/objective.rb +40 -0
- data/lib/holivia/commands/selfcare.rb +4 -0
- data/lib/holivia/commands/selfcare_objective.rb +81 -0
- data/lib/holivia/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 83d3ab262bb3fc4381d4ca420e6186ef577ce8e40db802b0658209e2ea0599b5
|
|
4
|
+
data.tar.gz: 36813fba6ea7c7cdb25d6b5cbfc97905226959e956fa02a146c9d60a54357898
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 36d0c89c7d469290018d121ada800c8bf4da4fcc6af6918930c5907c283786b5aded11979050a0f6ef9fb19c127bdebb789e3b014eb09c842c568eb404421f05
|
|
7
|
+
data.tar.gz: 8e9086a2a046deec0170ec502391c8cda726963933d8597159aa98ce498e21d88a0e6aebe059606ae07387cad8655be6f88449ed3035cee1d6a161dfff316044
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.5.0] - 2026-05-06
|
|
4
|
+
|
|
5
|
+
- Add `--state` flag on `selfcare create` and `selfcare update` for AASM-driven lifecycle transitions
|
|
6
|
+
- Add top-level `holivia objective` commands (`index`, `show`) for the read-only Objective resource
|
|
7
|
+
- Add `holivia selfcare objective` CRUD (`index`, `show`, `create`, `update`, `delete`) for the selfcare↔objective join, with `delete` printing `{deleted: true, id: <id>}` on 204
|
|
8
|
+
- Update compose example and help text to document inline `objectives` array on compose/update payloads
|
|
9
|
+
- Update help text to surface the `states` and `objective_tiers` keys returned by `selfcare schema`
|
|
10
|
+
|
|
3
11
|
## [0.4.0] - 2026-04-28
|
|
4
12
|
|
|
5
13
|
- Add `--image FILE` flag on `selfcare create` and `selfcare update` for multipart image uploads
|
data/examples/compose.json
CHANGED
|
@@ -5,6 +5,11 @@
|
|
|
5
5
|
"goal": "Comprendre et réduire le stress",
|
|
6
6
|
"content_type": "video_type",
|
|
7
7
|
"locale": "fr",
|
|
8
|
+
"state": "published",
|
|
9
|
+
"objectives": [
|
|
10
|
+
{ "objective_id": 18, "tier": "main" },
|
|
11
|
+
{ "objective_id": 19, "tier": "secondary" }
|
|
12
|
+
],
|
|
8
13
|
"formats": [
|
|
9
14
|
{
|
|
10
15
|
"format_type": "video",
|
data/lib/holivia/cli/help.rb
CHANGED
|
@@ -25,9 +25,12 @@ module Holivia
|
|
|
25
25
|
holivia selfcare index List all selfcare contents
|
|
26
26
|
holivia selfcare show <id> Show a selfcare content by id
|
|
27
27
|
holivia selfcare create [options] Create a selfcare content
|
|
28
|
-
|
|
28
|
+
(--state draft|ongoing_translation|translation_to_be_reviewed|
|
|
29
|
+
translation_reviewed|published)
|
|
30
|
+
holivia selfcare update <id> [options] Update a selfcare content (same --state values)
|
|
29
31
|
holivia selfcare compose Create a full content tree atomically (no audio)
|
|
30
|
-
holivia selfcare schema Show allowed values for content_types, format_types,
|
|
32
|
+
holivia selfcare schema Show allowed values for content_types, format_types,
|
|
33
|
+
item_types, states, objective_tiers
|
|
31
34
|
|
|
32
35
|
Content Formats:
|
|
33
36
|
holivia selfcare format create [options] Add a format to a selfcare content
|
|
@@ -41,6 +44,22 @@ module Holivia
|
|
|
41
44
|
holivia selfcare item create [options] Add an item to a slide
|
|
42
45
|
holivia selfcare item update <id> [options] Update a slide item
|
|
43
46
|
|
|
47
|
+
Objectives:
|
|
48
|
+
holivia objective index [--page N --per-page N --code CODE] List objectives
|
|
49
|
+
holivia objective show <id> Show one objective
|
|
50
|
+
Translated fields are returned in the default locale (fr).
|
|
51
|
+
|
|
52
|
+
Selfcare Content Objectives:
|
|
53
|
+
holivia selfcare objective index [--page N --per-page N --selfcare-content-id ID --objective-id ID]
|
|
54
|
+
List a selfcare content's associated objectives
|
|
55
|
+
holivia selfcare objective show <id> Show one selfcare content objective
|
|
56
|
+
holivia selfcare objective create --selfcare-content-id ID --objective-id ID [--tier main|secondary]
|
|
57
|
+
Associate an objective to a selfcare content (tier defaults to main)
|
|
58
|
+
holivia selfcare objective update <id> --tier main|secondary Change the tier
|
|
59
|
+
holivia selfcare objective delete <id> Dissociate an objective from a selfcare content
|
|
60
|
+
Inline alternative: include "objectives": [{ "objective_id": ID, "tier": "main" }, ...] in the
|
|
61
|
+
JSON payload of compose/update. On update, [] clears the list; omitting the key leaves it untouched.
|
|
62
|
+
|
|
44
63
|
Data Model:
|
|
45
64
|
SelfcareContent → ContentFormat (format_type: text, audio, video)
|
|
46
65
|
→ Slide (title, duration) → SlideItem (one of: RichTextItem, VideoItem,
|
data/lib/holivia/cli.rb
CHANGED
|
@@ -8,16 +8,18 @@ require_relative "commands/format"
|
|
|
8
8
|
require_relative "commands/slide"
|
|
9
9
|
require_relative "commands/env"
|
|
10
10
|
require_relative "commands/item"
|
|
11
|
+
require_relative "commands/objective"
|
|
11
12
|
|
|
12
13
|
module Holivia
|
|
13
14
|
class CLI
|
|
14
|
-
def self.start(args)
|
|
15
|
+
def self.start(args) # rubocop:disable Metrics/CyclomaticComplexity
|
|
15
16
|
command = args.shift
|
|
16
17
|
case command
|
|
17
18
|
when "login" then Commands::Auth.new.login(args)
|
|
18
19
|
when "logout" then Commands::Auth.new.logout
|
|
19
20
|
when "env" then Commands::Env.route(args)
|
|
20
21
|
when "selfcare" then Commands::Selfcare.route(args)
|
|
22
|
+
when "objective" then Commands::Objective.route(args)
|
|
21
23
|
when "version", "--version", "-v" then puts "holivia #{Holivia::VERSION}"
|
|
22
24
|
when "--help", "-h", nil then puts Help::HELP_TEXT
|
|
23
25
|
else warn "Unknown command: #{command}"
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "base"
|
|
4
|
+
|
|
5
|
+
module Holivia
|
|
6
|
+
module Commands
|
|
7
|
+
class Objective < Base
|
|
8
|
+
BASE_PATH = "/api/v1/backoffice/objectives"
|
|
9
|
+
|
|
10
|
+
def self.route(args)
|
|
11
|
+
subcommand = args.shift
|
|
12
|
+
case subcommand
|
|
13
|
+
when "index" then new.index(args)
|
|
14
|
+
when "show" then new.show(args)
|
|
15
|
+
else warn "Unknown objective command: #{subcommand}"
|
|
16
|
+
exit 1
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def index(args = [])
|
|
21
|
+
params = {}
|
|
22
|
+
OptionParser.new do |opts|
|
|
23
|
+
opts.banner = "Usage: holivia objective index [options]"
|
|
24
|
+
opts.on("--page N", Integer) { |v| params[:page] = v }
|
|
25
|
+
opts.on("--per-page N", Integer) { |v| params[:per_page] = v }
|
|
26
|
+
opts.on("--code CODE") { |v| params[:code] = v }
|
|
27
|
+
end.parse!(args)
|
|
28
|
+
|
|
29
|
+
output(client.get(BASE_PATH, params: params))
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def show(args = [])
|
|
33
|
+
id = args.shift
|
|
34
|
+
abort "Usage: holivia objective show <id>" unless id
|
|
35
|
+
|
|
36
|
+
output(client.get("#{BASE_PATH}/#{id}"))
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative "base"
|
|
4
|
+
require_relative "selfcare_objective"
|
|
4
5
|
|
|
5
6
|
module Holivia
|
|
6
7
|
module Commands
|
|
@@ -27,6 +28,7 @@ module Holivia
|
|
|
27
28
|
when "format" then Format.route(args)
|
|
28
29
|
when "slide" then Slide.route(args)
|
|
29
30
|
when "item" then Item.route(args)
|
|
31
|
+
when "objective" then SelfcareObjective.route(args)
|
|
30
32
|
else warn "Unknown selfcare command: #{subcommand}"
|
|
31
33
|
exit 1
|
|
32
34
|
end
|
|
@@ -53,6 +55,7 @@ module Holivia
|
|
|
53
55
|
opts.on("--duration DURATION", Integer) { |v| options[:duration] = v }
|
|
54
56
|
opts.on("--description DESC") { |v| options[:description] = v }
|
|
55
57
|
opts.on("--image FILE") { |v| options[:image] = v }
|
|
58
|
+
opts.on("--state STATE") { |v| options[:state] = v }
|
|
56
59
|
end.parse!(args)
|
|
57
60
|
options = options.merge(piped_json)
|
|
58
61
|
|
|
@@ -73,6 +76,7 @@ module Holivia
|
|
|
73
76
|
opts.on("--duration DURATION", Integer) { |v| options[:duration] = v }
|
|
74
77
|
opts.on("--description DESC") { |v| options[:description] = v }
|
|
75
78
|
opts.on("--image FILE") { |v| options[:image] = v }
|
|
79
|
+
opts.on("--state STATE") { |v| options[:state] = v }
|
|
76
80
|
end.parse!(args)
|
|
77
81
|
options = options.merge(piped_json)
|
|
78
82
|
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "base"
|
|
4
|
+
|
|
5
|
+
module Holivia
|
|
6
|
+
module Commands
|
|
7
|
+
class SelfcareObjective < Base
|
|
8
|
+
BASE_PATH = "/api/v1/backoffice/selfcare_content_objectives"
|
|
9
|
+
|
|
10
|
+
def self.route(args)
|
|
11
|
+
subcommand = args.shift
|
|
12
|
+
case subcommand
|
|
13
|
+
when "index" then new.index(args)
|
|
14
|
+
when "show" then new.show(args)
|
|
15
|
+
when "create" then new.create(args)
|
|
16
|
+
when "update" then new.update(args)
|
|
17
|
+
when "delete" then new.delete(args)
|
|
18
|
+
else warn "Unknown selfcare objective command: #{subcommand}"
|
|
19
|
+
exit 1
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def index(args = [])
|
|
24
|
+
params = {}
|
|
25
|
+
OptionParser.new do |opts|
|
|
26
|
+
opts.banner = "Usage: holivia selfcare objective index [options]"
|
|
27
|
+
opts.on("--page N", Integer) { |v| params[:page] = v }
|
|
28
|
+
opts.on("--per-page N", Integer) { |v| params[:per_page] = v }
|
|
29
|
+
opts.on("--selfcare-content-id ID", Integer) { |v| params[:selfcare_content_id] = v }
|
|
30
|
+
opts.on("--objective-id ID", Integer) { |v| params[:objective_id] = v }
|
|
31
|
+
end.parse!(args)
|
|
32
|
+
|
|
33
|
+
output(client.get(BASE_PATH, params: params))
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def show(args = [])
|
|
37
|
+
id = args.shift
|
|
38
|
+
abort "Usage: holivia selfcare objective show <id>" unless id
|
|
39
|
+
|
|
40
|
+
output(client.get("#{BASE_PATH}/#{id}"))
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def create(args = [])
|
|
44
|
+
options = {}
|
|
45
|
+
OptionParser.new do |opts|
|
|
46
|
+
opts.banner = "Usage: holivia selfcare objective create [options]"
|
|
47
|
+
opts.on("--selfcare-content-id ID", Integer) { |v| options[:selfcare_content_id] = v }
|
|
48
|
+
opts.on("--objective-id ID", Integer) { |v| options[:objective_id] = v }
|
|
49
|
+
opts.on("--tier TIER") { |v| options[:tier] = v }
|
|
50
|
+
end.parse!(args)
|
|
51
|
+
options = options.merge(piped_json)
|
|
52
|
+
|
|
53
|
+
abort "No options provided. Use --help for usage." if options.empty?
|
|
54
|
+
output(client.post(BASE_PATH, body: options))
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def update(args = [])
|
|
58
|
+
id = args.shift
|
|
59
|
+
abort "Usage: holivia selfcare objective update <id> [options]" unless id
|
|
60
|
+
|
|
61
|
+
options = {}
|
|
62
|
+
OptionParser.new do |opts|
|
|
63
|
+
opts.banner = "Usage: holivia selfcare objective update <id> [options]"
|
|
64
|
+
opts.on("--tier TIER") { |v| options[:tier] = v }
|
|
65
|
+
end.parse!(args)
|
|
66
|
+
options = options.merge(piped_json)
|
|
67
|
+
|
|
68
|
+
abort "No options provided. Use --help for usage." if options.empty?
|
|
69
|
+
output(client.patch("#{BASE_PATH}/#{id}", body: options))
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def delete(args = [])
|
|
73
|
+
id = args.shift
|
|
74
|
+
abort "Usage: holivia selfcare objective delete <id>" unless id
|
|
75
|
+
|
|
76
|
+
client.delete("#{BASE_PATH}/#{id}")
|
|
77
|
+
output(deleted: true, id: id.to_i)
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
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.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Holivia
|
|
@@ -66,7 +66,9 @@ files:
|
|
|
66
66
|
- lib/holivia/commands/env.rb
|
|
67
67
|
- lib/holivia/commands/format.rb
|
|
68
68
|
- lib/holivia/commands/item.rb
|
|
69
|
+
- lib/holivia/commands/objective.rb
|
|
69
70
|
- lib/holivia/commands/selfcare.rb
|
|
71
|
+
- lib/holivia/commands/selfcare_objective.rb
|
|
70
72
|
- lib/holivia/commands/slide.rb
|
|
71
73
|
- lib/holivia/config_error.rb
|
|
72
74
|
- lib/holivia/configuration.rb
|