Sha256: bb865154d15c5f298a5934fc8f24302da969c4c750f20c9e110e43991158a9e7

Contents?: true

Size: 559 Bytes

Versions: 3

Compression:

Stored size: 559 Bytes

Contents

module Pipekit
  class Person
    include Repository

    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 update_by_email(email, fields)
      person = find_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

3 entries across 3 versions & 1 rubygems

Version Path
pipekit-1.2.0 lib/pipekit/person.rb
pipekit-1.0.2 lib/pipekit/person.rb
pipekit-1.0.1 lib/pipekit/person.rb