1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/rackspace/models/monitoring/base.rb
Matt Darby 72e52e70be Revert "Moving Rackspace logic to fog-rackspace"
This reverts commit d6ecb19d24.

Conflicts:
	fog.gemspec
2014-12-10 11:30:34 -05:00

29 lines
802 B
Ruby

require 'digest/md5'
module Fog
module Rackspace
class Monitoring
class Base < Fog::Model
attribute :created_at
attribute :updated_at
# Back to drawing board on this one I think
def hash
attrs = attributes.dup
attrs.delete_if {|key, value| [:created_at, :updated_at, :id].include?(key)}
attrs.delete_if {|key, value| value.kind_of?(Base) }
keys = attrs.keys.map{|sym| sym.to_s}.sort.join ''
values = attrs.values.map{|sym| sym.to_s}.sort.join ''
Digest::MD5.hexdigest(keys + values)
end
def compare?(b)
a_o = params
b_o = b.params
remain = a_o.reject {|key, value| b_o[key] === value}
remain.empty?
end
end
end
end
end