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/publishing_platform_headers.rb,
lib/publishing_platform_api/middleware/publishing_platform_header_sniffer.rb

Defined Under Namespace

Modules: ExceptionHandling Classes: 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, PublishingApi, PublishingPlatformHeaderSniffer, PublishingPlatformHeaders, Railtie, Response, Router, SocketErrorException, TimedOutException

Constant Summary collapse

VERSION =
"0.6.1"

Class Method Summary collapse

Class Method Details

.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



16
17
18
19
20
21
# File 'lib/publishing_platform_api.rb', line 16

def self.content_store(options = {})
  PublishingPlatformApi::ContentStore.new(
    PublishingPlatformLocation.find("content-store"),
    { bearer_token: ENV["CONTENT_STORE_BEARER_TOKEN"] }.merge(options),
  )
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



29
30
31
32
33
34
# File 'lib/publishing_platform_api.rb', line 29

def self.publishing_api(options = {})
  PublishingPlatformApi::PublishingApi.new(
    PublishingPlatformLocation.find("publishing-api"),
    { bearer_token: ENV["PUBLISHING_API_BEARER_TOKEN"] }.merge(options),
  )
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



42
43
44
45
46
47
# File 'lib/publishing_platform_api.rb', line 42

def self.router(options = {})
  PublishingPlatformApi::Router.new(
    PublishingPlatformLocation.find("router-api"),
    { bearer_token: ENV["ROUTER_API_BEARER_TOKEN"] }.merge(options),
  )
end