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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 527dd92dd98452269357273594b57fd009e875c8
4
- data.tar.gz: 814f84b862988ba3fc7df51610bc4cc182908a4c
3
+ metadata.gz: 8682c0e2402a646cae436c2d103074312f84e656
4
+ data.tar.gz: 9ab29d7ccf6b4c1b93816527515bfa0859898f2a
5
5
  SHA512:
6
- metadata.gz: b363f469d80d454db40a5ff53fe4ff39568ca3c1ff7bbc959efa8bb5c4138822ad3e4c56affbe3079b842694040ad054891366a7893322ee7d4277e1167b4881
7
- data.tar.gz: e7badddaada9d1f4d34c2d7d144df62ebb84a74bcbf59dc2856099e0f1ea5ac67966b23660128e55f1815a4d015b4a0aa9dd62f932685992813d1649271c3612
6
+ metadata.gz: 38f3c5d4aa1b0c98b4c33193318d3ab975e61a2f6a6ac11d634a39050f9ebdb048009c01270261d00c0e2ab6952b99bd610264c9edd60e1a4217d5132a6368a0
7
+ data.tar.gz: 0eb2bcac3782982da752cefa205befb4e14c61ecf6db4c750c82c36573b784631079c92abf000e381fe462263864616c78961d59816235b9feb73ca5ef0aa035
@@ -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['BOX_CLIENT_ID'] are set
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
@@ -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,:can_non_owners_invite]
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]
@@ -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"
@@ -1,3 +1,3 @@
1
1
  module Boxr
2
- VERSION = "0.30.0"
2
+ VERSION = "0.31.0"
3
3
  end
@@ -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.30.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-07 00:00:00.000000000 Z
11
+ date: 2015-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler