archivesspace-client 0.5.0 → 0.5.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 324a811c6e310286a30371cda14266b61f11570373aa20baf61b1f54b8e3c8d3
4
- data.tar.gz: 319354d94ec1fb765a8a811f2ff8273c21342f40fa8e3a5e3c122b4b9af85b92
3
+ metadata.gz: d62f24f62e27e4dcb265982a09d19929029a12d7926983137f7835b9e945ec8d
4
+ data.tar.gz: 88b7f1d79f02207cba4dfbb6334fae4a7080adca8634c6c52b53d6616398dfd0
5
5
  SHA512:
6
- metadata.gz: 1ecd05a580e11e19fd50db9b0f0d4ede6ff816d36d8789d50420a1d1275bf9247c5172b932f3ad9627e96655ce27f919d35e6737816650541615cf5efea22c95
7
- data.tar.gz: 679be0bac6c9a81b685ed233e457d98670e00f834946f57d7ed46091bfd83040c0ee12d0e196bddd00a9bfb88fefc8b0c06170dfd294652b4322b958bfdac4df
6
+ metadata.gz: d776656385e5e84c4ba0adfec158e6a43ef60720aec43108a15e6e307adaf5022eb2168d463cdc74f4657aae62bbea80662d851dc65aee8a4ed02b1f9cc432d2
7
+ data.tar.gz: 482eeab5c389e3433bae0102a687dfc42ede31792bf0b9bafcd2b0ec22492769523c42639718f9c202fc83abd2b08b6b798a7827826441c2ee951de9d817eda9
@@ -71,6 +71,7 @@ module ArchivesSpace
71
71
 
72
72
  def request(method, path, options = {})
73
73
  sleep config.throttle
74
+ options = options.dup
74
75
  options[:headers] = {TOKEN => token} if token
75
76
  Request.new(context, config, method, path, options).execute
76
77
  end
@@ -14,7 +14,7 @@ module ArchivesSpace
14
14
  @method = method.downcase.to_sym
15
15
  @path = path.gsub(%r{^/+}, "")
16
16
 
17
- @options = options
17
+ @options = options.dup
18
18
 
19
19
  @options[:headers] = DEFAULT_HEADERS.merge(@options.fetch(:headers, {}))
20
20
  @options[:headers]["User-Agent"] = "#{Client::NAME}/#{Client::VERSION}"
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ArchivesSpace
4
4
  class Client
5
- VERSION = "0.5.0"
5
+ VERSION = "0.5.1"
6
6
  end
7
7
  end
@@ -158,6 +158,24 @@ describe ArchivesSpace::Client do
158
158
  request = ArchivesSpace::Request.new(nil, client.config)
159
159
  expect(request.options[:headers]["User-Agent"]).to eq "#{ArchivesSpace::Client::NAME}/#{ArchivesSpace::Client::VERSION}"
160
160
  end
161
+
162
+ it "does not mutate the caller's options hash" do
163
+ opts = {query: {foo: "bar"}, headers: {"X-Custom" => "1"}}
164
+ caller_opts = Marshal.load(Marshal.dump(opts))
165
+ ArchivesSpace::Request.new(nil, client.config, "GET", "resources", opts)
166
+ expect(opts).to eq(caller_opts)
167
+ end
168
+
169
+ it "does not mutate the caller's options hash when injecting the session token" do
170
+ client.token = "abc123"
171
+ opts = {query: {foo: "bar"}}
172
+ caller_opts = Marshal.load(Marshal.dump(opts))
173
+ allow(ArchivesSpace::Request).to receive(:new).and_return(
174
+ double("request", execute: double("response", status_code: 200))
175
+ )
176
+ client.get("resources", opts)
177
+ expect(opts).to eq(caller_opts)
178
+ end
161
179
  end
162
180
 
163
181
  describe "URL construction" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: archivesspace-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Cooper