Class: PactBroker::Deployments::DeployedVersion

Inherits:
Sequel::Model
  • Object
show all
Defined in:
lib/pact_broker/deployments/deployed_version.rb

Instance Method Summary collapse

Instance Method Details

#after_createObject



78
79
80
81
82
83
84
85
86
87
# File 'lib/pact_broker/deployments/deployed_version.rb', line 78

def after_create
  super
  CurrentlyDeployedVersionId.new(
    pacticipant_id: pacticipant_id,
    environment_id: environment_id,
    version_id: version_id,
    target_for_index: target_for_index,
    deployed_version_id: id
  ).upsert
end

#application_instanceObject

target has been renamed to applicationInstance in the API.



94
95
96
# File 'lib/pact_broker/deployments/deployed_version.rb', line 94

def application_instance
  target
end

#application_instance=(application_instance) ⇒ Object



98
99
100
# File 'lib/pact_broker/deployments/deployed_version.rb', line 98

def application_instance= application_instance
  self.target = application_instance
end

#before_validationObject



73
74
75
76
# File 'lib/pact_broker/deployments/deployed_version.rb', line 73

def before_validation
  super
  self.target_for_index = target.nil? ? "" : target
end

#currently_deployedObject



89
90
91
# File 'lib/pact_broker/deployments/deployed_version.rb', line 89

def currently_deployed
  !!currently_deployed_version_id
end

#environment_nameObject



106
107
108
# File 'lib/pact_broker/deployments/deployed_version.rb', line 106

def environment_name
  environment.name
end

#record_undeployedObject



110
111
112
113
# File 'lib/pact_broker/deployments/deployed_version.rb', line 110

def record_undeployed
  self.class.where(id: id).record_undeployed
  self.refresh
end

#version_numberObject



102
103
104
# File 'lib/pact_broker/deployments/deployed_version.rb', line 102

def version_number
  version.number
end