jeremytregunna/ruby-trello

View on GitHub
doc/Trello/Checklist.html

Summary

Maintainability
Test Coverage
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
  Class: Trello::Checklist
  
    &mdash; Documentation by YARD 0.9.25
  
</title>

  <link rel="stylesheet" href="../css/style.css" type="text/css" />

  <link rel="stylesheet" href="../css/common.css" type="text/css" />

<script type="text/javascript">
  pathId = "Trello::Checklist";
  relpath = '../';
</script>


  <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>


  </head>
  <body>
    <div class="nav_wrap">
      <iframe id="nav" src="../class_list.html?1"></iframe>
      <div id="resizer"></div>
    </div>

    <div id="main" tabindex="-1">
      <div id="header">
        <div id="menu">
  
    <a href="../_index.html">Index (C)</a> &raquo;
    <span class='title'><span class='object_link'><a href="../Trello.html" title="Trello (module)">Trello</a></span></span>
     &raquo; 
    <span class="title">Checklist</span>
  
</div>

        <div id="search">
  
    <a class="full_list_link" id="class_list_link"
        href="../class_list.html">

        <svg width="24" height="24">
          <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
          <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
          <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
        </svg>
    </a>
  
</div>
        <div class="clear"></div>
      </div>

      <div id="content"><h1>Class: Trello::Checklist
  
  
  
</h1>
<div class="box_info">
  
  <dl>
    <dt>Inherits:</dt>
    <dd>
      <span class="inheritName"><span class='object_link'><a href="BasicData.html" title="Trello::BasicData (class)">BasicData</a></span></span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next"><span class='object_link'><a href="BasicData.html" title="Trello::BasicData (class)">BasicData</a></span></li>
          
            <li class="next">Trello::Checklist</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
    </dd>
  </dl>
  

  
  
  
  
  

  

  
  <dl>
    <dt>Defined in:</dt>
    <dd>lib/trello/checklist.rb</dd>
  </dl>
  
</div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    
<p>A Checklist holds items which are like a “task” list. Checklists are linked to a card.</p>


  </div>
</div>
<div class="tags">
  

</div>



  <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
  <ul class="summary">
    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#board_id-instance_method" title="#board_id (instance method)">#<strong>board_id</strong>  &#x21d2; String </a>
    

    
  </span>
  
  
  
    
      <span class="note title readonly">readonly</span>
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>A 24-character hex string.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#card_id-instance_method" title="#card_id (instance method)">#<strong>card_id</strong>  &#x21d2; String </a>
    

    
  </span>
  
  
  
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#check_items-instance_method" title="#check_items (instance method)">#<strong>check_items</strong>  &#x21d2; Object </a>
    

    
  </span>
  
  
  
    
      <span class="note title readonly">readonly</span>
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#id-instance_method" title="#id (instance method)">#<strong>id</strong>  &#x21d2; String </a>
    

    
  </span>
  
  
  
    
      <span class="note title readonly">readonly</span>
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#name-instance_method" title="#name (instance method)">#<strong>name</strong>  &#x21d2; String </a>
    

    
  </span>
  
  
  
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#position-instance_method" title="#position (instance method)">#<strong>position</strong>  &#x21d2; Object </a>
    

    
  </span>
  
  
  
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#source_checklist_id=-instance_method" title="#source_checklist_id= (instance method)">#<strong>source_checklist_id</strong>  &#x21d2; String </a>
    

    
  </span>
  
  
  
    
    
      <span class="note title writeonly">writeonly</span>
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

    
  </ul>



  
  
  <h3 class="inherited">Attributes inherited from <span class='object_link'><a href="BasicData.html" title="Trello::BasicData (class)">BasicData</a></span></h3>
  <p class="inherited"><span class='object_link'><a href="BasicData.html#client-instance_method" title="Trello::BasicData#client (method)">#client</a></span></p>


  
    <h2>
      Instance Method Summary
      <small><a href="#" class="summary_toggle">collapse</a></small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#add_item-instance_method" title="#add_item (instance method)">#<strong>add_item</strong>(name, checked = false, position = &#39;bottom&#39;)  &#x21d2; Object </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Add an item to the checklist.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#copy-instance_method" title="#copy (instance method)">#<strong>copy</strong>  &#x21d2; Object </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Copy a checklist (i.e., same attributes, items, etc.).</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#delete-instance_method" title="#delete (instance method)">#<strong>delete</strong>  &#x21d2; Object </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Delete a checklist.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#delete_checklist_item-instance_method" title="#delete_checklist_item (instance method)">#<strong>delete_checklist_item</strong>(item_id)  &#x21d2; Object </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Delete a checklist item.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#items-instance_method" title="#items (instance method)">#<strong>items</strong>  &#x21d2; Object </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Return a list of items on the checklist.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#update_item_state-instance_method" title="#update_item_state (instance method)">#<strong>update_item_state</strong>(item_id, state)  &#x21d2; Object </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Update a checklist item&#39;s state, e.g.: “complete” or “incomplete”.</p>
</div></span>
  
</li>

      
    </ul>
  


  
  
  
  
  
  
  
  
  <h3 class="inherited">Methods inherited from <span class='object_link'><a href="BasicData.html" title="Trello::BasicData (class)">BasicData</a></span></h3>
  <p class="inherited"><span class='object_link'><a href="BasicData.html#==-instance_method" title="Trello::BasicData#== (method)">#==</a></span>, <span class='object_link'><a href="BasicData.html#attributes-instance_method" title="Trello::BasicData#attributes (method)">#attributes</a></span>, <span class='object_link'><a href="BasicData.html#client-class_method" title="Trello::BasicData.client (method)">client</a></span>, <span class='object_link'><a href="BasicData.html#collection_name-instance_method" title="Trello::BasicData#collection_name (method)">#collection_name</a></span>, <span class='object_link'><a href="BasicData.html#collection_path-instance_method" title="Trello::BasicData#collection_path (method)">#collection_path</a></span>, <span class='object_link'><a href="BasicData.html#create-class_method" title="Trello::BasicData.create (method)">create</a></span>, <span class='object_link'><a href="BasicData.html#element_name-instance_method" title="Trello::BasicData#element_name (method)">#element_name</a></span>, <span class='object_link'><a href="BasicData.html#element_path-instance_method" title="Trello::BasicData#element_path (method)">#element_path</a></span>, <span class='object_link'><a href="BasicData.html#find-class_method" title="Trello::BasicData.find (method)">find</a></span>, <span class='object_link'><a href="BasicData.html#hash-instance_method" title="Trello::BasicData#hash (method)">#hash</a></span>, <span class='object_link'><a href="BasicData.html#initialize-instance_method" title="Trello::BasicData#initialize (method)">#initialize</a></span>, <span class='object_link'><a href="BasicData.html#many-class_method" title="Trello::BasicData.many (method)">many</a></span>, <span class='object_link'><a href="BasicData.html#one-class_method" title="Trello::BasicData.one (method)">one</a></span>, <span class='object_link'><a href="BasicData.html#parse-class_method" title="Trello::BasicData.parse (method)">parse</a></span>, <span class='object_link'><a href="BasicData.html#parse_many-class_method" title="Trello::BasicData.parse_many (method)">parse_many</a></span>, <span class='object_link'><a href="BasicData.html#path_name-class_method" title="Trello::BasicData.path_name (method)">path_name</a></span>, <span class='object_link'><a href="BasicData.html#refresh!-instance_method" title="Trello::BasicData#refresh! (method)">#refresh!</a></span>, <span class='object_link'><a href="BasicData.html#register_attrs-class_method" title="Trello::BasicData.register_attrs (method)">register_attrs</a></span>, <span class='object_link'><a href="BasicData.html#save-class_method" title="Trello::BasicData.save (method)">save</a></span>, <span class='object_link'><a href="BasicData.html#save-instance_method" title="Trello::BasicData#save (method)">#save</a></span>, <span class='object_link'><a href="BasicData.html#schema-class_method" title="Trello::BasicData.schema (method)">schema</a></span>, <span class='object_link'><a href="BasicData.html#schema-instance_method" title="Trello::BasicData#schema (method)">#schema</a></span>, <span class='object_link'><a href="BasicData.html#update!-instance_method" title="Trello::BasicData#update! (method)">#update!</a></span>, <span class='object_link'><a href="BasicData.html#update_fields-instance_method" title="Trello::BasicData#update_fields (method)">#update_fields</a></span></p>

  
  
  
  
  
  
  
  
  <h3 class="inherited">Methods included from <span class='object_link'><a href="JsonUtils.html" title="Trello::JsonUtils (module)">JsonUtils</a></span></h3>
  <p class="inherited"><span class='object_link'><a href="JsonUtils.html#included-class_method" title="Trello::JsonUtils.included (method)">included</a></span></p>

  
  
  <div id="constructor_details" class="method_details_list">
  <h2>Constructor Details</h2>
  
    <p class="notice">This class inherits a constructor from <span class='object_link'><a href="BasicData.html#initialize-instance_method" title="Trello::BasicData#initialize (method)">Trello::BasicData</a></span></p>
  
