duracloud-client 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/duracloud.rb +19 -6
- data/lib/duracloud/bit_integrity_report.rb +63 -0
- data/lib/duracloud/client.rb +0 -5
- data/lib/duracloud/content.rb +0 -4
- data/lib/duracloud/content_properties.rb +0 -4
- data/lib/duracloud/durastore_request.rb +0 -2
- data/lib/duracloud/manifest.rb +24 -0
- data/lib/duracloud/request.rb +0 -3
- data/lib/duracloud/rest_methods.rb +9 -11
- data/lib/duracloud/space.rb +0 -5
- data/lib/duracloud/space_acls.rb +0 -3
- data/lib/duracloud/space_properties.rb +0 -1
- data/lib/duracloud/version.rb +1 -1
- data/spec/fixtures/responses/GetManifest.tsv +3 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 597a70d0d1ce9abc360fe01770e5dd4ed058604c
|
4
|
+
data.tar.gz: ef764b6b7e68c8dfe9899ff46f5ab3f325a006d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7da0a6da94606f9d25e3164c84999c602d7ece4c9ea62930abe5b3b7816f0f551ef797303a04a3b6af7ed48e8509b66925121c9a3e38cc6c27746c59035ae77
|
7
|
+
data.tar.gz: e05f77e6a948cf0008ccddb0de25f0f9ed0c07d5fc1a9f5b77796c9e0fee6f4ab7d0341f9a31d6ca283bcdd36ff18a3fe217b05fe5ee7d9fcb3e0a81b4b2c9b6
|
data/lib/duracloud.rb
CHANGED
@@ -1,11 +1,24 @@
|
|
1
1
|
require "duracloud/version"
|
2
2
|
require "duracloud/error"
|
3
|
-
require "duracloud/client"
|
4
|
-
require "duracloud/request"
|
5
|
-
require "duracloud/content"
|
6
|
-
require "duracloud/store"
|
7
|
-
require "duracloud/space"
|
8
3
|
|
9
4
|
module Duracloud
|
10
|
-
|
5
|
+
autoload :BitIntegrityReport, "duracloud/bit_integrity_report"
|
6
|
+
autoload :Client, "duracloud/client"
|
7
|
+
autoload :Configuration, "duracloud/configuration"
|
8
|
+
autoload :Connection, "duracloud/connection"
|
9
|
+
autoload :Content, "duracloud/content"
|
10
|
+
autoload :ContentProperties, "duracloud/content_properties"
|
11
|
+
autoload :DurastoreRequest, "duracloud/durastore_request"
|
12
|
+
autoload :ErrorHandler, "duracloud/error_handler"
|
13
|
+
autoload :HasProperties, "duracloud/has_properties"
|
14
|
+
autoload :Manifest, "duracloud/manifest"
|
15
|
+
autoload :Persistence, "duracloud/persistence"
|
16
|
+
autoload :Properties, "duracloud/properties"
|
17
|
+
autoload :Request, "duracloud/request"
|
18
|
+
autoload :Response, "duracloud/response"
|
19
|
+
autoload :RestMethods, "duracloud/rest_methods"
|
20
|
+
autoload :Space, "duracloud/space"
|
21
|
+
autoload :SpaceAcls, "duracloud/space_acls"
|
22
|
+
autoload :SpaceProperties, "duracloud/space_properties"
|
23
|
+
autoload :Store, "duracloud/store"
|
11
24
|
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require "date"
|
2
|
+
require "csv"
|
3
|
+
|
4
|
+
module Duracloud
|
5
|
+
class BitIntegrityReport
|
6
|
+
|
7
|
+
SUCCESS = "SUCCESS".freeze
|
8
|
+
FAILURE = "FAILURE".freeze
|
9
|
+
|
10
|
+
CSV_OPTS = {
|
11
|
+
col_sep: '\t',
|
12
|
+
headers: :first_row,
|
13
|
+
write_headers: true,
|
14
|
+
return_headers: true,
|
15
|
+
}
|
16
|
+
|
17
|
+
def self.success?(space_id)
|
18
|
+
new(space_id).success?
|
19
|
+
end
|
20
|
+
|
21
|
+
attr_reader :space_id
|
22
|
+
|
23
|
+
def initialize(space_id)
|
24
|
+
@space_id = space_id
|
25
|
+
end
|
26
|
+
|
27
|
+
def data
|
28
|
+
report.body
|
29
|
+
end
|
30
|
+
|
31
|
+
def completion_date
|
32
|
+
DateTime.parse(properties["Bit-Integrity-Report-Completion-Date"].first)
|
33
|
+
end
|
34
|
+
|
35
|
+
def result
|
36
|
+
properties["Bit-Integrity-Report-Result"].first
|
37
|
+
end
|
38
|
+
|
39
|
+
def csv(opts = {})
|
40
|
+
CSV.new(data, CSV_OPTS.merge(opts))
|
41
|
+
end
|
42
|
+
|
43
|
+
def success?
|
44
|
+
result == SUCCESS
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def report
|
50
|
+
@report ||= Client.get_bit_integrity_report(space_id)
|
51
|
+
end
|
52
|
+
|
53
|
+
def properties
|
54
|
+
@properties ||= if @report
|
55
|
+
report.headers
|
56
|
+
else
|
57
|
+
response = Client.get_bit_integrity_report_properties(space_id)
|
58
|
+
response.headers
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
data/lib/duracloud/client.rb
CHANGED
data/lib/duracloud/content.rb
CHANGED
@@ -0,0 +1,24 @@
|
|
1
|
+
require "csv"
|
2
|
+
|
3
|
+
module Duracloud
|
4
|
+
class Manifest
|
5
|
+
|
6
|
+
CSV_OPTS = {
|
7
|
+
col_sep: '\t',
|
8
|
+
headers: :first_row,
|
9
|
+
write_headers: true,
|
10
|
+
return_headers: true,
|
11
|
+
}
|
12
|
+
|
13
|
+
def self.csv(space_id, csv_opts: {})
|
14
|
+
data = raw(space_id)
|
15
|
+
CSV.new(data, CSV_OPTS.merge(csv_opts))
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.raw(space_id)
|
19
|
+
response = Client.get_manifest(space_id)
|
20
|
+
response.body
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
data/lib/duracloud/request.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require "duracloud/durastore_request"
|
2
|
-
|
3
1
|
module Duracloud
|
4
2
|
module RestMethods
|
5
3
|
|
@@ -56,27 +54,27 @@ module Duracloud
|
|
56
54
|
end
|
57
55
|
|
58
56
|
def get_audit_log
|
59
|
-
|
57
|
+
durastore :get, "audit/#{space_id}"
|
60
58
|
end
|
61
59
|
|
62
|
-
def get_manifest
|
63
|
-
|
60
|
+
def get_manifest(space_id)
|
61
|
+
durastore :get, "manifest/#{space_id}"
|
64
62
|
end
|
65
63
|
|
66
|
-
def get_bit_integrity_report
|
67
|
-
|
64
|
+
def get_bit_integrity_report(space_id)
|
65
|
+
durastore :get, "bit-integrity/#{space_id}"
|
68
66
|
end
|
69
67
|
|
70
|
-
def get_bit_integrity_report_properties
|
71
|
-
|
68
|
+
def get_bit_integrity_report_properties(space_id)
|
69
|
+
durastore :head, "bit-integrity/#{space_id}"
|
72
70
|
end
|
73
71
|
|
74
72
|
def get_tasks
|
75
|
-
raise NotImplementedError
|
73
|
+
raise NotImplementedError, "The API method 'Get Tasks' has not been implemented."
|
76
74
|
end
|
77
75
|
|
78
76
|
def perform_task
|
79
|
-
raise NotImplementedError
|
77
|
+
raise NotImplementedError, "The API method 'Perform Task' has not been implemented."
|
80
78
|
end
|
81
79
|
|
82
80
|
private
|
data/lib/duracloud/space.rb
CHANGED
@@ -2,11 +2,6 @@ require "date"
|
|
2
2
|
require "nokogiri"
|
3
3
|
require "forwardable"
|
4
4
|
|
5
|
-
require "duracloud/persistence"
|
6
|
-
require "duracloud/has_properties"
|
7
|
-
require "duracloud/space_properties"
|
8
|
-
require "duracloud/space_acls"
|
9
|
-
|
10
5
|
module Duracloud
|
11
6
|
class Space
|
12
7
|
extend Forwardable
|
data/lib/duracloud/space_acls.rb
CHANGED
data/lib/duracloud/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: duracloud-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Chandek-Stark
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashie
|
@@ -139,6 +139,7 @@ files:
|
|
139
139
|
- duracloud.gemspec
|
140
140
|
- lib/duracloud-client.rb
|
141
141
|
- lib/duracloud.rb
|
142
|
+
- lib/duracloud/bit_integrity_report.rb
|
142
143
|
- lib/duracloud/client.rb
|
143
144
|
- lib/duracloud/configuration.rb
|
144
145
|
- lib/duracloud/connection.rb
|
@@ -148,6 +149,7 @@ files:
|
|
148
149
|
- lib/duracloud/error.rb
|
149
150
|
- lib/duracloud/error_handler.rb
|
150
151
|
- lib/duracloud/has_properties.rb
|
152
|
+
- lib/duracloud/manifest.rb
|
151
153
|
- lib/duracloud/persistence.rb
|
152
154
|
- lib/duracloud/properties.rb
|
153
155
|
- lib/duracloud/request.rb
|
@@ -158,6 +160,7 @@ files:
|
|
158
160
|
- lib/duracloud/space_properties.rb
|
159
161
|
- lib/duracloud/store.rb
|
160
162
|
- lib/duracloud/version.rb
|
163
|
+
- spec/fixtures/responses/GetManifest.tsv
|
161
164
|
- spec/fixtures/responses/GetSpaces.xml
|
162
165
|
- spec/fixtures/responses/GetStores.xml
|
163
166
|
- spec/spec_helper.rb
|
@@ -191,6 +194,7 @@ signing_key:
|
|
191
194
|
specification_version: 4
|
192
195
|
summary: Ruby client for communicating with DuraCloud
|
193
196
|
test_files:
|
197
|
+
- spec/fixtures/responses/GetManifest.tsv
|
194
198
|
- spec/fixtures/responses/GetSpaces.xml
|
195
199
|
- spec/fixtures/responses/GetStores.xml
|
196
200
|
- spec/spec_helper.rb
|