pipedrive_api_rb 1.0.0 → 1.0.1
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 +4 -4
- data/lib/pipedrive/person.rb +3 -3
- data/lib/pipedrive/version.rb +1 -1
- data/lib/pipedrive_api_rb.rb +3 -0
- data/spec/lib/pipedrive/person_spec.rb +8 -7
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d311e681e15f101bfcf2436056a92fadbf482926e9333e63510a16d45158a296
|
4
|
+
data.tar.gz: 2e6219fdbd535019c12484e3a78fba94f059b3581c74dbbfc69822c98e9111b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 199213167d3841be6893f18a90477831ddb0c8112ed5aa35bd570810e9a4b1f2ab4ce20ffe5c5a83ba83e0f281f29ca5ddf4700da08e47e51a1f41bad7984bd1
|
7
|
+
data.tar.gz: 3a78a00d1ce07d8c4d7f66aa9d075935cc69f8c78972b00583ea7d26f52c02c434fbd8a238dfb8246ff705e5c61ea597e8cd733092bf13a6368b2c28dce91a12
|
data/lib/pipedrive/person.rb
CHANGED
@@ -8,15 +8,15 @@ module Pipedrive
|
|
8
8
|
include ::Pipedrive::Operations::Delete
|
9
9
|
include ::Pipedrive::Utils
|
10
10
|
|
11
|
-
def
|
11
|
+
def search(*args, &block)
|
12
12
|
params = args.extract_options!
|
13
13
|
params[:term] ||= args[0]
|
14
14
|
raise 'term is missing' unless params[:term]
|
15
15
|
|
16
|
-
params[:
|
16
|
+
params[:fields] ||= args[1]
|
17
17
|
return to_enum(:find_by_name, params) unless block_given?
|
18
18
|
|
19
|
-
follow_pagination(:make_api_call, [:get, '
|
19
|
+
follow_pagination(:make_api_call, [:get, 'search'], params, &block)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
data/lib/pipedrive/version.rb
CHANGED
@@ -11,20 +11,21 @@ RSpec.describe ::Pipedrive::Person do
|
|
11
11
|
it { is_expected.to eq('persons') }
|
12
12
|
end
|
13
13
|
|
14
|
-
describe '#
|
14
|
+
describe '#search' do
|
15
15
|
it 'calls #make_api_call with term' do
|
16
|
-
expect(subject).to receive(:make_api_call).with(:get, '
|
17
|
-
expect { |b| subject.
|
16
|
+
expect(subject).to receive(:make_api_call).with(:get, 'search', { term: 'term', fields: nil})
|
17
|
+
expect { |b| subject.search('term', &b) }.to yield_successive_args
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'calls #make_api_call with term and search_by_email' do
|
21
|
-
expect(subject).to receive(:make_api_call).with(:get, '
|
22
|
-
expect { |b| subject.
|
21
|
+
expect(subject).to receive(:make_api_call).with(:get, 'search', { term: 'term', fields: "email" })
|
22
|
+
expect { |b| subject.search('term', "email", &b) }.to yield_successive_args
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'yields results' do
|
26
|
-
expect(subject).to receive(:make_api_call).with(:get, '
|
27
|
-
|
26
|
+
expect(subject).to receive(:make_api_call).with(:get, 'search', { term: 'term', fields: nil, start: 0 }).
|
27
|
+
and_return(::Hashie::Mash.new(data: [1, 2], success: true))
|
28
|
+
expect { |b| subject.search('term', &b) }.to yield_successive_args(1, 2)
|
28
29
|
end
|
29
30
|
end
|
30
31
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pipedrive_api_rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Sterba
|
@@ -212,6 +212,7 @@ files:
|
|
212
212
|
- lib/pipedrive/user.rb
|
213
213
|
- lib/pipedrive/utils.rb
|
214
214
|
- lib/pipedrive/version.rb
|
215
|
+
- lib/pipedrive_api_rb.rb
|
215
216
|
- pipedrive.gemspec
|
216
217
|
- spec/lib/pipedrive/activity_spec.rb
|
217
218
|
- spec/lib/pipedrive/activity_type_spec.rb
|