boxr 0.30.0 → 0.31.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/jwt_auth.rb +1 -1
- data/lib/boxr/client.rb +2 -1
- data/lib/boxr/files.rb +9 -13
- data/lib/boxr/version.rb +1 -1
- data/spec/boxr_spec.rb +4 -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: 8682c0e2402a646cae436c2d103074312f84e656
|
4
|
+
data.tar.gz: 9ab29d7ccf6b4c1b93816527515bfa0859898f2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38f3c5d4aa1b0c98b4c33193318d3ab975e61a2f6a6ac11d634a39050f9ebdb048009c01270261d00c0e2ab6952b99bd610264c9edd60e1a4217d5132a6368a0
|
7
|
+
data.tar.gz: 0eb2bcac3782982da752cefa205befb4e14c61ecf6db4c750c82c36573b784631079c92abf000e381fe462263864616c78961d59816235b9feb73ca5ef0aa035
|
data/examples/jwt_auth.rb
CHANGED
@@ -6,7 +6,7 @@ require 'openssl'
|
|
6
6
|
|
7
7
|
private_key = OpenSSL::PKey::RSA.new(File.read(ENV['JWT_PRIVATE_KEY_PATH']), ENV['JWT_PRIVATE_KEY_PASSWORD'])
|
8
8
|
|
9
|
-
#make sure ENV['BOX_ENTERPRISE_ID'] and ENV['
|
9
|
+
#make sure ENV['BOX_ENTERPRISE_ID'], ENV['BOX_CLIENT_ID'] and ENV['BOX_CLIENT_SECRET'] are set
|
10
10
|
response = Boxr::get_enterprise_token(private_key: private_key)
|
11
11
|
|
12
12
|
ap response
|
data/lib/boxr/client.rb
CHANGED
@@ -32,7 +32,8 @@ module Boxr
|
|
32
32
|
:size,:path_collection,:created_by,:modified_by,:trashed_at,:purged_at,
|
33
33
|
:content_created_at,:content_modified_at,:owned_by,:shared_link,:folder_upload_email,
|
34
34
|
:parent,:item_status,:item_collection,:sync_state,:has_collaborations,:permissions,:tags,
|
35
|
-
:sha1,:shared_link,:version_number,:comment_count,:lock,:extension,:is_package
|
35
|
+
:sha1,:shared_link,:version_number,:comment_count,:lock,:extension,:is_package,
|
36
|
+
:expiring_embed_link, :can_non_owners_invite]
|
36
37
|
FOLDER_AND_FILE_FIELDS_QUERY = FOLDER_AND_FILE_FIELDS.join(',')
|
37
38
|
|
38
39
|
COMMENT_FIELDS = [:type,:id,:is_reply_comment,:message,:tagged_message,:created_by,:created_at,:item,:modified_at]
|
data/lib/boxr/files.rb
CHANGED
@@ -26,6 +26,15 @@ module Boxr
|
|
26
26
|
end
|
27
27
|
alias :file :file_from_id
|
28
28
|
|
29
|
+
def embed_url(file)
|
30
|
+
file_info = file_from_id(file, fields:[:expiring_embed_link])
|
31
|
+
url = file_info.expiring_embed_link.url
|
32
|
+
url
|
33
|
+
end
|
34
|
+
alias :embed_link :embed_url
|
35
|
+
alias :preview_url :embed_url
|
36
|
+
alias :preview_link :embed_url
|
37
|
+
|
29
38
|
def update_file(file, name: nil, description: nil, parent: nil, shared_link: nil, tags: nil, lock: nil, if_match: nil)
|
30
39
|
file_id = ensure_id(file)
|
31
40
|
parent_id = ensure_id(parent)
|
@@ -182,19 +191,6 @@ module Boxr
|
|
182
191
|
new_file
|
183
192
|
end
|
184
193
|
|
185
|
-
def embed_url(file, version: nil, disable_download: nil)
|
186
|
-
file_id = ensure_id(file)
|
187
|
-
uri = "#{FILES_URI}/#{file_id}/embed_url"
|
188
|
-
|
189
|
-
query = {}
|
190
|
-
query[:version] = version unless version.nil?
|
191
|
-
query[:disable_download] = disable_download unless disable_download.nil?
|
192
|
-
|
193
|
-
result, response = get(uri, query: query)
|
194
|
-
result.url
|
195
|
-
end
|
196
|
-
alias :preview_url :embed_url
|
197
|
-
|
198
194
|
def thumbnail(file, min_height: nil, min_width: nil, max_height: nil, max_width: nil)
|
199
195
|
file_id = ensure_id(file)
|
200
196
|
uri = "#{FILES_URI}/#{file_id}/thumbnail.png"
|
data/lib/boxr/version.rb
CHANGED
data/spec/boxr_spec.rb
CHANGED
@@ -151,6 +151,10 @@ describe Boxr::Client do
|
|
151
151
|
file_info = BOX_CLIENT.file(test_file)
|
152
152
|
expect(file_info.id).to eq(test_file.id)
|
153
153
|
|
154
|
+
puts "get file preview link"
|
155
|
+
preview_url = BOX_CLIENT.preview_url(test_file)
|
156
|
+
expect(preview_url).to start_with("https://")
|
157
|
+
|
154
158
|
puts "update file"
|
155
159
|
new_description = 'this file is used to test Boxr'
|
156
160
|
tags = ['tag one','tag two']
|
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: 0.
|
4
|
+
version: 0.31.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: 2015-10-
|
11
|
+
date: 2015-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|