class Pipekit::Person

Constants

PLURALIZED_CLASSNAME
SINGULAR_CLASSNAME

Public Instance Methods

create_or_update(fields) click to toggle source
# File lib/pipekit/person.rb, line 26
def create_or_update(fields)
  update_by_email(fields[:email], fields)
rescue ResourceNotFoundError
  create(fields)
end
find_deals(id) click to toggle source
# File lib/pipekit/person.rb, line 32
def find_deals(id)
  request.get("#{id}/deals")
end
find_exactly_by_email(email) click to toggle source
# File lib/pipekit/person.rb, line 15
def find_exactly_by_email(email)
  get_by_email(email).select do |item|
    item["email"] == email
  end.first
end
get_by_email(email) click to toggle source
# File lib/pipekit/person.rb, line 7
def get_by_email(email)
  request.get("find", term: email, search_by_email: 1)
end
get_by_name(name) click to toggle source
# File lib/pipekit/person.rb, line 11
def get_by_name(name)
  request.get("find", term: name)
end
update_by_email(email, fields) click to toggle source
# File lib/pipekit/person.rb, line 21
def update_by_email(email, fields)
  person = find_exactly_by_email(email)
  update(person["id"], fields)
end