Sha256: 29bdc8038ba3caf030c8a92704021df7795e80c4a9be7424fa8d3671fc8ffa41
Contents?: true
Size: 775 Bytes
Versions: 1
Compression:
Stored size: 775 Bytes
Contents
module Pipekit class Deal include Repository SINGULAR_CLASSNAME = "deal".freeze PLURALIZED_CLASSNAME = "deals".freeze 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 # Finds a person by their email, then finds the first deal related to that # person and updates it with the params provided 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 end UnknownPersonError = Class.new(StandardError) end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pipekit-2.1.1 | lib/pipekit/deal.rb |