Class: Amocrm::Resources::Tasks

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Tasks

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

Parameters:



130
131
132
# File 'lib/amocrm/resources/tasks.rb', line 130

def initialize(client:)
  @client = client
end

Instance Method Details

#create(body:, request_options: {}) ⇒ Amocrm::Models::TaskCreateResponse::TaskCreateResponse, Amocrm::Models::TaskCreateResponse::Problem

Create tasks.



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

def create(params)
  parsed, options = Amocrm::TaskCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "api/v4/tasks",
    body: parsed[:body],
    model: Amocrm::Models::TaskCreateResponse,
    options: options
  )
end

#get_by_id(id, request_options: {}) ⇒ Amocrm::Models::TaskGetByIDResponse::Task, Amocrm::Models::TaskGetByIDResponse::Problem

Get a task by id.

Parameters:

Returns:

See Also:



89
90
91
92
93
94
95
96
# File 'lib/amocrm/resources/tasks.rb', line 89

def get_by_id(id, params = {})
  @client.request(
    method: :get,
    path: ["api/v4/tasks/%1$s", id],
    model: Amocrm::Models::TaskGetByIDResponse,
    options: params[:request_options]
  )
end

#list(filter: nil, limit: nil, order: nil, page: nil, query: nil, request_options: {}) ⇒ Amocrm::Models::TaskListResponse::TaskListResponse, Amocrm::Models::TaskListResponse::Problem

Get a list of tasks (pagination, sorting, filtering).

Parameters:

  • filter (Object)

    Filtering parameters

  • limit (Integer)

    Pagination limit

  • order (Object)

    Sorting, e.g. order=asc

  • page (Integer)

    Pagination page

  • query (String, Integer)

    Search by query string or id

  • request_options (Amocrm::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



67
68
69
70
71
72
73
74
75
76
77
# File 'lib/amocrm/resources/tasks.rb', line 67

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

#update(body:, request_options: {}) ⇒ Amocrm::Models::TaskUpdateResponse::TaskUpdateResponse, Amocrm::Models::TaskUpdateResponse::Problem

Update tasks (batch).



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

def update(params)
  parsed, options = Amocrm::TaskUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: "api/v4/tasks",
    body: parsed[:body],
    model: Amocrm::Models::TaskUpdateResponse,
    options: options
  )
end

#update_by_id(id, complete_till: nil, entity_id: nil, entity_type: nil, is_completed: nil, responsible_user_id: nil, result: nil, task_type_id: nil, text: nil, request_options: {}) ⇒ Amocrm::Models::TaskUpdateByIDResponse::TaskUpdateResponse, Amocrm::Models::TaskUpdateByIDResponse::Problem

Update a task by id.

Parameters:

Returns:

See Also:



116
117
118
119
120
121
122
123
124
125
# File 'lib/amocrm/resources/tasks.rb', line 116

def update_by_id(id, params = {})
  parsed, options = Amocrm::TaskUpdateByIDParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["api/v4/tasks/%1$s", id],
    body: parsed,
    model: Amocrm::Models::TaskUpdateByIDResponse,
    options: options
  )
end