Class: GdsApi::PublishingApi::SpecialRoutePublisher
- Inherits:
-
Object
- Object
- GdsApi::PublishingApi::SpecialRoutePublisher
- Defined in:
- lib/gds_api/publishing_api/special_route_publisher.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ SpecialRoutePublisher
constructor
A new instance of SpecialRoutePublisher.
- #publish(options) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ SpecialRoutePublisher
Returns a new instance of SpecialRoutePublisher.
7 8 9 10 |
# File 'lib/gds_api/publishing_api/special_route_publisher.rb', line 7 def initialize( = {}) @logger = [:logger] || GdsApi::Base.logger @publishing_api = [:publishing_api] || GdsApi::PublishingApi.new(Plek.find("publishing-api")) end |
Instance Method Details
#publish(options) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/gds_api/publishing_api/special_route_publisher.rb', line 12 def publish() logger.info("Publishing #{.fetch(:type)} route #{.fetch(:base_path)}, routing to #{.fetch(:rendering_app)}") update_type = .fetch(:update_type, "major") locale = .fetch(:locale, "en") put_content_response = publishing_api.put_content( .fetch(:content_id), base_path: .fetch(:base_path), document_type: .fetch(:document_type, "special_route"), schema_name: .fetch(:schema_name, "special_route"), title: .fetch(:title), description: .fetch(:description, ""), locale:, details: {}, routes: [ { path: .fetch(:base_path), type: .fetch(:type), }, ], publishing_app: .fetch(:publishing_app), rendering_app: .fetch(:rendering_app), public_updated_at: time.now.iso8601, update_type:, ) publishing_api.patch_links(.fetch(:content_id), links: [:links]) if [:links] publishing_api.publish(.fetch(:content_id), update_type, locale:) put_content_response end |