Skip to content

Commit

Permalink
Merge pull request #913 from alphagov/add-documentation-to-publishing…
Browse files Browse the repository at this point in the history
…-intent

Add some documentation around publishing intents
  • Loading branch information
1pretz1 authored Mar 26, 2019
2 parents 83206e8 + 4a8b2f1 commit c648992
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 c648992

Please sign in to comment.