class RightApiHelper::Deployments

Public Class Methods

new(right_api_client) click to toggle source
Calls superclass method RightApiHelper::Base::new
# File lib/right_api_helper/deployments.rb, line 21
def initialize(right_api_client)
  super(right_api_client)
  @api_shim = RightApiHelper::API15.new(right_api_client)
end

Public Instance Methods

find_or_create(name) click to toggle source

Return: MediaType : right_api_client deployment

# File lib/right_api_helper/deployments.rb, line 27
def find_or_create(name)
  @log.info "Looking for deployment: '#{name}'..."
  deployment = @api_shim.find_deployment_by_name(name)
  @log.info "Deployment #{deployment.nil? ? "not found" : "found"}."
  unless deployment
    deployment = @api_shim.create_deployment(name)
    @log.info "Deployment created: '#{name}'"
  end
  deployment
end