holivia 0.6.0 → 0.7.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: 88e7b483f29ede5b8d719e09e0e64014979b01fbe4f46e3476131d5f04cf6dd4
4
- data.tar.gz: 51142c7c75c2917c065e7eb99b9c5162d3c08e435722acdf2f532bcc4b17d2e7
3
+ metadata.gz: 61c8a59293a0b4cfb43dca7bad3c64694c75582875dff6198efea295712a1477
4
+ data.tar.gz: 9795ce32e8ada6e69eeedbb24549f711120ec6caa491d89fb86605bd2ecbb4a2
5
5
  SHA512:
6
- metadata.gz: 2b35a23633a3f1fd43dd849297c49f2bf836d237575ccd797fdd63274743b06cabd66a8c082cb82b14992270cb1f5c1048c0fce32cd7f8c1c12032dca529ae9e
7
- data.tar.gz: 4fd44133555a0453e2e21b4daad51d1ba5a7e5e42bfba0f8bce98f0b1c245af8bbcc0913a0e74964ed2c690506d12ad3fbee4a15138c52f7bcc2a5478c8aa446
6
+ metadata.gz: 8e68ebf330b241d4eae1d048d415adb2f6f6b551d63bed270e0ab17610535672e323a26a4c85b904e338613d48b87f88f59a9920866fc6f9dd3299229907f348
7
+ data.tar.gz: 9b431f54025a5420fada21b6769063b06f1da5e02cb1b5e09dc1b28bcadc534847758441fad1090b945c412c99fe9aeb24ae8c433792eaad2e4a69aba6a5c186
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.7.0] - 2026-07-02
4
+
5
+ - Add `holivia communication` commands for communication library CRUD, publishing, schema discovery, and document/cover uploads
6
+
3
7
  ## [0.6.0] - 2026-06-05
4
8
 
5
9
  - Add `holivia appointment video-diagnostics <id>` for appointment video diagnostics
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, and appointment diagnostics.
5
+ The `holivia` executable is primarily used to manage Holivia backoffice data from the terminal: environments, authentication, selfcare content, objectives, communication library items, and appointment diagnostics.
6
6
 
7
7
  Coding agents can use [`SKILL.md`](SKILL.md) as a downloadable usage guide for operating this CLI safely.
8
8
 
@@ -166,6 +166,29 @@ Show video diagnostics for an appointment:
166
166
  holivia appointment video-diagnostics 42
167
167
  ```
168
168
 
169
+ List communication library items:
170
+
171
+ ```bash
172
+ holivia communication index --locale fr --document-type poster
173
+ ```
174
+
175
+ Create a communication item:
176
+
177
+ ```bash
178
+ holivia communication create \
179
+ --title "Launch poster" \
180
+ --locale fr \
181
+ --document-type poster \
182
+ --document launch-poster.pdf \
183
+ --cover-image cover.png
184
+ ```
185
+
186
+ Publish it:
187
+
188
+ ```bash
189
+ holivia communication publish 123
190
+ ```
191
+
169
192
  ## Files And Uploads
170
193
 
171
194
  Selfcare create and update commands can upload images with `--image <path>`.
@@ -182,6 +205,8 @@ holivia selfcare item create --slide-id 456 --item-type AudioItem --audio medita
182
205
 
183
206
  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>`.
184
207
 
208
+ Communication item create and update commands upload the required document with `--document <path>` and can upload or replace the cover image with `--cover-image <path>`.
209
+
185
210
  ## Development
186
211
 
187
212
  After checking out the repo, run:
@@ -49,6 +49,17 @@ 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
+ Communication Items:
53
+ holivia communication index [--page N --per-page N --query TEXT --locale LOCALE --document-type TYPE]
54
+ List communication library items
55
+ holivia communication show <id> Show one communication item
56
+ holivia communication create [options] Create a communication item with a required document upload
57
+ holivia communication update <id> [options] Update metadata or replace uploads
58
+ holivia communication publish <id> Publish a draft communication item
59
+ holivia communication unpublish <id> Unpublish a communication item and clear published_at
60
+ holivia communication delete <id> Delete a communication item
61
+ holivia communication schema Show allowed document_types and locales
62
+
52
63
  Appointments:
