Class: Pipedrive::User

Inherits:
Resource show all
Defined in:
lib/pipedrive/resources/user.rb

Class Method Summary collapse

Methods inherited from Resource

all, class_name, fields_dicc, has_many, #initialize, #initialize_from_data, inverted_fields_dicc, #no_content?, #refresh, #resource_url, resource_url, retrieve, search, #search_for_fields, search_for_fields, #update_attributes, update_method, #update_method

Methods included from APIOperations::Create

#create

Methods included from APIOperations::Delete

#delete

Methods included from APIOperations::Update

#update

Methods included from APIOperations::Request

included

Constructor Details

This class inherits a constructor from Pipedrive::Resource

Class Method Details

.find(term, search_by_email) ⇒ Object

GET /v1/users/find/ Find users by their name or email



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/pipedrive/resources/user.rb', line 7

def self.find(term, search_by_email)
  params = { term: term }
  params = params.merge({ search_by_email: 1 }) if search_by_email
  response = request(
    :get,
    "#{resource_url}/find",
    params
  )
  items = response[:data]

  return [] if items.nil?

  items.map { |d| new(d) }
end