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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2229eb1062b34eabf5e7040caf0a2c497caa7d2ef13c75f896eb76e1e7c25fea
4
- data.tar.gz: 4404394473173cfa99b4f5b22af110fa2dbd1f9018262fa3b4c48c49f51ba99a
3
+ metadata.gz: 04ca88d5d328877cca29dd525572f39a8d08eb1fab798f161854746daa7b8679
4
+ data.tar.gz: 2243419e800241709f0565b0f4ce698e62ebce286f2a1eead58e50202ea66ecb
5
5
  SHA512:
6
- metadata.gz: 958241267042bcdcbd94247873beefe73afbd43da4860047411c5891fcc25cd56555b719b2f760d9e949c14e6a88c4a90e7658b4c12cc11b4a592c367f02ddf0
7
- data.tar.gz: 8d6c582d64c0be4ca4da7cc87f629b2735d90b4640eb2ee154b9cf32597e2f3fa9f65c1fe2c544c075d671d1d0a8d89ac7eabc42cc86fc69ec7d68e9487d524a
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
- enterprise_metadata
398
+ get_enterprise_templates
399
+ get_metadata_template_by_name(scope, template_key)
399
400
 
400
- metadata_schema(scope, template_key)
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)
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Boxr
2
- VERSION = "1.9.0"
2
+ VERSION = "1.10.0"
3
3
  end
@@ -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.9.0
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 00:00:00.000000000 Z
11
+ date: 2019-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler