Class: Pipedrive::Organization

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

Instance Attribute Summary

Attributes inherited from Base

#data

Class Method Summary collapse

Methods inherited from Base

authenticate, bad_response, #initialize, new_list

Constructor Details

This class inherits a constructor from Pipedrive::Base

Class Method Details

.create(opts = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/pipedrive/organization.rb', line 5

def self.create( opts = {} )
  res = post "/organizations", :body => opts
  if res.success?
    res['data'] = opts.merge res['data']
    Organization.new(res)
  else
    bad_response(res)
  end
end

.find(id) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/pipedrive/organization.rb', line 15

def self.find(id)
  res = get "/organizations/#{id}"
  if res.ok?
    Organization.new(res)
  else
    bad_response(res)
  end
end

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



24
25
26
27
28
29
30
31
# File 'lib/pipedrive/organization.rb', line 24

def self.find_by_name(name, opts={})
  res = get "/organizations/find", :query => { :term => name }.merge(opts)
  if res.ok?
    Organization.new_list(res)
  else
    bad_response(res)
  end
end