Class: Insightly::User

Inherits:
ReadOnly show all
Defined in:
lib/insightly/user.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ReadOnly

#==, #build, build, #config, #get_collection, #initialize, #process, #remote_data

Methods inherited from Base

#==, all, api_field, build, #build, #config, custom_fields, #get_collection, #initialize, #load, #process, #reload, #remote_data, #to_json, #url_base

Constructor Details

This class inherits a constructor from Insightly::ReadOnly

Class Method Details

.find_all_by_email(email) ⇒ Object



19
20
21
# File 'lib/insightly/user.rb', line 19

def self.find_all_by_email(email)
  User.all.collect {|x| x if x.email_address && x.email_address.match(email)}.compact
end

.find_all_by_name(name) ⇒ Object



28
29
30
31
# File 'lib/insightly/user.rb', line 28

def self.find_all_by_name(name)
  User.all.collect {|x|  x if x.name && x.name.match(name) }.compact

end

.find_by_email(email) ⇒ Object



22
23
24
25
26
27
# File 'lib/insightly/user.rb', line 22

def self.find_by_email(email)
  User.all.each do |x|
    return x if x.email_address && x.email_address.match(email)
  end
  nil
end

.find_by_name(name) ⇒ Object



32
33
34
35
36
37
# File 'lib/insightly/user.rb', line 32

def self.find_by_name(name)
  User.all.collect do |x|
    return x if x.name && x.name.match(name)
  end
  nil
end

Instance Method Details

#last_name_firstObject



41
42
43
44
# File 'lib/insightly/user.rb', line 41

def last_name_first
  result = "#{self.last_name},#{self.first_name}".strip
  result == "," ? "" : result
end

#nameObject



38
39
40
# File 'lib/insightly/user.rb', line 38

def name
       "#{self.first_name} #{self.last_name}".strip
end

#remote_idObject



16
17
18
# File 'lib/insightly/user.rb', line 16

def remote_id
  self.user_id
end