</div>

  <div id="instance_attr_details" class="attr_details">
    <h2>Instance Attribute Details</h2>
    
      
      <span id=""></span>
      <div class="method_details first">
  <h3 class="signature first" id="board_id-instance_method">
  
    #<strong>board_id</strong>  &#x21d2; <tt><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></tt>  <span class="extras">(readonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Returns A 24-character hex string.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>A 24-character hex string</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/trello/checklist.rb', line 18</span>

<span class='kw'>class</span> <span class='const'><span class='object_link'><a href="" title="Trello::Checklist (class)">Checklist</a></span></span> <span class='op'>&lt;</span> <span class='const'><span class='object_link'><a href="BasicData.html" title="Trello::BasicData (class)">BasicData</a></span></span>
  <span class='id identifier rubyid_schema'>schema</span> <span class='kw'>do</span>
    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:id</span><span class='comma'>,</span> <span class='label'>readonly:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>primary_key:</span> <span class='kw'>true</span>

    <span class='comment'># Readonly
</span>    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:check_items</span><span class='comma'>,</span> <span class='label'>readonly:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>checkItems</span><span class='tstring_end'>&#39;</span></span>
    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:board_id</span><span class='comma'>,</span> <span class='label'>readonly:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>idBoard</span><span class='tstring_end'>&#39;</span></span>

    <span class='comment'># Writable
</span>    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:name</span>
    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:position</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>pos</span><span class='tstring_end'>&#39;</span></span>

    <span class='comment'># Writable but for update only
</span>    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:card_id</span><span class='comma'>,</span> <span class='label'>create_only:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>idCard</span><span class='tstring_end'>&#39;</span></span>
    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:source_checklist_id</span><span class='comma'>,</span> <span class='label'>create_only:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>idChecklistSource</span><span class='tstring_end'>&#39;</span></span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_validates_presence_of'>validates_presence_of</span> <span class='symbol'>:id</span>
  <span class='id identifier rubyid_validates_length_of'>validates_length_of</span> <span class='symbol'>:name</span><span class='comma'>,</span> <span class='label'>in:</span> <span class='int'>1</span><span class='op'>..</span><span class='int'>16384</span>

  <span class='comment'># Return a list of items on the checklist.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_items'>items</span>
    <span class='id identifier rubyid_check_items'>check_items</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_item_fields'>item_fields</span><span class='op'>|</span>
      <span class='const'><span class='object_link'><a href="Item.html" title="Trello::Item (class)">Item</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="BasicData.html#initialize-instance_method" title="Trello::BasicData#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_item_fields'>item_fields</span><span class='rparen'>)</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>

  <span class='comment'># Return a reference to the board the checklist is on.
</span>  <span class='id identifier rubyid_one'>one</span> <span class='symbol'>:board</span><span class='comma'>,</span> <span class='label'>path:</span> <span class='symbol'>:checklists</span><span class='comma'>,</span> <span class='label'>using:</span> <span class='symbol'>:board_id</span>

  <span class='comment'># Return a reference to the card the checklist is on.
