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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 40063e0f756163b9f014413b1015a540381aff4dc47fdd04d43eb0f088e852ff
4
- data.tar.gz: 1bbf85b5274279498459666a017f2e0a3d0b6fab1a9f07fcb4dd0344785a805b
3
+ metadata.gz: 4228f0c6466f0201da66c3cd077351503d1d53674d92b28ba0796866d4a4b51c
4
+ data.tar.gz: f88a5fa3b4065b3b491dc28491c86bfbe2f02a31c6e5a73cf5312910eb86752f
5
5
  SHA512:
6
- metadata.gz: 0ab3fe10d8a97c07c51124ed777facd3f57db71fc56a06ac9d031a3eb752f028b78c0309aed2e21a34510fb426c68b3226cc6d54ee13145281447fd000fc84f4
7
- data.tar.gz: fb4306f1764b16adb8153c9a0812d20f3ce3683da0700563b05ce492d7907c68d9da5dce02361235d9bd30890152b047a22c7cb9a11665cd9526ebd80338a91d
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)
@@ -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 = '~> 2.0'
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"
@@ -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
 
@@ -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 = {
@@ -1,3 +1,3 @@
1
1
  module Boxr
2
- VERSION = "1.14.0".freeze
2
+ VERSION = "1.16.0".freeze
3
3
  end
@@ -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)
@@ -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({})
@@ -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.14.0
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: 2019-11-29 00:00:00.000000000 Z
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.0.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: