Class: Fog::Image::OpenStack::Images
Instance Attribute Summary
Attributes inherited from Collection
#connection
Instance Method Summary
collapse
Methods inherited from Collection
#clear, #create, #initialize, #inspect, #load, model, #model, #new, #reload, #table, #to_json
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_sym, *arguments, &block) ⇒ Object
37
38
39
40
41
42
43
|
# File 'lib/fog/openstack/models/image/images.rb', line 37
def method_missing(method_sym, *arguments, &block)
if method_sym.to_s =~ /^find_by_(.*)$/
load(connection.list_public_images_detailed($1 ,arguments.first).body['images'])
else
super
end
end
|
Instance Method Details
#all ⇒ Object
10
11
12
|
# File 'lib/fog/openstack/models/image/images.rb', line 10
def all
load(connection.list_public_images_detailed.body['images'])
end
|
#destroy(id) ⇒ Object
32
33
34
35
|
# File 'lib/fog/openstack/models/image/images.rb', line 32
def destroy(id)
image = self.find_by_id(id)
image.destroy
end
|
#details ⇒ Object
14
15
16
|
# File 'lib/fog/openstack/models/image/images.rb', line 14
def details
load(connection.list_public_images_detailed.body['images'])
end
|
#find_attribute(attribute, value) ⇒ Object
53
54
55
56
|
# File 'lib/fog/openstack/models/image/images.rb', line 53
def find_attribute(attribute,value)
attribute = attribute.to_s.gsub("find_by_", "")
load(connection.list_public_images_detailed(attribute , value).body['images'])
end
|
#find_by_id(id) ⇒ Object
18
19
20
|
# File 'lib/fog/openstack/models/image/images.rb', line 18
def find_by_id(id)
self.find {|image| image.id == id}
end
|
#find_by_size_max(size) ⇒ Object
49
50
51
|
# File 'lib/fog/openstack/models/image/images.rb', line 49
def find_by_size_max(size)
find_attribute(__method__, size)
end
|
#find_by_size_min(size) ⇒ Object
45
46
47
|
# File 'lib/fog/openstack/models/image/images.rb', line 45
def find_by_size_min(size)
find_attribute(__method__, size)
end
|
#private ⇒ Object
27
28
29
30
|
# File 'lib/fog/openstack/models/image/images.rb', line 27
def private
images = load(connection.list_public_images_detailed.body['images'])
images.delete_if{|image| image.is_public}
end
|
#public ⇒ Object
22
23
24
25
|
# File 'lib/fog/openstack/models/image/images.rb', line 22
def public
images = load(connection.list_public_images_detailed.body['images'])
images.delete_if{|image| image.is_public == false}
end
|