boxr 1.14.0 → 1.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -0
- data/boxr.gemspec +1 -1
- data/lib/boxr/client.rb +4 -0
- data/lib/boxr/metadata.rb +7 -0
- data/lib/boxr/version.rb +1 -1
- data/lib/boxr/web_links.rb +25 -0
- data/spec/boxr/metadata_spec.rb +4 -0
- data/spec/boxr/web_links_spec.rb +13 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4228f0c6466f0201da66c3cd077351503d1d53674d92b28ba0796866d4a4b51c
|
4
|
+
data.tar.gz: f88a5fa3b4065b3b491dc28491c86bfbe2f02a31c6e5a73cf5312910eb86752f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '045222090425c6e3200174120967ffc2d3b0322db99f1aee9ce834cf7de6a9b5c41ffb0590a4547c21365476f7e1827ad27e84c95e7674645151b1c07c33886a'
|
7
|
+
data.tar.gz: 94909a12a7d0ab30c3939412bb03d4ae89760b9bfcf2c78552da7fb178bdb3718e060e50cb59cf6f3647804557f79c67194bc9f5ca35544b2d504110e9061c93
|
data/README.md
CHANGED
@@ -289,6 +289,12 @@ get_web_link(web_link)
|
|
289
289
|
update_web_link(web_link, url: nil, parent: nil, name: nil, description: nil)
|
290
290
|
|
291
291
|
delete_web_link(web_link)
|
292
|
+
|
293
|
+
trashed_web_link(web_link, fields: [])
|
294
|
+
|
295
|
+
delete_trashed_web_link(web_link)
|
296
|
+
|
297
|
+
restore_trashed_web_link(web_link, name: nil, parent: nil)
|
292
298
|
```
|
293
299
|
#### [Comments](https://developer.box.com/en/reference/resources/comment/)
|
294
300
|
```ruby
|
@@ -444,6 +450,7 @@ delete_folder_metadata(folder, scope, template)
|
|
444
450
|
|
445
451
|
get_enterprise_templates
|
446
452
|
get_metadata_template_by_name(scope, template_key)
|
453
|
+
get_metadata_template_by_id(template_id)
|
447
454
|
|
448
455
|
create_metadata_template(display_name, template_key: nil, fields: [], hidden: nil)
|
449
456
|
delete_metadata_template(scope, template_key)
|
data/boxr.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.required_ruby_version = '
|
21
|
+
spec.required_ruby_version = '>= 2.0'
|
22
22
|
|
23
23
|
spec.add_development_dependency "bundler", "~> 1.6"
|
24
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
data/lib/boxr/client.rb
CHANGED
@@ -59,6 +59,10 @@ module Boxr
|
|
59
59
|
GROUP_FIELDS = [:type, :id, :name, :created_at, :modified_at]
|
60
60
|
GROUP_FIELDS_QUERY = GROUP_FIELDS.join(',')
|
61
61
|
|
62
|
+
WEB_LINK_FIELDS = [:type, :id, :created_at, :created_by, :description, :etag, :item_status, :modified_at, :modified_by,
|
63
|
+
:name, :owned_by, :parent, :path_collection, :purged_at, :sequence_id, :shared_link, :trashed_at, :url]
|
64
|
+
WEB_LINK_FIELDS_QUERY = WEB_LINK_FIELDS.join(',')
|
65
|
+
|
62
66
|
VALID_COLLABORATION_ROLES = ['editor','viewer','previewer','uploader','previewer uploader','viewer uploader','co-owner','owner']
|
63
67
|
|
64
68
|
|
data/lib/boxr/metadata.rb
CHANGED
@@ -93,6 +93,13 @@ module Boxr
|
|
93
93
|
end
|
94
94
|
alias :get_metadata_template_by_name :metadata_schema
|
95
95
|
|
96
|
+
def get_metadata_template_by_id(template_id)
|
97
|
+
template_id = ensure_id(template_id)
|
98
|
+
uri = "#{METADATA_TEMPLATES_URI}/#{template_id}"
|
99
|
+
schema, response = get(uri)
|
100
|
+
schema
|
101
|
+
end
|
102
|
+
|
96
103
|
def create_metadata_template(display_name, template_key: nil, fields: [], hidden: nil)
|
97
104
|
uri = "#{METADATA_TEMPLATES_URI}/schema"
|
98
105
|
schema = {
|
data/lib/boxr/version.rb
CHANGED
data/lib/boxr/web_links.rb
CHANGED
@@ -51,6 +51,31 @@ module Boxr
|
|
51
51
|
result
|
52
52
|
end
|
53
53
|
|
54
|
+
def trashed_web_link(web_link, fields: [])
|
55
|
+
web_link_id = ensure_id(web_link)
|
56
|
+
uri = "#{WEB_LINKS_URI}/#{web_link_id}/trash"
|
57
|
+
query = build_fields_query(fields, WEB_LINK_FIELDS_QUERY)
|
58
|
+
|
59
|
+
web_link, response = get(uri, query: query)
|
60
|
+
web_link
|
61
|
+
end
|
62
|
+
alias :get_trashed_web_link :trashed_web_link
|
63
|
+
|
64
|
+
def delete_trashed_web_link(web_link)
|
65
|
+
web_link_id = ensure_id(web_link)
|
66
|
+
uri = "#{WEB_LINKS_URI}/#{web_link_id}/trash"
|
67
|
+
result, response = delete(uri)
|
68
|
+
result
|
69
|
+
end
|
70
|
+
|
71
|
+
def restore_trashed_web_link(web_link, name: nil, parent: nil)
|
72
|
+
web_link_id = ensure_id(web_link)
|
73
|
+
parent_id = ensure_id(parent)
|
74
|
+
|
75
|
+
uri = "#{WEB_LINKS_URI}/#{web_link_id}"
|
76
|
+
restore_trashed_item(uri, name, parent_id)
|
77
|
+
end
|
78
|
+
|
54
79
|
private
|
55
80
|
|
56
81
|
def verify_url(item)
|
data/spec/boxr/metadata_spec.rb
CHANGED
@@ -76,6 +76,10 @@ describe 'file metadata operations' do
|
|
76
76
|
template_key = metadata_template["templateKey"]
|
77
77
|
scope = metadata_template["scope"]
|
78
78
|
|
79
|
+
puts "get metadata template by id"
|
80
|
+
metadata_template = BOX_CLIENT.get_metadata_template_by_id(metadata_template["id"])
|
81
|
+
expect(metadata_template["displayName"]).to eq("Test Template")
|
82
|
+
|
79
83
|
puts "delete metadata template"
|
80
84
|
result = BOX_CLIENT.delete_metadata_template(scope, template_key)
|
81
85
|
expect(result).to eq({})
|
data/spec/boxr/web_links_spec.rb
CHANGED
@@ -16,5 +16,18 @@ describe "web links operations" do
|
|
16
16
|
puts "delete web link"
|
17
17
|
result = BOX_CLIENT.delete_web_link(web_link)
|
18
18
|
expect(result).to eq({})
|
19
|
+
|
20
|
+
puts "get trashed web link"
|
21
|
+
trashed_web_link = BOX_CLIENT.trashed_web_link(web_link)
|
22
|
+
expect(trashed_web_link.item_status).to eq("trashed")
|
23
|
+
|
24
|
+
puts "restore trashed web link"
|
25
|
+
restored_web_link = BOX_CLIENT.restore_trashed_web_link(web_link)
|
26
|
+
expect(restored_web_link.item_status).to eq("active")
|
27
|
+
|
28
|
+
puts "trash and permanently delete web link"
|
29
|
+
BOX_CLIENT.delete_web_link(web_link)
|
30
|
+
result = BOX_CLIENT.delete_trashed_web_link(web_link)
|
31
|
+
expect(result).to eq({})
|
19
32
|
end
|
20
33
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: boxr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chad Burnette
|
8
8
|
- Xavier Hocquet
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-12-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -248,13 +248,13 @@ homepage: https://github.com/cburnette/boxr
|
|
248
248
|
licenses:
|
249
249
|
- MIT
|
250
250
|
metadata: {}
|
251
|
-
post_install_message:
|
251
|
+
post_install_message:
|
252
252
|
rdoc_options: []
|
253
253
|
require_paths:
|
254
254
|
- lib
|
255
255
|
required_ruby_version: !ruby/object:Gem::Requirement
|
256
256
|
requirements:
|
257
|
-
- - "
|
257
|
+
- - ">="
|
258
258
|
- !ruby/object:Gem::Version
|
259
259
|
version: '2.0'
|
260
260
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
@@ -263,8 +263,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
263
263
|
- !ruby/object:Gem::Version
|
264
264
|
version: '0'
|
265
265
|
requirements: []
|
266
|
-
rubygems_version: 3.
|
267
|
-
signing_key:
|
266
|
+
rubygems_version: 3.2.3
|
267
|
+
signing_key:
|
268
268
|
specification_version: 4
|
269
269
|
summary: A Ruby client library for the Box V2 Content API.
|
270
270
|
test_files:
|