Sha256: aab9d547bf88341f01e337b637cf4060596c6be2c0dd6fc1318271de27f0146a

Contents?: true

Size: 1.2 KB

Versions: 8

Compression:

Stored size: 1.2 KB

Contents

require 'roar/representer/json/hal'
require 'pact_broker/api/pact_broker_urls'
require_relative 'version_decorator'

module Roar
  module Representer
    module Feature

      module Hypermedia

        #Monkey patch alert! Get "no method rel for Nil" when there is an empty array
        #in links. Cannot reproduce this in the roar tests :(
        alias_method :original_compile_links_for, :compile_links_for

        def compile_links_for configs, *args
          original_compile_links_for(configs, *args).select(&:any?)
        end

      end
    end
  end
end


module PactBroker

  module Api

    module Decorators

      class PacticipantCollectionRepresenter < BaseDecorator

        collection :pacticipants, exec_context: :decorator, :class => PactBroker::Models::Pacticipant, :extend => PactBroker::Api::Decorators::PacticipantRepresenter

        def pacticipants
          represented
        end

        link :self do | options |
          pacticipants_url options[:base_url]
        end

        links :pacticipants do | options |
          represented.collect{ | pacticipant | {:href => pacticipant_url(options[:base_url], pacticipant), :title => pacticipant.name } }
        end

      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pact_broker-1.3.1 lib/pact_broker/api/decorators/pacticipant_collection_decorator.rb
pact_broker-1.3.0 lib/pact_broker/api/decorators/pacticipant_collection_decorator.rb
pact_broker-1.2.0 lib/pact_broker/api/decorators/pacticipant_collection_decorator.rb
pact_broker-1.1.0 lib/pact_broker/api/decorators/pacticipant_collection_decorator.rb
pact_broker-1.0.0 lib/pact_broker/api/decorators/pacticipant_collection_decorator.rb
pact_broker-1.0.0.alpha3 lib/pact_broker/api/decorators/pacticipant_collection_decorator.rb
pact_broker-1.0.0.alpha2 lib/pact_broker/api/decorators/pacticipant_collection_decorator.rb
pact_broker-1.0.0.alpha1 lib/pact_broker/api/decorators/pacticipant_collection_decorator.rb