Class: Pipedrive::Person

Inherits:
Base
  • Object
show all
Defined in:
lib/pipedrive/person.rb

Instance Attribute Summary

Attributes inherited from Base

#data

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

all, authenticate, bad_response, create, destroy, #destroy, find, find_by_name, #initialize, #initialize_related_objects, new_list, resource_path, search, #update

Constructor Details

This class inherits a constructor from Pipedrive::Base

Class Method Details

.find_or_create_by_name(name, opts = {}) ⇒ Object


6
7
8
# File 'lib/pipedrive/person.rb', line 6

def find_or_create_by_name(name, opts={})
  find_by_name(name, :org_id => opts[:org_id]).first || create(opts.merge(:name => name))
end

Instance Method Details

#dealsObject


12
13
14
# File 'lib/pipedrive/person.rb', line 12

def deals()
  Deal.all(get "#{resource_path}/#{id}/deals", :everyone => 1)
end

#merge(opts = {}) ⇒ Object


16
17
18
19
# File 'lib/pipedrive/person.rb', line 16

def merge(opts = {})
  res = put "#{resource_path}/#{id}/merge", :body => opts
  res.success? ? res['data'] : bad_response(res,opts)
end