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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0037ff658b5959ae0dca3bdfed3af072d81a7755
4
- data.tar.gz: 6677bb48ecbe7d07e25d1bf27c1737250f4c1ae9
3
+ metadata.gz: af0fd967341aed3754e732ab4d6b80f9a7b3b45e
4
+ data.tar.gz: 2e5df91999db5694b01df4b796a5a709e3f9fad2
5
5
  SHA512:
6
- metadata.gz: 6a0e6a7532fb0e39ae48dd242e9b20f03cae6870f43addbbb20c6d137f49cddcec1510798c9e33fbb516c8a6b71906afafc2c8c647cfdb9bc6cdd97417d28d57
7
- data.tar.gz: 0265b3b0cfc3fd3d0ea4eac70bafd83f528632259e9bbc4943cd869b0aa5cd490e1a7e880a749bb73c13e9a400eb7f2c246fbe87a543d8092b8f1ff3517e4866
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.
@@ -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
- raise 'no collection URI provided' unless collection_uri
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
- # CONTENT_DISPOSITION = 'attachment'.freeze
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
 
@@ -4,7 +4,7 @@ module Stash
4
4
  NAME = 'stash-sword'.freeze
5
5
 
6
6
  # The version of this gem
7
- VERSION = '0.1.1'.freeze
7
+ VERSION = '0.1.2'.freeze
8
8
 
9
9
  # The copyright notice for this gem
10
10
  COPYRIGHT = 'Copyright (c) 2016 The Regents of the University of California'.freeze
@@ -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=payload; filename=\"example.zip\"",
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.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-06-24 00:00:00.000000000 Z
11
+ date: 2016-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client