class PactBroker::Api::Resources::PacticipantBranches
Public Instance Methods
allowed_methods()
click to toggle source
# File lib/pact_broker/api/resources/pacticipant_branches.rb, line 19 def allowed_methods ["GET", "DELETE", "OPTIONS"] end
content_types_provided()
click to toggle source
# File lib/pact_broker/api/resources/pacticipant_branches.rb, line 15 def content_types_provided [["application/hal+json", :to_json]] end
delete_resource()
click to toggle source
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.
# 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
policy_name()
click to toggle source
# File lib/pact_broker/api/resources/pacticipant_branches.rb, line 31 def policy_name :'versions::branches' end
resource_exists?()
click to toggle source
# File lib/pact_broker/api/resources/pacticipant_branches.rb, line 23 def resource_exists? !!pacticipant end
to_json()
click to toggle 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
branches()
click to toggle 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
eager_load_associations()
click to toggle 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
exclude()
click to toggle source
# File lib/pact_broker/api/resources/pacticipant_branches.rb, line 57 def exclude Rack::Utils.parse_nested_query(request.uri.query)["exclude"] || [] end