Class: Zavudev::Resources::Contacts::Channels
- Inherits:
-
Object
- Object
- Zavudev::Resources::Contacts::Channels
- Defined in:
- lib/zavudev/resources/contacts/channels.rb
Instance Method Summary collapse
-
#add(contact_id, channel:, identifier:, country_code: nil, is_primary: nil, label: nil, request_options: {}) ⇒ Zavudev::Models::Contacts::ChannelAddResponse
Add a new communication channel to an existing contact.
-
#initialize(client:) ⇒ Channels
constructor
private
A new instance of Channels.
-
#remove(channel_id, contact_id:, request_options: {}) ⇒ nil
Remove a communication channel from a contact.
-
#set_primary(channel_id, contact_id:, request_options: {}) ⇒ Zavudev::Models::Contacts::ChannelSetPrimaryResponse
Set a channel as the primary channel for its type.
-
#update(channel_id, contact_id:, label: nil, metadata: nil, verified: nil, request_options: {}) ⇒ Zavudev::Models::Contacts::ChannelUpdateResponse
Update a contact’s channel properties.
Constructor Details
#initialize(client:) ⇒ Channels
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 Channels.
130 131 132 |
# File 'lib/zavudev/resources/contacts/channels.rb', line 130 def initialize(client:) @client = client end |
Instance Method Details
#add(contact_id, channel:, identifier:, country_code: nil, is_primary: nil, label: nil, request_options: {}) ⇒ Zavudev::Models::Contacts::ChannelAddResponse
Add a new communication channel to an existing contact.
62 63 64 65 66 67 68 69 70 71 |
# File 'lib/zavudev/resources/contacts/channels.rb', line 62 def add(contact_id, params) parsed, = Zavudev::Contacts::ChannelAddParams.dump_request(params) @client.request( method: :post, path: ["v1/contacts/%1$s/channels", contact_id], body: parsed, model: Zavudev::Models::Contacts::ChannelAddResponse, options: ) end |
#remove(channel_id, contact_id:, request_options: {}) ⇒ nil
Remove a communication channel from a contact. Cannot remove the last channel.
86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/zavudev/resources/contacts/channels.rb', line 86 def remove(channel_id, params) parsed, = Zavudev::Contacts::ChannelRemoveParams.dump_request(params) contact_id = parsed.delete(:contact_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :delete, path: ["v1/contacts/%1$s/channels/%2$s", contact_id, channel_id], model: NilClass, options: ) end |
#set_primary(channel_id, contact_id:, request_options: {}) ⇒ Zavudev::Models::Contacts::ChannelSetPrimaryResponse
Set a channel as the primary channel for its type.
113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/zavudev/resources/contacts/channels.rb', line 113 def set_primary(channel_id, params) parsed, = Zavudev::Contacts::ChannelSetPrimaryParams.dump_request(params) contact_id = parsed.delete(:contact_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :post, path: ["v1/contacts/%1$s/channels/%2$s/primary", contact_id, channel_id], model: Zavudev::Models::Contacts::ChannelSetPrimaryResponse, options: ) end |
#update(channel_id, contact_id:, label: nil, metadata: nil, verified: nil, request_options: {}) ⇒ Zavudev::Models::Contacts::ChannelUpdateResponse
Update a contact’s channel properties.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/zavudev/resources/contacts/channels.rb', line 26 def update(channel_id, params) parsed, = Zavudev::Contacts::ChannelUpdateParams.dump_request(params) contact_id = parsed.delete(:contact_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :patch, path: ["v1/contacts/%1$s/channels/%2$s", contact_id, channel_id], body: parsed, model: Zavudev::Models::Contacts::ChannelUpdateResponse, options: ) end |