Class: Closeio::Rails::Contact

Inherits:
Base
  • Object
show all
Defined in:
app/models/closeio/rails/contact.rb

Instance Method Summary collapse

Methods included from Attributes

#attributes

Instance Method Details

#emailObject

Raises:

  • (NotImplementedError)


9
10
11
# File 'app/models/closeio/rails/contact.rb', line 9

def email
  raise NotImplementedError, "You need to implement Closeio::Rails::Contact#email in your own subclass or prepended mixin."
end

#email_addressesObject



17
18
19
# File 'app/models/closeio/rails/contact.rb', line 17

def email_addresses
  emails.inject({}) {|h,data| h[data[:email]] = data[:type]; h}
end

#has_login?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'app/models/closeio/rails/contact.rb', line 5

def has_login?
  emails.find {|e| e['type'] == 'other'}.present?
end

#phone_numbersObject



13
14
15
# File 'app/models/closeio/rails/contact.rb', line 13

def phone_numbers
  phones.inject({}) {|h, p| h[p['phone_formatted']] = p['type']; h}
end