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.
-
#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.
-
#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.
246 247 248 249 |
# File 'lib/zavudev/resources/broadcasts.rb', line 246 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 |
#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.
182 183 184 185 186 187 188 189 |
# File 'lib/zavudev/resources/broadcasts.rb', line 182 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.
205 206 207 208 209 210 211 212 213 214 |
# File 'lib/zavudev/resources/broadcasts.rb', line 205 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 |
#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.
232 233 234 235 236 237 238 239 240 241 |
# File 'lib/zavudev/resources/broadcasts.rb', line 232 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 |