title: How do a rename a file using the Google Drive API for Ruby?
body: <p>This seems like a basic question, but I'm well into my second day now :(</p>
  
  <p>I'm using the Google Drive Ruby Api here: <a href="https://github.com/google/google-api-ruby-client" rel="noreferrer">https://github.com/google/google-api-ruby-client</a> but the basic file examples in the README appear to be well out of date. In particular, calls to <code>Drive.update_file</code> don't take anything like the parameters shown.</p>
  
  <p>So far, I can get hold of an authorized DriveService:</p>
  
  <pre><code>drive = Google::Apis::DriveV3::DriveService.new
  drive.authorization = Google::Auth.get_application_default(['https://www.googleapis.com/auth/drive'])
  </code></pre>
  
  <p>I can get a File:</p>
  
  <pre><code>file_id = 'string-of-stuff'
  file = drive.get_file file_id
  </code></pre>
  
  <p>I can set attributes on the File object that look okay:</p>
  
  <pre><code>file.update!(name: 'My new name')
  </code></pre>
  
  <p>But, I can't figure out how to get the update/patch to actually work after that. The README suggests <code>drive.update_file(file)</code>, but that just explodes with a type error. </p>
  
  <pre><code>TypeError: Can't convert Google::Apis::DriveV3::File into String or Array.
  </code></pre>
  
  <p>Looking at the code, <code>#update_file</code> actually expects a <code>file_id</code> as the first param.</p>
  
  <p>I've tried all sorts of variations based on the README, like:</p>
  
  <pre><code>drive.update_file(file_id, {name: 'New name'})
  </code></pre>
  
  <p>or: </p>
  
  <pre><code>drive.update_file(file_id, {title: 'New name'})
  </code></pre>
  
  <p>or (looking at the code):</p>
  
  <pre><code>drive.update_file(file_id, fields: {title: 'New name'})
  </code></pre>
  
  <p>or even:</p>
  
  <pre><code>drive.update_file(file_id, file)
  </code></pre>
  
  <p>which explodes with:</p>
  
  <pre><code>Google::Apis::ClientError: fieldNotWritable: The resource body includes fields which are not directly writable.
  </code></pre>
  
  <p>But nothing works for me. Has anyone used this library? Everything else seems fairly straightforward, but this is just HARD.</p>