lib/pipekit/person.rb in pipekit-1.2.0 vs lib/pipekit/person.rb in pipekit-2.0.0
- old
+ new
@@ -8,11 +8,17 @@
def get_by_name(name)
request.get("find", term: name)
end
+ def find_exactly_by_email(email)
+ get_by_email(email).select do |item|
+ item["email"] == email
+ end.first
+ end
+
def update_by_email(email, fields)
- person = find_by(email: email)
+ person = find_exactly_by_email(email)
update(person["id"], fields)
end
def create_or_update(fields)
update_by_email(fields[:email], fields)