Sha256: c3323a448e53d6a6f2486a0135486804fd86908146b0b51c22b292d34c61601e

Contents?: true

Size: 683 Bytes

Versions: 6

Compression:

Stored size: 683 Bytes

Contents

module Aptible
  module Api
    class Database < Resource
      belongs_to :account
      embeds_one :last_operation
      embeds_one :disk
      has_one :service
      has_many :operations

      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

6 entries across 6 versions & 1 rubygems

Version Path
aptible-api-0.8.4 lib/aptible/api/database.rb
aptible-api-0.8.3 lib/aptible/api/database.rb
aptible-api-0.8.2 lib/aptible/api/database.rb
aptible-api-0.8.1 lib/aptible/api/database.rb
aptible-api-0.8.0 lib/aptible/api/database.rb
aptible-api-0.7.17 lib/aptible/api/database.rb