Sha256: f0ae828f714711ec4a66bb0a55e8cb87c864eaefbedab5240cb39d7d22982103

Contents?: true

Size: 581 Bytes

Versions: 16

Compression:

Stored size: 581 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 self.from_array(*)
        Collection::Apps[*super]
      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

16 entries across 16 versions & 1 rubygems

Version Path
engineyard-1.3.1 lib/engineyard/model/app.rb
engineyard-1.3.0 lib/engineyard/model/app.rb
engineyard-1.2.4 lib/engineyard/model/app.rb
engineyard-1.2.3 lib/engineyard/model/app.rb
engineyard-1.2.2 lib/engineyard/model/app.rb
engineyard-1.2.1 lib/engineyard/model/app.rb
engineyard-1.2.0 lib/engineyard/model/app.rb
engineyard-1.1.3 lib/engineyard/model/app.rb
engineyard-1.1.2 lib/engineyard/model/app.rb
engineyard-1.1.1 lib/engineyard/model/app.rb
engineyard-1.1.0 lib/engineyard/model/app.rb
engineyard-1.0.2 lib/engineyard/model/app.rb
engineyard-1.0.1 lib/engineyard/model/app.rb
engineyard-1.0.0 lib/engineyard/model/app.rb
engineyard-0.10.0 lib/engineyard/model/app.rb
engineyard-0.9.0 lib/engineyard/model/app.rb