53
64
  holivia appointment video-diagnostics <id> Show video diagnostics for an appointment
54
65
 
@@ -89,6 +100,8 @@ module Holivia
89
100
  Accepted audio formats: MP3, MP4, WAV, OGG, FLAC, AAC, M4A, WebM. Max size: 100 MB.
90
101
  Image uploads use --image <path> on selfcare create/update (sent as multipart/form-data).
91
102
  Accepted image formats: JPEG, PNG, WebP, GIF. Max size: 5 MB.
103
+ Communication uploads use --document <path> and optional --cover-image <path>.
104
+ The API validates accepted communication upload formats and file sizes.
92
105
  Compose is JSON-only — to attach an image to a composed tree, PATCH the returned id:
93
106
  holivia selfcare update <id> --image <path>
94
107
 
data/lib/holivia/cli.rb CHANGED
@@ -10,6 +10,7 @@ require_relative "commands/env"
10
10
  require_relative "commands/item"
11
11
  require_relative "commands/objective"
12
12
  require_relative "commands/appointment"
13
+ require_relative "commands/communication_item"
13
14
 
14
15
  module Holivia
15
16
  class CLI
@@ -22,6 +23,7 @@ module Holivia
22
23
  when "selfcare" then Commands::Selfcare.route(args)
23
24
  when "objective" then Commands::Objective.route(args)
24
25
  when "appointment" then Commands::Appointment.route(args)
26
+ when "communication" then Commands::CommunicationItem.route(args)
25
27
  when "version", "--version", "-v" then puts "holivia #{Holivia::VERSION}"
26
28
  when "--help", "-h", nil then puts Help::HELP_TEXT
27
29
  else warn "Unknown command: #{command}"
