Class: Brightbox::User
- Inherits:
-
Api
- Object
- Api
- Brightbox::User
show all
- Defined in:
- lib/brightbox-cli/users.rb
Instance Attribute Summary
Attributes inherited from Api
#id
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Api
#attributes, cache_all!, cached_get, conn, #created_on, #exists?, find, find_all_or_warn, find_by_handle, find_or_call, #fog_attributes, #fog_model, #initialize, klass_name, #method_missing, require_account?, #respond_to_missing?
Constructor Details
This class inherits a constructor from Brightbox::Api
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Brightbox::Api
Class Method Details
.all ⇒ Object
9
10
11
|
# File 'lib/brightbox-cli/users.rb', line 9
def self.all
conn.users
end
|
.default_field_order ⇒ Object
18
19
20
|
# File 'lib/brightbox-cli/users.rb', line 18
def self.default_field_order
i[id name email_address accounts]
end
|
.get(id) ⇒ Object
13
14
15
16
|
# File 'lib/brightbox-cli/users.rb', line 13
def self.get(id)
u = conn.users.get id
u.nil? || u.id != id ? nil : u
end
|
Instance Method Details
#accounts ⇒ Object
22
23
24
|
# File 'lib/brightbox-cli/users.rb', line 22
def accounts
@accounts ||= fog_model.accounts.map { |a| Account.new(a["id"]) }
end
|
#render_cell ⇒ Object
38
39
40
|
# File 'lib/brightbox-cli/users.rb', line 38
def render_cell
handle if fog_model
end
|
#save ⇒ Object
30
31
32
|
# File 'lib/brightbox-cli/users.rb', line 30
def save
fog_model.save
end
|
#ssh_key_set? ⇒ Boolean
34
35
36
|
# File 'lib/brightbox-cli/users.rb', line 34
def ssh_key_set?
!ssh_key.to_s.strip.empty?
end
|
#to_row ⇒ Object
3
4
5
6
7
|
# File 'lib/brightbox-cli/users.rb', line 3
def to_row
attributes.merge(
accounts: accounts.size
)
end
|
#to_s ⇒ Object
26
27
28
|
# File 'lib/brightbox-cli/users.rb', line 26
def to_s
@id
end
|