PipedrivePUT 1.1.38 → 1.1.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 921eb1997ade18df04866320d10f74e47ae8829d
4
- data.tar.gz: 4c89ca09576821eb9692ca00ae24387cdf3adf35
3
+ metadata.gz: e9418a8856c3a5af86a78b306137c0d1ac0b9f2a
4
+ data.tar.gz: 836c0a4809088b6758c0e3feb6f5016417b10404
5
5
  SHA512:
6
- metadata.gz: 6f0532e5a413f03714506cf22d9e7cf591bf327cdae9afe21f68011351586a0eb5d4928c9206e16e8aee626e78486f3c93f01618befe4acb1b7c09e8a471e78e
7
- data.tar.gz: fcfe2445213312b37c9c4636c56f00008a32ffa4a33cf722749513fb2f2f6b5245bf82f5c67b60f05dbdd506b7c3ab58251b9decead801fbe137991d2deda578
6
+ metadata.gz: 9ae51e95ea461417c191f089d724d4342de5aeb4d6cef2c1480127e35f30884ca4ecd7f546722844b60e3c6c6e32b66c7c39b7f32e22714dd7312adfa986047e
7
+ data.tar.gz: e44b7d8a594017fc5c1bb777364062b0d30e17e37cad8f0b9973d86d9caae28c7c2c50847eaac45cf5d21d1cdcc8dcff3274c65ce9904b87deca7895dc21d6d7
@@ -1,48 +1,100 @@
1
1
  module PipedrivePUT
2
2
  class Deal
3
- include PipedrivePUT
4
3
 
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
4
+ include PipedrivePUT
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
+ def self.getAllDeals
14
+ @start = 0
15
+
16
+ table = Array.new
17
+ @more_items = true
18
+ tablesize = 0
19
+ while @more_items == true do
20
+ count = 0
21
+ @base = 'https://api.pipedrive.com/v1/deals?start=' + @start.to_s + '&limit=500&api_token=' + @@key.to_s
8
22
  @content = open(@base.to_s).read
9
23
  @parsed = JSON.parse(@content)
10
- return @parsed
11
- end
12
-
13
-
14
- def self.getAllDeals
15
-
16
- @start = 0
17
-
18
- table = Array.new
19
- @more_items = true
20
- tablesize = 0
21
- while @more_items == true do
22
- count = 0
23
- #puts @more_items
24
- @base = 'https://api.pipedrive.com/v1/deals?start=' + @start.to_s + '&limit=500&api_token=' + @@key.to_s
25
- #puts @base
26
- @content = open(@base.to_s).read
27
- @parsed = JSON.parse(@content)
28
-
29
- while count < @parsed["data"].size
30
- #table.push(@parsed["data"][count])
31
- table[tablesize] = @parsed["data"][count]
32
- count = count +1
33
- tablesize = tablesize + 1
34
- end
35
-
36
- @pagination = @parsed['additional_data']['pagination']
37
- @more_items = @pagination['more_items_in_collection']
38
- #puts @more_items
39
- @start = @pagination['next_start']
40
- #puts @start
41
- end
42
-
43
- return table
44
- end
45
-
46
- end
47
24
 
