stash-sword 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +5 -0
- data/lib/stash/sword/client.rb +8 -4
- data/lib/stash/sword/header_utils.rb +2 -2
- data/lib/stash/sword/module_info.rb +1 -1
- data/spec/unit/stash/sword2/client_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af0fd967341aed3754e732ab4d6b80f9a7b3b45e
|
4
|
+
data.tar.gz: 2e5df91999db5694b01df4b796a5a709e3f9fad2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91af61a83ee80da3d08043c8dfcf6a6058324dbdcf6c3e4645a8cfd68e1aef7ed53a01447a1ab911c9fec31a6bdbcdef1d374552eb0f002c33ba2230e3bc96db
|
7
|
+
data.tar.gz: 6aab871185203aee75de2fce19dd54090000d478a96134b6e19fe732261048ed49ce4ef33760e01cb00c904ab2f82bf608935088e0561c0c56aecd69fb423af6
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## 0.1.2 (11 July 2016)
|
2
|
+
|
3
|
+
- Use `Content-disposition: attachment` (per [SWORD spec](http://swordapp.github.io/SWORDv2-Profile/SWORDProfile.html))
|
4
|
+
instead of `form-data`, now that Merritt supports it properly.
|
5
|
+
|
1
6
|
## 0.1.1 (23 June 2016)
|
2
7
|
|
3
8
|
- `logger` is now a parameter passed to `Stash::Sword::Client` instead of a global singleton.
|
data/lib/stash/sword/client.rb
CHANGED
@@ -26,10 +26,8 @@ module Stash
|
|
26
26
|
# @param on_behalf_of [String, nil] the user for whom the original sword package was deposited on behalf of.
|
27
27
|
# Defaults to `username`.
|
28
28
|
# @param logger [Logger, nil] the logger to use, or nil to use a default logger
|
29
|
-
def initialize(collection_uri:, username:, password:, on_behalf_of: nil, logger: nil, helper: nil)
|
30
|
-
|
31
|
-
raise 'no username provided' unless username
|
32
|
-
raise 'no password provided' unless password
|
29
|
+
def initialize(collection_uri:, username:, password:, on_behalf_of: nil, logger: nil, helper: nil) # rubocop:disable Metrics/ParameterLists
|
30
|
+
validate(collection_uri, password, username)
|
33
31
|
@collection_uri = to_uri(collection_uri)
|
34
32
|
@username = username
|
35
33
|
@password = password
|
@@ -70,6 +68,12 @@ module Stash
|
|
70
68
|
|
71
69
|
private
|
72
70
|
|
71
|
+
def validate(collection_uri, password, username)
|
72
|
+
raise 'no collection URI provided' unless collection_uri
|
73
|
+
raise 'no username provided' unless username
|
74
|
+
raise 'no password provided' unless password
|
75
|
+
end
|
76
|
+
|
73
77
|
def maybe_redirect(response)
|
74
78
|
return response unless [301, 302, 307].include?(response.code)
|
75
79
|
log.debug(response_to_log_msg(response))
|
@@ -5,8 +5,8 @@ module Stash
|
|
5
5
|
SIMPLE_ZIP = 'http://purl.org/net/sword/package/SimpleZip'.freeze
|
6
6
|
APPLICATION_ZIP = 'application/zip'.freeze
|
7
7
|
MULTIPART_RELATED_ATOM_XML = 'multipart/related; type="application/atom+xml"'.freeze
|
8
|
-
|
9
|
-
CONTENT_DISPOSITION = 'form-data'.freeze
|
8
|
+
CONTENT_DISPOSITION = 'attachment'.freeze
|
9
|
+
# CONTENT_DISPOSITION = 'form-data'.freeze
|
10
10
|
|
11
11
|
attr_reader :on_behalf_of
|
12
12
|
|
@@ -90,7 +90,7 @@ module Stash
|
|
90
90
|
|
91
91
|
mime_headers = {
|
92
92
|
'Packaging' => 'http://purl.org/net/sword/package/SimpleZip',
|
93
|
-
'Content-Disposition' => "#{expected_disposition}; name
|
93
|
+
'Content-Disposition' => "#{expected_disposition}; name=\"payload\"; filename=\"example.zip\"",
|
94
94
|
'Content-Type' => 'application/zip',
|
95
95
|
'Content-MD5' => md5
|
96
96
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stash-sword
|
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 Moles
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|