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.6 lib/engineyard/model/app.rb
engineyard-1.4.5 lib/engineyard/model/app.rb
engineyard-1.4.4 lib/engineyard/model/app.rb
engineyard-1.4.3 lib/engineyard/model/app.rb
engineyard-1.4.2 lib/engineyard/model/app.rb
engineyard-1.4.1 lib/engineyard/model/app.rb