Class: Sentdm::Resources::Contacts
- Inherits:
-
Object
- Object
- Sentdm::Resources::Contacts
- Defined in:
- lib/sentdm/resources/contacts.rb
Overview
Create, update, and manage customer contact lists
Instance Method Summary collapse
-
#create(phone_number: nil, sandbox: nil, idempotency_key: nil, x_profile_id: nil, request_options: {}) ⇒ Sentdm::Models::APIResponseOfContact
Some parameter documentations has been truncated, see Models::ContactCreateParams for more details.
-
#delete(id, body:, x_profile_id: nil, request_options: {}) ⇒ nil
Some parameter documentations has been truncated, see Models::ContactDeleteParams for more details.
-
#initialize(client:) ⇒ Contacts
constructor
private
A new instance of Contacts.
-
#list(page:, page_size:, channel: nil, phone: nil, search: nil, x_profile_id: nil, request_options: {}) ⇒ Sentdm::Models::ContactListResponse
Some parameter documentations has been truncated, see Models::ContactListParams for more details.
-
#retrieve(id, x_profile_id: nil, request_options: {}) ⇒ Sentdm::Models::APIResponseOfContact
Some parameter documentations has been truncated, see Models::ContactRetrieveParams for more details.
-
#update(id, channel_consent: nil, default_channel: nil, opt_out: nil, sandbox: nil, idempotency_key: nil, x_profile_id: nil, request_options: {}) ⇒ Sentdm::Models::APIResponseOfContact
Some parameter documentations has been truncated, see Models::ContactUpdateParams for more details.
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.
183 184 185 |
# File 'lib/sentdm/resources/contacts.rb', line 183 def initialize(client:) @client = client end |
Instance Method Details
#create(phone_number: nil, sandbox: nil, idempotency_key: nil, x_profile_id: nil, request_options: {}) ⇒ Sentdm::Models::APIResponseOfContact
Some parameter documentations has been truncated, see Models::ContactCreateParams for more details.
Creates a new contact by phone number and associates it with the authenticated customer.
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/sentdm/resources/contacts.rb', line 28 def create(params = {}) parsed, = Sentdm::ContactCreateParams.dump_request(params) header_params = {idempotency_key: "idempotency-key", x_profile_id: "x-profile-id"} @client.request( method: :post, path: "v3/contacts", headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Sentdm::APIResponseOfContact, options: ) end |
#delete(id, body:, x_profile_id: nil, request_options: {}) ⇒ nil
Some parameter documentations has been truncated, see Models::ContactDeleteParams for more details.
Dissociates a contact from the authenticated customer. Inherited contacts cannot be deleted.
168 169 170 171 172 173 174 175 176 177 178 |
# File 'lib/sentdm/resources/contacts.rb', line 168 def delete(id, params) parsed, = Sentdm::ContactDeleteParams.dump_request(params) @client.request( method: :delete, path: ["v3/contacts/%1$s", id], headers: parsed.except(:body).transform_keys(x_profile_id: "x-profile-id"), body: parsed[:body], model: NilClass, options: ) end |
#list(page:, page_size:, channel: nil, phone: nil, search: nil, x_profile_id: nil, request_options: {}) ⇒ Sentdm::Models::ContactListResponse
Some parameter documentations has been truncated, see Models::ContactListParams for more details.
Retrieves a paginated list of contacts for the authenticated customer. Supports filtering by search term, channel, or phone number.
135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/sentdm/resources/contacts.rb', line 135 def list(params) query_params = [:page, :page_size, :channel, :phone, :search] parsed, = Sentdm::ContactListParams.dump_request(params) query = Sentdm::Internal::Util.encode_query_params(parsed.slice(*query_params)) @client.request( method: :get, path: "v3/contacts", query: query, headers: parsed.except(*query_params).transform_keys(x_profile_id: "x-profile-id"), model: Sentdm::Models::ContactListResponse, options: ) end |
#retrieve(id, x_profile_id: nil, request_options: {}) ⇒ Sentdm::Models::APIResponseOfContact
Some parameter documentations has been truncated, see Models::ContactRetrieveParams for more details.
Retrieves a specific contact by their unique identifier. Returns detailed contact information including phone formats, available channels, and opt-out status.
59 60 61 62 63 64 65 66 67 68 |
# File 'lib/sentdm/resources/contacts.rb', line 59 def retrieve(id, params = {}) parsed, = Sentdm::ContactRetrieveParams.dump_request(params) @client.request( method: :get, path: ["v3/contacts/%1$s", id], headers: parsed.transform_keys(x_profile_id: "x-profile-id"), model: Sentdm::APIResponseOfContact, options: ) end |
#update(id, channel_consent: nil, default_channel: nil, opt_out: nil, sandbox: nil, idempotency_key: nil, x_profile_id: nil, request_options: {}) ⇒ Sentdm::Models::APIResponseOfContact
Some parameter documentations has been truncated, see Models::ContactUpdateParams for more details.
Updates a contact’s default channel and/or opt-out status. Inherited contacts cannot be updated.
97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/sentdm/resources/contacts.rb', line 97 def update(id, params = {}) parsed, = Sentdm::ContactUpdateParams.dump_request(params) header_params = {idempotency_key: "idempotency-key", x_profile_id: "x-profile-id"} @client.request( method: :patch, path: ["v3/contacts/%1$s", id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Sentdm::APIResponseOfContact, options: ) end |