Class: Zavudev::Resources::Broadcasts
- Inherits:
-
Object
- Object
- Zavudev::Resources::Broadcasts
- Defined in:
- lib/zavudev/resources/broadcasts.rb,
lib/zavudev/resources/broadcasts/contacts.rb
Defined Under Namespace
Classes: Contacts
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#cancel(broadcast_id, request_options: {}) ⇒ Zavudev::Models::BroadcastCancelResponse
Cancel a broadcast.
-
#create(channel:, name:, content: nil, email_html_body: nil, email_subject: nil, idempotency_key: nil, message_type: nil, metadata: nil, scheduled_at: nil, sender_id: nil, text: nil, request_options: {}) ⇒ Zavudev::Models::BroadcastCreateResponse
Create a new broadcast campaign.
-
#delete(broadcast_id, request_options: {}) ⇒ nil
Delete a broadcast in draft status.
-
#escalate_review(broadcast_id, request_options: {}) ⇒ Zavudev::Models::BroadcastEscalateReviewResponse
Request manual review by the Zavu team for a rejected broadcast.
-
#initialize(client:) ⇒ Broadcasts
constructor
private
A new instance of Broadcasts.
-
#list(cursor: nil, limit: nil, status: nil, request_options: {}) ⇒ Zavudev::Internal::Cursor<Zavudev::Models::Broadcast>
List broadcasts for this project.
-
#progress(broadcast_id, request_options: {}) ⇒ Zavudev::Models::BroadcastProgress
Get real-time progress of a broadcast including delivery counts and estimated completion time.
-
#reschedule(broadcast_id, scheduled_at:, request_options: {}) ⇒ Zavudev::Models::BroadcastRescheduleResponse
Update the scheduled time for a broadcast.
-
#retrieve(broadcast_id, request_options: {}) ⇒ Zavudev::Models::BroadcastRetrieveResponse
Get broadcast.
-
#retry_review(broadcast_id, request_options: {}) ⇒ Zavudev::Models::BroadcastRetryReviewResponse
Resubmit a rejected broadcast for AI review after editing content.
-
#send_(broadcast_id, scheduled_at: nil, request_options: {}) ⇒ Zavudev::Models::BroadcastSendResponse
Start sending the broadcast immediately or schedule for later.
-
#update(broadcast_id, content: nil, email_html_body: nil, email_subject: nil, metadata: nil, name: nil, text: nil, request_options: {}) ⇒ Zavudev::Models::BroadcastUpdateResponse
Update a broadcast in draft status.
Constructor Details
#initialize(client:) ⇒ Broadcasts
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Broadcasts.
286 287 288 289 |
# File 'lib/zavudev/resources/broadcasts.rb', line 286 def initialize(client:) @client = client @contacts = Zavudev::Resources::Broadcasts::Contacts.new(client: client) end |
Instance Attribute Details
#contacts ⇒ Zavudev::Resources::Broadcasts::Contacts (readonly)
7 8 9 |
# File 'lib/zavudev/resources/broadcasts.rb', line 7 def contacts @contacts end |
Instance Method Details
#cancel(broadcast_id, request_options: {}) ⇒ Zavudev::Models::BroadcastCancelResponse
Cancel a broadcast. Pending contacts will be skipped, but already queued messages may still be delivered.
162 163 164 165 166 167 168 169 |
# File 'lib/zavudev/resources/broadcasts.rb', line 162 def cancel(broadcast_id, params = {}) @client.request( method: :post, path: ["v1/broadcasts/%1$s/cancel", broadcast_id], model: Zavudev::Models::BroadcastCancelResponse, options: params[:request_options] ) end |
#create(channel:, name:, content: nil, email_html_body: nil, email_subject: nil, idempotency_key: nil, message_type: nil, metadata: nil, scheduled_at: nil, sender_id: nil, text: nil, request_options: {}) ⇒ Zavudev::Models::BroadcastCreateResponse
Create a new broadcast campaign. Add contacts after creation, then send.
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/zavudev/resources/broadcasts.rb', line 40 def create(params) parsed, = Zavudev::BroadcastCreateParams.dump_request(params) @client.request( method: :post, path: "v1/broadcasts", body: parsed, model: Zavudev::Models::BroadcastCreateResponse, options: ) end |
#delete(broadcast_id, request_options: {}) ⇒ nil
Delete a broadcast in draft status.
142 143 144 145 146 147 148 149 |
# File 'lib/zavudev/resources/broadcasts.rb', line 142 def delete(broadcast_id, params = {}) @client.request( method: :delete, path: ["v1/broadcasts/%1$s", broadcast_id], model: NilClass, options: params[:request_options] ) end |
#escalate_review(broadcast_id, request_options: {}) ⇒ Zavudev::Models::BroadcastEscalateReviewResponse
Request manual review by the Zavu team for a rejected broadcast. Use this after automated review rejection if you believe the content is legitimate.
182 183 184 185 186 187 188 189 |
# File 'lib/zavudev/resources/broadcasts.rb', line 182 def escalate_review(broadcast_id, params = {}) @client.request( method: :post, path: ["v1/broadcasts/%1$s/escalate", broadcast_id], model: Zavudev::Models::BroadcastEscalateReviewResponse, options: params[:request_options] ) end |
#list(cursor: nil, limit: nil, status: nil, request_options: {}) ⇒ Zavudev::Internal::Cursor<Zavudev::Models::Broadcast>
List broadcasts for this project.
119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/zavudev/resources/broadcasts.rb', line 119 def list(params = {}) parsed, = Zavudev::BroadcastListParams.dump_request(params) query = Zavudev::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "v1/broadcasts", query: query, page: Zavudev::Internal::Cursor, model: Zavudev::Broadcast, options: ) end |
#progress(broadcast_id, request_options: {}) ⇒ Zavudev::Models::BroadcastProgress
Get real-time progress of a broadcast including delivery counts and estimated completion time.
202 203 204 205 206 207 208 209 |
# File 'lib/zavudev/resources/broadcasts.rb', line 202 def progress(broadcast_id, params = {}) @client.request( method: :get, path: ["v1/broadcasts/%1$s/progress", broadcast_id], model: Zavudev::BroadcastProgress, options: params[:request_options] ) end |
#reschedule(broadcast_id, scheduled_at:, request_options: {}) ⇒ Zavudev::Models::BroadcastRescheduleResponse
Update the scheduled time for a broadcast. The broadcast must be in scheduled status.
225 226 227 228 229 230 231 232 233 234 |
# File 'lib/zavudev/resources/broadcasts.rb', line 225 def reschedule(broadcast_id, params) parsed, = Zavudev::BroadcastRescheduleParams.dump_request(params) @client.request( method: :patch, path: ["v1/broadcasts/%1$s/schedule", broadcast_id], body: parsed, model: Zavudev::Models::BroadcastRescheduleResponse, options: ) end |
#retrieve(broadcast_id, request_options: {}) ⇒ Zavudev::Models::BroadcastRetrieveResponse
Get broadcast
61 62 63 64 65 66 67 68 |
# File 'lib/zavudev/resources/broadcasts.rb', line 61 def retrieve(broadcast_id, params = {}) @client.request( method: :get, path: ["v1/broadcasts/%1$s", broadcast_id], model: Zavudev::Models::BroadcastRetrieveResponse, options: params[:request_options] ) end |
#retry_review(broadcast_id, request_options: {}) ⇒ Zavudev::Models::BroadcastRetryReviewResponse
Resubmit a rejected broadcast for AI review after editing content. Maximum 3 review attempts allowed per broadcast.
247 248 249 250 251 252 253 254 |
# File 'lib/zavudev/resources/broadcasts.rb', line 247 def retry_review(broadcast_id, params = {}) @client.request( method: :post, path: ["v1/broadcasts/%1$s/retry-review", broadcast_id], model: Zavudev::Models::BroadcastRetryReviewResponse, options: params[:request_options] ) end |
#send_(broadcast_id, scheduled_at: nil, request_options: {}) ⇒ Zavudev::Models::BroadcastSendResponse
Start sending the broadcast immediately or schedule for later. Broadcasts go through automated AI content review before sending. If the review passes, the broadcast proceeds. If rejected, use PATCH to edit content, then call POST /retry-review. Reserves the estimated cost from your balance.
272 273 274 275 276 277 278 279 280 281 |
# File 'lib/zavudev/resources/broadcasts.rb', line 272 def send_(broadcast_id, params = {}) parsed, = Zavudev::BroadcastSendParams.dump_request(params) @client.request( method: :post, path: ["v1/broadcasts/%1$s/send", broadcast_id], body: parsed, model: Zavudev::Models::BroadcastSendResponse, options: ) end |
#update(broadcast_id, content: nil, email_html_body: nil, email_subject: nil, metadata: nil, name: nil, text: nil, request_options: {}) ⇒ Zavudev::Models::BroadcastUpdateResponse
Update a broadcast in draft status.
93 94 95 96 97 98 99 100 101 102 |
# File 'lib/zavudev/resources/broadcasts.rb', line 93 def update(broadcast_id, params = {}) parsed, = Zavudev::BroadcastUpdateParams.dump_request(params) @client.request( method: :patch, path: ["v1/broadcasts/%1$s", broadcast_id], body: parsed, model: Zavudev::Models::BroadcastUpdateResponse, options: ) end |