Skip to content

Commit

Permalink
Add some documentation around publishing intents
Browse files Browse the repository at this point in the history
This adds some brief guidance around using the intents endpoint with
links to more detailed guidance in the publishing-api.

Depends on:
alphagov/publishing-api#1470

Trello:
alphagov/publishing-api#1470
  • Loading branch information
1pretz1 committed Mar 22, 2019
1 parent 674c2fa commit 4a8b2f1
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/gds_api/publishing_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,31 @@
require_relative 'exceptions'

class GdsApi::PublishingApi < GdsApi::Base
# Create a publishing intent for a base_path.
#
# @param base_path [String]
# @param payload [Hash]
# @example
#
# publishing_api.put_intent(
# '/some/base_path',
# {
# publish_time: '2024-03-15T09:00:00.000+00:00',
# publishing_app: 'content-publisher',
# rendering_app: 'government-frontend',
# }
#)
#
# @see https://github.com/alphagov/publishing-api/blob/master/doc/api.md#put-publish-intentbase_path
def put_intent(base_path, payload)
put_json(intent_url(base_path), payload)
end

# Delete a publishing intent for a base_path.
#
# @param base_path [String]
#
# @see https://github.com/alphagov/publishing-api/blob/master/doc/api.md#delete-publish-intentbase_path
def destroy_intent(base_path)
delete_json(intent_url(base_path))
rescue GdsApi::HTTPNotFound => e
Expand Down

0 comments on commit 4a8b2f1

Please sign in to comment.