class PactBroker::Api::Decorators::CustomErrorProblemJsonDecorator

Public Class Methods

new(title:, type:, detail:, status: ) click to toggle source

@option title [String] @option type [String] @option detail [String] @option status [Integer] HTTP status code

# File lib/pact_broker/api/decorators/custom_error_problem_json_decorator.rb, line 12
def initialize(title:, type:, detail:, status: )
  @title = title
  @type = type
  @detail = detail
  @status = status
end

Public Instance Methods

to_hash(user_options: {}, **__other) click to toggle source

@return [Hash]

# File lib/pact_broker/api/decorators/custom_error_problem_json_decorator.rb, line 20
def to_hash(user_options: {}, **__other)
  {
    "title" => @title,
    "type" => "#{user_options[:base_url]}/problem/#{@type}",
    "detail" => @detail,
    "status" => @status
  }
end
to_json(*args, **kwargs) click to toggle source

@return [String] JSON

# File lib/pact_broker/api/decorators/custom_error_problem_json_decorator.rb, line 30
def to_json(*args, **kwargs)
  to_hash(*args, **kwargs).to_json
end