Sha256: 8857e72f1a4a8c6b1ad1763023559e495743f2bff0a3b29b3e96595dae5e3ce4

Contents?: true

Size: 518 Bytes

Versions: 3

Compression:

Stored size: 518 Bytes

Contents

require "cfoundry/v2/model"

module CFoundry::V2
  class Route < Model
    attribute :host, :string
    validates_format_of :host, :with => /\A[a-z]+([a-z0-9\-]*[a-z0-9]+)?\Z/i
    validates_length_of :host, :maximum => 63
    validates_presence_of :domain
    to_one    :domain
    to_one    :space

    queryable_by :host, :domain_guid

    def name
      "#{host}.#{domain.name}"
    end

    private

    def attribute_for_error(error)
      error.is_a?(CFoundry::RouteHostTaken) ? :host : :base
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cfoundry-1.1.0.rc3 lib/cfoundry/v2/route.rb
cfoundry-1.1.0.rc2 lib/cfoundry/v2/route.rb
cfoundry-1.1.0.rc1 lib/cfoundry/v2/route.rb