Class: Zavudev::Resources::Contacts
- Inherits:
-
Object
- Object
- Zavudev::Resources::Contacts
- Defined in:
- lib/zavudev/resources/contacts.rb
Instance Method Summary collapse
-
#initialize(client:) ⇒ Contacts
constructor
private
A new instance of Contacts.
-
#list(cursor: nil, limit: nil, phone_number: nil, request_options: {}) ⇒ Zavudev::Internal::Cursor<Zavudev::Models::Contact>
List contacts with their communication channels.
-
#retrieve(contact_id, request_options: {}) ⇒ Zavudev::Models::Contact
Get contact.
-
#retrieve_by_phone(phone_number, request_options: {}) ⇒ Zavudev::Models::Contact
Get contact by phone number.
-
#update(contact_id, default_channel: nil, metadata: nil, request_options: {}) ⇒ Zavudev::Models::Contact
Update contact.
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.
99 100 101 |
# File 'lib/zavudev/resources/contacts.rb', line 99 def initialize(client:) @client = client end |
Instance Method Details
#list(cursor: nil, limit: nil, phone_number: nil, request_options: {}) ⇒ Zavudev::Internal::Cursor<Zavudev::Models::Contact>
List contacts with their communication channels.
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/zavudev/resources/contacts.rb', line 63 def list(params = {}) parsed, = Zavudev::ContactListParams.dump_request(params) query = Zavudev::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "v1/contacts", query: query.transform_keys(phone_number: "phoneNumber"), page: Zavudev::Internal::Cursor, model: Zavudev::Contact, options: ) end |
#retrieve(contact_id, request_options: {}) ⇒ Zavudev::Models::Contact
Get contact
16 17 18 19 20 21 22 23 |
# File 'lib/zavudev/resources/contacts.rb', line 16 def retrieve(contact_id, params = {}) @client.request( method: :get, path: ["v1/contacts/%1$s", contact_id], model: Zavudev::Contact, options: params[:request_options] ) end |
#retrieve_by_phone(phone_number, request_options: {}) ⇒ Zavudev::Models::Contact
Get contact by phone number
87 88 89 90 91 92 93 94 |
# File 'lib/zavudev/resources/contacts.rb', line 87 def retrieve_by_phone(phone_number, params = {}) @client.request( method: :get, path: ["v1/contacts/phone/%1$s", phone_number], model: Zavudev::Contact, options: params[:request_options] ) end |
#update(contact_id, default_channel: nil, metadata: nil, request_options: {}) ⇒ Zavudev::Models::Contact
Update contact
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/zavudev/resources/contacts.rb', line 40 def update(contact_id, params = {}) parsed, = Zavudev::ContactUpdateParams.dump_request(params) @client.request( method: :patch, path: ["v1/contacts/%1$s", contact_id], body: parsed, model: Zavudev::Contact, options: ) end |