PipedrivePUT 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +4 -0
- data/README.md +100 -0
- data/Rakefile +2 -0
- data/lib/PipedrivePUT.rb +26 -0
- data/lib/PipedrivePUT/deal.rb +16 -0
- data/lib/PipedrivePUT/organization.rb +58 -0
- data/lib/PipedrivePUT/search.rb +90 -0
- data/lib/PipedrivePUT/users.rb +17 -0
- data/lib/PipedrivePUT/version.rb +3 -0
- metadata +137 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3a7d516c1db6306ec38ba02752d87d5befc20a31
|
4
|
+
data.tar.gz: 64d26fa79882da518a5e7aa609039868a210f79c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: aa1138fd8508dfb0887feb787e34a59549525b1ab6888293a9667f55c77a9f656a630d94fd683f76c9ec4ded3866db6898b7132f66e159b25c253a4346687c19
|
7
|
+
data.tar.gz: c3580215c7282e2e5cb12b1a76908a2b3af1f3c7d18159a9b6e6587282e62199469943afab9ffa102aa0ac69cc823b12fb9e45653cbb86386bc7af288fec0df2
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
# PipedrivePUT
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'PipedrivePUT'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install PipedrivePUT
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
PipedrivePUT.key(< API Token Here >)
|
24
|
+
|
25
|
+
## Organizations
|
26
|
+
|
27
|
+
Get all organizations from your account at Pipedrive
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
PipedrivePUT::Organizations.getAllOrgs
|
31
|
+
```
|
32
|
+
|
33
|
+
Add an organization
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
PipedrivePUT::Organizations.addOrganization(< Name of new Organization >)
|
37
|
+
```
|
38
|
+
|
39
|
+
## Deals
|
40
|
+
|
41
|
+
Get Specific Deal with ID
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
PipedrivePUT::Deals.getDeal(<id>)
|
45
|
+
```
|
46
|
+
|
47
|
+
## Search
|
48
|
+
|
49
|
+
Search entire Pipedrive (Deals, Organizations, Product, File, Person)
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
PipedrivePUT::Search.search(< Term >)
|
53
|
+
```
|
54
|
+
|
55
|
+
Search Specific Item type in Pipedrive (Deals, Organizations, Product, File, Person)
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
PipedrivePUT::Search.search(< Term >, < item_type>)
|
59
|
+
```
|
60
|
+
|
61
|
+
Example:
|
62
|
+
|
63
|
+
```ruby
|
64
|
+
PipedrivePUT::Search.search("UPMC", "organization")
|
65
|
+
```
|
66
|
+
|
67
|
+
## Users
|
68
|
+
|
69
|
+
Get All users for your company
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
PipedrivePUT::Users.getAllUsers
|
73
|
+
```
|
74
|
+
|
75
|
+
Data is returned in JSON format.
|
76
|
+
|
77
|
+
This can be easily customized. I needed something quickly and easily for my own personal project.
|
78
|
+
|
79
|
+
This is my first attempt at a ruby gem so I appoligize if things are unorthodox.
|
80
|
+
|
81
|
+
## To do List
|
82
|
+
|
83
|
+
1. Add search for specific organization id
|
84
|
+
|
85
|
+
2. Add support for additional arguments to create an organization
|
86
|
+
|
87
|
+
3. Get All Deals
|
88
|
+
|
89
|
+
4. Add a deal
|
90
|
+
|
91
|
+
5. Many other Pipedrive API Calls
|
92
|
+
|
93
|
+
|
94
|
+
## Contributing
|
95
|
+
|
96
|
+
1. Fork it ( https://github.com/jakepens71/RailsPipedriveGem/fork )
|
97
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
98
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
99
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
100
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/lib/PipedrivePUT.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require "PipedrivePUT/version"
|
2
|
+
require "PipedrivePUT/organization"
|
3
|
+
require 'PipedrivePUT/search'
|
4
|
+
require 'PipedrivePUT/users'
|
5
|
+
require 'PipedrivePUT/deal'
|
6
|
+
|
7
|
+
require 'json'
|
8
|
+
require 'open-uri'
|
9
|
+
require 'rest-client'
|
10
|
+
|
11
|
+
|
12
|
+
module PipedrivePUT
|
13
|
+
|
14
|
+
attr_accessor :key
|
15
|
+
|
16
|
+
#set the giving API key for pipedrive
|
17
|
+
def self.key(key)
|
18
|
+
@@key = key
|
19
|
+
end
|
20
|
+
|
21
|
+
#See which key is givin
|
22
|
+
def self.getKey
|
23
|
+
@@key
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module PipedrivePUT
|
2
|
+
class Deal
|
3
|
+
include PipedrivePUT
|
4
|
+
|
5
|
+
#Return data of a specific deal
|
6
|
+
def self.getDeal(id)
|
7
|
+
@base = 'https://api.pipedrive.com/v1/deals/' + id.to_s + '?api_token=' + @@key.to_s
|
8
|
+
@content = open(@base.to_s).read
|
9
|
+
@parsed = JSON.parse(@content)
|
10
|
+
#return @parsed
|
11
|
+
end
|
12
|
+
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module PipedrivePUT
|
2
|
+
class Organizations
|
3
|
+
|
4
|
+
include PipedrivePUT
|
5
|
+
|
6
|
+
|
7
|
+
def self.key
|
8
|
+
puts @@key
|
9
|
+
end
|
10
|
+
|
11
|
+
#Get All Organizations from Pipedrive
|
12
|
+
def self.getAllOrgs()
|
13
|
+
|
14
|
+
@start = 0
|
15
|
+
|
16
|
+
table = Array.new
|
17
|
+
@more_items = true
|
18
|
+
|
19
|
+
while @more_items == true do
|
20
|
+
#puts @more_items
|
21
|
+
@base = 'https://api.pipedrive.com/v1/organizations?start=' + @start.to_s + '&limit=500&api_token=' + @@key.to_s
|
22
|
+
#puts @base
|
23
|
+
@content = open(@base.to_s).read
|
24
|
+
@parsed = JSON.parse(@content)
|
25
|
+
@data = @parsed["data"]
|
26
|
+
|
27
|
+
table.push(@data)
|
28
|
+
|
29
|
+
@pagination = @parsed['additional_data']['pagination']
|
30
|
+
@more_items = @pagination['more_items_in_collection']
|
31
|
+
#puts @more_items
|
32
|
+
@start = @pagination['next_start']
|
33
|
+
#puts @start
|
34
|
+
end
|
35
|
+
|
36
|
+
#return table
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
#Add an organization
|
41
|
+
#TO DO: Add optional *args full functionality
|
42
|
+
def self.addOrganization(name, *args)
|
43
|
+
args.each_with_index{ |arg, i| puts "#{i+1}. #{arg}" }
|
44
|
+
|
45
|
+
if (args.size > 1)
|
46
|
+
raise "Only takes one additional Params (<Organization Name>, <Owner ID>)"
|
47
|
+
end
|
48
|
+
|
49
|
+
@base = 'https://api.pipedrive.com/v1/organizations?api_token=' + @@key.to_s
|
50
|
+
|
51
|
+
|
52
|
+
RestClient.post @base.to_s, { "name" => name }.to_json, :content_type => :json, :accept => :json
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
module PipedrivePUT
|
2
|
+
class Search
|
3
|
+
|
4
|
+
include PipedrivePUT
|
5
|
+
|
6
|
+
|
7
|
+
def self.key
|
8
|
+
puts @@key
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
#Search Pipedrive
|
13
|
+
def self.search(term, *args)
|
14
|
+
@start = 0
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
if (args.size > 1)
|
19
|
+
|
20
|
+
raise "Please only specify one item type (deal, organization, person, product, file)"
|
21
|
+
return
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
if (args.size == 1)
|
26
|
+
#Search through specific Item
|
27
|
+
table = Array.new
|
28
|
+
@more_items = true
|
29
|
+
|
30
|
+
@item_type = args[0].downcase
|
31
|
+
|
32
|
+
while @more_items == true do
|
33
|
+
@base = 'https://api.pipedrive.com/v1/searchResults?term=' + term.to_s + '&item_type=' + @item_type.to_s + '&' + @start.to_s + '&limit=500&api_token=' + @@key.to_s
|
34
|
+
|
35
|
+
puts @base
|
36
|
+
|
37
|
+
@content = open(@base.to_s).read
|
38
|
+
|
39
|
+
puts @content
|
40
|
+
|
41
|
+
@parsed = JSON.parse(@content)
|
42
|
+
@data = @parsed["data"]
|
43
|
+
|
44
|
+
table.push(@data)
|
45
|
+
|
46
|
+
@pagination = @parsed['additional_data']['pagination']
|
47
|
+
@more_items = @pagination['more_items_in_collection']
|
48
|
+
#puts @more_items
|
49
|
+
@start = @pagination['next_start']
|
50
|
+
#puts @start
|
51
|
+
end
|
52
|
+
|
53
|
+
else
|
54
|
+
|
55
|
+
#Search through every item type
|
56
|
+
table = Array.new
|
57
|
+
@more_items = true
|
58
|
+
|
59
|
+
while @more_items == true do
|
60
|
+
@base = 'https://api.pipedrive.com/v1/searchResults?term=' + term.to_s + '&' + @start.to_s + '&limit=500&api_token=' + @@key.to_s
|
61
|
+
|
62
|
+
puts @base
|
63
|
+
|
64
|
+
@content = open(@base.to_s).read
|
65
|
+
|
66
|
+
puts @content
|
67
|
+
|
68
|
+
@parsed = JSON.parse(@content)
|
69
|
+
@data = @parsed["data"]
|
70
|
+
|
71
|
+
table.push(@data)
|
72
|
+
|
73
|
+
@pagination = @parsed['additional_data']['pagination']
|
74
|
+
@more_items = @pagination['more_items_in_collection']
|
75
|
+
#puts @more_items
|
76
|
+
@start = @pagination['next_start']
|
77
|
+
#puts @start
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
end
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module PipedrivePUT
|
2
|
+
class Users
|
3
|
+
include PipedrivePUT
|
4
|
+
|
5
|
+
#Get All Users for organization.
|
6
|
+
#Might have to loop through such as uptop if have more than what comes in.
|
7
|
+
def self.getAllUsers
|
8
|
+
@base = 'https://api.pipedrive.com/v1/users?api_token=' + @@key.to_s
|
9
|
+
|
10
|
+
@content = open(@base.to_s).read
|
11
|
+
@parsed = JSON.parse(@content)
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: PipedrivePUT
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jacob Shay
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-05-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.2'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rest-client
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: em-resolv-replace
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: eventmachine
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: Pipedrive gem that i needed
|
98
|
+
email:
|
99
|
+
- jake_ps@comcast.net
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- Gemfile
|
105
|
+
- README.md
|
106
|
+
- Rakefile
|
107
|
+
- lib/PipedrivePUT.rb
|
108
|
+
- lib/PipedrivePUT/deal.rb
|
109
|
+
- lib/PipedrivePUT/organization.rb
|
110
|
+
- lib/PipedrivePUT/search.rb
|
111
|
+
- lib/PipedrivePUT/users.rb
|
112
|
+
- lib/PipedrivePUT/version.rb
|
113
|
+
homepage: ''
|
114
|
+
licenses:
|
115
|
+
- MIT
|
116
|
+
metadata: {}
|
117
|
+
post_install_message:
|
118
|
+
rdoc_options: []
|
119
|
+
require_paths:
|
120
|
+
- lib
|
121
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
requirements: []
|
132
|
+
rubyforge_project:
|
133
|
+
rubygems_version: 2.4.5
|
134
|
+
signing_key:
|
135
|
+
specification_version: 4
|
136
|
+
summary: Pipedrive gem that i needed
|
137
|
+
test_files: []
|