class PactBroker::Labels::Repository
Public Instance Methods
create(args)
click to toggle source
# File lib/pact_broker/labels/repository.rb, line 10 def create args Domain::Label.new(name: args.fetch(:name), pacticipant: args.fetch(:pacticipant)).save end
delete(args)
click to toggle source
# File lib/pact_broker/labels/repository.rb, line 23 def delete args find(args).delete end
delete_by_pacticipant_id(pacticipant_id)
click to toggle source
# File lib/pact_broker/labels/repository.rb, line 27 def delete_by_pacticipant_id pacticipant_id Sequel::Model.db[:labels].where(pacticipant_id: pacticipant_id).delete end
find(args)
click to toggle source
# File lib/pact_broker/labels/repository.rb, line 14 def find args PactBroker::Domain::Label .select(Sequel.qualify("labels", "name"), Sequel.qualify("labels", "pacticipant_id"), Sequel.qualify("labels", "created_at"), Sequel.qualify("labels", "updated_at")) .join(:pacticipants, {id: :pacticipant_id}) .where(name_like(Sequel.qualify("labels", "name"), args.fetch(:label_name))) .where(name_like(Sequel.qualify("pacticipants", "name"), args.fetch(:pacticipant_name))) .single_record end