class PactBroker::Api::Resources::BranchVersions

Public Instance Methods

allowed_methods() click to toggle source
# File lib/pact_broker/api/resources/branch_versions.rb, line 17
def allowed_methods
  ["GET", "OPTIONS"]
end
branch() click to toggle source
# File lib/pact_broker/api/resources/branch_versions.rb, line 41
def branch
  @branch ||= branch_service.find_branch(**identifier_from_path.slice(:pacticipant_name, :branch_name))
end
content_types_provided() click to toggle source
# File lib/pact_broker/api/resources/branch_versions.rb, line 13
def content_types_provided
  [["application/hal+json", :to_json]]
end
malformed_request?() click to toggle source
# File lib/pact_broker/api/resources/branch_versions.rb, line 21
def malformed_request?
  super || request.get? && validation_errors_for_schema?(schema, request.query)
end
policy_name() click to toggle source
# File lib/pact_broker/api/resources/branch_versions.rb, line 37
def policy_name
  :'versions::versions'
end
resource_exists?() click to toggle source
# File lib/pact_broker/api/resources/branch_versions.rb, line 25
def resource_exists?
  !!branch
end
resource_title() click to toggle source
# File lib/pact_broker/api/resources/branch_versions.rb, line 45
def resource_title
  "Versions for branch #{branch.name} of #{branch.pacticipant.name}"
end
to_json() click to toggle source
# File lib/pact_broker/api/resources/branch_versions.rb, line 29
def to_json
  decorator_class(:versions_decorator).new(versions).to_json(**decorator_options(identifier_from_path.merge(resource_title: resource_title)))
end
versions() click to toggle source
# File lib/pact_broker/api/resources/branch_versions.rb, line 33
def versions
  @versions ||= version_service.find_pacticipant_versions_in_reverse_order(pacticipant_name, { branch_name: identifier_from_path[:branch_name] }, pagination_options, decorator_class(:versions_decorator).eager_load_associations)
end

Private Instance Methods

schema() click to toggle source
# File lib/pact_broker/api/resources/branch_versions.rb, line 51
def schema
  if request.get?
    PactBroker::Api::Contracts::PaginationQueryParamsSchema
  end
end