gds-api-adapters 11.6.0 → 12.0.0

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.
@@ -9,7 +9,7 @@ class GdsApi::FinderSchema
9
9
  document_attributes.each_with_object({}) do |(k, v), values|
10
10
  values.store(
11
11
  user_friendly_facet_label(k.to_s),
12
- find_schema_allowed_value_entry(k.to_s, v)
12
+ user_friendly_facet_value(k.to_s, v),
13
13
  )
14
14
  end
15
15
  end
@@ -27,7 +27,13 @@ class GdsApi::FinderSchema
27
27
  find_facet(facet_key.to_s).fetch("name")
28
28
  end
29
29
 
30
- def find_schema_allowed_value_entry(facet_key, value)
30
+ def user_friendly_facet_value(facet_key, value)
31
+ Array(value).map { |value|
32
+ find_schema_allowed_value_label(facet_key, value)
33
+ }
34
+ end
35
+
36
+ def find_schema_allowed_value_label(facet_key, value)
31
37
  value_label_pair = allowed_values_for(facet_key)
32
38
  .find { |schema_value|
33
39
  schema_value.fetch("value") == value
@@ -40,6 +40,10 @@ module GdsApi
40
40
  @http_response.code
41
41
  end
42
42
 
43
+ def headers
44
+ @http_response.headers
45
+ end
46
+
43
47
  def to_hash
44
48
  @parsed ||= transform_parsed(JSON.parse(@http_response.body))
45
49
  end
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '11.6.0'
2
+ VERSION = '12.0.0'
3
3
  end
@@ -49,8 +49,8 @@ describe GdsApi::FinderSchema do
49
49
 
50
50
  let(:formatted_attrs) {
51
51
  {
52
- "Case type" => "CA98 and civil cartels",
53
- "Market sector" => "Aerospace",
52
+ "Case type" => ["CA98 and civil cartels"],
53
+ "Market sector" => ["Aerospace"],
54
54
  }
55
55
  }
56
56
 
@@ -73,5 +73,23 @@ describe GdsApi::FinderSchema do
73
73
  "market sector 'does-not-exist' not found in cma-cases schema")
74
74
  end
75
75
  end
76
+
77
+ describe "when a value is an array of values" do
78
+ let(:document_attrs) {
79
+ {
80
+ market_sector: ["aerospace"],
81
+ }
82
+ }
83
+
84
+ let(:formatted_attrs) {
85
+ {
86
+ "Market sector" => ["Aerospace"],
87
+ }
88
+ }
89
+
90
+ it "formats the given keys and values" do
91
+ schema.user_friendly_values(document_attrs).must_equal(formatted_attrs)
92
+ end
93
+ end
76
94
  end
77
95
  end
@@ -5,7 +5,7 @@ describe GdsApi::Response do
5
5
 
6
6
  describe "accessing HTTP response details" do
7
7
  before :each do
8
- @mock_http_response = stub(:body => "A Response body", :code => 200)
8
+ @mock_http_response = stub(:body => "A Response body", :code => 200, :headers => {'cache-control' => 'public'})
9
9
  @response = GdsApi::Response.new(@mock_http_response)
10
10
  end
11
11
 
@@ -16,6 +16,10 @@ describe GdsApi::Response do
16
16
  it "should return the status code" do
17
17
  assert_equal 200, @response.code
18
18
  end
19
+
20
+ it "should pass-on the response headers" do
21
+ assert_equal({'cache-control' => 'public'}, @response.headers)
22
+ end
19
23
  end
20
24
 
21
25
  describe "processing web_urls" do
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: 11.6.0
4
+ version: 12.0.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: 2014-07-11 00:00:00.000000000 Z
12
+ date: 2014-07-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: plek
@@ -385,7 +385,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
385
385
  version: '0'
386
386
  segments:
387
387
  - 0
388
- hash: 713806713155441280
388
+ hash: -1023858681611689448
389
389
  required_rubygems_version: !ruby/object:Gem::Requirement
390
390
  none: false
391
391
  requirements:
@@ -394,7 +394,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
394
394
  version: '0'
395
395
  segments:
396
396
  - 0
397
- hash: 713806713155441280
397
+ hash: -1023858681611689448
398
398
  requirements: []
399
399
  rubyforge_project:
400
400
  rubygems_version: 1.8.23