PipedrivePUT
Status
Travis CI Build Status
Installation
Add this line to your application's Gemfile:
gem 'PipedrivePUT'
#Needed for some http commands.
gem 'httparty'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install PipedrivePUT
To install config file
rails g pipedrive_p_u_t:config
This will install a config file in config/initializers/pipedriveput.rb
Make sure to change the value inside of this file
PipedrivePUT.key('your_api_key_goes_here')
Organizations
Get all organizations from your account at Pipedrive
PipedrivePUT::Organizations.getAllOrgs
Get Organization by ID
PipedrivePUT::Organizations.getOrganization(< id >)
Add an organization
PipedrivePUT::Organizations.addOrganization(< Name of new Organization >)
You can also add various other parameters based on values in Pipedrive or custom keys when creating a organization!
PipedrivePUT::Organizations.addOrganization(< Name of new Organization >, < :optionArgument => "value" > )
NOTE: the options must be in hash format
Example:
PipedrivePUT::Organizations.addOrganization("Jacob Programming Test", :address => "South Jasmine Street")
You can aso add ANY custom key from Pipedrive to this to input values into those fields
Example:
PipedrivePUT::Organizations.addOrganization("Jacob Programming Test", :'3df8474115f948137b3f98a0ff651d0edbbd2f54' => "JMD", :address => "South Jasmine Street")
Find Organization by term
PipedrivePUT::Organizations.findOrganizationByName(< Term >)
Find Persons in an Organization
PipedrivePUT::Organizations.getPersonsOfOrganization(< id >)
Update an organization
PipedrivePUT::Organizations.updateOrganization(< id >, < optional params >)
Example
PipedrivePUT::Organizations.updateOrganization(1, :name => "New Organization Name")
Deals
Get Specific Deal with ID
PipedrivePUT::Deal.getDeal(<id>)
Get All Deals
PipedrivePUT::Deal.getAllDeals
Deal Fields
Get All Deal Fields
PipedrivePUT::DealFields.getAllDealFields
Search
Search entire Pipedrive (Deals, Organizations, Product, File, Person)
PipedrivePUT::Search.search(< Term >)
Search Specific Item type in Pipedrive (Deals, Organizations, Product, File, Person)
PipedrivePUT::Search.search(< Term >, < item_type >)
Example:
PipedrivePUT::Search.search("UPMC", "organization")
Users
Get All users for your company
PipedrivePUT::Users.getAllUsers
Persons
Get all persons from Pipedrive
PipedrivePUT::Persons.getAllPersons
Get specifi Person from Pipedrive
PipedrivePUT::Persons.detailsOfPerson(< id >)
Add a person to Pipedrive
PipedrivePUT::Persons.addPerson(< Name of Person >, < additional params >)
Example:
PipedrivePUT::Persons.addPerson("Programming Test Person", {:org_id => 15367, :phone => [{:value=>'555-555-3340',:label=>'work'},{:value=>'555-111-1111',:label=>'home'}]})
NOTE: The option arguments do not be put in as strings. As of right now that is not working in irb console. I will attempt to see if that plays a factor in rails its self.
Delete a persons from Pipedrive
PipedrivePUT::Persons.deletePerson(< id >)
Update a persons from Pipedrive
PipedrivePUT::Persons.updatePerson(< id >, < additional params >)
Example
PipedrivePUT::Persons.updatePerson(10, :email => "test@test.com")
Activities
Get all Activites per user
PipedrivePUT::Activity.getActivity(< user_id >)
Get all Activites for a specific organization
PipedrivePUT::Activity.getOrgActivities(< org_id >)
Add an Activity
PipedrivePUT::Activity.addActivity(<subject>, <type>, <:options => "value">)
Activity Types
Get all Activity Types
PipedrivePUT::Activity.getActivity_type
Filters
Get all filters
PipedrivePUT::Filters.getFilters
Files
Get all files
PipedrivePUT::Files.getAllFiles
Download a specific file
PipedrivePUT::Files.downloadFile(< file_id >)
^This will download the specific file and place it in the root dir of your current dir
Currencies
Get all Currencies
PipedrivePUT::Currencies.getAllCurr
Search for Currencies based off currency name
PipedrivePUT::Currencies.getCurr(< currency_name >)
If you want to get fancy and calculate exchange rates I added method in for that as well :)
PipedrivePUT::Currencies.getExchangeRate(< currency_name >, < options = {} >)
PipedrivePUT::Currencies.getExchangeRate('Australian Dollar', :amount => "100_80", :ex_code => "USD")
Pipelines
Get all Pipelines
PipedrivePUT::Pipelines.getAllPipelines
Get one Pipeline
PipedrivePUT::Pipelines.getOnePipeline(< id >)
Recents
Get all Recent changes from Pipedrive based on a specific time
PipedrivePUT::Recents.getRecent(< Time.now >)
Organization Fields
Get all fields that are able to be used in an organization
PipedrivePUT::OrganizationFields.getAllOrganizationFields
NOTE: This searches for everything in Pipedrive (deal, organization, user, state, product, etc.)
I hope to add additional support to break this down at a later time.
Add Organization Field
PipedrivePUT::OrganizationFields.addOrganizationField(< Field Name>, <Field Type>, { <options> } )
Field types: " ", varchar, varchar_auto, text, double, monetary, date, set, enum, user, org, people, phone, time, timerange, daterange
NOTE: The field type for Pipedrive is required. However, it can also be left as empty.
Example:
PipedrivePUT::OrganizationFields.addOrganizationField("Total Ordered in September", "monetary", {:important_flag => 'true'})
Data is returned in JSON format.
This can be easily customized. I needed something quickly and easily for my own personal project.
This is my first attempt at a ruby gem so I appoligize if things are unorthodox.
The Pipedrive API can be found at:
https://developers.pipedrive.com/v1
To do List
-
Add support for additional arguments when creating a deal
-
Add ability to search for recent changes by specific types onle (deal, organization, user, state, etc.)
-
Many other Pipedrive API Calls
Contributing
- Fork it ( https://github.com/jakepens71/RailsPipedriveGem/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request