Sha256: f0f46c6b157eef21f350bc9e550df5341c5ae4c1151838a046e88b5e665c1c47

Contents?: true

Size: 805 Bytes

Versions: 6

Compression:

Stored size: 805 Bytes

Contents

require 'pact_broker/api/resources/base_resource'
require 'pact_broker/api/decorators/relationships_csv_decorator'

module PactBroker
  module Api
    module Resources
      class Group < BaseResource
        def content_types_provided
          [["text/csv", :to_csv]]
        end

        def allowed_methods
          ["GET", "OPTIONS"]
        end

        def resource_exists?
          pacticipant
        end

        def to_csv
          if group
            PactBroker::Api::Decorators::RelationshipsCsvDecorator.new(group).to_csv
          else
            ""
          end
        end

        def policy_name
          :'groups::group'
        end

        private

        def group
          @group ||= group_service.find_group_containing(pacticipant)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pact_broker-2.74.1 lib/pact_broker/api/resources/group.rb
pact_broker-2.74.0 lib/pact_broker/api/resources/group.rb
pact_broker-2.73.0 lib/pact_broker/api/resources/group.rb
pact_broker-2.72.0 lib/pact_broker/api/resources/group.rb
pact_broker-2.71.0 lib/pact_broker/api/resources/group.rb
pact_broker-2.70.0 lib/pact_broker/api/resources/group.rb