Sha256: f051c436305099f04ce5413aaa40ddcaa7756765e61d2edf3de6667ce02f9e8f

Contents?: true

Size: 836 Bytes

Versions: 7

Compression:

Stored size: 836 Bytes

Contents

module Aptible
  module Api
    class Database < Resource
      belongs_to :account
      belongs_to :current_configuration
      embeds_one :last_operation
      embeds_one :disk
      has_one :service
      has_one :initialize_from
      has_many :operations
      has_many :backups
      has_many :dependents
      has_many :configurations

      field :id
      field :handle
      field :type
      field :passphrase
      field :connection_url
      field :created_at, type: Time
      field :updated_at, type: Time
      field :status
      field :docker_repo

      def failed?
        # TODO: Add failed status at API level
        return false if provisioned?
        operations.select { |o| o.type == 'provision' }.all?(&:failed?)
      end

      def provisioned?
        status == 'provisioned'
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
aptible-api-0.9.8 lib/aptible/api/database.rb
aptible-api-0.9.7 lib/aptible/api/database.rb
aptible-api-0.9.6 lib/aptible/api/database.rb
aptible-api-0.9.5 lib/aptible/api/database.rb
aptible-api-0.9.4 lib/aptible/api/database.rb
aptible-api-0.9.3 lib/aptible/api/database.rb
aptible-api-0.9.2 lib/aptible/api/database.rb