ruby-pardot 1.2.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rubocop.yml +9 -0
- data/Gemfile +3 -1
- data/Gemfile.lock +26 -19
- data/README.rdoc +23 -18
- data/Rakefile +2 -3
- data/lib/pardot/authentication.rb +23 -12
- data/lib/pardot/client.rb +18 -6
- data/lib/pardot/error.rb +6 -2
- data/lib/pardot/http.rb +51 -41
- data/lib/pardot/objects/custom_fields.rb +33 -0
- data/lib/pardot/objects/emails.rb +9 -14
- data/lib/pardot/objects/list_memberships.rb +8 -12
- data/lib/pardot/objects/lists.rb +20 -25
- data/lib/pardot/objects/opportunities.rb +21 -26
- data/lib/pardot/objects/prospect_accounts.rb +6 -7
- data/lib/pardot/objects/prospects.rb +69 -71
- data/lib/pardot/objects/users.rb +17 -21
- data/lib/pardot/objects/visitor_activities.rb +15 -19
- data/lib/pardot/objects/visitors.rb +17 -21
- data/lib/pardot/objects/visits.rb +15 -19
- data/lib/pardot/version.rb +1 -1
- data/lib/ruby-pardot.rb +1 -0
- data/ruby-pardot.gemspec +15 -13
- data/spec/pardot/authentication_spec.rb +84 -50
- data/spec/pardot/client_spec.rb +52 -17
- data/spec/pardot/error_spec.rb +6 -4
- data/spec/pardot/http_spec.rb +96 -104
- data/spec/pardot/objects/custom_fields_spec.rb +53 -0
- data/spec/pardot/objects/emails_spec.rb +34 -33
- data/spec/pardot/objects/lists_spec.rb +34 -37
- data/spec/pardot/objects/opportunities_spec.rb +59 -60
- data/spec/pardot/objects/prospect_accounts_spec.rb +72 -73
- data/spec/pardot/objects/prospects_spec.rb +58 -57
- data/spec/pardot/objects/users_spec.rb +58 -60
- data/spec/pardot/objects/visitor_activities_spec.rb +57 -60
- data/spec/pardot/objects/visitors_spec.rb +56 -60
- data/spec/pardot/objects/visits_spec.rb +56 -60
- data/spec/spec_helper.rb +2 -0
- data/spec/support/client_support.rb +40 -4
- data/spec/support/fakeweb.rb +14 -5
- metadata +17 -18
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
|
-
def
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
def create_auth_managers
|
4
|
+
[UsernamePasswordAuthManager.new, SalesforceAccessTokenAuthManager.new]
|
5
|
+
end
|
6
|
+
|
7
|
+
class UsernamePasswordAuthManager
|
8
|
+
attr_accessor :test_name_suffix, :expected_authorization_header
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@test_name_suffix = 'With UsernamePassword Auth'
|
12
|
+
@expected_authorization_header = 'Pardot api_key=my_api_key, user_key=bar'
|
13
|
+
end
|
14
|
+
|
15
|
+
def create_client
|
16
|
+
client = Pardot::Client.new 'user@test.com', 'foo', 'bar'
|
17
|
+
client.api_key = 'my_api_key'
|
18
|
+
client
|
19
|
+
end
|
20
|
+
|
21
|
+
def has_business_unit_id_header?
|
22
|
+
false
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
class SalesforceAccessTokenAuthManager
|
27
|
+
attr_accessor :test_name_suffix, :expected_authorization_header, :expected_business_unit_id_header
|
28
|
+
|
29
|
+
def initialize
|
30
|
+
@test_name_suffix = 'With Salesforce OAuth'
|
31
|
+
@expected_authorization_header = 'Bearer access_token_value'
|
32
|
+
@expected_business_unit_id_header = '0Uv000000000001CAA'
|
33
|
+
end
|
34
|
+
|
35
|
+
def create_client
|
36
|
+
Pardot::Client.new nil, nil, nil, 3, 'access_token_value', '0Uv000000000001CAA'
|
37
|
+
end
|
38
|
+
|
39
|
+
def has_business_unit_id_header?
|
40
|
+
false
|
41
|
+
end
|
6
42
|
end
|
data/spec/support/fakeweb.rb
CHANGED
@@ -1,14 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'fakeweb'
|
2
4
|
FakeWeb.allow_net_connect = false
|
3
5
|
|
4
|
-
def fake_post
|
5
|
-
FakeWeb.register_uri(:post, "https://pi.pardot.com#{path}", :
|
6
|
+
def fake_post(path, response)
|
7
|
+
FakeWeb.register_uri(:post, "https://pi.pardot.com#{path}", body: response)
|
6
8
|
end
|
7
9
|
|
8
|
-
def fake_get
|
9
|
-
FakeWeb.register_uri(:get, "https://pi.pardot.com#{path}", :
|
10
|
+
def fake_get(path, response)
|
11
|
+
FakeWeb.register_uri(:get, "https://pi.pardot.com#{path}", body: response)
|
10
12
|
end
|
11
13
|
|
12
|
-
def fake_authenticate
|
14
|
+
def fake_authenticate(client, api_key)
|
13
15
|
client.api_key = api_key
|
14
16
|
end
|
17
|
+
|
18
|
+
def assert_authorization_header(auth_manager)
|
19
|
+
expect(FakeWeb.last_request[:authorization]).to eq(auth_manager.expected_authorization_header)
|
20
|
+
if auth_manager.has_business_unit_id_header?
|
21
|
+
expect(FakeWeb.last_request['Business-Unit-Id']).to eq(auth_manager.expected_business_unit_id_header)
|
22
|
+
end
|
23
|
+
end
|
metadata
CHANGED
@@ -1,16 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-pardot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Cunning
|
8
|
-
- Chris Little
|
9
|
-
- Justin Roberts
|
10
8
|
autorequire:
|
11
9
|
bindir: bin
|
12
10
|
cert_chain: []
|
13
|
-
date:
|
11
|
+
date: 2021-06-10 00:00:00.000000000 Z
|
14
12
|
dependencies:
|
15
13
|
- !ruby/object:Gem::Dependency
|
16
14
|
name: crack
|
@@ -32,14 +30,14 @@ dependencies:
|
|
32
30
|
requirements:
|
33
31
|
- - '='
|
34
32
|
- !ruby/object:Gem::Version
|
35
|
-
version: 0.
|
33
|
+
version: 0.18.1
|
36
34
|
type: :runtime
|
37
35
|
prerelease: false
|
38
36
|
version_requirements: !ruby/object:Gem::Requirement
|
39
37
|
requirements:
|
40
38
|
- - '='
|
41
39
|
- !ruby/object:Gem::Version
|
42
|
-
version: 0.
|
40
|
+
version: 0.18.1
|
43
41
|
- !ruby/object:Gem::Dependency
|
44
42
|
name: bundler
|
45
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,41 +56,40 @@ dependencies:
|
|
58
56
|
name: rspec
|
59
57
|
requirement: !ruby/object:Gem::Requirement
|
60
58
|
requirements:
|
61
|
-
- -
|
59
|
+
- - '='
|
62
60
|
- !ruby/object:Gem::Version
|
63
|
-
version:
|
61
|
+
version: 3.5.0
|
64
62
|
type: :development
|
65
63
|
prerelease: false
|
66
64
|
version_requirements: !ruby/object:Gem::Requirement
|
67
65
|
requirements:
|
68
|
-
- -
|
66
|
+
- - '='
|
69
67
|
- !ruby/object:Gem::Version
|
70
|
-
version:
|
68
|
+
version: 3.5.0
|
71
69
|
- !ruby/object:Gem::Dependency
|
72
70
|
name: fakeweb
|
73
71
|
requirement: !ruby/object:Gem::Requirement
|
74
72
|
requirements:
|
75
|
-
- -
|
73
|
+
- - '='
|
76
74
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
75
|
+
version: 1.3.0
|
78
76
|
type: :development
|
79
77
|
prerelease: false
|
80
78
|
version_requirements: !ruby/object:Gem::Requirement
|
81
79
|
requirements:
|
82
|
-
- -
|
80
|
+
- - '='
|
83
81
|
- !ruby/object:Gem::Version
|
84
|
-
version:
|
82
|
+
version: 1.3.0
|
85
83
|
description: Library for interacting with the Pardot API
|
86
84
|
email:
|
87
85
|
- support@pardot.com
|
88
|
-
- chris.little@salesforce.com
|
89
|
-
- justin.roberts@salesforce.com
|
90
86
|
executables: []
|
91
87
|
extensions: []
|
92
88
|
extra_rdoc_files: []
|
93
89
|
files:
|
94
90
|
- ".gitignore"
|
95
91
|
- ".rspec"
|
92
|
+
- ".rubocop.yml"
|
96
93
|
- Gemfile
|
97
94
|
- Gemfile.lock
|
98
95
|
- README.rdoc
|
@@ -101,6 +98,7 @@ files:
|
|
101
98
|
- lib/pardot/client.rb
|
102
99
|
- lib/pardot/error.rb
|
103
100
|
- lib/pardot/http.rb
|
101
|
+
- lib/pardot/objects/custom_fields.rb
|
104
102
|
- lib/pardot/objects/emails.rb
|
105
103
|
- lib/pardot/objects/list_memberships.rb
|
106
104
|
- lib/pardot/objects/lists.rb
|
@@ -118,6 +116,7 @@ files:
|
|
118
116
|
- spec/pardot/client_spec.rb
|
119
117
|
- spec/pardot/error_spec.rb
|
120
118
|
- spec/pardot/http_spec.rb
|
119
|
+
- spec/pardot/objects/custom_fields_spec.rb
|
121
120
|
- spec/pardot/objects/emails_spec.rb
|
122
121
|
- spec/pardot/objects/lists_spec.rb
|
123
122
|
- spec/pardot/objects/opportunities_spec.rb
|
@@ -141,14 +140,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
141
140
|
requirements:
|
142
141
|
- - ">="
|
143
142
|
- !ruby/object:Gem::Version
|
144
|
-
version: '
|
143
|
+
version: '2.6'
|
145
144
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
145
|
requirements:
|
147
146
|
- - ">="
|
148
147
|
- !ruby/object:Gem::Version
|
149
148
|
version: 1.3.6
|
150
149
|
requirements: []
|
151
|
-
rubygems_version: 3.0.
|
150
|
+
rubygems_version: 3.0.3
|
152
151
|
signing_key:
|
153
152
|
specification_version: 4
|
154
153
|
summary: Library for interacting with the Pardot API
|