Skip to content

Commit

Permalink
Remove Panopticon API
Browse files Browse the repository at this point in the history
  • Loading branch information
tijmenb committed Feb 13, 2017
1 parent 48439d0 commit 0053047
Show file tree
Hide file tree
Showing 10 changed files with 6 additions and 642 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,7 @@
# Unreleased

* Remove Panopticon API

# 39.2.0

* Add support for the import endpoint for the Publishing API.
Expand Down
24 changes: 1 addition & 23 deletions README.md
Expand Up @@ -79,33 +79,11 @@ downstream service can optionally use the identifier to perform authorisation
on the request. This will be used by content-store as a mechanism to only
return access-limited content to authenticated and authorised users.

## App-level Authentication

The API Adapters currently support either HTTP Basic or OAuth2 (bearer token)
authentication. This allows an application to identify itself to another where
required. This is currently used by the `GdsApi::Panopticon::Registerer`
adapter, which expects a constant called `PANOPTICON_API_CREDENTIALS` to be
defined that identifies the calling application to Panopticon:

PANOPTICON_API_CREDENTIALS = { bearer_token: 'MY_BEARER_TOKEN' }

## Test Helpers

There are also test helpers for stubbing various requests in other apps.
Example usage of the panopticon helper:

In `test_helper.rb`:

require 'gds_api/test_helpers/panopticon'

class ActiveSupport::TestCase
include GdsApi::TestHelpers::Panopticon
end

In the test:

panopticon_has_metadata('id' => 12345, 'need_ids' => [need.id],
'slug' => 'my_slug')
See [all the test helpers in lib/gds_api/test_helpers](/lib/gds_api/test_helpers).

### Dependencies

Expand Down
11 changes: 1 addition & 10 deletions lib/gds_api/helpers.rb
Expand Up @@ -5,7 +5,6 @@
require 'gds_api/imminence'
require 'gds_api/licence_application'
require 'gds_api/need_api'
require 'gds_api/panopticon'
require 'gds_api/worldwide'
require 'gds_api/email_alert_api'

Expand Down Expand Up @@ -39,14 +38,6 @@ def need_api(options = {})
@need_api ||= GdsApi::NeedApi.new(Plek.current.find("needapi"), options)
end

def panopticon_api(options = {})
@panopticon_api ||= GdsApi::Panopticon.new(Plek.current.find("panopticon"), panopticon_api_credentials.merge(options))
end

def panopticon_api_credentials
Object::const_defined?(:PANOPTICON_API_CREDENTIALS) ? PANOPTICON_API_CREDENTIALS : {}
end

def worldwide_api(options = {})
@worldwide_api ||= GdsApi::Worldwide.new(Plek.current.find("whitehall-admin"), options)
end
Expand All @@ -57,7 +48,7 @@ def email_alert_api(options = {})

def self.included(klass)
if klass.respond_to?(:helper_method)
klass.helper_method :panopticon_api, :imminence_api, :content_api, :licence_application_api
klass.helper_method :imminence_api, :content_api, :licence_application_api
end
end
end
Expand Down
80 changes: 0 additions & 80 deletions lib/gds_api/panopticon.rb

This file was deleted.

100 changes: 0 additions & 100 deletions lib/gds_api/panopticon/registerer.rb

This file was deleted.

76 changes: 0 additions & 76 deletions lib/gds_api/test_helpers/panopticon.rb

This file was deleted.

1 change: 0 additions & 1 deletion test/helpers_test.rb
Expand Up @@ -16,7 +16,6 @@ class TestDouble
refute_nil test_with_helpers.imminence_api
refute_nil test_with_helpers.licence_application_api
refute_nil test_with_helpers.need_api
refute_nil test_with_helpers.panopticon_api
refute_nil test_with_helpers.worldwide_api
refute_nil test_with_helpers.email_alert_api
end
Expand Down

0 comments on commit 0053047

Please sign in to comment.