Module: PartyResource
- Defined in:
- lib/party_resource/route.rb,
lib/party_resource/request.rb,
lib/party_resource/property.rb,
lib/party_resource/buildable.rb,
lib/party_resource/connector.rb,
lib/party_resource/exceptions.rb,
lib/party_resource/connector/base.rb,
lib/party_resource/party_resource.rb
Defined Under Namespace
Modules: Buildable, ClassMethods, Connector, Exceptions, ParameterValues Classes: Property, Request, Route
Class Method Summary collapse
- .logger ⇒ Object
-
.logger=(logger) ⇒ Object
Set logger to use.
Instance Method Summary collapse
-
#properties_equal?(other) ⇒ Boolean
Test if all properties are equal.
-
#to_properties_hash ⇒ Hash
Converts the objects properties to a hash.
Class Method Details
.logger ⇒ Object
19 20 21 |
# File 'lib/party_resource/party_resource.rb', line 19 def self.logger @logger end |
.logger=(logger) ⇒ Object
Set logger to use
14 15 16 |
# File 'lib/party_resource/party_resource.rb', line 14 def self.logger=(logger) @logger = logger end |
Instance Method Details
#properties_equal?(other) ⇒ Boolean
Test if all properties are equal
167 168 169 170 171 172 173 |
# File 'lib/party_resource/party_resource.rb', line 167 def properties_equal?(other) begin self.class.send(:property_list).all? {|property| self.send(property.name) == other.send(property.name) } rescue NoMethodError false end end |
#to_properties_hash ⇒ Hash
Converts the objects properties to a hash
160 161 162 163 164 |
# File 'lib/party_resource/party_resource.rb', line 160 def to_properties_hash self.class.send(:property_list).inject({}) do |hash, property| hash.merge(property.to_hash(self)) end end |