Sha256: ff6f2dd17c177bfb8be606c74b1a14659f61a5ee838be04400388d0d6d59c5e7

Contents?: true

Size: 551 Bytes

Versions: 8

Compression:

Stored size: 551 Bytes

Contents

require "jfoundry/v2/model"

module JFoundry::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
    validates_presence_of :space
    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?(JFoundry::RouteHostTaken) ? :host : :base
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
jfoundry-0.1.7 lib/jfoundry/v2/route.rb
jfoundry-0.1.6 lib/jfoundry/v2/route.rb
jfoundry-0.1.4 lib/jfoundry/v2/route.rb
jfoundry-0.1.3 lib/jfoundry/v2/route.rb
jfoundry-0.1.2 lib/jfoundry/v2/route.rb
jfoundry-0.1.1 lib/jfoundry/v2/route.rb
jfoundry-0.1.0.pre lib/jfoundry/v2/route.rb
jfoundry-0.1.0 lib/jfoundry/v2/route.rb