Sha256: b9ee6617d5cc5163434ef6df8c688d7c588cb6369060ee66381ff4d4413d443f
Contents?: true
Size: 943 Bytes
Versions: 1
Compression:
Stored size: 943 Bytes
Contents
# Formats a message string into application/problem+json format. module PactBroker module Api module Decorators class CustomErrorProblemJSONDecorator # @option title [String] # @option type [String] # @option detail [String] # @option status [Integer] HTTP status code def initialize(title:, type:, detail:, status: ) @title = title @type = type @detail = detail @status = status end # @return [Hash] def to_hash(decorator_options = {}) { "title" => @title, "type" => "#{decorator_options.dig(:user_options, :base_url)}/problem/#{@type}", "detail" => @detail, "status" => @status } end # @return [String] JSON def to_json(decorator_options = {}) to_hash(decorator_options).to_json end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pact_broker-2.106.0 | lib/pact_broker/api/decorators/custom_error_problem_json_decorator.rb |