Sha256: cfcab89519eef8df01e02451dc718298452225e146d5edd870cafb35bfff22bd
Contents?: true
Size: 974 Bytes
Versions: 4
Compression:
Stored size: 974 Bytes
Contents
module ActsAsIcontact # 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.) class MessageStatistics < Subresource include ReadOnly alias_method :message, :parent # This one's a little weird; remove scoped_find, and add scoped_first to retrieve just one record class <<self alias_method :scoped_find, :cannot_query end # Returns just one resource corresponding to the parent Message def self.scoped_first(parent) response = parent.connection[collection_name].get parsed = JSON.parse(response) self.new(parsed[collection_name].merge(:parent => parent)) end end end
Version data entries
4 entries across 4 versions & 2 rubygems