lib/bbcloud/servers.rb in bbcloud-0.11.2 vs lib/bbcloud/servers.rb in bbcloud-0.12.0

- old
+ new

@@ -1,8 +1,12 @@ module Brightbox class Server < Api + def self.create_servers(count,options) + (0...count).map {|i| create(options) } + end + def self.create(options) new(conn.servers.create(options)) end def server_type @@ -17,19 +21,20 @@ a = fog_model.attributes a[:image] = image a[:created_at] = created_at a[:created_on] = fog_model.created_at.strftime("%Y-%m-%d") a[:type] = server_type + a[:status] = fog_model.state a[:zone] = Zone.new(zone_id) if zone_id a[:hostname] = hostname a[:public_hostname] = public_hostname unless cloud_ips.empty? a end def to_row o = attributes - o[:cloud_ips] = cloud_ips.collect { |i| i['public_ip'] } + o[:cloud_ip_ids] = cloud_ips.collect { |i| i['id'] } o[:ips] = interfaces.collect { |i| i['ipv4_address'] }.join(', ') o end def deleted? @@ -53,10 +58,10 @@ def self.all conn.servers end def self.default_field_order - [:id, :status, :type, :zone, :created_on, :image_id, :cloud_ips, :name] + [:id, :status, :type, :zone, :created_on, :image_id,:cloud_ip_ids,:name] end def hostname "#{id}.gb1.brightbox.com" end