Sha256: 27d8ef2e1adbb50b01ce9975a3ba12065d2046473fb3d61c9b91c5f408a8857d

Contents?: true

Size: 752 Bytes

Versions: 12

Compression:

Stored size: 752 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[*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

12 entries across 12 versions & 1 rubygems

Version Path
engineyard-1.4.0 lib/engineyard/model/app.rb
engineyard-1.3.33 lib/engineyard/model/app.rb
engineyard-1.3.32 lib/engineyard/model/app.rb
engineyard-1.3.31 lib/engineyard/model/app.rb
engineyard-1.3.30 lib/engineyard/model/app.rb
engineyard-1.3.29 lib/engineyard/model/app.rb
engineyard-1.3.28 lib/engineyard/model/app.rb
engineyard-1.3.25 lib/engineyard/model/app.rb
engineyard-1.3.22 lib/engineyard/model/app.rb
engineyard-1.3.21 lib/engineyard/model/app.rb
engineyard-1.3.20 lib/engineyard/model/app.rb
engineyard-1.3.19 lib/engineyard/model/app.rb