Class: Blueticks::Resources::ContactsResource
- Inherits:
-
BaseResource
- Object
- BaseResource
- Blueticks::Resources::ContactsResource
- Defined in:
- lib/blueticks/resources/contacts.rb
Instance Attribute Summary
Attributes inherited from BaseResource
Instance Method Summary collapse
-
#get_profile_picture(chat_id) ⇒ Object
Retrieve the CDN URL for a contact’s profile picture.
-
#list(query: nil, limit: nil, cursor: nil) ⇒ Object
Search the user’s WhatsApp contacts.
Methods inherited from BaseResource
Constructor Details
This class inherits a constructor from Blueticks::BaseResource
Instance Method Details
#get_profile_picture(chat_id) ⇒ Object
Retrieve the CDN URL for a contact’s profile picture.
21 22 23 24 |
# File 'lib/blueticks/resources/contacts.rb', line 21 def get_profile_picture(chat_id) data = client.request("GET", "/v1/contacts/#{chat_id}/profile_picture") Types::ProfilePicture.from_hash(data) end |
#list(query: nil, limit: nil, cursor: nil) ⇒ Object
Search the user’s WhatsApp contacts. Cursor-paginated.
11 12 13 14 15 16 17 18 |
# File 'lib/blueticks/resources/contacts.rb', line 11 def list(query: nil, limit: nil, cursor: nil) params = {} params["query"] = query unless query.nil? params["limit"] = limit unless limit.nil? params["cursor"] = cursor unless cursor.nil? data = client.request("GET", "/v1/contacts", params: params.empty? ? nil : params) Types::Page.from_hash(data, item_type: Types::WhatsAppContact) end |