Sha256: af0f0638d288fbf49cafed4c18514185c8760d13f112392dd906404c0ba21221

Contents?: true

Size: 508 Bytes

Versions: 12

Compression:

Stored size: 508 Bytes

Contents

module EY
  module Model
    class App < ApiStruct.new(:name, :repository_uri, :environments, :api)

      def self.from_hash(hash)
        super.tap do |app|
          app.environments = Environment.from_array(app.environments, :api => app.api)
        end
      end

      def sole_environment
        if environments.size == 1
          environments.first
        end
      end

      def sole_environment!
        sole_environment or raise NoSingleEnvironmentError.new(self)
      end

    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
engineyard-0.8.2 lib/engineyard/model/app.rb
engineyard-0.8.1 lib/engineyard/model/app.rb
engineyard-0.8.0 lib/engineyard/model/app.rb
engineyard-0.7.1 lib/engineyard/model/app.rb
engineyard-0.7.0 lib/engineyard/model/app.rb
engineyard-0.5.5 lib/engineyard/model/app.rb
engineyard-0.5.4 lib/engineyard/model/app.rb
engineyard-0.5.3 lib/engineyard/model/app.rb
engineyard-0.5.2 lib/engineyard/model/app.rb
engineyard-0.5.0 lib/engineyard/model/app.rb
engineyard-0.4.0 lib/engineyard/model/app.rb
engineyard-0.3.3 lib/engineyard/model/app.rb