Sha256: a89b313451eedfdffe47710a9db1ba1daa5be5b25a84a433adc125155c7dabd3

Contents?: true

Size: 755 Bytes

Versions: 26

Compression:

Stored size: 755 Bytes

Contents

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

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

      def self.from_array(*)
        Collection::Apps.new(super)
      end

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

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

      def last_deployment_on(environment)
        Deployment.last(self, environment, api)
      end

    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
engineyard-1.4.29 lib/engineyard/model/app.rb
engineyard-1.4.28 lib/engineyard/model/app.rb
engineyard-1.4.27 lib/engineyard/model/app.rb
engineyard-1.4.24 lib/engineyard/model/app.rb
engineyard-1.4.23 lib/engineyard/model/app.rb
engineyard-1.4.22 lib/engineyard/model/app.rb
engineyard-1.4.21 lib/engineyard/model/app.rb
engineyard-1.4.20 lib/engineyard/model/app.rb
engineyard-1.4.19 lib/engineyard/model/app.rb
engineyard-1.4.18 lib/engineyard/model/app.rb
engineyard-1.4.17 lib/engineyard/model/app.rb
engineyard-1.4.16 lib/engineyard/model/app.rb
engineyard-1.4.15 lib/engineyard/model/app.rb
engineyard-1.4.14 lib/engineyard/model/app.rb
engineyard-1.4.13 lib/engineyard/model/app.rb
engineyard-1.4.11 lib/engineyard/model/app.rb
engineyard-1.4.10 lib/engineyard/model/app.rb
engineyard-1.4.9 lib/engineyard/model/app.rb
engineyard-1.4.8 lib/engineyard/model/app.rb
engineyard-1.4.7 lib/engineyard/model/app.rb