Class: ContextIO::Contact

Inherits:
Object
  • Object
show all
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

Methods included from API::Resource

#delete

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
  .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 messages
  .messages.where(email: email)
end

#threads ⇒ Object

Poor man's has_many



29
30
31
# File 'lib/contextio/contact.rb', line 29

def threads
  .threads.where(email: email)
end