Sha256: 5bb8c7c022051e9aca8a1fe435871cab2a54d6d2707c61900320ae72f81c0dcb

Contents?: true

Size: 645 Bytes

Versions: 2

Compression:

Stored size: 645 Bytes

Contents

module Brightbox
  class User < Api
    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? || u.id != id ? nil : u
    end

    def self.default_field_order
      %i[id name email_address accounts]
    end

    def accounts
      @accounts ||= fog_model.accounts.map { |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

2 entries across 2 versions & 1 rubygems

Version Path
brightbox-cli-5.0.0.rc2 lib/brightbox-cli/users.rb
brightbox-cli-5.0.0.rc1 lib/brightbox-cli/users.rb