duracloud-client 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +43 -0
- data/lib/duracloud/audit_log.rb +1 -4
- data/lib/duracloud/bit_integrity_report.rb +1 -4
- data/lib/duracloud/manifest.rb +3 -9
- data/lib/duracloud/space.rb +1 -1
- data/lib/duracloud/tsv.rb +32 -0
- data/lib/duracloud/version.rb +1 -1
- data/lib/duracloud.rb +1 -1
- data/spec/fixtures/audit_log.tsv +7 -0
- data/spec/fixtures/bit_integrity_report.tsv +4 -0
- data/spec/fixtures/manifest.tsv +4 -0
- data/spec/unit/audit_log_spec.rb +17 -0
- data/spec/unit/bit_integrity_report_spec.rb +17 -0
- data/spec/unit/content_spec.rb +5 -3
- data/spec/unit/manifest_spec.rb +15 -5
- data/spec/unit/space_spec.rb +56 -26
- metadata +9 -3
- data/lib/duracloud/csv_reader.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59d7bfce0068c8362b66814cb1b02804fda5bba8
|
4
|
+
data.tar.gz: e01c0afa6b9369450862d5189ea0954cf2c90491
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ec2713a12f89c42e7b9fb9117d94051ebed80c610f64123ec33ef8226c0c72934c2369cbaba4799da6a6511baecdd9be4946bd88c10c909f08f025fe5787c7c
|
7
|
+
data.tar.gz: b779ccb8781e2a9fc40208766dd87442024f70c2e6c1e643fc0a7270892093c2d00f5bfce7c6e3efa341cfef9a61f4f966a5e6a2900da44a2b73de3e55ebba39
|
data/README.md
CHANGED
@@ -192,6 +192,49 @@ D, [2016-04-29T18:29:03.935451 #32379] DEBUG -- : Duracloud::Client HEAD https:/
|
|
192
192
|
=> false
|
193
193
|
```
|
194
194
|
|
195
|
+
### Reports
|
196
|
+
|
197
|
+
The audit logs, bit integrity reports and manifests are accessible in their original TSV format and in normalized CSV tables.
|
198
|
+
|
199
|
+
#### Audit Log
|
200
|
+
|
201
|
+
```
|
202
|
+
>> space = Duracloud::Space.find("rest-api-testing")
|
203
|
+
>> audit_log = space.audit_log
|
204
|
+
=> #<Duracloud::AuditLog:0x007fd44c077f38 @space_id="rest-api-testing", @store_id=nil, @response=nil>
|
205
|
+
|
206
|
+
>> audit_log.csv
|
207
|
+
D, [2016-05-19T13:36:49.107520 #28754] DEBUG -- : Duracloud::Client GET https://duke.duracloud.org/durastore/audit/rest-api-testing 200 OK
|
208
|
+
=> #<CSV::Table mode:col_or_row row_count:168>
|
209
|
+
```
|
210
|
+
|
211
|
+
#### Manifest
|
212
|
+
|
213
|
+
```
|
214
|
+
>> space = Duracloud::Space.find("rest-api-testing")
|
215
|
+
>> manifest = space.manifest
|
216
|
+
=> #<Duracloud::Manifest:0x007fd44d3c7048 @space_id="rest-api-testing", @store_id=nil, @tsv_response=nil, @bagit_response=nil>
|
217
|
+
|
218
|
+
>> manifest.csv
|
219
|
+
D, [2016-05-19T13:37:39.831013 #28754] DEBUG -- : Duracloud::Client GET https://duke.duracloud.org/durastore/manifest/rest-api-testing 200 OK
|
220
|
+
=> #<CSV::Table mode:col_or_row row_count:10>
|
221
|
+
|
222
|
+
>> manifest.csv.headers
|
223
|
+
=> ["space_id", "content_id", "md5"]
|
224
|
+
```
|
225
|
+
|
226
|
+
#### Bit Integrity Report
|
227
|
+
|
228
|
+
```
|
229
|
+
>> space = Duracloud::Space.find("rest-api-testing")
|
230
|
+
>> bit_integrity_report = space.bit_integrity_report
|
231
|
+
=> #<Duracloud::BitIntegrityReport:0x007f88e39a2950 @space_id="rest-api-testing", @store_id=nil, @report=nil, @properties=nil>
|
232
|
+
|
233
|
+
>> bit_integrity_report.csv
|
234
|
+
D, [2016-05-19T15:39:33.538448 #29974] DEBUG -- : Duracloud::Client GET https://duke.duracloud.org/durastore/bit-integrity/rest-api-testing 200 OK
|
235
|
+
=> #<CSV::Table mode:col_or_row row_count:8>
|
236
|
+
```
|
237
|
+
|
195
238
|
## Versioning
|
196
239
|
|
197
240
|
We endeavor to follow semantic versioning. In particular, versions < 1.0 may introduce backward-incompatible changes without notice. Use at your own risk. Version 1.0 signals a stable API.
|
data/lib/duracloud/audit_log.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
module Duracloud
|
2
2
|
class AuditLog
|
3
|
+
include TSV
|
3
4
|
|
4
5
|
attr_reader :space_id, :store_id
|
5
6
|
|
@@ -9,10 +10,6 @@ module Duracloud
|
|
9
10
|
@response = nil
|
10
11
|
end
|
11
12
|
|
12
|
-
def csv(opts = {})
|
13
|
-
CSVReader.call(tsv, opts)
|
14
|
-
end
|
15
|
-
|
16
13
|
def tsv
|
17
14
|
response.body
|
18
15
|
end
|
@@ -2,6 +2,7 @@ require "date"
|
|
2
2
|
|
3
3
|
module Duracloud
|
4
4
|
class BitIntegrityReport
|
5
|
+
include TSV
|
5
6
|
|
6
7
|
SUCCESS = "SUCCESS".freeze
|
7
8
|
FAILURE = "FAILURE".freeze
|
@@ -29,10 +30,6 @@ module Duracloud
|
|
29
30
|
properties[RESULT_HEADER].first
|
30
31
|
end
|
31
32
|
|
32
|
-
def csv(opts = {})
|
33
|
-
CSVReader.new(tsv, opts)
|
34
|
-
end
|
35
|
-
|
36
33
|
def success?
|
37
34
|
result == SUCCESS
|
38
35
|
end
|
data/lib/duracloud/manifest.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
module Duracloud
|
2
2
|
class Manifest
|
3
|
-
|
4
|
-
BAGIT = "BAGIT".freeze
|
5
|
-
TSV = "TSV".freeze
|
3
|
+
include TSV
|
6
4
|
|
7
5
|
attr_reader :space_id, :store_id
|
8
6
|
|
@@ -13,10 +11,6 @@ module Duracloud
|
|
13
11
|
@bagit_response = nil
|
14
12
|
end
|
15
13
|
|
16
|
-
def csv(opts = {})
|
17
|
-
CSVReader.call(tsv, opts)
|
18
|
-
end
|
19
|
-
|
20
14
|
def tsv
|
21
15
|
tsv_response.body
|
22
16
|
end
|
@@ -28,11 +22,11 @@ module Duracloud
|
|
28
22
|
private
|
29
23
|
|
30
24
|
def tsv_response
|
31
|
-
@tsv_response ||= get_response(TSV)
|
25
|
+
@tsv_response ||= get_response("TSV")
|
32
26
|
end
|
33
27
|
|
34
28
|
def bagit_response
|
35
|
-
@bagit_response ||= get_response(BAGIT)
|
29
|
+
@bagit_response ||= get_response("BAGIT")
|
36
30
|
end
|
37
31
|
|
38
32
|
def get_response(format)
|
data/lib/duracloud/space.rb
CHANGED
@@ -170,7 +170,7 @@ module Duracloud
|
|
170
170
|
# Return the bit integrity report for the space
|
171
171
|
# @return [Duracloud::BitIntegrityReport] the report
|
172
172
|
def bit_integrity_report
|
173
|
-
|
173
|
+
BitIntegrityReport.new(space_id, store_id)
|
174
174
|
end
|
175
175
|
|
176
176
|
# Return the manifest for the space
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require "csv"
|
2
|
+
|
3
|
+
module Duracloud
|
4
|
+
module TSV
|
5
|
+
# @return [CSV::Table]
|
6
|
+
def csv
|
7
|
+
@csv ||= CSV::Table.new([]).tap do |csv|
|
8
|
+
header_line, rows = tsv.split(/\r?\n/, 2)
|
9
|
+
headers = header_line.split("\t").map { |h| h.downcase.gsub(/-/, "_") }
|
10
|
+
header_row = CSV::Row.new(headers, headers, true)
|
11
|
+
csv << header_row
|
12
|
+
rows.split(/\r?\n/).each do |row|
|
13
|
+
csv << row.split("\t")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [Enumerator] rows as hashes
|
19
|
+
def rows
|
20
|
+
Enumerator.new do |e|
|
21
|
+
csv.by_row!.each do |row|
|
22
|
+
next if row.header_row?
|
23
|
+
e << row.to_hash
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def tsv
|
29
|
+
raise NotImplementedError, "Including module must implement `tsv`."
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/duracloud/version.rb
CHANGED
data/lib/duracloud.rb
CHANGED
@@ -9,7 +9,6 @@ module Duracloud
|
|
9
9
|
autoload :Connection, "duracloud/connection"
|
10
10
|
autoload :Content, "duracloud/content"
|
11
11
|
autoload :ContentProperties, "duracloud/content_properties"
|
12
|
-
autoload :CSVReader, "duracloud/csv_reader"
|
13
12
|
autoload :DurastoreRequest, "duracloud/durastore_request"
|
14
13
|
autoload :ErrorHandler, "duracloud/error_handler"
|
15
14
|
autoload :HasProperties, "duracloud/has_properties"
|
@@ -23,4 +22,5 @@ module Duracloud
|
|
23
22
|
autoload :SpaceAcls, "duracloud/space_acls"
|
24
23
|
autoload :SpaceProperties, "duracloud/space_properties"
|
25
24
|
autoload :Store, "duracloud/store"
|
25
|
+
autoload :TSV, "duracloud/tsv"
|
26
26
|
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
account store-id space-id content-id content-md5 content-size content-mimetype content-properties space-acls source-space-id source-content-id timestamp action username
|
2
|
+
example 1065 myspace 2016-04-27T18:34:18.018 CREATE_SPACE bob@example.com
|
3
|
+
example 1065 myspace {acl-bob@example.com=WRITE} 2016-04-27T18:34:20.020 SET_SPACE_ACLS bob@example.com
|
4
|
+
example 1065 myspace METADATA/d6/42/0c/9c/d6420c9c-82f8-4f6a-baf7-37b9be7f4c5f/20160502_172925/manifest-md5.txt 21fef474787860ccfb67bdd99ddee93a 55 text/plain { "content-file-path" : "/duracloud/METADATA/d6/42/0c/9c/d6420c9c-82f8-4f6a-baf7-37b9be7f4c5f/20160502_172925/manifest-md5.txt", "creator" : "bob@example.com", "content-file-created" : "2016-05-02T15:04:59.059", "content-file-last-accessed" : "2016-05-02T15:04:59.059", "content-mimetype" : "text/plain", "content-file-modified" : "2016-05-02T15:04:59.059"} 2016-05-02T21:06:45.045 ADD_CONTENT bob@example.com
|
5
|
+
example 1065 myspace METADATA/d6/42/0c/9c/d6420c9c-82f8-4f6a-baf7-37b9be7f4c5f/20160502_172925/data/object-desc.rdf e5f8c32a4997d808538df98b893caee0 2383 application/octet-stream { "content-file-path" : "/duracloud/METADATA/d6/42/0c/9c/d6420c9c-82f8-4f6a-baf7-37b9be7f4c5f/20160502_172925/data/object-desc.rdf", "creator" : "bob@example.com", "content-file-created" : "2016-05-02T15:04:59.059", "content-file-last-accessed" : "2016-05-02T15:11:31.031", "content-mimetype" : "application/octet-stream", "content-file-modified" : "2016-05-02T15:04:59.059"} 2016-05-02T21:06:46.046 ADD_CONTENT bob@example.com
|
6
|
+
example 1065 myspace METADATA/d6/42/0c/9c/d6420c9c-82f8-4f6a-baf7-37b9be7f4c5f/20160502_172925.zip edeb8560a822aad5cfb43dd2d563903b 2406 application/zip { "content-file-path" : "/duracloud/METADATA/d6/42/0c/9c/d6420c9c-82f8-4f6a-baf7-37b9be7f4c5f/20160502_172925.zip", "creator" : "bob@example.com", "content-file-created" : "2016-05-02T15:04:59.059", "content-file-last-accessed" : "2016-05-02T15:11:15.015", "content-mimetype" : "application/zip", "content-file-modified" : "2016-05-02T15:04:59.059"} 2016-05-02T21:06:46.046 ADD_CONTENT bob@example.com
|
7
|
+
example 1065 myspace METADATA/f1/ee/ac/99/f1eeac99-4d9a-49d1-8e17-02a61e244642/20160426_120239.zip f69d67c54d2aa7f97fb55cb40f357f79 6858 application/zip { "content-file-path" : "/duracloud/METADATA/f1/ee/ac/99/f1eeac99-4d9a-49d1-8e17-02a61e244642/20160426_120239.zip", "creator" : "bob@example.com", "content-file-created" : "2016-05-02T15:43:40.040", "content-file-last-accessed" : "2016-05-02T15:43:40.040", "content-mimetype" : "application/zip", "content-file-modified" : "2016-05-02T15:43:40.040"} 2016-05-02T21:06:53.053 ADD_CONTENT bob@example.com
|
@@ -0,0 +1,4 @@
|
|
1
|
+
date-checked account store-id store-type space-id content-id result content-checksum provider-checksum manifest-checksum details
|
2
|
+
2016-05-15T04:11:14 example 1065 AMAZON_S3 myspace BINARIES/00/00/e8/0000e819ac3e67d039d288adaab5b5e44c3c21d9 SUCCESS 27333f3c06a6d259863384799be68d30 27333f3c06a6d259863384799be68d30 27333f3c06a6d259863384799be68d30 --
|
3
|
+
2016-05-15T04:11:21 example 1065 AMAZON_S3 myspace BINARIES/00/03/4a/00034a58075c694f54be09393cf59d90c683954f SUCCESS 12283b9c2772b45b290962753cd8f66d 12283b9c2772b45b290962753cd8f66d 12283b9c2772b45b290962753cd8f66d --
|
4
|
+
2016-05-15T04:11:19 example 1065 AMAZON_S3 myspace BINARIES/00/03/7e/00037e755c26c7ddebedd159a87e98c8149461a2 SUCCESS 26cf06d36cbfe4f9fe50e5b14204eed1 26cf06d36cbfe4f9fe50e5b14204eed1 26cf06d36cbfe4f9fe50e5b14204eed1 --
|
@@ -0,0 +1,4 @@
|
|
1
|
+
space-id content-id MD5
|
2
|
+
myspace METADATA/d6/42/0c/9c/d6420c9c-82f8-4f6a-baf7-37b9be7f4c5f/20160502_172925/manifest-md5.txt 21fef474787860ccfb67bdd99ddee93a
|
3
|
+
myspace METADATA/d6/42/0c/9c/d6420c9c-82f8-4f6a-baf7-37b9be7f4c5f/20160502_172925/data/object-desc.rdf e5f8c32a4997d808538df98b893caee0
|
4
|
+
myspace METADATA/d6/42/0c/9c/d6420c9c-82f8-4f6a-baf7-37b9be7f4c5f/20160502_172925.zip 8de045d0dd989e0d778272a262645835
|
data/spec/unit/audit_log_spec.rb
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
module Duracloud
|
2
2
|
RSpec.describe AuditLog do
|
3
3
|
|
4
|
+
let(:tsv) { File.read(File.join(File.expand_path('../../fixtures/audit_log.tsv', __FILE__))) }
|
5
|
+
|
6
|
+
before {
|
7
|
+
allow(subject).to receive(:tsv) { tsv }
|
8
|
+
}
|
9
|
+
|
10
|
+
subject { described_class.new("myspace") }
|
11
|
+
|
12
|
+
describe "CSV" do
|
13
|
+
specify {
|
14
|
+
expect(subject.csv.headers).to eq(%w(account store_id space_id content_id content_md5 content_size content_mimetype content_properties space_acls source_space_id source_content_id timestamp action username))
|
15
|
+
expect(subject.csv.size).to eq(7)
|
16
|
+
expect(subject.csv.to_s.split("\n").first).to eq("account,store_id,space_id,content_id,content_md5,content_size,content_mimetype,content_properties,space_acls,source_space_id,source_content_id,timestamp,action,username")
|
17
|
+
expect(subject.rows.next).to eq({"account"=>"example", "store_id"=>"1065", "space_id"=>"myspace", "content_id"=>"", "content_md5"=>"", "content_size"=>"", "content_mimetype"=>"", "content_properties"=>"", "space_acls"=>"", "source_space_id"=>"", "source_content_id"=>"", "timestamp"=>"2016-04-27T18:34:18.018", "action"=>"CREATE_SPACE", "username"=>"bob@example.com"})
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
4
21
|
end
|
5
22
|
end
|
@@ -1,5 +1,22 @@
|
|
1
1
|
module Duracloud
|
2
2
|
RSpec.describe BitIntegrityReport do
|
3
3
|
|
4
|
+
let(:tsv) { File.read(File.join(File.expand_path('../../fixtures/bit_integrity_report.tsv', __FILE__))) }
|
5
|
+
|
6
|
+
before {
|
7
|
+
allow(subject).to receive(:tsv) { tsv }
|
8
|
+
}
|
9
|
+
|
10
|
+
subject { described_class.new("myspace") }
|
11
|
+
|
12
|
+
describe "CSV" do
|
13
|
+
specify {
|
14
|
+
expect(subject.csv.headers).to eq(%w(date_checked account store_id store_type space_id content_id result content_checksum provider_checksum manifest_checksum details))
|
15
|
+
expect(subject.csv.size).to eq(4)
|
16
|
+
expect(subject.csv.to_s.split("\n").first).to eq("date_checked,account,store_id,store_type,space_id,content_id,result,content_checksum,provider_checksum,manifest_checksum,details")
|
17
|
+
expect(subject.rows.next).to eq({"date_checked"=>"2016-05-15T04:11:14", "account"=>"example", "store_id"=>"1065", "store_type"=>"AMAZON_S3", "space_id"=>"myspace", "content_id"=>"BINARIES/00/00/e8/0000e819ac3e67d039d288adaab5b5e44c3c21d9", "result"=>"SUCCESS", "content_checksum"=>"27333f3c06a6d259863384799be68d30", "provider_checksum"=>"27333f3c06a6d259863384799be68d30", "manifest_checksum"=>"27333f3c06a6d259863384799be68d30", "details"=>"--"})
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
4
21
|
end
|
5
22
|
end
|
data/spec/unit/content_spec.rb
CHANGED
@@ -109,11 +109,13 @@ module Duracloud
|
|
109
109
|
|
110
110
|
describe "#properties" do
|
111
111
|
before {
|
112
|
-
|
113
|
-
|
112
|
+
allow(Client).to receive(:get_content_properties)
|
113
|
+
.with("foo", "bar", hash_including(storeID: nil)) {
|
114
|
+
double(headers: {'x-dura-meta-creator'=>'testuser'},
|
115
|
+
content_type: 'text/plain')
|
116
|
+
}
|
114
117
|
}
|
115
118
|
specify {
|
116
|
-
pending "A problem with Webmock / HTTPClient?"
|
117
119
|
content = Content.find("foo", "bar")
|
118
120
|
expect(content.properties.x_dura_meta_creator).to eq('testuser')
|
119
121
|
}
|
data/spec/unit/manifest_spec.rb
CHANGED
@@ -1,12 +1,22 @@
|
|
1
1
|
module Duracloud
|
2
2
|
RSpec.describe Manifest do
|
3
3
|
|
4
|
-
let(:
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
EOS
|
4
|
+
let(:tsv) { File.read(File.join(File.expand_path('../../fixtures/manifest.tsv', __FILE__))) }
|
5
|
+
|
6
|
+
before {
|
7
|
+
allow(subject).to receive(:tsv) { tsv }
|
9
8
|
}
|
10
9
|
|
10
|
+
subject { described_class.new("myspace") }
|
11
|
+
|
12
|
+
describe "CSV" do
|
13
|
+
specify {
|
14
|
+
expect(subject.csv.headers).to eq(%w(space_id content_id md5))
|
15
|
+
expect(subject.csv.size).to eq(4)
|
16
|
+
expect(subject.csv.to_s.split("\n").first).to eq("space_id,content_id,md5")
|
17
|
+
expect(subject.rows.next).to eq({"space_id"=>"myspace", "content_id"=>"METADATA/d6/42/0c/9c/d6420c9c-82f8-4f6a-baf7-37b9be7f4c5f/20160502_172925/manifest-md5.txt", "md5"=>"21fef474787860ccfb67bdd99ddee93a"})
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
11
21
|
end
|
12
22
|
end
|
data/spec/unit/space_spec.rb
CHANGED
@@ -101,40 +101,70 @@ EOS
|
|
101
101
|
}
|
102
102
|
let(:url) { "https://example.com/durastore/foo" }
|
103
103
|
before {
|
104
|
-
stub_request(:head, url)
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
104
|
+
stub_request(:head, "#{url}/foo1")
|
105
|
+
stub_request(:head, "#{url}/foo2")
|
106
|
+
stub_request(:head, "#{url}/foo3")
|
107
|
+
allow(Client).to receive(:get_space)
|
108
|
+
.with("foo", hash_including(storeID: nil)) {
|
109
|
+
double(body: body,
|
110
|
+
headers: {
|
111
|
+
'x-dura-meta-space-count'=>'3',
|
112
|
+
'x-dura-meta-space-created'=>'2016-04-05T17:59:11'
|
113
|
+
})
|
114
|
+
}
|
115
|
+
allow(Client).to receive(:get_space_properties)
|
116
|
+
.with("foo", hash_including(storeID: nil)) {
|
117
|
+
double(body: "",
|
118
|
+
headers: {
|
119
|
+
'x-dura-meta-space-count'=>'3',
|
120
|
+
'x-dura-meta-space-created'=>'2016-04-05T17:59:11'
|
121
|
+
})
|
122
|
+
}
|
110
123
|
}
|
111
|
-
describe "
|
112
|
-
|
113
|
-
|
124
|
+
describe "class methods" do
|
125
|
+
specify {
|
126
|
+
expect(Space.content_ids("foo").to_a).to eq(["foo1", "foo2", "foo3"])
|
127
|
+
}
|
128
|
+
specify {
|
129
|
+
expect(Space.items("foo").map(&:id)).to eq(["foo1", "foo2", "foo3"])
|
130
|
+
}
|
131
|
+
specify {
|
132
|
+
expect(Space.count("foo")).to eq(3)
|
133
|
+
}
|
114
134
|
end
|
115
|
-
describe "
|
135
|
+
describe "instance methods" do
|
116
136
|
subject { Space.find("foo") }
|
117
137
|
specify {
|
118
|
-
pending "Correcting the stub request"
|
119
138
|
expect(subject.content_ids.to_a).to eq(["foo1", "foo2", "foo3"])
|
120
139
|
}
|
140
|
+
specify {
|
141
|
+
expect(subject.items.map(&:id)).to eq(["foo1", "foo2", "foo3"])
|
142
|
+
}
|
143
|
+
its(:count) { is_expected.to eq(3) }
|
121
144
|
end
|
122
|
-
|
123
|
-
describe ".items"
|
124
|
-
describe "#items"
|
125
|
-
|
126
|
-
describe ".count"
|
127
|
-
describe "#count"
|
128
145
|
end
|
129
146
|
|
130
|
-
describe "
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
147
|
+
describe "reports" do
|
148
|
+
describe "class methods" do
|
149
|
+
before {
|
150
|
+
stub_request(:head, "https://example.com/durastore/foo")
|
151
|
+
}
|
152
|
+
specify {
|
153
|
+
expect(Space.audit_log("foo")).to be_a(AuditLog)
|
154
|
+
}
|
155
|
+
specify {
|
156
|
+
expect(Space.bit_integrity_report("foo")).to be_a(BitIntegrityReport)
|
157
|
+
}
|
158
|
+
specify {
|
159
|
+
expect(Space.manifest("foo")).to be_a(Manifest)
|
160
|
+
}
|
161
|
+
end
|
162
|
+
describe "instance methods" do
|
163
|
+
subject { described_class.new("foo") }
|
164
|
+
its(:audit_log) { is_expected.to be_a(AuditLog) }
|
165
|
+
its(:bit_integrity_report) { is_expected.to be_a(BitIntegrityReport) }
|
166
|
+
its(:manifest) { is_expected.to be_a(Manifest) }
|
167
|
+
end
|
168
|
+
end
|
139
169
|
end
|
140
170
|
end
|
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.1.
|
4
|
+
version: 0.1.2
|
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-05-
|
11
|
+
date: 2016-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashie
|
@@ -160,7 +160,6 @@ files:
|
|
160
160
|
- lib/duracloud/connection.rb
|
161
161
|
- lib/duracloud/content.rb
|
162
162
|
- lib/duracloud/content_properties.rb
|
163
|
-
- lib/duracloud/csv_reader.rb
|
164
163
|
- lib/duracloud/durastore_request.rb
|
165
164
|
- lib/duracloud/error.rb
|
166
165
|
- lib/duracloud/error_handler.rb
|
@@ -175,7 +174,11 @@ files:
|
|
175
174
|
- lib/duracloud/space_acls.rb
|
176
175
|
- lib/duracloud/space_properties.rb
|
177
176
|
- lib/duracloud/store.rb
|
177
|
+
- lib/duracloud/tsv.rb
|
178
178
|
- lib/duracloud/version.rb
|
179
|
+
- spec/fixtures/audit_log.tsv
|
180
|
+
- spec/fixtures/bit_integrity_report.tsv
|
181
|
+
- spec/fixtures/manifest.tsv
|
179
182
|
- spec/spec_helper.rb
|
180
183
|
- spec/unit/audit_log_spec.rb
|
181
184
|
- spec/unit/bit_integrity_report_spec.rb
|
@@ -210,6 +213,9 @@ signing_key:
|
|
210
213
|
specification_version: 4
|
211
214
|
summary: Ruby client for communicating with DuraCloud
|
212
215
|
test_files:
|
216
|
+
- spec/fixtures/audit_log.tsv
|
217
|
+
- spec/fixtures/bit_integrity_report.tsv
|
218
|
+
- spec/fixtures/manifest.tsv
|
213
219
|
- spec/spec_helper.rb
|
214
220
|
- spec/unit/audit_log_spec.rb
|
215
221
|
- spec/unit/bit_integrity_report_spec.rb
|
data/lib/duracloud/csv_reader.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
require "csv"
|
2
|
-
|
3
|
-
module Duracloud
|
4
|
-
class CSVReader
|
5
|
-
|
6
|
-
CSV_OPTS = {
|
7
|
-
col_sep: '\t',
|
8
|
-
headers: :first_row,
|
9
|
-
write_headers: true,
|
10
|
-
return_headers: false,
|
11
|
-
header_converters: [ ->(h){ h.downcase.gsub(/-/, "_") } ]
|
12
|
-
}
|
13
|
-
|
14
|
-
def self.call(data, opts = {})
|
15
|
-
CSV.new(data, CSV_OPTS.merge(opts))
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
19
|
-
end
|