Module: PublishingPlatformApi
- Defined in:
- lib/publishing_platform_api.rb,
lib/publishing_platform_api/railtie.rb,
lib/publishing_platform_api/version.rb,
lib/publishing_platform_api/response.rb,
lib/publishing_platform_api/exceptions.rb,
lib/publishing_platform_api/json_client.rb,
lib/publishing_platform_api/list_response.rb,
lib/publishing_platform_api/test_helpers/router.rb,
lib/publishing_platform_api/test_helpers/asset_manager.rb,
lib/publishing_platform_api/test_helpers/content_store.rb,
lib/publishing_platform_api/test_helpers/organisations.rb,
lib/publishing_platform_api/publishing_platform_headers.rb,
lib/publishing_platform_api/test_helpers/publishing_api.rb,
lib/publishing_platform_api/test_helpers/common_responses.rb,
lib/publishing_platform_api/test_helpers/content_item_helpers.rb,
lib/publishing_platform_api/publishing_api/special_route_publisher.rb,
lib/publishing_platform_api/middleware/publishing_platform_header_sniffer.rb
Overview
require “securerandom”
Defined Under Namespace
Modules: ExceptionHandling, TestHelpers Classes: AssetManager, Base, BaseError, ContentStore, EndpointNotFound, HTTPBadGateway, HTTPBadRequest, HTTPClientError, HTTPConflict, HTTPErrorResponse, HTTPForbidden, HTTPGatewayTimeout, HTTPGone, HTTPIntermittentClientError, HTTPIntermittentServerError, HTTPInternalServerError, HTTPNotFound, HTTPPayloadTooLarge, HTTPServerError, HTTPTooManyRequests, HTTPUnauthorized, HTTPUnavailable, HTTPUnprocessableEntity, InvalidUrl, JsonClient, ListResponse, Organisations, PublishingApi, PublishingPlatformHeaderSniffer, PublishingPlatformHeaders, Railtie, Response, Router, SocketErrorException, TimedOutException
Constant Summary collapse
- VERSION =
"0.11.0"
Class Method Summary collapse
-
.asset_manager(options = {}) ⇒ PublishingPlatformApi::AssetManager
Creates a PublishingPlatformApi::AssetManager adapter.
-
.content_store(options = {}) ⇒ PublishingPlatformApi::ContentStore
Creates a PublishingPlatformApi::ContentStore adapter.
-
.organisations(options = {}) ⇒ PublishingPlatformApi::Organisations
Creates a PublishingPlatformApi::Organisations adapter for accessing APIs through the origin, where the requests will be handled by Collections frontend.
-
.publishing_api(options = {}) ⇒ PublishingPlatformApi::PublishingApi
Creates a PublishingPlatformApi::PublishingApi adapter.
-
.router(options = {}) ⇒ PublishingPlatformApi::Router
Creates a PublishingPlatformApi::Router adapter for communicating with Router API.
Class Method Details
.asset_manager(options = {}) ⇒ PublishingPlatformApi::AssetManager
Creates a PublishingPlatformApi::AssetManager adapter
This will set a bearer token if a ASSET_MANAGER_BEARER_TOKEN environment variable is set
18 19 20 21 22 23 |
# File 'lib/publishing_platform_api.rb', line 18 def self.asset_manager( = {}) PublishingPlatformApi::AssetManager.new( PublishingPlatformLocation.find("asset-manager"), { bearer_token: ENV["ASSET_MANAGER_BEARER_TOKEN"] }.merge(), ) end |
.content_store(options = {}) ⇒ PublishingPlatformApi::ContentStore
Creates a PublishingPlatformApi::ContentStore adapter
This will set a bearer token if a CONTENT_STORE_BEARER_TOKEN environment variable is set
31 32 33 34 35 36 |
# File 'lib/publishing_platform_api.rb', line 31 def self.content_store( = {}) PublishingPlatformApi::ContentStore.new( PublishingPlatformLocation.find("content-store"), { bearer_token: ENV["CONTENT_STORE_BEARER_TOKEN"] }.merge(), ) end |
.organisations(options = {}) ⇒ PublishingPlatformApi::Organisations
Creates a PublishingPlatformApi::Organisations adapter for accessing APIs through the origin, where the requests will be handled by Collections frontend.
43 44 45 46 47 48 |
# File 'lib/publishing_platform_api.rb', line 43 def self.organisations( = {}) PublishingPlatformApi::Organisations.new( PublishingPlatformLocation.new.website_root, , ) end |
.publishing_api(options = {}) ⇒ PublishingPlatformApi::PublishingApi
Creates a PublishingPlatformApi::PublishingApi adapter
This will set a bearer token if a PUBLISHING_API_BEARER_TOKEN environment variable is set
56 57 58 59 60 61 |
# File 'lib/publishing_platform_api.rb', line 56 def self.publishing_api( = {}) PublishingPlatformApi::PublishingApi.new( PublishingPlatformLocation.find("publishing-api"), { bearer_token: ENV["PUBLISHING_API_BEARER_TOKEN"] }.merge(), ) end |
.router(options = {}) ⇒ PublishingPlatformApi::Router
Creates a PublishingPlatformApi::Router adapter for communicating with Router API
This will set a bearer token if a ROUTER_API_BEARER_TOKEN environment variable is set
69 70 71 72 73 74 |
# File 'lib/publishing_platform_api.rb', line 69 def self.router( = {}) PublishingPlatformApi::Router.new( PublishingPlatformLocation.find("router-api"), { bearer_token: ENV["ROUTER_API_BEARER_TOKEN"] }.merge(), ) end |