25
+ while count < @parsed["data"].size
26
+ table[tablesize] = @parsed["data"][count]
27
+ count = count +1
28
+ tablesi ze = tablesize + 1
29
+ end
30
+
31
+ @pagination = @parsed['additional_data']['pagination']
32
+ @more_items = @pagination['more_items_in_collection']
33
+ @start = @pagination['next_start']
34
+ end
35
+ return table
36
+ end
37
+
38
+ # Search deal by name
39
+ # term - Search term to look for
40
+ # optional parameters:
41
+ # person_id - ID of the person the deal is associated with.
42
+ # org_id - ID of the organization the deal is associated with.
43
+ # start - Pagination start
44
+ # limit - Items shown per page
45
+ def self.searchForDeal(term, options = {})
46
+ table = []
47
+ more_items = true
48
+
49
+ tablesize = 0
50
+ params = {}
51
+
52
+ # optional search parameters
53
+ params[:term] = term if term && !term.empty?
54
+ params[:start] = options.fetch(:start, 0)
55
+ params[:person_id] = options.fetch(:person_id, nil) if params[:person_id]
56
+ params[:org_id] = options.fetch(:org_id, nil) if params[:org_id]
57
+ params[:limit] = options.fetch(:limit, 500)
58
+ params[:api_token] = @@key.to_s
59
+
60
+ url = "https://api.pipedrive.com/v1/deals/find?#{URI.encode_www_form(params)}"
61
+
62
+ while more_items == true
63
+ count = 0
64
+
65
+ parsed = HTTParty.get(url)
66
+ return table if parsed['data'].nil?
67
+
68
+ while count < parsed['data'].size
69
+ table[tablesize] = parsed['data'][count]
70
+ count += 1
71
+ tablesize += 1
72
+ end
73
+ pagination = parsed['additional_data']['pagination']
74
+ more_items = pagination['more_items_in_collection']
75
+ params[:start] = pagination['next_start']
76
+ end
77
+ table
78
+ end
79
+
80
+ # id (required) - ID of the deal
81
+ # title - Deal title
82
+ # value - Value of the deal
83
+ # currency - Currency of the deal. Accepts a 3-character currency code
84
+ # user_id - ID of the user who will be marked as the owner of this deal
85
+ # person_id - ID of the person this deal will be associated with
86
+ # org_id - ID of the organization this deal will be associated with
87
+ # stage_id - ID of the stage this deal will be placed in a pipeline (note that you can't supply the ID of the pipeline as this will be assigned automatically based on stage_id)
88
+ # status - open = Open, won = Won, lost = Lost, deleted = Deleted
89
+ # lost_reason - Optional message about why the deal was lost (to be used when status=lost)
90
+ def self.updateDeal(id, options = {})
91
+ url = "https://api.pipedrive.com/v1/deals/#{id}"
92
+
93
+ response = HTTParty.put(
94
+ url,
95
+ body: options.to_json,
96
+ headers: { 'Content-type' => 'application/json' }
97
+ )
98
+ end
99
+ end
48
100
  end
@@ -12,14 +12,11 @@ module PipedrivePUT
12
12
  tablesize = 0
13
13
  while @more_items == true do
14
14
  count = 0
15
- #puts @more_items
16
15
  @base = 'https://api.pipedrive.com/v1/persons?start=' + @start.to_s + '&limit=500&api_token=' + @@key.to_s
17
- #puts @base
18
16
  @content = open(@base.to_s).read
19
17
  @parsed = JSON.parse(@content)
20
18
 
21
19
  while count < @parsed["data"].size
22
- #table.push(@parsed["data"][count])
23
20
  table[tablesize] = @parsed["data"][count]
24
21
  count = count +1
25
22
  tablesize = tablesize + 1
@@ -27,46 +24,46 @@ module PipedrivePUT
27
24
 
28
25
  @pagination = @parsed['additional_data']['pagination']
29
26
  @more_items = @pagination['more_items_in_collection']
30
- #puts @more_items
31
27
  @start = @pagination['next_start']
32
- #puts @start
33
- end
28
+ end
34
29
 
35
30
  return table
36
31
  end
37
32
 
38
33
  #Gets details of a signle person with id being passed in at params.
39
34
  def self.detailsOfPerson(id)
40
- @base = 'https://api.pipedrive.com/v1/persons/' + id.to_s + '?start=' + @start.to_s + '&limit=500&api_token=' + @@key.to_s
41
- @content = open(@base.to_s).read
42
- @parsed = JSON.parse(@content)
35
+ url = "https://api.pipedrive.com/v1/persons/#{id}&api_token=#{@@key.to_s}"
36
+ content = open(url).read
37
+ JSON.parse(content)
43
38
  end
44
39
 
45
40
  #Add an Person
46
41
  def self.addPerson(name, options = {})
47
- @url = 'https://api.pipedrive.com/v1/persons?api_token=' + @@key.to_s
42
+ url = "https://api.pipedrive.com/v1/persons?api_token=#{@@key.to_s}"
48
43
 
49
- if (!options.nil?)
50
- options.merge!(:name => name)
51
- response = HTTParty.post(@url.to_s, :body => options.to_json, :headers => {'Content-type' => 'application/json'})
52
- end
44
+ HTTParty.post(
45
+ url,
46
+ body: options.merge(name: name).to_json,
47
+ headers: {'Content-type' => 'application/json'}
48
+ )
53
49
  end
54
50
 
55
51
  #Delete a person from Pipedrive
56
52
  def self.deletePerson(id)
