Module: ActiveProject::Adapters::Trello::Lists

Included in:
ActiveProject::Adapters::TrelloAdapter
Defined in:
lib/active_project/adapters/trello/lists.rb

Instance Method Summary collapse

Instance Method Details

#create_list(board_id, attributes) ⇒ Hash

Creates a new list on a Trello board.

Parameters:

  • board_id (String)

    The ID of the board.

  • attributes (Hash)

    List attributes. Required: :name. Optional: :pos.

Returns:

  • (Hash)

    The raw data hash of the created list.



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/active_project/adapters/trello/lists.rb', line 11

def create_list(board_id, attributes)
  unless attributes[:name] && !attributes[:name].empty?
    raise ArgumentError, "Missing required attribute for Trello list creation: :name"
  end

  path = "boards/#{board_id}/lists"
  query_params = {
    name: attributes[:name],
    pos: attributes[:pos]
  }.compact

  make_request(:post, path, nil, query_params)
end