Class: Pipelinedeals::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/pipelinedeals/client.rb,
lib/pipelinedeals/client/version.rb

Constant Summary collapse

API_URL =
"https://api.pipelinedeals.com/api/v3/"
VERSION =
"0.0.1"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key) ⇒ Client

Returns a new instance of Client.



10
11
12
# File 'lib/pipelinedeals/client.rb', line 10

def initialize(api_key)
  @api_key = "#{api_key}"
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



6
7
8
# File 'lib/pipelinedeals/client.rb', line 6

def api_key
  @api_key
end

Instance Method Details

#create_person(data, endpoint = "people") ⇒ Object



31
32
33
# File 'lib/pipelinedeals/client.rb', line 31

def create_person(data, endpoint = "people")
  post_request(data, endpoint)
end

#people(page = 1, per_page = 10000) ⇒ Object



27
28
29
# File 'lib/pipelinedeals/client.rb', line 27

def people(page = 1, per_page = 10000)
  get_request("people", "&page=#{page}&per_page=#{per_page}")
end

#person_custom_fields(page = 1) ⇒ Object



23
24
25
# File 'lib/pipelinedeals/client.rb', line 23

def person_custom_fields(page = 1)
  get_request("/admin/person_custom_field_labels", "&page=#{page}")
end

#pingObject



14
15
16
17
# File 'lib/pipelinedeals/client.rb', line 14

def ping
  response = users
  !response.has_key?("errors") && !response.has_key?("error")
end

#update_person(data, id, options = "") ⇒ Object



35
36
37
# File 'lib/pipelinedeals/client.rb', line 35

def update_person(data, id, options = "")
  put_request(data, "people/#{id}", options)
end

#users(page = 1) ⇒ Object



19
20
21
# File 'lib/pipelinedeals/client.rb', line 19

def users(page = 1)
  get_request("users", "&page=#{page}")
end