Sha256: 51109fd023ac338285ed824951b5f98269f379c85298cc361ad9a1711674f037

Contents?: true

Size: 677 Bytes

Versions: 2

Compression:

Stored size: 677 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
          PactBroker::Api::Decorators::RelationshipsCsvDecorator.new(group).to_csv
        end

        private

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pact_broker-2.58.3 lib/pact_broker/api/resources/group.rb
pact_broker-2.58.2 lib/pact_broker/api/resources/group.rb