boxr 1.9.0 → 1.10.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 +4 -2
- data/lib/boxr/metadata.rb +22 -1
- data/lib/boxr/version.rb +1 -1
- data/spec/boxr/metadata_spec.rb +21 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04ca88d5d328877cca29dd525572f39a8d08eb1fab798f161854746daa7b8679
|
4
|
+
data.tar.gz: 2243419e800241709f0565b0f4ce698e62ebce286f2a1eead58e50202ea66ecb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3b6c2986449944d0d5cca6a2305e615e7387adff4d1e932bad5eb5431d7b48b87c57bb0d6c95a06586e0a98c896aaff94c09cf56a2ae8e9a7a6da36e878b911
|
7
|
+
data.tar.gz: d8d373850ad0b6f4ac9d99501dfe62a74ff00590a109c05ef7ea7bd1ea579036629114fe5de289db17234da45a49256d365046a819a9332dc2e8cf123fd933ae
|
data/README.md
CHANGED
@@ -395,9 +395,11 @@ update_folder_metadata(folder, updates, scope, template)
|
|
395
395
|
delete_metadata(file, scope: :global, template: :properties)
|
396
396
|
delete_folder_metadata(folder, scope, template)
|
397
397
|
|
398
|
-
|
398
|
+
get_enterprise_templates
|
399
|
+
get_metadata_template_by_name(scope, template_key)
|
399
400
|
|
400
|
-
|
401
|
+
create_metadata_template(display_name, template_key: nil, fields: [], hidden: nil)
|
402
|
+
delete_metadata_template(scope, template_key)
|
401
403
|
```
|
402
404
|
|
403
405
|
#### [Watermarking](https://box-content.readme.io/reference#watermarking)
|
data/lib/boxr/metadata.rb
CHANGED
@@ -77,12 +77,33 @@ module Boxr
|
|
77
77
|
ent_metadata, response = get(uri)
|
78
78
|
ent_metadata
|
79
79
|
end
|
80
|
+
alias :get_enterprise_templates :enterprise_metadata
|
80
81
|
|
81
82
|
def metadata_schema(scope, template_key)
|
82
83
|
uri = "#{METADATA_TEMPLATES_URI}/#{scope}/#{template_key}/schema"
|
83
84
|
schema, response = get(uri)
|
84
85
|
schema
|
85
86
|
end
|
87
|
+
alias :get_metadata_template_by_name :metadata_schema
|
88
|
+
|
89
|
+
def create_metadata_template(display_name, template_key: nil, fields: [], hidden: nil)
|
90
|
+
uri = "#{METADATA_TEMPLATES_URI}/schema"
|
91
|
+
schema = {
|
92
|
+
scope: "enterprise",
|
93
|
+
displayName: display_name,
|
94
|
+
}
|
95
|
+
schema[:templateKey] = template_key unless template_key.nil?
|
96
|
+
schema[:hidden] = hidden unless hidden.nil?
|
97
|
+
schema[:fields] = fields unless fields.empty?
|
98
|
+
|
99
|
+
metadata_template, response = post(uri, schema, content_type: "application/json")
|
100
|
+
metadata_template
|
101
|
+
end
|
86
102
|
|
103
|
+
def delete_metadata_template(scope, template_key)
|
104
|
+
uri = "#{METADATA_TEMPLATES_URI}/#{scope}/#{template_key}/schema"
|
105
|
+
result, response = delete(uri)
|
106
|
+
result
|
107
|
+
end
|
87
108
|
end
|
88
|
-
end
|
109
|
+
end
|
data/lib/boxr/version.rb
CHANGED
data/spec/boxr/metadata_spec.rb
CHANGED
@@ -29,6 +29,8 @@ describe 'file metadata operations' do
|
|
29
29
|
#NOTE: this test will fail unless you create a metadata template called 'test' with two attributes: 'a' of type text, and 'b' of type text
|
30
30
|
it "invokes folder metadata operations" do
|
31
31
|
new_folder = BOX_CLIENT.create_folder(SUB_FOLDER_NAME, @test_folder)
|
32
|
+
fields = [{displayName: "a", type: "string"},{displayName: "b", type: "string"}]
|
33
|
+
metadata_template = BOX_CLIENT.create_metadata_template("test", fields: fields)
|
32
34
|
|
33
35
|
puts "create folder metadata"
|
34
36
|
meta = {"a" => "hello", "b" => "world"}
|
@@ -48,5 +50,24 @@ describe 'file metadata operations' do
|
|
48
50
|
puts "delete folder metadata"
|
49
51
|
result = BOX_CLIENT.delete_folder_metadata(new_folder, "enterprise", "test")
|
50
52
|
expect(result).to eq({})
|
53
|
+
|
54
|
+
puts "cleanup metadata template"
|
55
|
+
template_key = metadata_template["templateKey"]
|
56
|
+
scope = metadata_template["scope"]
|
57
|
+
BOX_CLIENT.delete_metadata_template(scope, template_key)
|
58
|
+
end
|
59
|
+
|
60
|
+
#rake spec SPEC_OPTS="-e \"invokes metadata template operations"\"
|
61
|
+
it "invokes metadata template operations" do
|
62
|
+
puts "create metadata template"
|
63
|
+
metadata_template = BOX_CLIENT.create_metadata_template("Test Template")
|
64
|
+
expect(metadata_template["displayName"]).to eq("Test Template")
|
65
|
+
|
66
|
+
template_key = metadata_template["templateKey"]
|
67
|
+
scope = metadata_template["scope"]
|
68
|
+
|
69
|
+
puts "delete metadata template"
|
70
|
+
result = BOX_CLIENT.delete_metadata_template(scope, template_key)
|
71
|
+
expect(result).to eq({})
|
51
72
|
end
|
52
73
|
end
|
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.10.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: 2019-06-
|
11
|
+
date: 2019-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|