</span>  <span class='id identifier rubyid_one'>one</span> <span class='symbol'>:card</span><span class='comma'>,</span> <span class='label'>path:</span> <span class='symbol'>:checklists</span><span class='comma'>,</span> <span class='label'>using:</span> <span class='symbol'>:card_id</span>

  <span class='comment'># Add an item to the checklist
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_add_item'>add_item</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_checked'>checked</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_position'>position</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>bottom</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
    <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/checklists/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_id'>id</span><span class='embexpr_end'>}</span><span class='tstring_content'>/checkItems</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='label'>name:</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='label'>checked:</span> <span class='id identifier rubyid_checked'>checked</span><span class='comma'>,</span> <span class='label'>pos:</span> <span class='id identifier rubyid_position'>position</span><span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Update a checklist item&#39;s state, e.g.: &quot;complete&quot; or &quot;incomplete&quot;
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_update_item_state'>update_item_state</span><span class='lparen'>(</span><span class='id identifier rubyid_item_id'>item_id</span><span class='comma'>,</span> <span class='id identifier rubyid_state'>state</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_state'>state</span> <span class='op'>=</span> <span class='lparen'>(</span> <span class='id identifier rubyid_state'>state</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>complete</span><span class='tstring_end'>&#39;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>incomplete</span><span class='tstring_end'>&#39;</span></span> <span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_state'>state</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></span><span class='rparen'>)</span>
    <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_put'>put</span><span class='lparen'>(</span>
        <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/cards/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_card_id'>card_id</span><span class='embexpr_end'>}</span><span class='tstring_content'>/checkItem/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_item_id'>item_id</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
        <span class='label'>state:</span> <span class='id identifier rubyid_state'>state</span>
    <span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Delete a checklist item
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_delete_checklist_item'>delete_checklist_item</span><span class='lparen'>(</span><span class='id identifier rubyid_item_id'>item_id</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/checklists/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_id'>id</span><span class='embexpr_end'>}</span><span class='tstring_content'>/checkItems/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_item_id'>item_id</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Delete a checklist
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span>
    <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/checklists/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_id'>id</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Copy a checklist (i.e., same attributes, items, etc.)
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_copy'>copy</span>
    <span class='id identifier rubyid_checklist_copy'>checklist_copy</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='label'>name:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='label'>board_id:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_board_id'>board_id</span><span class='comma'>,</span> <span class='label'>card_id:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_card_id'>card_id</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_copy_items_to'>copy_items_to</span><span class='lparen'>(</span><span class='id identifier rubyid_checklist_copy'>checklist_copy</span><span class='rparen'>)</span>
    <span class='kw'>return</span> <span class='id identifier rubyid_checklist_copy'>checklist_copy</span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_private'>private</span>
  <span class='kw'>def</span> <span class='id identifier rubyid_copy_items_to'>copy_items_to</span><span class='lparen'>(</span><span class='id identifier rubyid_another_checklist'>another_checklist</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_items'>items</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_item'>item</span><span class='op'>|</span>
      <span class='id identifier rubyid_another_checklist'>another_checklist</span><span class='period'>.</span><span class='id identifier rubyid_add_item'>add_item</span><span class='lparen'>(</span><span class='id identifier rubyid_item'>item</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_item'>item</span><span class='period'>.</span><span class='id identifier rubyid_complete?'>complete?</span><span class='rparen'>)</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id="card_id=-instance_method"></span>
      <div class="method_details ">
  <h3 class="signature " id="card_id-instance_method">
  
    #<strong>card_id</strong>  &#x21d2; <tt><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    

  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/trello/checklist.rb', line 18</span>

<span class='kw'>class</span> <span class='const'><span class='object_link'><a href="" title="Trello::Checklist (class)">Checklist</a></span></span> <span class='op'>&lt;</span> <span class='const'><span class='object_link'><a href="BasicData.html" title="Trello::BasicData (class)">BasicData</a></span></span>
  <span class='id identifier rubyid_schema'>schema</span> <span class='kw'>do</span>
    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:id</span><span class='comma'>,</span> <span class='label'>readonly:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>primary_key:</span> <span class='kw'>true</span>

    <span class='comment'># Readonly
</span>    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:check_items</span><span class='comma'>,</span> <span class='label'>readonly:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>checkItems</span><span class='tstring_end'>&#39;</span></span>
    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:board_id</span><span class='comma'>,</span> <span class='label'>readonly:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>idBoard</span><span class='tstring_end'>&#39;</span></span>

    <span class='comment'># Writable
</span>    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:name</span>
    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:position</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>pos</span><span class='tstring_end'>&#39;</span></span>

    <span class='comment'># Writable but for update only
</span>    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:card_id</span><span class='comma'>,</span> <span class='label'>create_only:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>idCard</span><span class='tstring_end'>&#39;</span></span>
    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:source_checklist_id</span><span class='comma'>,</span> <span class='label'>create_only:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>idChecklistSource</span><span class='tstring_end'>&#39;</span></span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_validates_presence_of'>validates_presence_of</span> <span class='symbol'>:id</span>
  <span class='id identifier rubyid_validates_length_of'>validates_length_of</span> <span class='symbol'>:name</span><span class='comma'>,</span> <span class='label'>in:</span> <span class='int'>1</span><span class='op'>..</span><span class='int'>16384</span>

  <span class='comment'># Return a list of items on the checklist.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_items'>items</span>
    <span class='id identifier rubyid_check_items'>check_items</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_item_fields'>item_fields</span><span class='op'>|</span>
      <span class='const'><span class='object_link'><a href="Item.html" title="Trello::Item (class)">Item</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="BasicData.html#initialize-instance_method" title="Trello::BasicData#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_item_fields'>item_fields</span><span class='rparen'>)</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>

  <span class='comment'># Return a reference to the board the checklist is on.
</span>  <span class='id identifier rubyid_one'>one</span> <span class='symbol'>:board</span><span class='comma'>,</span> <span class='label'>path:</span> <span class='symbol'>:checklists</span><span class='comma'>,</span> <span class='label'>using:</span> <span class='symbol'>:board_id</span>

  <span class='comment'># Return a reference to the card the checklist is on.
</span>  <span class='id identifier rubyid_one'>one</span> <span class='symbol'>:card</span><span class='comma'>,</span> <span class='label'>path:</span> <span class='symbol'>:checklists</span><span class='comma'>,</span> <span class='label'>using:</span> <span class='symbol'>:card_id</span>

  <span class='comment'># Add an item to the checklist
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_add_item'>add_item</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_checked'>checked</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_position'>position</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>bottom</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
    <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/checklists/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_id'>id</span><span class='embexpr_end'>}</span><span class='tstring_content'>/checkItems</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='label'>name:</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='label'>checked:</span> <span class='id identifier rubyid_checked'>checked</span><span class='comma'>,</span> <span class='label'>pos:</span> <span class='id identifier rubyid_position'>position</span><span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Update a checklist item&#39;s state, e.g.: &quot;complete&quot; or &quot;incomplete&quot;
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_update_item_state'>update_item_state</span><span class='lparen'>(</span><span class='id identifier rubyid_item_id'>item_id</span><span class='comma'>,</span> <span class='id identifier rubyid_state'>state</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_state'>state</span> <span class='op'>=</span> <span class='lparen'>(</span> <span class='id identifier rubyid_state'>state</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>complete</span><span class='tstring_end'>&#39;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>incomplete</span><span class='tstring_end'>&#39;</span></span> <span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_state'>state</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></span><span class='rparen'>)</span>
    <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_put'>put</span><span class='lparen'>(</span>
        <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/cards/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_card_id'>card_id</span><span class='embexpr_end'>}</span><span class='tstring_content'>/checkItem/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_item_id'>item_id</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
        <span class='label'>state:</span> <span class='id identifier rubyid_state'>state</span>
    <span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Delete a checklist item
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_delete_checklist_item'>delete_checklist_item</span><span class='lparen'>(</span><span class='id identifier rubyid_item_id'>item_id</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/checklists/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_id'>id</span><span class='embexpr_end'>}</span><span class='tstring_content'>/checkItems/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_item_id'>item_id</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Delete a checklist
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span>
    <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/checklists/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_id'>id</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Copy a checklist (i.e., same attributes, items, etc.)
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_copy'>copy</span>
    <span class='id identifier rubyid_checklist_copy'>checklist_copy</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='label'>name:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='label'>board_id:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_board_id'>board_id</span><span class='comma'>,</span> <span class='label'>card_id:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_card_id'>card_id</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_copy_items_to'>copy_items_to</span><span class='lparen'>(</span><span class='id identifier rubyid_checklist_copy'>checklist_copy</span><span class='rparen'>)</span>
    <span class='kw'>return</span> <span class='id identifier rubyid_checklist_copy'>checklist_copy</span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_private'>private</span>
  <span class='kw'>def</span> <span class='id identifier rubyid_copy_items_to'>copy_items_to</span><span class='lparen'>(</span><span class='id identifier rubyid_another_checklist'>another_checklist</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_items'>items</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_item'>item</span><span class='op'>|</span>
      <span class='id identifier rubyid_another_checklist'>another_checklist</span><span class='period'>.</span><span class='id identifier rubyid_add_item'>add_item</span><span class='lparen'>(</span><span class='id identifier rubyid_item'>item</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_item'>item</span><span class='period'>.</span><span class='id identifier rubyid_complete?'>complete?</span><span class='rparen'>)</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id=""></span>
      <div class="method_details ">
  <h3 class="signature " id="check_items-instance_method">
  
    #<strong>check_items</strong>  &#x21d2; <tt>Object</tt>  <span class="extras">(readonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    

  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Object</tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/trello/checklist.rb', line 18</span>

<span class='kw'>class</span> <span class='const'><span class='object_link'><a href="" title="Trello::Checklist (class)">Checklist</a></span></span> <span class='op'>&lt;</span> <span class='const'><span class='object_link'><a href="BasicData.html" title="Trello::BasicData (class)">BasicData</a></span></span>
  <span class='id identifier rubyid_schema'>schema</span> <span class='kw'>do</span>
    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:id</span><span class='comma'>,</span> <span class='label'>readonly:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>primary_key:</span> <span class='kw'>true</span>

    <span class='comment'># Readonly
</span>    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:check_items</span><span class='comma'>,</span> <span class='label'>readonly:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>checkItems</span><span class='tstring_end'>&#39;</span></span>
    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:board_id</span><span class='comma'>,</span> <span class='label'>readonly:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>idBoard</span><span class='tstring_end'>&#39;</span></span>

    <span class='comment'># Writable
</span>    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:name</span>
    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:position</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>pos</span><span class='tstring_end'>&#39;</span></span>

    <span class='comment'># Writable but for update only
</span>    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:card_id</span><span class='comma'>,</span> <span class='label'>create_only:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>idCard</span><span class='tstring_end'>&#39;</span></span>
    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:source_checklist_id</span><span class='comma'>,</span> <span class='label'>create_only:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>idChecklistSource</span><span class='tstring_end'>&#39;</span></span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_validates_presence_of'>validates_presence_of</span> <span class='symbol'>:id</span>
  <span class='id identifier rubyid_validates_length_of'>validates_length_of</span> <span class='symbol'>:name</span><span class='comma'>,</span> <span class='label'>in:</span> <span class='int'>1</span><span class='op'>..</span><span class='int'>16384</span>

  <span class='comment'># Return a list of items on the checklist.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_items'>items</span>
    <span class='id identifier rubyid_check_items'>check_items</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_item_fields'>item_fields</span><span class='op'>|</span>
      <span class='const'><span class='object_link'><a href="Item.html" title="Trello::Item (class)">Item</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="BasicData.html#initialize-instance_method" title="Trello::BasicData#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_item_fields'>item_fields</span><span class='rparen'>)</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>

  <span class='comment'># Return a reference to the board the checklist is on.
</span>  <span class='id identifier rubyid_one'>one</span> <span class='symbol'>:board</span><span class='comma'>,</span> <span class='label'>path:</span> <span class='symbol'>:checklists</span><span class='comma'>,</span> <span class='label'>using:</span> <span class='symbol'>:board_id</span>

  <span class='comment'># Return a reference to the card the checklist is on.
</span>  <span class='id identifier rubyid_one'>one</span> <span class='symbol'>:card</span><span class='comma'>,</span> <span class='label'>path:</span> <span class='symbol'>:checklists</span><span class='comma'>,</span> <span class='label'>using:</span> <span class='symbol'>:card_id</span>

  <span class='comment'># Add an item to the checklist
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_add_item'>add_item</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_checked'>checked</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_position'>position</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>bottom</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
    <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/checklists/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_id'>id</span><span class='embexpr_end'>}</span><span class='tstring_content'>/checkItems</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='label'>name:</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='label'>checked:</span> <span class='id identifier rubyid_checked'>checked</span><span class='comma'>,</span> <span class='label'>pos:</span> <span class='id identifier rubyid_position'>position</span><span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Update a checklist item&#39;s state, e.g.: &quot;complete&quot; or &quot;incomplete&quot;
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_update_item_state'>update_item_state</span><span class='lparen'>(</span><span class='id identifier rubyid_item_id'>item_id</span><span class='comma'>,</span> <span class='id identifier rubyid_state'>state</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_state'>state</span> <span class='op'>=</span> <span class='lparen'>(</span> <span class='id identifier rubyid_state'>state</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>complete</span><span class='tstring_end'>&#39;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>incomplete</span><span class='tstring_end'>&#39;</span></span> <span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_state'>state</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></span><span class='rparen'>)</span>
    <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_put'>put</span><span class='lparen'>(</span>
        <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/cards/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_card_id'>card_id</span><span class='embexpr_end'>}</span><span class='tstring_content'>/checkItem/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_item_id'>item_id</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
        <span class='label'>state:</span> <span class='id identifier rubyid_state'>state</span>
    <span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Delete a checklist item
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_delete_checklist_item'>delete_checklist_item</span><span class='lparen'>(</span><span class='id identifier rubyid_item_id'>item_id</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/checklists/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_id'>id</span><span class='embexpr_end'>}</span><span class='tstring_content'>/checkItems/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_item_id'>item_id</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Delete a checklist
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span>
    <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/checklists/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_id'>id</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Copy a checklist (i.e., same attributes, items, etc.)
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_copy'>copy</span>
    <span class='id identifier rubyid_checklist_copy'>checklist_copy</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='label'>name:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='label'>board_id:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_board_id'>board_id</span><span class='comma'>,</span> <span class='label'>card_id:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_card_id'>card_id</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_copy_items_to'>copy_items_to</span><span class='lparen'>(</span><span class='id identifier rubyid_checklist_copy'>checklist_copy</span><span class='rparen'>)</span>
    <span class='kw'>return</span> <span class='id identifier rubyid_checklist_copy'>checklist_copy</span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_private'>private</span>
  <span class='kw'>def</span> <span class='id identifier rubyid_copy_items_to'>copy_items_to</span><span class='lparen'>(</span><span class='id identifier rubyid_another_checklist'>another_checklist</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_items'>items</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_item'>item</span><span class='op'>|</span>
      <span class='id identifier rubyid_another_checklist'>another_checklist</span><span class='period'>.</span><span class='id identifier rubyid_add_item'>add_item</span><span class='lparen'>(</span><span class='id identifier rubyid_item'>item</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_item'>item</span><span class='period'>.</span><span class='id identifier rubyid_complete?'>complete?</span><span class='rparen'>)</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id=""></span>
      <div class="method_details ">
  <h3 class="signature " id="id-instance_method">
  
    #<strong>id</strong>  &#x21d2; <tt><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></tt>  <span class="extras">(readonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    

  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/trello/checklist.rb', line 18</span>

<span class='kw'>class</span> <span class='const'><span class='object_link'><a href="" title="Trello::Checklist (class)">Checklist</a></span></span> <span class='op'>&lt;</span> <span class='const'><span class='object_link'><a href="BasicData.html" title="Trello::BasicData (class)">BasicData</a></span></span>
  <span class='id identifier rubyid_schema'>schema</span> <span class='kw'>do</span>
    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:id</span><span class='comma'>,</span> <span class='label'>readonly:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>primary_key:</span> <span class='kw'>true</span>

    <span class='comment'># Readonly
</span>    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:check_items</span><span class='comma'>,</span> <span class='label'>readonly:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>checkItems</span><span class='tstring_end'>&#39;</span></span>
    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:board_id</span><span class='comma'>,</span> <span class='label'>readonly:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>idBoard</span><span class='tstring_end'>&#39;</span></span>

    <span class='comment'># Writable
</span>    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:name</span>
    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:position</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>pos</span><span class='tstring_end'>&#39;</span></span>

    <span class='comment'># Writable but for update only
</span>    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:card_id</span><span class='comma'>,</span> <span class='label'>create_only:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>idCard</span><span class='tstring_end'>&#39;</span></span>
    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:source_checklist_id</span><span class='comma'>,</span> <span class='label'>create_only:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>idChecklistSource</span><span class='tstring_end'>&#39;</span></span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_validates_presence_of'>validates_presence_of</span> <span class='symbol'>:id</span>
  <span class='id identifier rubyid_validates_length_of'>validates_length_of</span> <span class='symbol'>:name</span><span class='comma'>,</span> <span class='label'>in:</span> <span class='int'>1</span><span class='op'>..</span><span class='int'>16384</span>

  <span class='comment'># Return a list of items on the checklist.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_items'>items</span>
    <span class='id identifier rubyid_check_items'>check_items</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_item_fields'>item_fields</span><span class='op'>|</span>
      <span class='const'><span class='object_link'><a href="Item.html" title="Trello::Item (class)">Item</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="BasicData.html#initialize-instance_method" title="Trello::BasicData#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_item_fields'>item_fields</span><span class='rparen'>)</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>

  <span class='comment'># Return a reference to the board the checklist is on.
</span>  <span class='id identifier rubyid_one'>one</span> <span class='symbol'>:board</span><span class='comma'>,</span> <span class='label'>path:</span> <span class='symbol'>:checklists</span><span class='comma'>,</span> <span class='label'>using:</span> <span class='symbol'>:board_id</span>

  <span class='comment'># Return a reference to the card the checklist is on.
</span>  <span class='id identifier rubyid_one'>one</span> <span class='symbol'>:card</span><span class='comma'>,</span> <span class='label'>path:</span> <span class='symbol'>:checklists</span><span class='comma'>,</span> <span class='label'>using:</span> <span class='symbol'>:card_id</span>

  <span class='comment'># Add an item to the checklist
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_add_item'>add_item</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_checked'>checked</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_position'>position</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>bottom</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
    <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/checklists/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_id'>id</span><span class='embexpr_end'>}</span><span class='tstring_content'>/checkItems</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='label'>name:</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='label'>checked:</span> <span class='id identifier rubyid_checked'>checked</span><span class='comma'>,</span> <span class='label'>pos:</span> <span class='id identifier rubyid_position'>position</span><span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Update a checklist item&#39;s state, e.g.: &quot;complete&quot; or &quot;incomplete&quot;
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_update_item_state'>update_item_state</span><span class='lparen'>(</span><span class='id identifier rubyid_item_id'>item_id</span><span class='comma'>,</span> <span class='id identifier rubyid_state'>state</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_state'>state</span> <span class='op'>=</span> <span class='lparen'>(</span> <span class='id identifier rubyid_state'>state</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>complete</span><span class='tstring_end'>&#39;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>incomplete</span><span class='tstring_end'>&#39;</span></span> <span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_state'>state</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></span><span class='rparen'>)</span>
    <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_put'>put</span><span class='lparen'>(</span>
        <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/cards/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_card_id'>card_id</span><span class='embexpr_end'>}</span><span class='tstring_content'>/checkItem/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_item_id'>item_id</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
        <span class='label'>state:</span> <span class='id identifier rubyid_state'>state</span>
    <span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Delete a checklist item
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_delete_checklist_item'>delete_checklist_item</span><span class='lparen'>(</span><span class='id identifier rubyid_item_id'>item_id</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/checklists/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_id'>id</span><span class='embexpr_end'>}</span><span class='tstring_content'>/checkItems/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_item_id'>item_id</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Delete a checklist
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span>
    <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/checklists/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_id'>id</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Copy a checklist (i.e., same attributes, items, etc.)
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_copy'>copy</span>
    <span class='id identifier rubyid_checklist_copy'>checklist_copy</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='label'>name:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='label'>board_id:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_board_id'>board_id</span><span class='comma'>,</span> <span class='label'>card_id:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_card_id'>card_id</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_copy_items_to'>copy_items_to</span><span class='lparen'>(</span><span class='id identifier rubyid_checklist_copy'>checklist_copy</span><span class='rparen'>)</span>
    <span class='kw'>return</span> <span class='id identifier rubyid_checklist_copy'>checklist_copy</span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_private'>private</span>
  <span class='kw'>def</span> <span class='id identifier rubyid_copy_items_to'>copy_items_to</span><span class='lparen'>(</span><span class='id identifier rubyid_another_checklist'>another_checklist</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_items'>items</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_item'>item</span><span class='op'>|</span>
      <span class='id identifier rubyid_another_checklist'>another_checklist</span><span class='period'>.</span><span class='id identifier rubyid_add_item'>add_item</span><span class='lparen'>(</span><span class='id identifier rubyid_item'>item</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_item'>item</span><span class='period'>.</span><span class='id identifier rubyid_complete?'>complete?</span><span class='rparen'>)</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id="name=-instance_method"></span>
      <div class="method_details ">
  <h3 class="signature " id="name-instance_method">
  
    #<strong>name</strong>  &#x21d2; <tt><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    

  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/trello/checklist.rb', line 18</span>

<span class='kw'>class</span> <span class='const'><span class='object_link'><a href="" title="Trello::Checklist (class)">Checklist</a></span></span> <span class='op'>&lt;</span> <span class='const'><span class='object_link'><a href="BasicData.html" title="Trello::BasicData (class)">BasicData</a></span></span>
  <span class='id identifier rubyid_schema'>schema</span> <span class='kw'>do</span>
    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:id</span><span class='comma'>,</span> <span class='label'>readonly:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>primary_key:</span> <span class='kw'>true</span>

    <span class='comment'># Readonly
</span>    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:check_items</span><span class='comma'>,</span> <span class='label'>readonly:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>checkItems</span><span class='tstring_end'>&#39;</span></span>
    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:board_id</span><span class='comma'>,</span> <span class='label'>readonly:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>idBoard</span><span class='tstring_end'>&#39;</span></span>

    <span class='comment'># Writable
</span>    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:name</span>
    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:position</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>pos</span><span class='tstring_end'>&#39;</span></span>

    <span class='comment'># Writable but for update only
</span>    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:card_id</span><span class='comma'>,</span> <span class='label'>create_only:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>idCard</span><span class='tstring_end'>&#39;</span></span>
    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:source_checklist_id</span><span class='comma'>,</span> <span class='label'>create_only:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>idChecklistSource</span><span class='tstring_end'>&#39;</span></span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_validates_presence_of'>validates_presence_of</span> <span class='symbol'>:id</span>
  <span class='id identifier rubyid_validates_length_of'>validates_length_of</span> <span class='symbol'>:name</span><span class='comma'>,</span> <span class='label'>in:</span> <span class='int'>1</span><span class='op'>..</span><span class='int'>16384</span>

  <span class='comment'># Return a list of items on the checklist.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_items'>items</span>
    <span class='id identifier rubyid_check_items'>check_items</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_item_fields'>item_fields</span><span class='op'>|</span>
      <span class='const'><span class='object_link'><a href="Item.html" title="Trello::Item (class)">Item</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="BasicData.html#initialize-instance_method" title="Trello::BasicData#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_item_fields'>item_fields</span><span class='rparen'>)</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>

  <span class='comment'># Return a reference to the board the checklist is on.
</span>  <span class='id identifier rubyid_one'>one</span> <span class='symbol'>:board</span><span class='comma'>,</span> <span class='label'>path:</span> <span class='symbol'>:checklists</span><span class='comma'>,</span> <span class='label'>using:</span> <span class='symbol'>:board_id</span>

  <span class='comment'># Return a reference to the card the checklist is on.
</span>  <span class='id identifier rubyid_one'>one</span> <span class='symbol'>:card</span><span class='comma'>,</span> <span class='label'>path:</span> <span class='symbol'>:checklists</span><span class='comma'>,</span> <span class='label'>using:</span> <span class='symbol'>:card_id</span>

  <span class='comment'># Add an item to the checklist
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_add_item'>add_item</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_checked'>checked</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_position'>position</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>bottom</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
    <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/checklists/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_id'>id</span><span class='embexpr_end'>}</span><span class='tstring_content'>/checkItems</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='label'>name:</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='label'>checked:</span> <span class='id identifier rubyid_checked'>checked</span><span class='comma'>,</span> <span class='label'>pos:</span> <span class='id identifier rubyid_position'>position</span><span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Update a checklist item&#39;s state, e.g.: &quot;complete&quot; or &quot;incomplete&quot;
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_update_item_state'>update_item_state</span><span class='lparen'>(</span><span class='id identifier rubyid_item_id'>item_id</span><span class='comma'>,</span> <span class='id identifier rubyid_state'>state</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_state'>state</span> <span class='op'>=</span> <span class='lparen'>(</span> <span class='id identifier rubyid_state'>state</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>complete</span><span class='tstring_end'>&#39;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>incomplete</span><span class='tstring_end'>&#39;</span></span> <span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_state'>state</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></span><span class='rparen'>)</span>
    <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_put'>put</span><span class='lparen'>(</span>
        <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/cards/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_card_id'>card_id</span><span class='embexpr_end'>}</span><span class='tstring_content'>/checkItem/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_item_id'>item_id</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
        <span class='label'>state:</span> <span class='id identifier rubyid_state'>state</span>
    <span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Delete a checklist item
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_delete_checklist_item'>delete_checklist_item</span><span class='lparen'>(</span><span class='id identifier rubyid_item_id'>item_id</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/checklists/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_id'>id</span><span class='embexpr_end'>}</span><span class='tstring_content'>/checkItems/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_item_id'>item_id</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Delete a checklist
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span>
    <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/checklists/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_id'>id</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Copy a checklist (i.e., same attributes, items, etc.)
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_copy'>copy</span>
    <span class='id identifier rubyid_checklist_copy'>checklist_copy</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='label'>name:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='label'>board_id:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_board_id'>board_id</span><span class='comma'>,</span> <span class='label'>card_id:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_card_id'>card_id</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_copy_items_to'>copy_items_to</span><span class='lparen'>(</span><span class='id identifier rubyid_checklist_copy'>checklist_copy</span><span class='rparen'>)</span>
    <span class='kw'>return</span> <span class='id identifier rubyid_checklist_copy'>checklist_copy</span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_private'>private</span>
  <span class='kw'>def</span> <span class='id identifier rubyid_copy_items_to'>copy_items_to</span><span class='lparen'>(</span><span class='id identifier rubyid_another_checklist'>another_checklist</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_items'>items</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_item'>item</span><span class='op'>|</span>
      <span class='id identifier rubyid_another_checklist'>another_checklist</span><span class='period'>.</span><span class='id identifier rubyid_add_item'>add_item</span><span class='lparen'>(</span><span class='id identifier rubyid_item'>item</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_item'>item</span><span class='period'>.</span><span class='id identifier rubyid_complete?'>complete?</span><span class='rparen'>)</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id="position=-instance_method"></span>
      <div class="method_details ">
  <h3 class="signature " id="position-instance_method">
  
    #<strong>position</strong>  &#x21d2; <tt>Object</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    

  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Object</tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/trello/checklist.rb', line 18</span>

<span class='kw'>class</span> <span class='const'><span class='object_link'><a href="" title="Trello::Checklist (class)">Checklist</a></span></span> <span class='op'>&lt;</span> <span class='const'><span class='object_link'><a href="BasicData.html" title="Trello::BasicData (class)">BasicData</a></span></span>
  <span class='id identifier rubyid_schema'>schema</span> <span class='kw'>do</span>
    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:id</span><span class='comma'>,</span> <span class='label'>readonly:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>primary_key:</span> <span class='kw'>true</span>

    <span class='comment'># Readonly
</span>    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:check_items</span><span class='comma'>,</span> <span class='label'>readonly:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>checkItems</span><span class='tstring_end'>&#39;</span></span>
    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:board_id</span><span class='comma'>,</span> <span class='label'>readonly:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>idBoard</span><span class='tstring_end'>&#39;</span></span>

    <span class='comment'># Writable
</span>    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:name</span>
    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:position</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>pos</span><span class='tstring_end'>&#39;</span></span>

    <span class='comment'># Writable but for update only
</span>    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:card_id</span><span class='comma'>,</span> <span class='label'>create_only:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>idCard</span><span class='tstring_end'>&#39;</span></span>
    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:source_checklist_id</span><span class='comma'>,</span> <span class='label'>create_only:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>idChecklistSource</span><span class='tstring_end'>&#39;</span></span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_validates_presence_of'>validates_presence_of</span> <span class='symbol'>:id</span>
  <span class='id identifier rubyid_validates_length_of'>validates_length_of</span> <span class='symbol'>:name</span><span class='comma'>,</span> <span class='label'>in:</span> <span class='int'>1</span><span class='op'>..</span><span class='int'>16384</span>

  <span class='comment'># Return a list of items on the checklist.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_items'>items</span>
    <span class='id identifier rubyid_check_items'>check_items</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_item_fields'>item_fields</span><span class='op'>|</span>
      <span class='const'><span class='object_link'><a href="Item.html" title="Trello::Item (class)">Item</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="BasicData.html#initialize-instance_method" title="Trello::BasicData#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_item_fields'>item_fields</span><span class='rparen'>)</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>

  <span class='comment'># Return a reference to the board the checklist is on.
</span>  <span class='id identifier rubyid_one'>one</span> <span class='symbol'>:board</span><span class='comma'>,</span> <span class='label'>path:</span> <span class='symbol'>:checklists</span><span class='comma'>,</span> <span class='label'>using:</span> <span class='symbol'>:board_id</span>

  <span class='comment'># Return a reference to the card the checklist is on.
</span>  <span class='id identifier rubyid_one'>one</span> <span class='symbol'>:card</span><span class='comma'>,</span> <span class='label'>path:</span> <span class='symbol'>:checklists</span><span class='comma'>,</span> <span class='label'>using:</span> <span class='symbol'>:card_id</span>

  <span class='comment'># Add an item to the checklist
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_add_item'>add_item</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_checked'>checked</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_position'>position</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>bottom</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
    <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/checklists/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_id'>id</span><span class='embexpr_end'>}</span><span class='tstring_content'>/checkItems</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='label'>name:</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='label'>checked:</span> <span class='id identifier rubyid_checked'>checked</span><span class='comma'>,</span> <span class='label'>pos:</span> <span class='id identifier rubyid_position'>position</span><span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Update a checklist item&#39;s state, e.g.: &quot;complete&quot; or &quot;incomplete&quot;
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_update_item_state'>update_item_state</span><span class='lparen'>(</span><span class='id identifier rubyid_item_id'>item_id</span><span class='comma'>,</span> <span class='id identifier rubyid_state'>state</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_state'>state</span> <span class='op'>=</span> <span class='lparen'>(</span> <span class='id identifier rubyid_state'>state</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>complete</span><span class='tstring_end'>&#39;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>incomplete</span><span class='tstring_end'>&#39;</span></span> <span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_state'>state</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></span><span class='rparen'>)</span>
    <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_put'>put</span><span class='lparen'>(</span>
        <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/cards/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_card_id'>card_id</span><span class='embexpr_end'>}</span><span class='tstring_content'>/checkItem/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_item_id'>item_id</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
        <span class='label'>state:</span> <span class='id identifier rubyid_state'>state</span>
    <span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Delete a checklist item
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_delete_checklist_item'>delete_checklist_item</span><span class='lparen'>(</span><span class='id identifier rubyid_item_id'>item_id</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/checklists/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_id'>id</span><span class='embexpr_end'>}</span><span class='tstring_content'>/checkItems/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_item_id'>item_id</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Delete a checklist
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span>
    <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/checklists/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_id'>id</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Copy a checklist (i.e., same attributes, items, etc.)
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_copy'>copy</span>
    <span class='id identifier rubyid_checklist_copy'>checklist_copy</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='label'>name:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='label'>board_id:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_board_id'>board_id</span><span class='comma'>,</span> <span class='label'>card_id:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_card_id'>card_id</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_copy_items_to'>copy_items_to</span><span class='lparen'>(</span><span class='id identifier rubyid_checklist_copy'>checklist_copy</span><span class='rparen'>)</span>
    <span class='kw'>return</span> <span class='id identifier rubyid_checklist_copy'>checklist_copy</span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_private'>private</span>
  <span class='kw'>def</span> <span class='id identifier rubyid_copy_items_to'>copy_items_to</span><span class='lparen'>(</span><span class='id identifier rubyid_another_checklist'>another_checklist</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_items'>items</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_item'>item</span><span class='op'>|</span>
      <span class='id identifier rubyid_another_checklist'>another_checklist</span><span class='period'>.</span><span class='id identifier rubyid_add_item'>add_item</span><span class='lparen'>(</span><span class='id identifier rubyid_item'>item</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_item'>item</span><span class='period'>.</span><span class='id identifier rubyid_complete?'>complete?</span><span class='rparen'>)</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id=""></span>
      <div class="method_details ">
  <h3 class="signature " id="source_checklist_id=-instance_method">
  
    #<strong>source_checklist_id=</strong>(value)  &#x21d2; <tt><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></tt>  <span class="extras">(writeonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    

  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/trello/checklist.rb', line 18</span>

<span class='kw'>class</span> <span class='const'><span class='object_link'><a href="" title="Trello::Checklist (class)">Checklist</a></span></span> <span class='op'>&lt;</span> <span class='const'><span class='object_link'><a href="BasicData.html" title="Trello::BasicData (class)">BasicData</a></span></span>
  <span class='id identifier rubyid_schema'>schema</span> <span class='kw'>do</span>
    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:id</span><span class='comma'>,</span> <span class='label'>readonly:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>primary_key:</span> <span class='kw'>true</span>

    <span class='comment'># Readonly
</span>    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:check_items</span><span class='comma'>,</span> <span class='label'>readonly:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>checkItems</span><span class='tstring_end'>&#39;</span></span>
    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:board_id</span><span class='comma'>,</span> <span class='label'>readonly:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>idBoard</span><span class='tstring_end'>&#39;</span></span>

    <span class='comment'># Writable
</span>    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:name</span>
    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:position</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>pos</span><span class='tstring_end'>&#39;</span></span>

    <span class='comment'># Writable but for update only
</span>    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:card_id</span><span class='comma'>,</span> <span class='label'>create_only:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>idCard</span><span class='tstring_end'>&#39;</span></span>
    <span class='id identifier rubyid_attribute'>attribute</span> <span class='symbol'>:source_checklist_id</span><span class='comma'>,</span> <span class='label'>create_only:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>remote_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>idChecklistSource</span><span class='tstring_end'>&#39;</span></span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_validates_presence_of'>validates_presence_of</span> <span class='symbol'>:id</span>
  <span class='id identifier rubyid_validates_length_of'>validates_length_of</span> <span class='symbol'>:name</span><span class='comma'>,</span> <span class='label'>in:</span> <span class='int'>1</span><span class='op'>..</span><span class='int'>16384</span>

  <span class='comment'># Return a list of items on the checklist.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_items'>items</span>
    <span class='id identifier rubyid_check_items'>check_items</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_item_fields'>item_fields</span><span class='op'>|</span>
      <span class='const'><span class='object_link'><a href="Item.html" title="Trello::Item (class)">Item</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="BasicData.html#initialize-instance_method" title="Trello::BasicData#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_item_fields'>item_fields</span><span class='rparen'>)</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>

  <span class='comment'># Return a reference to the board the checklist is on.
</span>  <span class='id identifier rubyid_one'>one</span> <span class='symbol'>:board</span><span class='comma'>,</span> <span class='label'>path:</span> <span class='symbol'>:checklists</span><span class='comma'>,</span> <span class='label'>using:</span> <span class='symbol'>:board_id</span>

  <span class='comment'># Return a reference to the card the checklist is on.
</span>  <span class='id identifier rubyid_one'>one</span> <span class='symbol'>:card</span><span class='comma'>,</span> <span class='label'>path:</span> <span class='symbol'>:checklists</span><span class='comma'>,</span> <span class='label'>using:</span> <span class='symbol'>:card_id</span>

  <span class='comment'># Add an item to the checklist
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_add_item'>add_item</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_checked'>checked</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_position'>position</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>bottom</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
    <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/checklists/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_id'>id</span><span class='embexpr_end'>}</span><span class='tstring_content'>/checkItems</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='label'>name:</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='label'>checked:</span> <span class='id identifier rubyid_checked'>checked</span><span class='comma'>,</span> <span class='label'>pos:</span> <span class='id identifier rubyid_position'>position</span><span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Update a checklist item&#39;s state, e.g.: &quot;complete&quot; or &quot;incomplete&quot;
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_update_item_state'>update_item_state</span><span class='lparen'>(</span><span class='id identifier rubyid_item_id'>item_id</span><span class='comma'>,</span> <span class='id identifier rubyid_state'>state</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_state'>state</span> <span class='op'>=</span> <span class='lparen'>(</span> <span class='id identifier rubyid_state'>state</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>complete</span><span class='tstring_end'>&#39;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>incomplete</span><span class='tstring_end'>&#39;</span></span> <span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_state'>state</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></span><span class='rparen'>)</span>
    <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_put'>put</span><span class='lparen'>(</span>
        <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/cards/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_card_id'>card_id</span><span class='embexpr_end'>}</span><span class='tstring_content'>/checkItem/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_item_id'>item_id</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
        <span class='label'>state:</span> <span class='id identifier rubyid_state'>state</span>
    <span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Delete a checklist item
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_delete_checklist_item'>delete_checklist_item</span><span class='lparen'>(</span><span class='id identifier rubyid_item_id'>item_id</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/checklists/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_id'>id</span><span class='embexpr_end'>}</span><span class='tstring_content'>/checkItems/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_item_id'>item_id</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Delete a checklist
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span>
    <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/checklists/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_id'>id</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Copy a checklist (i.e., same attributes, items, etc.)
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_copy'>copy</span>
    <span class='id identifier rubyid_checklist_copy'>checklist_copy</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='label'>name:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='label'>board_id:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_board_id'>board_id</span><span class='comma'>,</span> <span class='label'>card_id:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_card_id'>card_id</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_copy_items_to'>copy_items_to</span><span class='lparen'>(</span><span class='id identifier rubyid_checklist_copy'>checklist_copy</span><span class='rparen'>)</span>
    <span class='kw'>return</span> <span class='id identifier rubyid_checklist_copy'>checklist_copy</span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_private'>private</span>
  <span class='kw'>def</span> <span class='id identifier rubyid_copy_items_to'>copy_items_to</span><span class='lparen'>(</span><span class='id identifier rubyid_another_checklist'>another_checklist</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_items'>items</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_item'>item</span><span class='op'>|</span>
      <span class='id identifier rubyid_another_checklist'>another_checklist</span><span class='period'>.</span><span class='id identifier rubyid_add_item'>add_item</span><span class='lparen'>(</span><span class='id identifier rubyid_item'>item</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_item'>item</span><span class='period'>.</span><span class='id identifier rubyid_complete?'>complete?</span><span class='rparen'>)</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>


  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="add_item-instance_method">
  
    #<strong>add_item</strong>(name, checked = false, position = &#39;bottom&#39;)  &#x21d2; <tt>Object</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Add an item to the checklist</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


52
53
54</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/trello/checklist.rb', line 52</span>

<span class='kw'>def</span> <span class='id identifier rubyid_add_item'>add_item</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_checked'>checked</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_position'>position</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>bottom</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
  <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/checklists/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_id'>id</span><span class='embexpr_end'>}</span><span class='tstring_content'>/checkItems</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='label'>name:</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='label'>checked:</span> <span class='id identifier rubyid_checked'>checked</span><span class='comma'>,</span> <span class='label'>pos:</span> <span class='id identifier rubyid_position'>position</span><span class='rbrace'>}</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="copy-instance_method">
  
    #<strong>copy</strong>  &#x21d2; <tt>Object</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Copy a checklist (i.e., same attributes, items, etc.)</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


76
77
78
79
80</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/trello/checklist.rb', line 76</span>

<span class='kw'>def</span> <span class='id identifier rubyid_copy'>copy</span>
  <span class='id identifier rubyid_checklist_copy'>checklist_copy</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='label'>name:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='label'>board_id:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_board_id'>board_id</span><span class='comma'>,</span> <span class='label'>card_id:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_card_id'>card_id</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_copy_items_to'>copy_items_to</span><span class='lparen'>(</span><span class='id identifier rubyid_checklist_copy'>checklist_copy</span><span class='rparen'>)</span>
  <span class='kw'>return</span> <span class='id identifier rubyid_checklist_copy'>checklist_copy</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="delete-instance_method">
  
    #<strong>delete</strong>  &#x21d2; <tt>Object</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Delete a checklist</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


71
72
73</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/trello/checklist.rb', line 71</span>

<span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span>
  <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/checklists/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_id'>id</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="delete_checklist_item-instance_method">
  
    #<strong>delete_checklist_item</strong>(item_id)  &#x21d2; <tt>Object</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Delete a checklist item</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


66
67
68</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/trello/checklist.rb', line 66</span>

<span class='kw'>def</span> <span class='id identifier rubyid_delete_checklist_item'>delete_checklist_item</span><span class='lparen'>(</span><span class='id identifier rubyid_item_id'>item_id</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/checklists/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_id'>id</span><span class='embexpr_end'>}</span><span class='tstring_content'>/checkItems/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_item_id'>item_id</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="items-instance_method">
  
    #<strong>items</strong>  &#x21d2; <tt>Object</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Return a list of items on the checklist.</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


39
40
41
42
43</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/trello/checklist.rb', line 39</span>

<span class='kw'>def</span> <span class='id identifier rubyid_items'>items</span>
  <span class='id identifier rubyid_check_items'>check_items</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_item_fields'>item_fields</span><span class='op'>|</span>
    <span class='const'><span class='object_link'><a href="Item.html" title="Trello::Item (class)">Item</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="BasicData.html#initialize-instance_method" title="Trello::BasicData#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_item_fields'>item_fields</span><span class='rparen'>)</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="update_item_state-instance_method">
  
    #<strong>update_item_state</strong>(item_id, state)  &#x21d2; <tt>Object</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Update a checklist item&#39;s state, e.g.: “complete” or “incomplete”</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


57
58
59
60
61
62
63</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/trello/checklist.rb', line 57</span>

<span class='kw'>def</span> <span class='id identifier rubyid_update_item_state'>update_item_state</span><span class='lparen'>(</span><span class='id identifier rubyid_item_id'>item_id</span><span class='comma'>,</span> <span class='id identifier rubyid_state'>state</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_state'>state</span> <span class='op'>=</span> <span class='lparen'>(</span> <span class='id identifier rubyid_state'>state</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>complete</span><span class='tstring_end'>&#39;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>incomplete</span><span class='tstring_end'>&#39;</span></span> <span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_state'>state</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></span><span class='rparen'>)</span>
  <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_put'>put</span><span class='lparen'>(</span>
      <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/cards/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_card_id'>card_id</span><span class='embexpr_end'>}</span><span class='tstring_content'>/checkItem/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_item_id'>item_id</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
      <span class='label'>state:</span> <span class='id identifier rubyid_state'>state</span>
  <span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>

      <div id="footer">
  Generated on Tue Nov 10 16:31:56 2020 by
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.9.25 (ruby-2.6.6).
</div>

    </div>
  </body>
</html>