Class: Amocrm::Resources::ContactChats

Inherits:
Object
  • Object
show all
Defined in:
lib/amocrm/resources/contact_chats.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ ContactChats

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 ContactChats.

Parameters:



52
53
54
# File 'lib/amocrm/resources/contact_chats.rb', line 52

def initialize(client:)
  @client = client
end

Instance Method Details

Link chats to contacts.



38
39
40
41
42
43
44
45
46
47
# File 'lib/amocrm/resources/contact_chats.rb', line 38

def link(params)
  parsed, options = Amocrm::ContactChatLinkParams.dump_request(params)
  @client.request(
    method: :post,
    path: "api/v4/contacts/chats",
    body: parsed[:body],
    model: Amocrm::Models::ContactChatLinkResponse,
    options: options
  )
end

#list(filter: nil, request_options: {}) ⇒ Amocrm::Models::ContactChatListResponse::ContactChatLinksResponse, Amocrm::Models::ContactChatListResponse::Problem

Get list of linked chats.



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/amocrm/resources/contact_chats.rb', line 16

def list(params = {})
  parsed, options = Amocrm::ContactChatListParams.dump_request(params)
  query = Amocrm::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "api/v4/contacts/chats",
    query: query,
    model: Amocrm::Models::ContactChatListResponse,
    options: options
  )
end