This commit is contained in:
Steve Bazyl 2016-01-22 11:23:23 -08:00
commit 3d4ec29fef
1 changed files with 10 additions and 1 deletions

View File

@ -139,7 +139,7 @@ to replace. For example:
```ruby ```ruby
file = {id: '123', title: 'My document', labels: { starred: true }} file = {id: '123', title: 'My document', labels: { starred: true }}
file = drive.insert_file(file) # Returns a Drive::File instance file = drive.create_file(file, {}) # Returns a Drive::File instance
``` ```
is equivalent to: is equivalent to:
@ -150,6 +150,15 @@ file.labels = Drive::File::Labels.new(starred: true)
file = drive.update_file(file) # Returns a Drive::File instance file = drive.update_file(file) # Returns a Drive::File instance
``` ```
IMPORTANT: Be careful when supplying hashes for request objects. If it is the last argument to a method, ruby will interpret the hash as keyword arguments. To prevent this, appending an empty hash as an extra parameter will avoid misinterpretation.
```ruby
file = {id: '123', title: 'My document', labels: { starred: true }}
file = drive.create_file(file) # Raises ArgumentError: unknown keywords: id, title, labels
file = drive.create_file(file, {}) # Returns a Drive::File instance
```
## Authorization ## Authorization
[OAuth 2](https://developers.google.com/accounts/docs/OAuth2) is used to authorize applications. This library uses [OAuth 2](https://developers.google.com/accounts/docs/OAuth2) is used to authorize applications. This library uses