Class: Zavudev::Resources::Broadcasts::Contacts
- Inherits:
-
Object
- Object
- Zavudev::Resources::Broadcasts::Contacts
- Defined in:
- lib/zavudev/resources/broadcasts/contacts.rb
Instance Method Summary collapse
-
#add(broadcast_id, contacts:, request_options: {}) ⇒ Zavudev::Models::Broadcasts::ContactAddResponse
Add contacts to a broadcast in batch.
-
#initialize(client:) ⇒ Contacts
constructor
private
A new instance of Contacts.
-
#list(broadcast_id, cursor: nil, limit: nil, status: nil, request_options: {}) ⇒ Zavudev::Internal::Cursor<Zavudev::Models::BroadcastContact>
List contacts in a broadcast with optional status filter.
-
#remove(contact_id, broadcast_id:, request_options: {}) ⇒ nil
Remove a contact from a broadcast in draft status.
Constructor Details
#initialize(client:) ⇒ Contacts
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 Contacts.
91 92 93 |
# File 'lib/zavudev/resources/broadcasts/contacts.rb', line 91 def initialize(client:) @client = client end |
Instance Method Details
#add(broadcast_id, contacts:, request_options: {}) ⇒ Zavudev::Models::Broadcasts::ContactAddResponse
Add contacts to a broadcast in batch. Maximum 1000 contacts per request.
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/zavudev/resources/broadcasts/contacts.rb', line 50 def add(broadcast_id, params) parsed, = Zavudev::Broadcasts::ContactAddParams.dump_request(params) @client.request( method: :post, path: ["v1/broadcasts/%1$s/contacts", broadcast_id], body: parsed, model: Zavudev::Models::Broadcasts::ContactAddResponse, options: ) end |
#list(broadcast_id, cursor: nil, limit: nil, status: nil, request_options: {}) ⇒ Zavudev::Internal::Cursor<Zavudev::Models::BroadcastContact>
List contacts in a broadcast with optional status filter.
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/zavudev/resources/broadcasts/contacts.rb', line 24 def list(broadcast_id, params = {}) parsed, = Zavudev::Broadcasts::ContactListParams.dump_request(params) query = Zavudev::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["v1/broadcasts/%1$s/contacts", broadcast_id], query: query, page: Zavudev::Internal::Cursor, model: Zavudev::BroadcastContact, options: ) end |
#remove(contact_id, broadcast_id:, request_options: {}) ⇒ nil
Remove a contact from a broadcast in draft status.
74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/zavudev/resources/broadcasts/contacts.rb', line 74 def remove(contact_id, params) parsed, = Zavudev::Broadcasts::ContactRemoveParams.dump_request(params) broadcast_id = parsed.delete(:broadcast_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :delete, path: ["v1/broadcasts/%1$s/contacts/%2$s", broadcast_id, contact_id], model: NilClass, options: ) end |