Class: Brightbox::ConfigMap
- Inherits:
-
Api
- Object
- Api
- Brightbox::ConfigMap
show all
- Defined in:
- lib/brightbox-cli/config_map.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, #respond_to_missing?, #to_s
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
5
6
7
|
# File 'lib/brightbox-cli/config_map.rb', line 5
def self.all
conn.config_maps
end
|
.create(options) ⇒ Object
9
10
11
|
# File 'lib/brightbox-cli/config_map.rb', line 9
def self.create(options)
new(conn.config_maps.create(options))
end
|
.default_field_order ⇒ Object
17
18
19
|
# File 'lib/brightbox-cli/config_map.rb', line 17
def self.default_field_order
i[id name]
end
|
.detailed_fields ⇒ Object
21
22
23
24
25
26
|
# File 'lib/brightbox-cli/config_map.rb', line 21
def self.detailed_fields
i[
id
name
]
end
|
.get(id) ⇒ Object
13
14
15
|
# File 'lib/brightbox-cli/config_map.rb', line 13
def self.get(id)
conn.config_maps.get(id)
end
|
.require_account? ⇒ Boolean
3
|
# File 'lib/brightbox-cli/config_map.rb', line 3
def self.require_account?; true; end
|
Instance Method Details
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/brightbox-cli/config_map.rb', line 28
def format_data(format)
case format.to_sym
when :text
attributes[:data].map do |key, value|
"#{key.to_s.rjust(16)}: #{value}"
end.join("\n")
else
JSON.dump(data)
end
end
|
#to_row ⇒ Object
39
40
41
42
43
44
45
|
# File 'lib/brightbox-cli/config_map.rb', line 39
def to_row
{
id: attributes[:id],
name: attributes[:name],
data: attributes[:data]
}
end
|
#update(options) ⇒ Object
47
48
49
50
51
|
# File 'lib/brightbox-cli/config_map.rb', line 47
def update(options)
self.class.conn.update_config_map(id, options)
reload
self
end
|