Sha256: 3d4f9f0e58c4b86a4b7b355e5c54583182bfb2a245dbd5dd8be5f72f33f58147
Contents?: true
Size: 1.61 KB
Versions: 27
Compression:
Stored size: 1.61 KB
Contents
require "pact_broker/deployments/environment" require "securerandom" require "pact_broker/pacticipants/generate_display_name" require "pact_broker/string_refinements" require "pact_broker/repositories/scopes" module PactBroker module Deployments module EnvironmentService using PactBroker::StringRefinements extend PactBroker::Repositories::Scopes extend self def self.included(base) base.extend(self) end def next_uuid SecureRandom.uuid end def create(uuid, environment) environment.uuid = uuid if environment.display_name.blank? environment.display_name = PactBroker::Pacticipants::GenerateDisplayName.call(environment.name) end environment.save end def replace(uuid, environment) environment.uuid = uuid if environment.display_name.blank? environment.display_name = PactBroker::Pacticipants::GenerateDisplayName.call(environment.name) end environment.upsert end alias_method :update, :replace # For PF def find_all scope_for(PactBroker::Deployments::Environment).order(Sequel.function(:lower, :display_name)).all end def find(uuid) PactBroker::Deployments::Environment.where(uuid: uuid).single_record end def find_by_name(name) PactBroker::Deployments::Environment.where(name: name).single_record end def delete(uuid) PactBroker::Deployments::Environment.where(uuid: uuid).delete end def find_for_pacticipant(_pacticipant) find_all end end end end
Version data entries
27 entries across 27 versions & 1 rubygems