Class: ContextIO::Contact
- Inherits:
-
Object
- Object
- ContextIO::Contact
- Includes:
- API::Resource
- Defined in:
- lib/contextio/contact.rb
Instance Attribute Summary
Attributes included from API::Resource
#api_attributes, #primary_key, #resource_url
Instance Method Summary collapse
- #email ⇒ Object
-
#files ⇒ Object
Poor man's has_many.
- #last_received_at ⇒ Object
- #last_sent_at ⇒ Object
-
#messages ⇒ Object
Poor man's has_many.
-
#threads ⇒ Object
Poor man's has_many.
Methods included from API::Resource
Instance Method Details
#email ⇒ Object
16 17 18 |
# File 'lib/contextio/contact.rb', line 16 def email @email ||= emails.first end |
#files ⇒ Object
Poor man's has_many
39 40 41 |
# File 'lib/contextio/contact.rb', line 39 def files account.files.where(email: email) end |
#last_received_at ⇒ Object
20 21 22 |
# File 'lib/contextio/contact.rb', line 20 def last_received_at last_received ? Time.at(last_received) : nil end |
#last_sent_at ⇒ Object
24 25 26 |
# File 'lib/contextio/contact.rb', line 24 def last_sent_at last_sent ? Time.at(last_sent) : nil end |
#messages ⇒ Object
Poor man's has_many
34 35 36 |
# File 'lib/contextio/contact.rb', line 34 def account..where(email: email) end |
#threads ⇒ Object
Poor man's has_many
29 30 31 |
# File 'lib/contextio/contact.rb', line 29 def threads account.threads.where(email: email) end |