class PactBroker::Api::Resources::PacticipantBranches
Public Instance Methods
Source
# File lib/pact_broker/api/resources/pacticipant_branches.rb, line 19 def allowed_methods ["GET", "DELETE", "OPTIONS"] end
Source
# File lib/pact_broker/api/resources/pacticipant_branches.rb, line 15 def content_types_provided [["application/hal+json", :to_json]] end
Source
# File lib/pact_broker/api/resources/pacticipant_branches.rb, line 37 def delete_resource after_reply do branch_service.delete_branches_for_pacticipant(pacticipant, exclude: exclude) end notices = branch_service.branch_deletion_notices(pacticipant, exclude: exclude) response.body = decorator_class(:notices_decorator).new(notices).to_json(**decorator_options) 202 end
Allows bulk deletion of pacticipant branches, keeping the specified branches and the main branch. Deletes the branches asyncronously, after the response has been sent, for performance reasons.
Source
# File lib/pact_broker/api/resources/pacticipant_branches.rb, line 31 def policy_name :'versions::branches' end
Source
# File lib/pact_broker/api/resources/pacticipant_branches.rb, line 23 def resource_exists? !!pacticipant end
Source
# File lib/pact_broker/api/resources/pacticipant_branches.rb, line 27 def to_json decorator_class(:pacticipant_branches_decorator).new(branches).to_json(**decorator_options(pacticipant: pacticipant)) end
Private Instance Methods
Source
# File lib/pact_broker/api/resources/pacticipant_branches.rb, line 48 def branches @branches ||= branch_service.find_all_branches_for_pacticipant( pacticipant, filter_options, default_pagination_options.merge(pagination_options), eager_load_associations ) end
Source
# File lib/pact_broker/api/resources/pacticipant_branches.rb, line 61 def eager_load_associations decorator_class(:pacticipant_branches_decorator).eager_load_associations end
Source
# File lib/pact_broker/api/resources/pacticipant_branches.rb, line 57 def exclude Rack::Utils.parse_nested_query(request.uri.query)["exclude"] || [] end