boxr 1.3.0 → 1.4.0
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/README.md +2 -2
- data/lib/boxr/client.rb +9 -2
- data/lib/boxr/files.rb +2 -2
- data/lib/boxr/folders.rb +2 -2
- data/lib/boxr/version.rb +1 -1
- data/spec/boxr_spec.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 070f7c0d6b0a19d622880a61080cc53f8f648545
|
4
|
+
data.tar.gz: ab51a80c8118f7bdf048db7285cf04deaf9772ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07cf929137f8b6bbb9877b4643861a6ab430fbf957f575fe06a3f9b18b57b81317f3c9b1bfeffbef97fcb9292a30daca50c5da0b06d3740acecaa036fb1aae1a
|
7
|
+
data.tar.gz: ee5d20a7c16d3e629e9d6522b268b4749b44a337a66e8a708f2512c05d5be73b9cc88ab1d752cd006bc70c8bcc38aba085b73e11b7dd6f8dc81a49181bf8592c
|
data/README.md
CHANGED
@@ -163,7 +163,7 @@ delete_folder(folder, recursive: false, if_match: nil)
|
|
163
163
|
|
164
164
|
copy_folder(folder, dest_folder, name: nil)
|
165
165
|
|
166
|
-
create_shared_link_for_folder(folder, access: nil, unshared_at: nil, can_download: nil, can_preview: nil)
|
166
|
+
create_shared_link_for_folder(folder, access: nil, unshared_at: nil, can_download: nil, can_preview: nil, password: nil)
|
167
167
|
|
168
168
|
disable_shared_link_for_folder(folder)
|
169
169
|
|
@@ -217,7 +217,7 @@ copy_file(file, parent, name: nil)
|
|
217
217
|
|
218
218
|
thumbnail(file, min_height: nil, min_width: nil, max_height: nil, max_width: nil)
|
219
219
|
|
220
|
-
create_shared_link_for_file(file, access: nil, unshared_at: nil, can_download: nil, can_preview: nil)
|
220
|
+
create_shared_link_for_file(file, access: nil, unshared_at: nil, can_download: nil, can_preview: nil, password: nil)
|
221
221
|
|
222
222
|
disable_shared_link_for_file(file)
|
223
223
|
|
data/lib/boxr/client.rb
CHANGED
@@ -271,7 +271,13 @@ module Boxr
|
|
271
271
|
end
|
272
272
|
|
273
273
|
def ensure_id(item)
|
274
|
-
|
274
|
+
# Ruby 2.4 unified Fixnum and Bignum into Integer. This tests for Ruby 2.4
|
275
|
+
if 1.class == Integer
|
276
|
+
return item if item.class == String || item.class == Integer || item.nil?
|
277
|
+
else
|
278
|
+
return item if item.class == String || item.class == Fixnum || item.class == Bignum || item.nil?
|
279
|
+
end
|
280
|
+
|
275
281
|
return item.id if item.respond_to?(:id)
|
276
282
|
raise BoxrError.new(boxr_message: "Expecting an id of class String or Fixnum, or object that responds to :id")
|
277
283
|
end
|
@@ -287,9 +293,10 @@ module Boxr
|
|
287
293
|
restored_item
|
288
294
|
end
|
289
295
|
|
290
|
-
def create_shared_link(uri, item_id, access, unshared_at, can_download, can_preview)
|
296
|
+
def create_shared_link(uri, item_id, access, unshared_at, can_download, can_preview, password)
|
291
297
|
attributes = {shared_link: {access: access}}
|
292
298
|
attributes[:shared_link][:unshared_at] = unshared_at.to_datetime.rfc3339 unless unshared_at.nil?
|
299
|
+
attributes[:shared_link][:password] = password unless password.nil?
|
293
300
|
attributes[:shared_link][:permissions] = {} unless can_download.nil? && can_preview.nil?
|
294
301
|
attributes[:shared_link][:permissions][:can_download] = can_download unless can_download.nil?
|
295
302
|
attributes[:shared_link][:permissions][:can_preview] = can_preview unless can_preview.nil?
|
data/lib/boxr/files.rb
CHANGED
@@ -211,10 +211,10 @@ module Boxr
|
|
211
211
|
thumbnail
|
212
212
|
end
|
213
213
|
|
214
|
-
def create_shared_link_for_file(file, access: nil, unshared_at: nil, can_download: nil, can_preview: nil)
|
214
|
+
def create_shared_link_for_file(file, access: nil, unshared_at: nil, can_download: nil, can_preview: nil, password: nil)
|
215
215
|
file_id = ensure_id(file)
|
216
216
|
uri = "#{FILES_URI}/#{file_id}"
|
217
|
-
create_shared_link(uri, file_id, access, unshared_at, can_download, can_preview)
|
217
|
+
create_shared_link(uri, file_id, access, unshared_at, can_download, can_preview, password)
|
218
218
|
end
|
219
219
|
|
220
220
|
def disable_shared_link_for_file(file)
|
data/lib/boxr/folders.rb
CHANGED
@@ -103,10 +103,10 @@ module Boxr
|
|
103
103
|
new_folder
|
104
104
|
end
|
105
105
|
|
106
|
-
def create_shared_link_for_folder(folder, access: nil, unshared_at: nil, can_download: nil, can_preview: nil)
|
106
|
+
def create_shared_link_for_folder(folder, access: nil, unshared_at: nil, can_download: nil, can_preview: nil, password: nil)
|
107
107
|
folder_id = ensure_id(folder)
|
108
108
|
uri = "#{FOLDERS_URI}/#{folder_id}"
|
109
|
-
create_shared_link(uri, folder_id, access, unshared_at, can_download, can_preview)
|
109
|
+
create_shared_link(uri, folder_id, access, unshared_at, can_download, can_preview, password)
|
110
110
|
end
|
111
111
|
|
112
112
|
def disable_shared_link_for_folder(folder)
|
data/lib/boxr/version.rb
CHANGED
data/spec/boxr_spec.rb
CHANGED
@@ -92,6 +92,10 @@ describe Boxr::Client do
|
|
92
92
|
puts "create shared link for folder"
|
93
93
|
updated_folder = BOX_CLIENT.create_shared_link_for_folder(@test_folder, access: :open)
|
94
94
|
expect(updated_folder.shared_link.access).to eq("open")
|
95
|
+
|
96
|
+
puts "create password-protected shared link for folder"
|
97
|
+
updated_folder = BOX_CLIENT.create_shared_link_for_folder(@test_folder, password: 'password')
|
98
|
+
expect(updated_folder.shared_link.is_password_enabled).to eq(true)
|
95
99
|
shared_link = updated_folder.shared_link.url
|
96
100
|
|
97
101
|
puts "inspect shared link"
|
@@ -213,6 +217,10 @@ describe Boxr::Client do
|
|
213
217
|
updated_file = BOX_CLIENT.create_shared_link_for_file(test_file, access: :open)
|
214
218
|
expect(updated_file.shared_link.access).to eq("open")
|
215
219
|
|
220
|
+
puts "create password-protected shared link for file"
|
221
|
+
updated_file = BOX_CLIENT.create_shared_link_for_file(test_file, password: 'password')
|
222
|
+
expect(updated_file.shared_link.is_password_enabled).to eq(true)
|
223
|
+
|
216
224
|
puts "disable shared link for file"
|
217
225
|
updated_file = BOX_CLIENT.disable_shared_link_for_file(test_file)
|
218
226
|
expect(updated_file.shared_link).to be_nil
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: boxr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chad Burnette
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|