gds-api-adapters 7.24.0 → 7.25.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/gds_api/base.rb CHANGED
@@ -44,10 +44,6 @@ class GdsApi::Base
44
44
  self.endpoint = options[:endpoint_url]
45
45
  end
46
46
 
47
- def adapter_name
48
- self.class.to_s.split("::").last.downcase
49
- end
50
-
51
47
  def url_for_slug(slug, options={})
52
48
  base = "#{base_url}/#{slug}.json#{query_string(options)}"
53
49
  end
@@ -1,12 +1,13 @@
1
- require 'gds_api/publisher'
2
- require 'gds_api/imminence'
3
- require 'gds_api/panopticon'
4
- require 'gds_api/content_api'
5
- require 'gds_api/licence_application'
6
1
  require 'gds_api/asset_manager'
7
- require 'gds_api/worldwide'
2
+ require 'gds_api/business_support_api'
3
+ require 'gds_api/content_api'
8
4
  require 'gds_api/fact_cave'
5
+ require 'gds_api/imminence'
6
+ require 'gds_api/licence_application'
9
7
  require 'gds_api/need_api'
8
+ require 'gds_api/panopticon'
9
+ require 'gds_api/publisher'
10
+ require 'gds_api/worldwide'
10
11
 
11
12
  module GdsApi
12
13
  module Helpers
@@ -14,6 +15,10 @@ module GdsApi
14
15
  @asset_manager_api ||= GdsApi::AssetManager.new(Plek.current.find('asset-manager'), options)
15
16
  end
16
17
 
18
+ def business_support_api(options = {})
19
+ @business_support_api ||= GdsApi::BusinessSupportApi.new(Plek.current.find("business-support-api"), options)
20
+ end
21
+
17
22
  def content_api(options = {})
18
23
  @content_api ||= GdsApi::ContentApi.new(Plek.current.find("contentapi"), options)
19
24
  end
@@ -10,10 +10,6 @@ class GdsApi::LicenceApplication < GdsApi::Base
10
10
  get_json(build_licence_url(id, snac_code))
11
11
  end
12
12
 
13
- def adapter_name
14
- "licensify"
15
- end
16
-
17
13
  private
18
14
 
19
15
  def build_licence_url(id, snac_code)
@@ -11,13 +11,13 @@ module GdsApi
11
11
  BUSINESS_SUPPORT_API_ENDPOINT = Plek.current.find('business-support-api')
12
12
 
13
13
  def setup_business_support_api_schemes_stubs
14
- @stubbed_content_api_business_support_schemes = {}
14
+ @stubbed_business_support_schemes = {}
15
15
  stub_request(:get, %r{\A#{BUSINESS_SUPPORT_API_ENDPOINT}/business-support-schemes\.json}).to_return do |request|
16
16
  if request.uri.query_values
17
- key = request.uri.query_values.values.sort.hash
18
- results = @stubbed_content_api_business_support_schemes[key] || []
17
+ key = facet_key(request.uri.query_values)
18
+ results = @stubbed_business_support_schemes[key] || []
19
19
  else
20
- results = @stubbed_content_api_business_support_schemes.values.flatten
20
+ results = @stubbed_business_support_schemes['default']
21
21
  end
22
22
  {:body => plural_response_base.merge("results" => results, "total" => results.size).to_json}
23
23
  end
@@ -25,11 +25,11 @@ module GdsApi
25
25
  end
26
26
 
27
27
  def business_support_api_has_scheme(scheme, facets={})
28
- key = facets.values.sort.hash
29
- unless @stubbed_content_api_business_support_schemes[key]
30
- @stubbed_content_api_business_support_schemes[key] = []
28
+ key = facet_key(facets)
29
+ unless @stubbed_business_support_schemes.has_key?(key)
30
+ @stubbed_business_support_schemes[key] = []
31
31
  end
32
- @stubbed_content_api_business_support_schemes[key] << scheme
32
+ @stubbed_business_support_schemes[key] << scheme
33
33
  end
34
34
 
35
35
  def business_support_api_has_schemes(schemes, facets={})
@@ -44,6 +44,14 @@ module GdsApi
44
44
  {:body => response_base.merge(:format => 'business_support', :title => title, :details => scheme).to_json}
45
45
  end
46
46
  end
47
+
48
+ private
49
+
50
+ def facet_key(facets)
51
+ key = 'default'
52
+ key = facets.values.sort.hash.to_s if facets and !facets.empty?
53
+ key
54
+ end
47
55
  end
48
56
  end
49
57
  end
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '7.24.0'
2
+ VERSION = '7.25.0'
3
3
  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.24.0
4
+ version: 7.25.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-18 00:00:00.000000000 Z
12
+ date: 2014-01-03 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: -2096834592399396496
346
+ hash: -1935104630694198771
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: -2096834592399396496
355
+ hash: -1935104630694198771
356
356
  requirements: []
357
357
  rubyforge_project:
358
358
  rubygems_version: 1.8.23