Class: Fog::Compute::Glesys::Ips

Inherits:
Fog::Collection show all
Defined in:
lib/rackspace-fog/glesys/models/compute/ips.rb

Instance Attribute Summary

Attributes inherited from Fog::Collection

#connection

Instance Method Summary collapse

Methods inherited from Fog::Collection

#clear, #create, #destroy, #initialize, #inspect, #load, model, #model, #reload, #table, #to_json

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one

Constructor Details

This class inherits a constructor from Fog::Collection

Instance Method Details

#allObject



14
15
16
17
# File 'lib/rackspace-fog/glesys/models/compute/ips.rb', line 14

def all
  data = connection.ip_list_own.body['response']['iplist']
  load(data)
end

#get(identifier) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/rackspace-fog/glesys/models/compute/ips.rb', line 19

def get(identifier)
  return nil if identifier.nil? || identifier == ""
  
  self.new( :serverid => identifier )          

  data  = connection.ip_list_own(:serverid => identifier).body['response']
  if data['iplist'].empty?
    nil 
  else
    new(data['iplist'].first)
  end 
end

#new(attributes = {}) ⇒ Object



32
33
34
# File 'lib/rackspace-fog/glesys/models/compute/ips.rb', line 32

def new(attributes = {})
  super({ :serverid => serverid }.merge!(attributes))
end