dropbox_api 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +1 -0
- data/README.md +33 -0
- data/TODO.md +2 -1
- data/lib/dropbox_api/endpoints/files/upload_session_append_v2.rb +16 -1
- data/lib/dropbox_api/metadata/upload_session_cursor.rb +4 -0
- data/lib/dropbox_api/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a62250d1f36ff29c61f2afcd4090bf14413e96f1
|
4
|
+
data.tar.gz: 5e7ada2b458307e520178183156239dc3a65647f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b092abd284615e06589ebecadb8858f2cbb5b8bc0507a42a01b477fe90d07d6be89550b31ff30f5b626622c1ea12cf868d70ad1743d89e0ef45a23cfbc8fd1d
|
7
|
+
data.tar.gz: dfd330a56e1773929a6121947ef48f29974b134daf112fb7195cb74e3846a9c808066e4e436a3483f737c43c145fc3dc4e3ac52673a11201984da4f33aa504b3
|
data/.yardopts
CHANGED
data/README.md
CHANGED
@@ -123,6 +123,39 @@ perform API calls. You can check the class' documentation to find
|
|
123
123
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
124
124
|
`bin/console` for an interactive prompt that will allow you to experiment.
|
125
125
|
|
126
|
+
### Testing
|
127
|
+
|
128
|
+
I recommend you to use a test account other than your main one.
|
129
|
+
|
130
|
+
We use VCR to record the HTTP calls to Dropbox, however we sometimes need to
|
131
|
+
regenerate the cassettes. Let's take `list_folder` as an example to show what
|
132
|
+
would be the procedure to do so:
|
133
|
+
|
134
|
+
1. Manually delete the existing cassettes in
|
135
|
+
`spec/fixtures/vcr_cassettes/list_folder/*.yml`.
|
136
|
+
|
137
|
+
2. Run the task to build the scaffolding in your Dropbox account so the tests
|
138
|
+
will pass. If it doesn't exist you may need to write it yourself, check
|
139
|
+
the `DropboxScaffoldBuilder` class to find all existing scaffold builders.
|
140
|
+
|
141
|
+
```text
|
142
|
+
DROPBOX_OAUTH_BEARER=YOUR_AUTH_BEARER rake test:build_scaffold[list_folder]
|
143
|
+
```
|
144
|
+
|
145
|
+
3. Run the tests and the cassettes will be written:
|
146
|
+
|
147
|
+
```text
|
148
|
+
DROPBOX_OAUTH_BEARER=YOUR_AUTH_BEARER rspec spec/endpoints/files/list_folder_spec.rb
|
149
|
+
```
|
150
|
+
|
151
|
+
The OAuth bearer shouldn't have been recorded in the cassette and it should've
|
152
|
+
been filtered. However, you may want to double check before pushing your
|
153
|
+
updates to Github.
|
154
|
+
|
155
|
+
Tip: You can simply run `export DROPBOX_OAUTH_BEARER=YOUR_AUTH_BEARER` at
|
156
|
+
the beginning of your work session so you don't need to prefix it in every
|
157
|
+
command line.
|
158
|
+
|
126
159
|
## Contributing
|
127
160
|
|
128
161
|
Any help will be much appreciated. The easiest way to help is to implement one
|
data/TODO.md
CHANGED
@@ -7,7 +7,8 @@
|
|
7
7
|
|
8
8
|
# Upcoming
|
9
9
|
|
10
|
-
TOKEN:
|
10
|
+
TOKEN: f0QNQhb3tLAAAAAAAAAACtK5eS9DgRPDzDSLcrIrkbY07buAw-sMRP9tjZeoOP08
|
11
|
+
Old token: VofXAX8DO1sAAAAAAAAEEyqrmzbYmFVaDQKj48yVUfhyhfOomXiG8emqP1xQGRnJ
|
11
12
|
|
12
13
|
- Create website with comparison with other libraries.
|
13
14
|
- Implement PermissionDeniedReason
|
@@ -13,8 +13,21 @@ module DropboxApi::Endpoints::Files
|
|
13
13
|
#
|
14
14
|
# A single request should not upload more than 150 MB of file contents.
|
15
15
|
#
|
16
|
+
# Calling this method may update the cursor received. In particular, the
|
17
|
+
# offset variable will be increased to match the new position. This allows
|
18
|
+
# you to make subsequent calls to the endpoint using the same `cursor`, as
|
19
|
+
# you can see in the example.
|
20
|
+
#
|
21
|
+
# @example
|
22
|
+
# # Rely on the offset position updated by `upload_session_append_v2`
|
23
|
+
# client = DropboxApi::Client.new
|
24
|
+
# cursor = client.upload_session_start('abc') # cursor.offset => 3
|
25
|
+
# client.upload_session_append_v2(cursor, 'def') # cursor.offset => 6
|
26
|
+
# client.upload_session_append_v2(cursor, 'ghi') # cursor.offset => 9
|
27
|
+
# client.upload_session_finish(...)
|
16
28
|
# @param cursor [DropboxApi::Metadata::UploadSessionCursor] Contains the
|
17
|
-
# upload session ID and the offset.
|
29
|
+
# upload session ID and the offset. This cursor will have its offset
|
30
|
+
# updated after a successful call.
|
18
31
|
# @option options close [Boolean] If +true+, the current session will be
|
19
32
|
# closed, at which point you won't be able to call
|
20
33
|
# {Client#upload_session_append_v2} anymore with the current session.
|
@@ -28,6 +41,8 @@ module DropboxApi::Endpoints::Files
|
|
28
41
|
perform_request(options.merge({
|
29
42
|
:cursor => cursor.to_hash
|
30
43
|
}), content)
|
44
|
+
|
45
|
+
cursor.offset += content.bytesize
|
31
46
|
end
|
32
47
|
end
|
33
48
|
end
|
data/lib/dropbox_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dropbox_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jesús Burgos
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -306,7 +306,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
306
306
|
version: '0'
|
307
307
|
requirements: []
|
308
308
|
rubyforge_project:
|
309
|
-
rubygems_version: 2.
|
309
|
+
rubygems_version: 2.6.11
|
310
310
|
signing_key:
|
311
311
|
specification_version: 4
|
312
312
|
summary: Library for communicating with Dropbox API v2
|