class RubyRedtail::User::Contacts

Constants

CONTACT_SEARCH_FIELDS
CONTACT_SEARCH_OPERANDS

Public Class Methods

new(api_hash) click to toggle source
# File lib/ruby-redtail/user/contacts.rb, line 11
def initialize(api_hash)
  @api_hash = api_hash
end

Public Instance Methods

create(params) click to toggle source

Create New Contact

# File lib/ruby-redtail/user/contacts.rb, line 50
def create (params)
  update(0, params)
end
search_by_letter(value, page = 1) click to toggle source

Contact Search by Letter Fetch returns a paged list of limited Contact Information, including the ContactID, based on a partial name or a single character. *value = searched beginning letter(s) *page = pagination help.redtailtechnology.com/entries/21937828-contacts-search-contacts-search

# File lib/ruby-redtail/user/contacts.rb, line 30
def search_by_letter (value, page = 1)
  build_contacts_array RubyRedtail::Query.run("contacts/search/beginswith?value=#{value}&page=#{page}", @api_hash, "GET")["Contacts"]
end
search_by_name(value, page = 1) click to toggle source

Contact Search by Name Fetch returns a paged list of limited Contact Information, including the ContactID *value = searched name *page = pagination help.redtailtechnology.com/entries/21937828-contacts-search-contacts-search

# File lib/ruby-redtail/user/contacts.rb, line 20
def search_by_name (value, page = 1)
  build_contacts_array RubyRedtail::Query.run("contacts/search?value=#{value}&page=#{page}", @api_hash, "GET")["Contacts"]
end

Protected Instance Methods

build_client(client_hash) click to toggle source
# File lib/ruby-redtail/user/contacts.rb, line 72
def build_client client_hash
  if client_hash
    RubyRedtail::Client.new(client_hash,@api_hash)
  else
    raise RubyRedtail::AuthenticationError
  end
end
build_clients_array(client_hashes) click to toggle source
# File lib/ruby-redtail/user/contacts.rb, line 80
def build_clients_array client_hashes
  if client_hashes
    client_hashes.collect { |client_hash| self.build_client client_hash }
  else
    raise RubyRedtail::AuthenticationError
  end
end
build_contact(contact_hash) click to toggle source
# File lib/ruby-redtail/user/contacts.rb, line 56
def build_contact contact_hash
  if contact_hash
    RubyRedtail::Contact.new(contact_hash,@api_hash)
  else
    raise RubyRedtail::AuthenticationError
  end
end
build_contacts_array(contact_hashes) click to toggle source
# File lib/ruby-redtail/user/contacts.rb, line 64
def build_contacts_array contact_hashes
  if contact_hashes
    contact_hashes.collect { |contact_hash| self.build_contact contact_hash }
  else
    raise RubyRedtail::AuthenticationError
  end
end