Sha256: cbc9cbf025784df91a0a93d8ca4bc1a88ed42d241a6ffec8414d196ef076c2eb
Contents?: true
Size: 787 Bytes
Versions: 1
Compression:
Stored size: 787 Bytes
Contents
module Pipekit class Person include Repository SINGULAR_CLASSNAME = "person".freeze PLURALIZED_CLASSNAME = "persons".freeze def get_by_email(email) request.get("find", term: email, search_by_email: 1) end 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_exactly_by_email(email) update(person["id"], fields) end def create_or_update(fields) update_by_email(fields[:email], fields) rescue ResourceNotFoundError create(fields) end def find_deals(id) request.get("#{id}/deals") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pipekit-2.1.1 | lib/pipekit/person.rb |