holivia 0.3.0 → 0.4.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 +5 -0
- data/lib/holivia/cli/help.rb +4 -0
- data/lib/holivia/commands/selfcare.rb +26 -3
- data/lib/holivia/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f07b97ef1cc9f170029aa93f37499e2ad93c8ff46909561df85e6be804eb1a54
|
|
4
|
+
data.tar.gz: 46c12d1102eabf769d43aae2291cce6ca79279d8ff9d27219b7d04b5c5caee8c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: caff35c64ab1b37ec0e3b0c3b06bbbc0e3b5d2515043f0260e27c174809e8d7943efc15b5e703008c59d819ad1051af671440a352f0a0757815c903daa2efd3f
|
|
7
|
+
data.tar.gz: 4631d47b8f8f4fd8d35abeec06f9f79a128f3ff966c750b61acced9433224c1f0a810c79b054511de73a9c09e817e6026a9b3602258cb0c9e79d40cc01450337
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.4.0] - 2026-04-28
|
|
4
|
+
|
|
5
|
+
- Add `--image FILE` flag on `selfcare create` and `selfcare update` for multipart image uploads
|
|
6
|
+
- Update help text with image upload usage and the compose-then-PATCH attach flow
|
|
7
|
+
|
|
3
8
|
## [0.3.0] - 2026-03-11
|
|
4
9
|
|
|
5
10
|
- Add multi-environment support with `~/.holivia/config.yml`
|
data/lib/holivia/cli/help.rb
CHANGED
|
@@ -65,6 +65,10 @@ module Holivia
|
|
|
65
65
|
All create/update/compose commands also accept piped JSON via stdin.
|
|
66
66
|
Audio uploads use --audio <path> on item create/update (sent as multipart/form-data).
|
|
67
67
|
Accepted audio formats: MP3, MP4, WAV, OGG, FLAC, AAC, M4A, WebM. Max size: 100 MB.
|
|
68
|
+
Image uploads use --image <path> on selfcare create/update (sent as multipart/form-data).
|
|
69
|
+
Accepted image formats: JPEG, PNG, WebP, GIF. Max size: 5 MB.
|
|
70
|
+
Compose is JSON-only — to attach an image to a composed tree, PATCH the returned id:
|
|
71
|
+
holivia selfcare update <id> --image <path>
|
|
68
72
|
|
|
69
73
|
Errors:
|
|
70
74
|
Validation errors (422) show structured details:
|
|
@@ -7,6 +7,13 @@ module Holivia
|
|
|
7
7
|
class Selfcare < Base
|
|
8
8
|
BASE_PATH = "/api/v1/backoffice/selfcare_contents"
|
|
9
9
|
COMPOSE_EXAMPLE_PATH = Holivia.root.join("examples", "compose.json").to_s
|
|
10
|
+
IMAGE_MIME_TYPES = {
|
|
11
|
+
".jpg" => "image/jpeg",
|
|
12
|
+
".jpeg" => "image/jpeg",
|
|
13
|
+
".png" => "image/png",
|
|
14
|
+
".webp" => "image/webp",
|
|
15
|
+
".gif" => "image/gif"
|
|
16
|
+
}.freeze
|
|
10
17
|
|
|
11
18
|
def self.route(args) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/AbcSize
|
|
12
19
|
subcommand = args.shift
|
|
@@ -36,7 +43,7 @@ module Holivia
|
|
|
36
43
|
output(client.get("#{BASE_PATH}/#{id}"))
|
|
37
44
|
end
|
|
38
45
|
|
|
39
|
-
def create(args = []) # rubocop:disable Metrics/AbcSize
|
|
46
|
+
def create(args = []) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
|
40
47
|
options = {}
|
|
41
48
|
OptionParser.new do |opts|
|
|
42
49
|
opts.banner = "Usage: holivia selfcare create [options]"
|
|
@@ -45,11 +52,12 @@ module Holivia
|
|
|
45
52
|
opts.on("--content-type TYPE") { |v| options[:content_type] = v }
|
|
46
53
|
opts.on("--duration DURATION", Integer) { |v| options[:duration] = v }
|
|
47
54
|
opts.on("--description DESC") { |v| options[:description] = v }
|
|
55
|
+
opts.on("--image FILE") { |v| options[:image] = v }
|
|
48
56
|
end.parse!(args)
|
|
49
57
|
options = options.merge(piped_json)
|
|
50
58
|
|
|
51
59
|
abort "No options provided. Use --help for usage." if options.empty?
|
|
52
|
-
output(client.post(BASE_PATH, body: options))
|
|
60
|
+
output(client.post(BASE_PATH, body: build_body(options)))
|
|
53
61
|
end
|
|
54
62
|
|
|
55
63
|
def update(args = []) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
|
@@ -64,11 +72,12 @@ module Holivia
|
|
|
64
72
|
opts.on("--content-type TYPE") { |v| options[:content_type] = v }
|
|
65
73
|
opts.on("--duration DURATION", Integer) { |v| options[:duration] = v }
|
|
66
74
|
opts.on("--description DESC") { |v| options[:description] = v }
|
|
75
|
+
opts.on("--image FILE") { |v| options[:image] = v }
|
|
67
76
|
end.parse!(args)
|
|
68
77
|
options = options.merge(piped_json)
|
|
69
78
|
|
|
70
79
|
abort "No options provided. Use --help for usage." if options.empty?
|
|
71
|
-
output(client.patch("#{BASE_PATH}/#{id}", body: options))
|
|
80
|
+
output(client.patch("#{BASE_PATH}/#{id}", body: build_body(options)))
|
|
72
81
|
end
|
|
73
82
|
|
|
74
83
|
def compose(args = []) # rubocop:disable Metrics/MethodLength
|
|
@@ -93,6 +102,20 @@ module Holivia
|
|
|
93
102
|
def schema(_args = [])
|
|
94
103
|
output(client.get("#{BASE_PATH}/schema"))
|
|
95
104
|
end
|
|
105
|
+
|
|
106
|
+
private
|
|
107
|
+
|
|
108
|
+
def build_body(options)
|
|
109
|
+
image_path = options.delete(:image)
|
|
110
|
+
return options unless image_path
|
|
111
|
+
|
|
112
|
+
options.merge(image: Faraday::Multipart::FilePart.new(image_path, detect_mime(image_path)))
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def detect_mime(path)
|
|
116
|
+
ext = File.extname(path).downcase
|
|
117
|
+
IMAGE_MIME_TYPES.fetch(ext, "application/octet-stream")
|
|
118
|
+
end
|
|
96
119
|
end
|
|
97
120
|
end
|
|
98
121
|
end
|
data/lib/holivia/version.rb
CHANGED