Class: Pipelinedeals::Client
- Inherits:
-
Object
- Object
- Pipelinedeals::Client
- 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
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
Instance Method Summary collapse
- #create_person(data, endpoint = "people") ⇒ Object
-
#initialize(api_key) ⇒ Client
constructor
A new instance of Client.
- #people(page = 1, per_page = 10000) ⇒ Object
- #person_custom_fields(page = 1) ⇒ Object
- #ping ⇒ Object
- #update_person(data, id, options = "") ⇒ Object
- #users(page = 1) ⇒ Object
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_key ⇒ Object (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 |
#ping ⇒ Object
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, = "") put_request(data, "people/#{id}", ) 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 |