class PactBroker::Api::Decorators::PacticipantDecorator

Public Class Methods

eager_load_associations() click to toggle source

The associations that should be eager loaded on the Pacticipant so that this decorator can be used without any extra calls to the database. @return Array<Symbol>

# File lib/pact_broker/api/decorators/pacticipant_decorator.rb, line 30
def self.eager_load_associations
  [:labels, :latest_version]
end

Public Instance Methods

to_hash(options) click to toggle source

representable passes through the kwargs from to_json as normal args

Calls superclass method
# File lib/pact_broker/api/decorators/pacticipant_decorator.rb, line 120
def to_hash(options)
  h = super
  dasherized = DasherizedVersionDecorator.new(represented).to_hash(options)
  if dasherized["_embedded"]
    if dasherized["_embedded"]["latest-version"]
      dasherized["_embedded"]["latest-version"]["title"] = "DEPRECATED - please use latestVersion"
      dasherized["_embedded"]["latest-version"]["name"] = "DEPRECATED - please use latestVersion"
    end
    h["_embedded"] ||= {}
    h["_embedded"].merge!(dasherized["_embedded"])
  end
  h
end