pipedrive_api_rb 1.0.2 → 1.0.5
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/.rubocop.yml +4 -0
- data/Gemfile +8 -0
- data/lib/pipedrive/operations/read.rb +2 -2
- data/lib/pipedrive/organization.rb +4 -3
- data/lib/pipedrive/person.rb +2 -1
- data/lib/pipedrive/version.rb +1 -1
- data/lib/pipedrive.rb +2 -1
- data/pipedrive.gemspec +1 -8
- data/spec/lib/pipedrive/activity_spec.rb +1 -1
- data/spec/lib/pipedrive/activity_type_spec.rb +1 -1
- data/spec/lib/pipedrive/base_spec.rb +30 -30
- data/spec/lib/pipedrive/deal_field_spec.rb +1 -1
- data/spec/lib/pipedrive/deal_spec.rb +1 -1
- data/spec/lib/pipedrive/file_spec.rb +1 -1
- data/spec/lib/pipedrive/filter_spec.rb +1 -1
- data/spec/lib/pipedrive/goal_spec.rb +1 -1
- data/spec/lib/pipedrive/lead_label_spec.rb +4 -2
- data/spec/lib/pipedrive/lead_spec.rb +4 -2
- data/spec/lib/pipedrive/note_spec.rb +1 -1
- data/spec/lib/pipedrive/operations/create_spec.rb +4 -4
- data/spec/lib/pipedrive/operations/delete_spec.rb +5 -5
- data/spec/lib/pipedrive/operations/read_spec.rb +15 -15
- data/spec/lib/pipedrive/operations/update_spec.rb +5 -5
- data/spec/lib/pipedrive/organization_field_spec.rb +1 -1
- data/spec/lib/pipedrive/{ogranization_spec.rb → organization_spec.rb} +1 -1
- data/spec/lib/pipedrive/person_field_spec.rb +1 -1
- data/spec/lib/pipedrive/person_spec.rb +6 -6
- data/spec/lib/pipedrive/product_field_spec.rb +1 -1
- data/spec/lib/pipedrive/product_spec.rb +1 -1
- data/spec/lib/pipedrive_spec.rb +4 -4
- metadata +6 -126
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f63dd4128df57e96da7b36e726860a8cc18c7dc0f67b1708db603df53a6a384b
|
4
|
+
data.tar.gz: 3a1b0dd17a9b38fd2a40a357ed0fc2f370530e269d089a4f0972bcc74b453e87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba4868af19ca27937e82c57d6a49416087dc9d5700a6d8a4c6bfd62621e7cedcb33315c4c66b8c86e29b85b5f68a3171bff664a92bb691be15315d4ae9004c9c
|
7
|
+
data.tar.gz: 31c0608214ca10457af5be4cd9e5b32f8d2679269cc46d24efc4c5a9d197a87927c32c203449d64b15c7cf092b9d6a6eb90142db29586d6cc35a0ad2cd0562f0
|
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
@@ -8,7 +8,7 @@ module Pipedrive
|
|
8
8
|
include ::Pipedrive::Utils
|
9
9
|
|
10
10
|
def each(params = {}, &block)
|
11
|
-
return to_enum(:each, params) unless
|
11
|
+
return to_enum(:each, params) unless block
|
12
12
|
|
13
13
|
follow_pagination(:chunk, [], params, &block)
|
14
14
|
end
|
@@ -24,7 +24,7 @@ module Pipedrive
|
|
24
24
|
res
|
25
25
|
end
|
26
26
|
|
27
|
-
def
|
27
|
+
def find(id)
|
28
28
|
make_api_call(:get, id)
|
29
29
|
end
|
30
30
|
end
|
@@ -8,13 +8,14 @@ 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
|
-
return to_enum(:find_by_name, params) unless block_given?
|
16
15
|
|
17
|
-
|
16
|
+
return to_enum(:search, params) unless block
|
17
|
+
|
18
|
+
follow_pagination(:make_api_call, [:get, 'search'], params, &block)
|
18
19
|
end
|
19
20
|
end
|
20
21
|
end
|
data/lib/pipedrive/person.rb
CHANGED
@@ -14,7 +14,8 @@ module Pipedrive
|
|
14
14
|
raise 'term is missing' unless params[:term]
|
15
15
|
|
16
16
|
params[:fields] ||= args[1]
|
17
|
-
|
17
|
+
params.delete :fields if params[:fields].blank?
|
18
|
+
return to_enum(:search, params) unless block
|
18
19
|
|
19
20
|
follow_pagination(:make_api_call, [:get, 'search'], params, &block)
|
20
21
|
end
|
data/lib/pipedrive/version.rb
CHANGED
data/lib/pipedrive.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'logger'
|
4
4
|
require 'active_support/core_ext/hash'
|
5
|
+
require 'active_support/core_ext/array'
|
5
6
|
require 'active_support/concern'
|
6
7
|
require 'active_support/inflector'
|
7
8
|
|
@@ -41,7 +42,7 @@ module Pipedrive
|
|
41
42
|
reset!
|
42
43
|
end
|
43
44
|
|
44
|
-
require 'pipedrive/railties' if defined?(
|
45
|
+
require 'pipedrive/railties' if defined?(Rails)
|
45
46
|
|
46
47
|
# Core
|
47
48
|
require 'pipedrive/base'
|
data/pipedrive.gemspec
CHANGED
@@ -16,7 +16,6 @@ Gem::Specification.new do |gem|
|
|
16
16
|
|
17
17
|
gem.files = `git ls-files -z`.split("\x0")
|
18
18
|
gem.executables = gem.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
20
19
|
gem.require_paths = ['lib']
|
21
20
|
gem.required_ruby_version = '>=2.5'
|
22
21
|
|
@@ -24,11 +23,5 @@ Gem::Specification.new do |gem|
|
|
24
23
|
gem.add_dependency('faraday')
|
25
24
|
gem.add_dependency('faraday-mashify')
|
26
25
|
gem.add_dependency('hashie', '>= 3.0')
|
27
|
-
gem.
|
28
|
-
gem.add_development_dependency('rake', '> 12')
|
29
|
-
gem.add_development_dependency('rspec', '>= 3.0')
|
30
|
-
gem.add_development_dependency('rubocop')
|
31
|
-
gem.add_development_dependency('rubocop-performance')
|
32
|
-
gem.add_development_dependency('rubocop-rspec')
|
33
|
-
gem.add_development_dependency('webmock')
|
26
|
+
gem.metadata['rubygems_mfa_required'] = 'true'
|
34
27
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
RSpec.describe
|
5
|
+
RSpec.describe Pipedrive::Base do
|
6
6
|
subject { described_class.new('token') }
|
7
7
|
|
8
8
|
describe '#entity_name' do
|
@@ -16,32 +16,32 @@ RSpec.describe ::Pipedrive::Base do
|
|
16
16
|
|
17
17
|
it {
|
18
18
|
expect(subject).to eq({
|
19
|
-
|
20
|
-
headers: { accept: 'application/json', content_type:
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
url: 'https://api.pipedrive.com',
|
20
|
+
headers: { accept: 'application/json', content_type: 'application/json', user_agent: "Pipedrive Ruby Client v#{Pipedrive::VERSION}" }
|
21
|
+
})
|
22
|
+
}
|
23
|
+
end
|
24
24
|
|
25
25
|
context '::connection' do
|
26
26
|
subject { super().connection }
|
27
27
|
|
28
|
-
it { is_expected.to
|
28
|
+
it { is_expected.to be_a(Faraday::Connection) }
|
29
29
|
end
|
30
30
|
|
31
31
|
describe '#failed_response' do
|
32
32
|
subject { super().failed_response(res) }
|
33
33
|
|
34
|
-
let(:res) { double('res', body:
|
34
|
+
let(:res) { double('res', body: Hashie::Mash.new({}), status: status) }
|
35
35
|
|
36
36
|
context 'status is 401' do
|
37
37
|
let(:status) { 401 }
|
38
38
|
|
39
39
|
it {
|
40
|
-
expect(subject).to eq(
|
41
|
-
|
40
|
+
expect(subject).to eq(Hashie::Mash.new({
|
41
|
+
failed: false,
|
42
42
|
not_authorized: true,
|
43
43
|
success: false
|
44
|
-
|
44
|
+
}))
|
45
45
|
}
|
46
46
|
end
|
47
47
|
|
@@ -49,11 +49,11 @@ RSpec.describe ::Pipedrive::Base do
|
|
49
49
|
let(:status) { 420 }
|
50
50
|
|
51
51
|
it {
|
52
|
-
expect(subject).to eq(
|
53
|
-
|
52
|
+
expect(subject).to eq(Hashie::Mash.new({
|
53
|
+
failed: true,
|
54
54
|
not_authorized: false,
|
55
55
|
success: false
|
56
|
-
|
56
|
+
}))
|
57
57
|
}
|
58
58
|
end
|
59
59
|
|
@@ -61,11 +61,11 @@ RSpec.describe ::Pipedrive::Base do
|
|
61
61
|
let(:status) { 400 }
|
62
62
|
|
63
63
|
it {
|
64
|
-
expect(subject).to eq(
|
65
|
-
|
64
|
+
expect(subject).to eq(Hashie::Mash.new({
|
65
|
+
failed: false,
|
66
66
|
not_authorized: false,
|
67
67
|
success: false
|
68
|
-
|
68
|
+
}))
|
69
69
|
}
|
70
70
|
end
|
71
71
|
end
|
@@ -78,32 +78,32 @@ RSpec.describe ::Pipedrive::Base do
|
|
78
78
|
context 'without id' do
|
79
79
|
it 'calls :get' do
|
80
80
|
stub_request(:get, 'https://api.pipedrive.com/v1/bases?api_token=token').to_return(status: 200, body: {}.to_json, headers: {})
|
81
|
-
expect_any_instance_of(
|
81
|
+
expect_any_instance_of(Faraday::Connection).to have_received(:get).with('/v1/bases?api_token=token', {}).and_call_original
|
82
82
|
expect(subject.make_api_call(:get))
|
83
83
|
end
|
84
84
|
|
85
85
|
it 'calls :post' do
|
86
86
|
stub_request(:post, 'https://api.pipedrive.com/v1/bases?api_token=token').to_return(status: 200, body: {}.to_json, headers: {})
|
87
|
-
expect_any_instance_of(
|
87
|
+
expect_any_instance_of(Faraday::Connection).to have_received(:post).with('/v1/bases?api_token=token', { test: 'bar' }.to_json).and_call_original
|
88
88
|
expect(subject.make_api_call(:post, test: 'bar'))
|
89
89
|
end
|
90
90
|
|
91
91
|
it 'calls :put' do
|
92
92
|
stub_request(:put, 'https://api.pipedrive.com/v1/bases?api_token=token').to_return(status: 200, body: {}.to_json, headers: {})
|
93
|
-
expect_any_instance_of(
|
93
|
+
expect_any_instance_of(Faraday::Connection).to have_received(:put).with('/v1/bases?api_token=token', { test: 'bar' }.to_json).and_call_original
|
94
94
|
expect(subject.make_api_call(:put, test: 'bar'))
|
95
95
|
end
|
96
96
|
|
97
97
|
it 'uses field_selector properly' do
|
98
98
|
stub_request(:get, 'https://api.pipedrive.com/v1/bases:(a,b,c)?api_token=token').to_return(status: 200, body: {}.to_json, headers: {})
|
99
|
-
expect_any_instance_of(
|
99
|
+
expect_any_instance_of(Faraday::Connection).to have_received(:get)
|
100
100
|
.with('/v1/bases:(a,b,c)?api_token=token', {}).and_call_original
|
101
101
|
expect(subject.make_api_call(:get, fields_to_select: %w[a b c]))
|
102
102
|
end
|
103
103
|
|
104
104
|
it 'does not use field_selector if it empty' do
|
105
105
|
stub_request(:get, 'https://api.pipedrive.com/v1/bases?api_token=token').to_return(status: 200, body: {}.to_json, headers: {})
|
106
|
-
expect_any_instance_of(
|
106
|
+
expect_any_instance_of(Faraday::Connection).to have_received(:get)
|
107
107
|
.with('/v1/bases?api_token=token', {}).and_call_original
|
108
108
|
expect(subject.make_api_call(:get, fields_to_select: []))
|
109
109
|
end
|
@@ -111,10 +111,10 @@ RSpec.describe ::Pipedrive::Base do
|
|
111
111
|
it 'retries if Errno::ETIMEDOUT' do
|
112
112
|
stub_request(:get, 'https://api.pipedrive.com/v1/bases?api_token=token').to_return(status: 200, body: {}.to_json, headers: {})
|
113
113
|
connection = subject.connection
|
114
|
-
allow(subject).to
|
115
|
-
allow(connection).to
|
114
|
+
allow(subject).to have_received(:connection).and_return(connection)
|
115
|
+
allow(connection).to have_received(:get)
|
116
116
|
.with('/v1/bases?api_token=token', {}).and_raise(Errno::ETIMEDOUT)
|
117
|
-
expect(connection).to
|
117
|
+
expect(connection).to have_received(:get)
|
118
118
|
.with('/v1/bases?api_token=token', {}).and_call_original
|
119
119
|
expect(subject.make_api_call(:get, fields_to_select: []))
|
120
120
|
end
|
@@ -123,32 +123,32 @@ RSpec.describe ::Pipedrive::Base do
|
|
123
123
|
context 'with id' do
|
124
124
|
it 'calls :get' do
|
125
125
|
stub_request(:get, 'https://api.pipedrive.com/v1/bases/12?api_token=token').to_return(status: 200, body: {}.to_json, headers: {})
|
126
|
-
expect_any_instance_of(
|
126
|
+
expect_any_instance_of(Faraday::Connection).to have_received(:get).with('/v1/bases/12?api_token=token', {}).and_call_original
|
127
127
|
expect(subject.make_api_call(:get, 12))
|
128
128
|
end
|
129
129
|
|
130
130
|
it 'calls :post' do
|
131
131
|
stub_request(:post, 'https://api.pipedrive.com/v1/bases/13?api_token=token').to_return(status: 200, body: {}.to_json, headers: {})
|
132
|
-
expect_any_instance_of(
|
132
|
+
expect_any_instance_of(Faraday::Connection).to have_received(:post).with('/v1/bases/13?api_token=token', { test: 'bar' }.to_json).and_call_original
|
133
133
|
expect(subject.make_api_call(:post, 13, test: 'bar'))
|
134
134
|
end
|
135
135
|
|
136
136
|
it 'calls :put' do
|
137
137
|
stub_request(:put, 'https://api.pipedrive.com/v1/bases/14?api_token=token').to_return(status: 200, body: {}.to_json, headers: {})
|
138
|
-
expect_any_instance_of(
|
138
|
+
expect_any_instance_of(Faraday::Connection).to have_received(:put).with('/v1/bases/14?api_token=token', { test: 'bar' }.to_json).and_call_original
|
139
139
|
expect(subject.make_api_call(:put, 14, test: 'bar'))
|
140
140
|
end
|
141
141
|
end
|
142
142
|
|
143
143
|
it 'calls Hashie::Mash if return empty string' do
|
144
144
|
stub_request(:get, 'https://api.pipedrive.com/v1/bases?api_token=token').to_return(status: 200, body: '', headers: {})
|
145
|
-
expect(
|
145
|
+
expect(Hashie::Mash).to have_received(:new).with(success: true).and_call_original
|
146
146
|
expect(subject.make_api_call(:get))
|
147
147
|
end
|
148
148
|
|
149
149
|
it 'calls #failed_response if failed status' do
|
150
150
|
stub_request(:get, 'https://api.pipedrive.com/v1/bases?api_token=token').to_return(status: 400, body: '', headers: {})
|
151
|
-
expect(subject).to
|
151
|
+
expect(subject).to have_received(:failed_response)
|
152
152
|
expect(subject.make_api_call(:get))
|
153
153
|
end
|
154
154
|
end
|
@@ -1,9 +1,11 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
RSpec.describe
|
3
|
+
RSpec.describe Pipedrive::LeadLabel do
|
4
4
|
subject { described_class.new('token') }
|
5
|
-
|
5
|
+
|
6
|
+
describe '#entity_name' do
|
6
7
|
subject { super().entity_name }
|
8
|
+
|
7
9
|
it { is_expected.to eq('leadLabels') }
|
8
10
|
end
|
9
11
|
end
|
@@ -1,9 +1,11 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
RSpec.describe
|
3
|
+
RSpec.describe Pipedrive::Lead do
|
4
4
|
subject { described_class.new('token') }
|
5
|
-
|
5
|
+
|
6
|
+
describe '#entity_name' do
|
6
7
|
subject { super().entity_name }
|
8
|
+
|
7
9
|
it { is_expected.to eq('leads') }
|
8
10
|
end
|
9
11
|
end
|
@@ -2,16 +2,16 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
RSpec.describe
|
5
|
+
RSpec.describe Pipedrive::Operations::Create do
|
6
6
|
subject do
|
7
|
-
Class.new(
|
8
|
-
include
|
7
|
+
Class.new(Pipedrive::Base) do
|
8
|
+
include Pipedrive::Operations::Create
|
9
9
|
end.new('token')
|
10
10
|
end
|
11
11
|
|
12
12
|
describe '#create' do
|
13
13
|
it 'calls #make_api_call' do
|
14
|
-
expect(subject).to
|
14
|
+
expect(subject).to have_received(:make_api_call).with(:post, { foo: 'bar' })
|
15
15
|
subject.create(foo: 'bar')
|
16
16
|
end
|
17
17
|
end
|
@@ -2,23 +2,23 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
RSpec.describe
|
5
|
+
RSpec.describe Pipedrive::Operations::Delete do
|
6
6
|
subject do
|
7
|
-
Class.new(
|
8
|
-
include
|
7
|
+
Class.new(Pipedrive::Base) do
|
8
|
+
include Pipedrive::Operations::Delete
|
9
9
|
end.new('token')
|
10
10
|
end
|
11
11
|
|
12
12
|
describe '#delete' do
|
13
13
|
it 'calls #make_api_call' do
|
14
|
-
expect(subject).to
|
14
|
+
expect(subject).to have_received(:make_api_call).with(:delete, 12)
|
15
15
|
subject.delete(12)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
19
|
describe '#delete_all' do
|
20
20
|
it 'calls #make_api_call' do
|
21
|
-
expect(subject).to
|
21
|
+
expect(subject).to have_received(:make_api_call).with(:delete)
|
22
22
|
subject.delete_all
|
23
23
|
end
|
24
24
|
end
|
@@ -2,16 +2,16 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
RSpec.describe
|
5
|
+
RSpec.describe Pipedrive::Operations::Read do
|
6
6
|
subject do
|
7
|
-
Class.new(
|
8
|
-
include
|
7
|
+
Class.new(Pipedrive::Base) do
|
8
|
+
include Pipedrive::Operations::Read
|
9
9
|
end.new('token')
|
10
10
|
end
|
11
11
|
|
12
12
|
describe '#find_by_id' do
|
13
13
|
it 'calls #make_api_call' do
|
14
|
-
expect(subject).to
|
14
|
+
expect(subject).to have_received(:make_api_call).with(:get, 12)
|
15
15
|
subject.find_by_id(12)
|
16
16
|
end
|
17
17
|
end
|
@@ -22,32 +22,32 @@ RSpec.describe ::Pipedrive::Operations::Read do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'returns Enumerator if no block given' do
|
25
|
-
expect(subject.each).to be_a(
|
25
|
+
expect(subject.each).to be_a(Enumerator)
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'calls to_enum with params' do
|
29
|
-
expect(subject).to
|
29
|
+
expect(subject).to have_received(:to_enum).with(:each, { foo: 'bar' })
|
30
30
|
subject.each(foo: 'bar')
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'yields data' do
|
34
|
-
expect(subject).to
|
34
|
+
expect(subject).to have_received(:chunk).and_return(Hashie::Mash.new(data: [1, 2], success: true))
|
35
35
|
expect { |b| subject.each(&b) }.to yield_successive_args(1, 2)
|
36
36
|
end
|
37
37
|
|
38
38
|
it 'follows pagination' do
|
39
|
-
expect(subject).to
|
40
|
-
expect(subject).to
|
39
|
+
expect(subject).to have_received(:chunk).with({ start: 0 }).and_return(Hashie::Mash.new(data: [1, 2], success: true, additional_data: additional_data))
|
40
|
+
expect(subject).to have_received(:chunk).with({ start: 10 }).and_return(Hashie::Mash.new(data: [3, 4], success: true))
|
41
41
|
expect { |b| subject.each(&b) }.to yield_successive_args(1, 2, 3, 4)
|
42
42
|
end
|
43
43
|
|
44
44
|
it 'does not yield anything if result is empty' do
|
45
|
-
expect(subject).to
|
45
|
+
expect(subject).to have_received(:chunk).with({ start: 0 }).and_return(Hashie::Mash.new(success: true))
|
46
46
|
expect { |b| subject.each(&b) }.to yield_successive_args
|
47
47
|
end
|
48
48
|
|
49
49
|
it 'does not yield anything if result is not success' do
|
50
|
-
expect(subject).to
|
50
|
+
expect(subject).to have_received(:chunk).with({ start: 0 }).and_return(Hashie::Mash.new(success: false))
|
51
51
|
expect { |b| subject.each(&b) }.to yield_successive_args
|
52
52
|
end
|
53
53
|
end
|
@@ -55,8 +55,8 @@ RSpec.describe ::Pipedrive::Operations::Read do
|
|
55
55
|
describe '#all' do
|
56
56
|
it 'calls #each' do
|
57
57
|
arr = double('enumerator')
|
58
|
-
allow(arr).to
|
59
|
-
expect(subject).to
|
58
|
+
allow(arr).to have_received(:to_a)
|
59
|
+
expect(subject).to have_received(:each).and_return(arr)
|
60
60
|
subject.all
|
61
61
|
end
|
62
62
|
end
|
@@ -64,13 +64,13 @@ RSpec.describe ::Pipedrive::Operations::Read do
|
|
64
64
|
describe '#chunk' do
|
65
65
|
it 'returns []' do
|
66
66
|
res = double('res', success?: false)
|
67
|
-
expect(subject).to
|
67
|
+
expect(subject).to have_received(:make_api_call).with(:get, {}).and_return(res)
|
68
68
|
expect(subject.chunk).to eq([])
|
69
69
|
end
|
70
70
|
|
71
71
|
it 'returns result' do
|
72
72
|
res = double('res', success?: true)
|
73
|
-
expect(subject).to
|
73
|
+
expect(subject).to have_received(:make_api_call).with(:get, {}).and_return(res)
|
74
74
|
expect(subject.chunk).to eq(res)
|
75
75
|
end
|
76
76
|
end
|
@@ -2,21 +2,21 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
RSpec.describe
|
5
|
+
RSpec.describe Pipedrive::Operations::Update do
|
6
6
|
subject do
|
7
|
-
Class.new(
|
8
|
-
include
|
7
|
+
Class.new(Pipedrive::Base) do
|
8
|
+
include Pipedrive::Operations::Update
|
9
9
|
end.new('token')
|
10
10
|
end
|
11
11
|
|
12
12
|
describe '#create' do
|
13
13
|
it 'calls #make_api_call' do
|
14
|
-
expect(subject).to
|
14
|
+
expect(subject).to have_received(:make_api_call).with(:put, 12, { foo: 'bar' })
|
15
15
|
subject.update(12, foo: 'bar')
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'calls #make_api_call with id in params' do
|
19
|
-
expect(subject).to
|
19
|
+
expect(subject).to have_received(:make_api_call).with(:put, 14, { foo: 'bar' })
|
20
20
|
subject.update(foo: 'bar', id: 14)
|
21
21
|
end
|
22
22
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
RSpec.describe
|
5
|
+
RSpec.describe Pipedrive::Person do
|
6
6
|
subject { described_class.new('token') }
|
7
7
|
|
8
8
|
describe '#entity_name' do
|
@@ -13,18 +13,18 @@ RSpec.describe ::Pipedrive::Person do
|
|
13
13
|
|
14
14
|
describe '#search' do
|
15
15
|
it 'calls #make_api_call with term' do
|
16
|
-
expect(subject).to
|
16
|
+
expect(subject).to have_received(:make_api_call).with(:get, 'search', { term: 'term', start: 0 })
|
17
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
|
22
|
-
expect { |b| subject.search('term',
|
21
|
+
expect(subject).to have_received(:make_api_call).with(:get, 'search', { term: 'term', fields: 'email', start: 0 })
|
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
|
27
|
-
|
26
|
+
expect(subject).to have_received(:make_api_call).with(:get, 'search', { term: 'term', start: 0 })
|
27
|
+
.and_return(Hashie::Mash.new(data: [1, 2], success: true))
|
28
28
|
expect { |b| subject.search('term', &b) }.to yield_successive_args(1, 2)
|
29
29
|
end
|
30
30
|
end
|
data/spec/lib/pipedrive_spec.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
RSpec.describe
|
5
|
+
RSpec.describe Pipedrive do
|
6
6
|
subject { described_class }
|
7
7
|
|
8
8
|
before do
|
@@ -13,7 +13,7 @@ RSpec.describe ::Pipedrive do
|
|
13
13
|
describe '#user_agent' do
|
14
14
|
subject { super().user_agent }
|
15
15
|
|
16
|
-
it { is_expected.to eq("Pipedrive Ruby Client v#{
|
16
|
+
it { is_expected.to eq("Pipedrive Ruby Client v#{Pipedrive::VERSION}") }
|
17
17
|
end
|
18
18
|
|
19
19
|
describe '#api_token' do
|
@@ -25,7 +25,7 @@ RSpec.describe ::Pipedrive do
|
|
25
25
|
describe '#logger' do
|
26
26
|
subject { super().logger }
|
27
27
|
|
28
|
-
it { is_expected.to
|
28
|
+
it { is_expected.to be_a(Logger) }
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -41,7 +41,7 @@ RSpec.describe ::Pipedrive do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
it 'sets logger' do
|
44
|
-
newlogger =
|
44
|
+
newlogger = Logger.new($stderr)
|
45
45
|
client.setup do |c|
|
46
46
|
c.logger = newlogger
|
47
47
|
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.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Sterba
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-01-
|
12
|
+
date: 2023-01-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -67,104 +67,6 @@ dependencies:
|
|
67
67
|
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '3.0'
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: bundler
|
72
|
-
requirement: !ruby/object:Gem::Requirement
|
73
|
-
requirements:
|
74
|
-
- - ">="
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version: '0'
|
77
|
-
type: :development
|
78
|
-
prerelease: false
|
79
|
-
version_requirements: !ruby/object:Gem::Requirement
|
80
|
-
requirements:
|
81
|
-
- - ">="
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
version: '0'
|
84
|
-
- !ruby/object:Gem::Dependency
|
85
|
-
name: rake
|
86
|
-
requirement: !ruby/object:Gem::Requirement
|
87
|
-
requirements:
|
88
|
-
- - ">"
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version: '12'
|
91
|
-
type: :development
|
92
|
-
prerelease: false
|
93
|
-
version_requirements: !ruby/object:Gem::Requirement
|
94
|
-
requirements:
|
95
|
-
- - ">"
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
version: '12'
|
98
|
-
- !ruby/object:Gem::Dependency
|
99
|
-
name: rspec
|
100
|
-
requirement: !ruby/object:Gem::Requirement
|
101
|
-
requirements:
|
102
|
-
- - ">="
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
version: '3.0'
|
105
|
-
type: :development
|
106
|
-
prerelease: false
|
107
|
-
version_requirements: !ruby/object:Gem::Requirement
|
108
|
-
requirements:
|
109
|
-
- - ">="
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
version: '3.0'
|
112
|
-
- !ruby/object:Gem::Dependency
|
113
|
-
name: rubocop
|
114
|
-
requirement: !ruby/object:Gem::Requirement
|
115
|
-
requirements:
|
116
|
-
- - ">="
|
117
|
-
- !ruby/object:Gem::Version
|
118
|
-
version: '0'
|
119
|
-
type: :development
|
120
|
-
prerelease: false
|
121
|
-
version_requirements: !ruby/object:Gem::Requirement
|
122
|
-
requirements:
|
123
|
-
- - ">="
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: '0'
|
126
|
-
- !ruby/object:Gem::Dependency
|
127
|
-
name: rubocop-performance
|
128
|
-
requirement: !ruby/object:Gem::Requirement
|
129
|
-
requirements:
|
130
|
-
- - ">="
|
131
|
-
- !ruby/object:Gem::Version
|
132
|
-
version: '0'
|
133
|
-
type: :development
|
134
|
-
prerelease: false
|
135
|
-
version_requirements: !ruby/object:Gem::Requirement
|
136
|
-
requirements:
|
137
|
-
- - ">="
|
138
|
-
- !ruby/object:Gem::Version
|
139
|
-
version: '0'
|
140
|
-
- !ruby/object:Gem::Dependency
|
141
|
-
name: rubocop-rspec
|
142
|
-
requirement: !ruby/object:Gem::Requirement
|
143
|
-
requirements:
|
144
|
-
- - ">="
|
145
|
-
- !ruby/object:Gem::Version
|
146
|
-
version: '0'
|
147
|
-
type: :development
|
148
|
-
prerelease: false
|
149
|
-
version_requirements: !ruby/object:Gem::Requirement
|
150
|
-
requirements:
|
151
|
-
- - ">="
|
152
|
-
- !ruby/object:Gem::Version
|
153
|
-
version: '0'
|
154
|
-
- !ruby/object:Gem::Dependency
|
155
|
-
name: webmock
|
156
|
-
requirement: !ruby/object:Gem::Requirement
|
157
|
-
requirements:
|
158
|
-
- - ">="
|
159
|
-
- !ruby/object:Gem::Version
|
160
|
-
version: '0'
|
161
|
-
type: :development
|
162
|
-
prerelease: false
|
163
|
-
version_requirements: !ruby/object:Gem::Requirement
|
164
|
-
requirements:
|
165
|
-
- - ">="
|
166
|
-
- !ruby/object:Gem::Version
|
167
|
-
version: '0'
|
168
70
|
description: Pipedrive.com API Wrapper
|
169
71
|
email:
|
170
72
|
- info@jansterba.com
|
@@ -225,12 +127,12 @@ files:
|
|
225
127
|
- spec/lib/pipedrive/lead_label_spec.rb
|
226
128
|
- spec/lib/pipedrive/lead_spec.rb
|
227
129
|
- spec/lib/pipedrive/note_spec.rb
|
228
|
-
- spec/lib/pipedrive/ogranization_spec.rb
|
229
130
|
- spec/lib/pipedrive/operations/create_spec.rb
|
230
131
|
- spec/lib/pipedrive/operations/delete_spec.rb
|
231
132
|
- spec/lib/pipedrive/operations/read_spec.rb
|
232
133
|
- spec/lib/pipedrive/operations/update_spec.rb
|
233
134
|
- spec/lib/pipedrive/organization_field_spec.rb
|
135
|
+
- spec/lib/pipedrive/organization_spec.rb
|
234
136
|
- spec/lib/pipedrive/person_field_spec.rb
|
235
137
|
- spec/lib/pipedrive/person_spec.rb
|
236
138
|
- spec/lib/pipedrive/product_field_spec.rb
|
@@ -240,7 +142,8 @@ files:
|
|
240
142
|
homepage: https://github.com/honzasterba/pipedrive_api_rb
|
241
143
|
licenses:
|
242
144
|
- MIT
|
243
|
-
metadata:
|
145
|
+
metadata:
|
146
|
+
rubygems_mfa_required: 'true'
|
244
147
|
post_install_message:
|
245
148
|
rdoc_options: []
|
246
149
|
require_paths:
|
@@ -260,27 +163,4 @@ rubygems_version: 3.3.7
|
|
260
163
|
signing_key:
|
261
164
|
specification_version: 4
|
262
165
|
summary: Pipedrive.com API Wrapper
|
263
|
-
test_files:
|
264
|
-
- spec/lib/pipedrive/activity_spec.rb
|
265
|
-
- spec/lib/pipedrive/activity_type_spec.rb
|
266
|
-
- spec/lib/pipedrive/base_spec.rb
|
267
|
-
- spec/lib/pipedrive/deal_field_spec.rb
|
268
|
-
- spec/lib/pipedrive/deal_spec.rb
|
269
|
-
- spec/lib/pipedrive/file_spec.rb
|
270
|
-
- spec/lib/pipedrive/filter_spec.rb
|
271
|
-
- spec/lib/pipedrive/goal_spec.rb
|
272
|
-
- spec/lib/pipedrive/lead_label_spec.rb
|
273
|
-
- spec/lib/pipedrive/lead_spec.rb
|
274
|
-
- spec/lib/pipedrive/note_spec.rb
|
275
|
-
- spec/lib/pipedrive/ogranization_spec.rb
|
276
|
-
- spec/lib/pipedrive/operations/create_spec.rb
|
277
|
-
- spec/lib/pipedrive/operations/delete_spec.rb
|
278
|
-
- spec/lib/pipedrive/operations/read_spec.rb
|
279
|
-
- spec/lib/pipedrive/operations/update_spec.rb
|
280
|
-
- spec/lib/pipedrive/organization_field_spec.rb
|
281
|
-
- spec/lib/pipedrive/person_field_spec.rb
|
282
|
-
- spec/lib/pipedrive/person_spec.rb
|
283
|
-
- spec/lib/pipedrive/product_field_spec.rb
|
284
|
-
- spec/lib/pipedrive/product_spec.rb
|
285
|
-
- spec/lib/pipedrive_spec.rb
|
286
|
-
- spec/spec_helper.rb
|
166
|
+
test_files: []
|