class PactBroker::Domain::Pacticipant

Public Instance Methods

any_versions?() click to toggle source
# File lib/pact_broker/domain/pacticipant.rb, line 72
def any_versions?
  PactBroker::Domain::Version.where(pacticipant: self).any?
end
before_destroy() click to toggle source
Calls superclass method
# File lib/pact_broker/domain/pacticipant.rb, line 49
def before_destroy
  PactBroker::Pacts::PactPublication.where(provider: self).delete
  PactBroker::Domain::Verification.where(consumer: self).or(provider: self).delete
  PactBroker::Domain::Version.where(pacticipant: self).delete
  PactBroker::Pacts::PactVersion.where(consumer: self).or(provider: self).delete
  PactBroker::Domain::Label.where(pacticipant: self).destroy
  super
end
before_save() click to toggle source
Calls superclass method
# File lib/pact_broker/domain/pacticipant.rb, line 58
def before_save
  super
  self.display_name = generate_display_name(name) if display_name.blank?
  self.main_branch = nil if main_branch.blank?
end
branch_head_for(branch_name) click to toggle source
# File lib/pact_broker/domain/pacticipant.rb, line 76
def branch_head_for(branch_name)
  branch_heads.find{ | branch_head | branch_head.branch_name == branch_name }
end
find_by_name(name) click to toggle source
# File lib/pact_broker/domain/pacticipant.rb, line 40
def find_by_name(name)
  where(name_like(:name, name))
end
label(label_name) click to toggle source
# File lib/pact_broker/domain/pacticipant.rb, line 35
def label label_name
  filter = name_like(Sequel[:labels][:name], label_name)
  join(:labels, {pacticipant_id: :id}).where(filter)
end
label?(name) click to toggle source
# File lib/pact_broker/domain/pacticipant.rb, line 80
def label?(name)
  labels.any? { |label| label.name == name }
end
latest_version() click to toggle source
# File lib/pact_broker/domain/pacticipant.rb, line 64
def latest_version
  versions.last
end
to_s() click to toggle source
# File lib/pact_broker/domain/pacticipant.rb, line 68
def to_s
  "Pacticipant: id=#{id}, name=#{name}"
end
where_name(name) click to toggle source
# File lib/pact_broker/domain/pacticipant.rb, line 44
def where_name(name)
  where(name_like(:name, name))
end
with_main_branch_set() click to toggle source
# File lib/pact_broker/domain/pacticipant.rb, line 31
def with_main_branch_set
  exclude(main_branch: nil)
end