@@ -0,0 +1,145 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base"
4
+
5
+ module Holivia
6
+ module Commands
7
+ class CommunicationItem < Base # rubocop:disable Metrics/ClassLength
8
+ BASE_PATH = "/api/v1/backoffice/communication_items"
9
+ CONTENT_TYPE_BY_EXTENSION = {
10
+ ".gif" => "image/gif",
11
+ ".jpeg" => "image/jpeg",
12
+ ".jpg" => "image/jpeg",
13
+ ".mov" => "video/quicktime",
14
+ ".mp4" => "video/mp4",
15
+ ".pdf" => "application/pdf",
16
+ ".png" => "image/png",
17
+ ".ppt" => "application/vnd.ms-powerpoint",
18
+ ".pptx" => "application/vnd.openxmlformats-officedocument.presentationml.presentation",
19
+ ".webm" => "video/webm",
20
+ ".webp" => "image/webp",
21
+ ".zip" => "application/zip"
22
+ }.freeze
23
+
24
+ def self.route(args) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength
25
+ subcommand = args.shift
26
+ case subcommand
27
+ when "index" then new.index(args)
28
+ when "show" then new.show(args)
29
+ when "create" then new.create(args)
30
+ when "update" then new.update(args)
31
+ when "publish" then new.publish(args)
32
+ when "unpublish" then new.unpublish(args)
33
+ when "delete" then new.delete(args)
34
+ when "schema" then new.schema(args)
35
+ else warn "Unknown communication command: #{subcommand}"
36
+ exit 1
37
+ end
38
+ end
39
+
40
+ def index(args = []) # rubocop:disable Metrics/AbcSize
41
+ params = {}
42
+ OptionParser.new do |opts|
43
+ opts.banner = "Usage: holivia communication index [options]"
44
+ opts.on("--page N", Integer) { |v| params[:page] = v }
45
+ opts.on("--per-page N", Integer) { |v| params[:per_page] = v }
46
+ opts.on("--query TEXT") { |v| params[:query] = v }
47
+ opts.on("--locale LOCALE") { |v| params[:locale] = v }
48
+ opts.on("--document-type TYPE") { |v| params[:document_type] = v }
49
+ end.parse!(args)
50
+
51
+ output(client.get(BASE_PATH, params: params))
52
+ end
53
+
54
+ def show(args = [])
55
+ id = args.shift
56
+ abort "Usage: holivia communication show <id>" unless id
57
+
58
+ output(client.get("#{BASE_PATH}/#{id}"))
59
+ end
60
+
61
+ def create(args = [])
62
+ options = {}
63
+ OptionParser.new do |opts|
64
+ opts.banner = "Usage: holivia communication create [options]"
65
+ add_write_options(opts, options)
66
+ end.parse!(args)
67
+ options = options.merge(piped_json)
68
+
69
+ abort "No options provided. Use --help for usage." if options.empty?
70
+ output(client.post(BASE_PATH, body: build_body(options)))
71
+ end
72
+
73
+ def update(args = [])
74
+ id = args.shift
75
+ abort "Usage: holivia communication update <id> [options]" unless id
76
+
77
+ options = {}
78
+ OptionParser.new do |opts|
79
+ opts.banner = "Usage: holivia communication update <id> [options]"
80
+ add_write_options(opts, options)
81
+ end.parse!(args)
82
+ options = options.merge(piped_json)
83
+
84
+ abort "No options provided. Use --help for usage." if options.empty?
85
+ output(client.patch("#{BASE_PATH}/#{id}", body: build_body(options)))
86
+ end
87
+
88
+ def publish(args = [])
89
+ transition(args, "publish")
90
+ end
91
+
92
+ def unpublish(args = [])
93
+ transition(args, "unpublish")
94
+ end
95
+
96
+ def delete(args = [])
97
+ id = args.shift
98
+ abort "Usage: holivia communication delete <id>" unless id
99
+
100
+ client.delete("#{BASE_PATH}/#{id}")
101
+ output(deleted: true, id: id.to_i)
102
+ end
103
+
104
+ def schema(_args = [])
105
+ output(client.get("#{BASE_PATH}/schema"))
106
+ end
107
+
108
+ private
109
+
110
+ def add_write_options(opts, options)
111
+ opts.on("--title TITLE") { |v| options[:title] = v }
112
+ opts.on("--description DESC") { |v| options[:description] = v }
113
+ opts.on("--document-type TYPE") { |v| options[:document_type] = v }
114
+ opts.on("--locale LOCALE") { |v| options[:locale] = v }
115
+ opts.on("--cover-image FILE") { |v| options[:cover_image] = v }
116
+ opts.on("--document FILE") { |v| options[:document] = v }
117
+ end
118
+
119
+ def transition(args, event)
120
+ id = args.shift
121
+ abort "Usage: holivia communication #{event} <id>" unless id
122
+
123
+ output(client.patch("#{BASE_PATH}/#{id}/#{event}"))
124
+ end
125
+
126
+ def build_body(options)
127
+ options = options.dup
128
+ attach_file_part(options, :cover_image)
129
+ attach_file_part(options, :document)
130
+ options
131
+ end
132
+
133
+ def attach_file_part(options, key)
134
+ path = options[key]
135
+ return unless path
136
+
137
+ options[key] = Faraday::Multipart::FilePart.new(path, detect_mime(path))
138
+ end
139
+
140
+ def detect_mime(path)
141
+ CONTENT_TYPE_BY_EXTENSION.fetch(File.extname(path).downcase, "application/octet-stream")
142
+ end
143
+ end
144
+ end
145
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Holivia
4
- VERSION = "0.6.0"
4
+ VERSION = "0.7.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.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Holivia
@@ -65,6 +65,7 @@ files:
65
65
  - lib/holivia/commands/appointment.rb
66
66
  - lib/holivia/commands/auth.rb
67
67
  - lib/holivia/commands/base.rb
68
+ - lib/holivia/commands/communication_item.rb
68
69
  - lib/holivia/commands/env.rb
69
70
  - lib/holivia/commands/format.rb
70
71
  - lib/holivia/commands/item.rb