lib/gds_api/publishing_api.rb
require_relative 'base' require_relative 'exceptions' class GdsApi::PublishingApi < GdsApi::Base def put_draft_content_item(base_path, payload) put_json!(draft_content_item_url(base_path), payload) end def put_content_item(base_path, payload) put_json!(content_item_url(base_path), payload) end def put_intent(base_path, payload) put_json!(intent_url(base_path), payload) end def destroy_intent(base_path) delete_json!(intent_url(base_path)) rescue GdsApi::HTTPNotFound => e e end def put_path(base_path, payload) put_json!(paths_url(base_path), payload) end private def draft_content_item_url(base_path) "#{endpoint}/draft-content#{base_path}" end def content_item_url(base_path) "#{endpoint}/content#{base_path}" end def intent_url(base_path) "#{endpoint}/publish-intent#{base_path}" end def paths_url(base_path) "#{endpoint}/paths#{base_path}" end end