Method: ChatWork::Client::TaskMethods#create_task

Defined in:
lib/chatwork/client/task_methods.rb

#create_task(room_id:, body:, to_ids:, limit: nil, limit_type: nil) {|response_body, response_header| ... } ⇒ Hashie::Mash

Add a new task to the chat

Examples:

response format

{
  "task_ids": [123,124]
}

Parameters:

  • room_id (Integer)
  • body (String)

    Task description

  • to_ids (Array<Integer>, String)

    Account ID of the person/people responsible to complete the task

  • limit (Time, Integer) (defaults to: nil)

    When the task is due

  • limit_type (String) (defaults to: nil)

    Type of task deadline (e.g. none, date, time)

Yields:

  • (response_body, response_header)

    if block was given, return response body and response header through block arguments

Yield Parameters:

  • response_body (Hashie::Mash)

    response body

  • response_header (Hash<String, String>)

    response header (e.g. X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset)

Returns:

  • (Hashie::Mash)

See Also:



66
67
68
69
70
71
72
73
74
75
# File 'lib/chatwork/client/task_methods.rb', line 66

def create_task(room_id:, body:, to_ids:, limit: nil, limit_type: nil, &block)
  params = {
    body:       body,
    to_ids:     Array(to_ids).join(","),
    limit_type: limit_type,
  }
  params[:limit] = limit.to_i if limit

  post("/rooms/#{room_id}/tasks", params, &block)
end