Class: Fog::Rackspace::Monitoring::Base
- Defined in:
- lib/fog/rackspace/models/monitoring/base.rb
Direct Known Subclasses
AgentToken, Alarm, AlarmExample, Check, CheckType, DataPoint, Entity, Metric
Instance Attribute Summary
Attributes inherited from Model
Instance Method Summary collapse
- #compare?(b) ⇒ Boolean
- #entity_id ⇒ Object
-
#hash ⇒ Object
Back to drawing board on this one I think.
Methods inherited from Model
#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Core::DeprecatedConnectionAccessors
#connection, #connection=, #prepare_service_value
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one
Constructor Details
This class inherits a constructor from Fog::Model
Instance Method Details
#compare?(b) ⇒ Boolean
21 22 23 24 25 26 |
# File 'lib/fog/rackspace/models/monitoring/base.rb', line 21 def compare?(b) a_o = params b_o = b.params remain = a_o.reject {|key, value| b_o[key] === value} remain.empty? end |
#entity_id ⇒ Object
28 29 30 31 |
# File 'lib/fog/rackspace/models/monitoring/base.rb', line 28 def entity_id raise(ArgumentError, "entity with id is required for this operation") unless entity && entity.identity entity.identity end |
#hash ⇒ Object
Back to drawing board on this one I think
12 13 14 15 16 17 18 19 |
# File 'lib/fog/rackspace/models/monitoring/base.rb', line 12 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 |