Sha256: cc1f0b366fd80aa27601671390567a8f8634ad6b87b3da003d265f00c1b6f5ca

Contents?: true

Size: 703 Bytes

Versions: 9

Compression:

Stored size: 703 Bytes

Contents

module Brightbox
  class User < Api

    def attributes
      fog_model.attributes
    end

    def to_row
      attributes.merge({ :accounts => accounts.size })
    end

    def self.all
      conn.users
    end

    def self.get(id)
      u = conn.users.get id
      (u.nil? or u.id != id) ? nil : u
    end

    def self.default_field_order
      [:id, :name, :email_address, :accounts]
    end

    def accounts
      @accounts ||= fog_model.accounts.collect { |a| Account.new(a["id"]) }
    end

    def to_s
      @id
    end

    def save
      fog_model.save
    end

    def ssh_key_set?
      !ssh_key.to_s.strip.empty?
    end

    def render_cell
      handle if fog_model
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
brightbox-cli-0.18.1 lib/brightbox-cli/users.rb
brightbox-cli-0.18.0 lib/brightbox-cli/users.rb
brightbox-cli-0.17.5 lib/brightbox-cli/users.rb
brightbox-cli-0.17.4 lib/brightbox-cli/users.rb
brightbox-cli-0.17.3 lib/brightbox-cli/users.rb
brightbox-cli-0.17.2 lib/brightbox-cli/users.rb
brightbox-cli-0.17.1 lib/brightbox-cli/users.rb
brightbox-cli-0.17.0 lib/brightbox-cli/users.rb
brightbox-cli-0.16.0 lib/brightbox-cli/users.rb