class Pipekit::Deal
Constants
- PLURALIZED_CLASSNAME
- SINGULAR_CLASSNAME
Public Instance Methods
get_by_person_id(person_id, person_repo: Person.new)
click to toggle source
# File lib/pipekit/deal.rb, line 7 def get_by_person_id(person_id, person_repo: Person.new) raise UnknownPersonError, "No person ID supplied when getting deals by person ID" unless person_id person_repo.find_deals(person_id) end
update_by_person(email, params, person_repo: Person.new)
click to toggle source
Finds a person by their email, then finds the first deal related to that person and updates it with the params provided
# File lib/pipekit/deal.rb, line 14 def update_by_person(email, params, person_repo: Person.new) person = person_repo.find_exactly_by_email(email) deal = get_by_person_id(person[:id], person_repo: person_repo).first update(deal[:id], params) end