57
- @url = 'https://api.pipedrive.com/v1/persons/' + id.to_s + '?api_token=' + @@key.to_s
58
- response = HTTParty.delete(@url.to_s)
53
+ url = "https://api.pipedrive.com/v1/persons/id?api_token=#{@@key}"
54
+ HTTParty.delete(url)
59
55
  end
60
56
 
61
57
 
62
58
  #Update a Person
63
59
  def self.updatePerson(id, options = {})
64
- @url = 'https://api.pipedrive.com/v1/persons/' + id.to_s + '?api_token=' + @@key.to_s
60
+ url = "https://api.pipedrive.com/v1/persons/id?api_token=#{@@key}"
65
61
 
66
- if (!options.nil?)
67
- options.merge!(:id => id)
68
- response = HTTParty.put(@url.to_s, :body => options.to_json, :headers => {'Content-type' => 'application/json'})
69
- end
62
+ HTTParty.put(
63
+ url,
64
+ body: options.merge(id: id).to_json,
65
+ headers: {'Content-type' => 'application/json'}
66
+ )
70
67
  end
71
68
 
72
69
  # Search person by name
@@ -1,3 +1,3 @@
1
1
  module PipedrivePUT
2
- VERSION = "1.1.38"
2
+ VERSION = "1.1.39"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: PipedrivePUT
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.38
4
+ version: 1.1.39
5
5
  platform: ruby
6
6
  authors:
7
7
  - JakePens71
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-05-26 00:00:00.000000000 Z
12
+ date: 2016-07-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -54,47 +54,47 @@ dependencies:
54
54
  - !ruby/object:Gem::Version
55
55
  version: '3.2'
56
56
  - !ruby/object:Gem::Dependency
57
- name: rest-client
57
+ name: em-resolv-replace
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - ">="
61
61
  - !ruby/object:Gem::Version
62
- version: 1.8.0
62
+ version: 1.1.3
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
- version: 1.8.0
69
+ version: 1.1.3
70
70
  - !ruby/object:Gem::Dependency
71
- name: em-resolv-replace
71
+ name: eventmachine
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - ">="
75
75
  - !ruby/object:Gem::Version
76
- version: 1.1.3
76
+ version: 1.0.7
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - ">="
82
82
  - !ruby/object:Gem::Version
83
- version: 1.1.3
83
+ version: 1.0.7
84
84
  - !ruby/object:Gem::Dependency
85
- name: eventmachine
85
+ name: i18n
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - ">="
89
89
  - !ruby/object:Gem::Version
90
- version: 1.0.7
90
+ version: 0.7.0
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - ">="
96
96
  - !ruby/object:Gem::Version
97
- version: 1.0.7
97
+ version: 0.7.0
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: money
100
100
  requirement: !ruby/object:Gem::Requirement
@@ -102,7 +102,7 @@ dependencies:
102
102
  - - ">="
103
103
  - !ruby/object:Gem::Version
104
104
  version: 6.7.1
105
- type: :development
105
+ type: :runtime
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
@@ -116,7 +116,7 @@ dependencies:
116
116
  - - ">="
117
117
  - !ruby/object:Gem::Version
118
118
  version: 3.2.0
119
- type: :development
119
+ type: :runtime
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
@@ -124,19 +124,33 @@ dependencies:
124
124
  - !ruby/object:Gem::Version
125
125
  version: 3.2.0
126
126
  - !ruby/object:Gem::Dependency
127
- name: i18n
127
+ name: mime-types
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  requirements:
130
- - - ">="
130
+ - - '='
131
131
  - !ruby/object:Gem::Version
132
- version: 0.7.0
133
- type: :development
132
+ version: 2.6.2
133
+ type: :runtime
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
137
- - - ">="
137
+ - - '='
138
138
  - !ruby/object:Gem::Version
139
- version: 0.7.0
139
+ version: 2.6.2
140
+ - !ruby/object:Gem::Dependency
141
+ name: rest-client
142
+ requirement: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - '='
145
+ - !ruby/object:Gem::Version
146
+ version: 1.8.0
147
+ type: :runtime
148
+ prerelease: false
149
+ version_requirements: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - '='
152
+ - !ruby/object:Gem::Version
153
+ version: 1.8.0
140
154
  description: Pipedrive gem support for activites, activity-types, deals, deal fields,organizations,
141
155
  organization fields, persons, pipelines, recents, search, users, and a bonus addition
142
156
  a currency exchange calculator.