gds-api-adapters 7.23.3 → 7.24.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -24,4 +24,12 @@ class GdsApi::NeedApi < GdsApi::Base
24
24
  def organisations
25
25
  get_json!("#{endpoint}/organisations")["organisations"]
26
26
  end
27
+
28
+ def close(need_id, duplicate_of)
29
+ # duplicate_of is a hash of the required fields for closing
30
+ # a need as a duplicate: { "duplicate_of" => 100001,
31
+ # "author" => { ... }
32
+ # }
33
+ put_json!("#{endpoint}/needs/#{CGI.escape(need_id.to_s)}/closed", duplicate_of)
34
+ end
27
35
  end
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '7.23.3'
2
+ VERSION = '7.24.0'
3
3
  end
@@ -207,4 +207,18 @@ describe GdsApi::NeedApi do
207
207
  assert_equal 2, orgs.size
208
208
  end
209
209
  end
210
+
211
+ describe "closing needs as duplicates" do
212
+ it "should send a PUT request" do
213
+ fields = {
214
+ duplicate_of: 100001
215
+ }
216
+
217
+ duplicate_stub = stub_request(:put, @base_api_url + "/needs/100005/closed")
218
+ .with(body: fields.to_json)
219
+ .to_return(status: 204)
220
+ @api.close(100005, fields)
221
+ assert_requested duplicate_stub
222
+ end
223
+ end
210
224
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gds-api-adapters
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.23.3
4
+ version: 7.24.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-12-17 00:00:00.000000000 Z
12
+ date: 2013-12-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: plek
@@ -343,7 +343,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
343
343
  version: '0'
344
344
  segments:
345
345
  - 0
346
- hash: 1175191499223805366
346
+ hash: -2096834592399396496
347
347
  required_rubygems_version: !ruby/object:Gem::Requirement
348
348
  none: false
349
349
  requirements:
@@ -352,7 +352,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
352
352
  version: '0'
353
353
  segments:
354
354
  - 0
355
- hash: 1175191499223805366
355
+ hash: -2096834592399396496
356
356
  requirements: []
357
357
  rubyforge_project:
358
358
  rubygems_version: 1.8.23