dropbox_api 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5dde8e23c02270cb1b1cc29c059d03ae27b9160f
4
- data.tar.gz: d398b3b9c4fc2edc3f190bea2a35e9dbaf4ae0fd
3
+ metadata.gz: a62250d1f36ff29c61f2afcd4090bf14413e96f1
4
+ data.tar.gz: 5e7ada2b458307e520178183156239dc3a65647f
5
5
  SHA512:
6
- metadata.gz: 4f174851e2e863c779082a8d5fdfa39b46ac62effb31215514a01f0ed34d5bfabe33da4fd0a7df06b331c4999e8f3683c57e712757e1a49e31ced9176d7ad4cc
7
- data.tar.gz: 28efd74cffc713594babe9a55318c447d541fad2ac5d8c1c3acde120b1f034fa16ecb6264c90545c9ef506e6daf6d3f26d7bdb95424c6193d5eea15771ad2a72
6
+ metadata.gz: 7b092abd284615e06589ebecadb8858f2cbb5b8bc0507a42a01b477fe90d07d6be89550b31ff30f5b626622c1ea12cf868d70ad1743d89e0ef45a23cfbc8fd1d
7
+ data.tar.gz: dfd330a56e1773929a6121947ef48f29974b134daf112fb7195cb74e3846a9c808066e4e436a3483f737c43c145fc3dc4e3ac52673a11201984da4f33aa504b3
data/.yardopts CHANGED
@@ -2,6 +2,7 @@
2
2
  --plugin rspec
3
3
  lib/**/*.rb
4
4
  spec/endpoints/**/*_spec.rb
5
+ spec/support/dropbox_scaffold_builder.rb
5
6
  --markup=markdown
6
7
  --markup-provider=redcarpet
7
8
  -
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: VofXAX8DO1sAAAAAAAAEEyqrmzbYmFVaDQKj48yVUfhyhfOomXiG8emqP1xQGRnJ
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
@@ -7,5 +7,9 @@ module DropboxApi::Metadata
7
7
  class UploadSessionCursor < Base
8
8
  field :session_id, String
9
9
  field :offset, Integer
10
+
11
+ def offset=(n)
12
+ self[:offset] = n
13
+ end
10
14
  end
11
15
  end
@@ -1,3 +1,3 @@
1
1
  module DropboxApi
2
- VERSION = '0.1.7'.freeze
2
+ VERSION = '0.1.8'.freeze
3
3
  end
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.7
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-06-10 00:00:00.000000000 Z
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.5.1
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