class PactBroker::Api::Decorators::VersionDecorator
Public Class Methods
Source
# File lib/pact_broker/api/decorators/version_decorator.rb, line 25 def self.eager_load_associations [ :pacticipant, :pact_publications, { branch_versions: [:version, :branch_head, { branch: :pacticipant }] }, { tags: :head_tag } ] end
Returns the list of associations that must be eager loaded to efficiently render a version when this decorator is used in a collection (eg. VersionsDecorator
) The associations that need to be eager loaded for the VersionDecorator
are hand coded @return <Array>
Public Instance Methods
Source
# File lib/pact_broker/api/decorators/version_decorator.rb, line 118 def from_hash(hash, options = {}) if hash["tags"] updated_hash = hash.dup updated_hash["_embedded"] ||= {} updated_hash["_embedded"]["tags"] = updated_hash.delete("tags") super(updated_hash, options) else super end end
Calls superclass method
Private Instance Methods
Source
# File lib/pact_broker/api/decorators/version_decorator.rb, line 131 def sorted_pacts represented.pact_publications.sort{ |a, b| a.provider_name.downcase <=> b.provider_name.downcase } end