Class: ActsAsIcontact::MessageStatistics
- Inherits:
-
Subresource
- Object
- Resource
- Subresource
- ActsAsIcontact::MessageStatistics
- Includes:
- ReadOnly
- Defined in:
- lib/acts_as_icontact/resources/message_statistics.rb
Overview
The read-only set of statistics attached to every Message. Because of this intrinsic association, the usual #find methods don’t work; this resource must be obtained using the individual message’s #statistics method. Note also that this is a singleton resource, not a collection. Property updates and saving are also prohibited (returning a ReadOnlyError exception.)
Instance Attribute Summary
Attributes inherited from Subresource
Class Method Summary collapse
-
.scoped_first(parent) ⇒ Object
Returns just one resource corresponding to the parent Message.
Methods included from ReadOnly
Methods inherited from Subresource
Methods inherited from Resource
#==, all, #connection, #error, #errors, find, find_by_id, first, #id, #initialize, #inspect, #method_missing, #new_record?, #property_names, #save, #save!
Constructor Details
This class inherits a constructor from ActsAsIcontact::Subresource
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ActsAsIcontact::ReadOnly
Class Method Details
.scoped_first(parent) ⇒ Object
Returns just one resource corresponding to the parent Message
17 18 19 20 21 |
# File 'lib/acts_as_icontact/resources/message_statistics.rb', line 17 def self.scoped_first(parent) response = parent.connection[collection_name].get parsed = JSON.parse(response) self.new(parsed[collection_name].merge(:parent => parent)) end |