Sha256: 95d3842276fa3802d1d2aff2833c663d91afaa5e59d5f7c86d2c181b3540d535

Contents?: true

Size: 985 Bytes

Versions: 6

Compression:

Stored size: 985 Bytes

Contents

class WcoHosting::Appliance
  include Mongoid::Document
  include Mongoid::Timestamps
  store_in collection: 'wco_appliances'

  belongs_to :leadset,      class_name: 'Wco::Leadset', inverse_of: :appliances
  belongs_to :subscription, class_name: 'Wco::Subscription' # , inverse_of: :appliance

  field :service_name
  before_validation :set_service_name, on: :create, unless: ->{ service_name }
  def set_service_name
    self[:service_name] = host.gsub(".", "_")
  end

  field :environment

  field :subdomain
  field :domain
  def host
    "#{subdomain}.#{domain}"
  end

  field :n_retries, type: :integer, default: 3

  belongs_to :appliance_tmpl, class_name: 'WcoHosting::ApplianceTmpl'
  def tmpl
    appliance_tmpl
  end
  def kind
    tmpl.kind
  end

  belongs_to :serverhost,  class_name: 'WcoHosting::Serverhost'

  field :port

  STATE_PENDING = 'state-pending'
  STATE_LIVE    = 'state-live'
  STATE_TERM    = 'state-term'
  field :state, default: STATE_PENDING

end


Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
wco_models-3.1.0.37 app/models/wco_hosting/appliance.rb
wco_models-3.1.0.36 app/models/wco_hosting/appliance.rb
wco_models-3.1.0.35 app/models/wco_hosting/appliance.rb
wco_models-3.1.0.34 app/models/wco_hosting/appliance.rb
wco_models-3.1.0.33 app/models/wco_hosting/appliance.rb
wco_models-3.1.0.32 app/models/wco_hosting/appliance.rb