Sha256: 3861acc59efd1153cd8318d87ba83522f3b1de004330f246c0ee7f119fe7406a

Contents?: true

Size: 662 Bytes

Versions: 6

Compression:

Stored size: 662 Bytes

Contents

module Brightbox
  class Account < Api

    def ram_free
      [ram_limit.to_i - ram_used.to_i, 0].max
    end

    def to_row
      attributes.merge({ :ram_free => ram_free, 
                         :cloud_ip_limit => limits_cloudips
                       })
    end

    def self.all
      a = conn.account
      a.connection = conn
      [new(a)]
    end

    def self.get(id)
      a = conn.account
      a.connection = conn
      if a.id == id
        new(a)
      else
        nil
      end
    end

    def self.default_field_order
      [:id, :name, :cloud_ip_limit, :ram_limit, :ram_used, :ram_free]
    end

    def to_s
      @id
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
bbcloud-0.9 lib/bbcloud/accounts.rb
bbcloud-0.8.2 lib/bbcloud/accounts.rb
bbcloud-0.8.1 lib/bbcloud/accounts.rb
bbcloud-0.8 lib/bbcloud/accounts.rb
bbcloud-0.7 lib/bbcloud/accounts.rb
bbcloud-0.6.2 lib/bbcloud/accounts.rb