developers API Documentation

Create a person and a deal, then add the deal to the person

ruby
require 'pp'
require 'json'
require 'rest_client'

key = "your api key"
api = "https://api.pipelinedeals.com/api/v3"

# Create a new person
person = {
  'person' => {
    'last_name' => "Monster"
  }
}

RestClient.post "#{api}/people.json?api_key=#{key}", person do |response|
  person = JSON.parse(response) # update the person hash from the response
end


# Create a new deal
deal = {
  'deal' => {
    'name' => 'Monster Deal'
  }
}

RestClient.post "#{api}/deals.json?api_key=#{key}", deal do |response|
  deal = JSON.parse(response) # update the deal hash from the response
end


# Add the deal to the person
id = person['id']
person = {
  'person' => {
    'deal_ids' => [deal['id']]
  }
}

RestClient.put "#{api}/people/#{id}.json?api_key=#{key}", person do |response|
  if response.code == 200
    puts "updated!"
  else
    puts "sad face"
  end
end

RestClient.get "#{api}/people/#{id}.json?associations=deals&api_key=#{key}" do |response|
  pp JSON.parse(response)
end