Sha256: a9fbbf1aaa9e4920653aa0b1156f4f0d455939047601542d18ec07d80ff326cf
Contents?: true
Size: 837 Bytes
Versions: 18
Compression:
Stored size: 837 Bytes
Contents
require 'contextio/api/resource' class ContextIO class Contact include ContextIO::API::Resource self.primary_key = :email self.association_name = :contact belongs_to :account lazy_attributes :emails, :name, :thumbnail, :last_received, :last_sent, :count private :last_received, :last_sent def email @email ||= emails.first end def last_received_at last_received ? Time.at(last_received) : nil end def last_sent_at last_sent ? Time.at(last_sent) : nil end # Poor man's has_many def threads account.threads.where(email: email) end # Poor man's has_many def messages account.messages.where(email: email) end # Poor man's has_many def files account.files.where(email: email) end end end
Version data entries
18 entries across 18 versions & 1 rubygems