ruby-pardot 1.1.0 → 1.4.0
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 +5 -5
- data/.gitignore +2 -0
- data/.rubocop.yml +9 -0
- data/Gemfile +3 -1
- data/Gemfile.lock +29 -22
- 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 +88 -40
- 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 +23 -21
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,43 +1,43 @@
|
|
|
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.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dan Cunning
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-02-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: crack
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- -
|
|
17
|
+
- - '='
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
19
|
+
version: 0.4.3
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
|
-
- -
|
|
24
|
+
- - '='
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
26
|
+
version: 0.4.3
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: httparty
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
|
-
- -
|
|
31
|
+
- - '='
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
33
|
+
version: 0.18.1
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
|
-
- -
|
|
38
|
+
- - '='
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version:
|
|
40
|
+
version: 0.18.1
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: bundler
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -56,30 +56,30 @@ dependencies:
|
|
|
56
56
|
name: rspec
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
|
-
- -
|
|
59
|
+
- - '='
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version:
|
|
61
|
+
version: 3.5.0
|
|
62
62
|
type: :development
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
|
-
- -
|
|
66
|
+
- - '='
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
|
-
version:
|
|
68
|
+
version: 3.5.0
|
|
69
69
|
- !ruby/object:Gem::Dependency
|
|
70
70
|
name: fakeweb
|
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
|
72
72
|
requirements:
|
|
73
|
-
- -
|
|
73
|
+
- - '='
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version:
|
|
75
|
+
version: 1.3.0
|
|
76
76
|
type: :development
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
|
-
- -
|
|
80
|
+
- - '='
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
|
-
version:
|
|
82
|
+
version: 1.3.0
|
|
83
83
|
description: Library for interacting with the Pardot API
|
|
84
84
|
email:
|
|
85
85
|
- support@pardot.com
|
|
@@ -89,6 +89,7 @@ extra_rdoc_files: []
|
|
|
89
89
|
files:
|
|
90
90
|
- ".gitignore"
|
|
91
91
|
- ".rspec"
|
|
92
|
+
- ".rubocop.yml"
|
|
92
93
|
- Gemfile
|
|
93
94
|
- Gemfile.lock
|
|
94
95
|
- README.rdoc
|
|
@@ -97,6 +98,7 @@ files:
|
|
|
97
98
|
- lib/pardot/client.rb
|
|
98
99
|
- lib/pardot/error.rb
|
|
99
100
|
- lib/pardot/http.rb
|
|
101
|
+
- lib/pardot/objects/custom_fields.rb
|
|
100
102
|
- lib/pardot/objects/emails.rb
|
|
101
103
|
- lib/pardot/objects/list_memberships.rb
|
|
102
104
|
- lib/pardot/objects/lists.rb
|
|
@@ -114,6 +116,7 @@ files:
|
|
|
114
116
|
- spec/pardot/client_spec.rb
|
|
115
117
|
- spec/pardot/error_spec.rb
|
|
116
118
|
- spec/pardot/http_spec.rb
|
|
119
|
+
- spec/pardot/objects/custom_fields_spec.rb
|
|
117
120
|
- spec/pardot/objects/emails_spec.rb
|
|
118
121
|
- spec/pardot/objects/lists_spec.rb
|
|
119
122
|
- spec/pardot/objects/opportunities_spec.rb
|
|
@@ -137,15 +140,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
137
140
|
requirements:
|
|
138
141
|
- - ">="
|
|
139
142
|
- !ruby/object:Gem::Version
|
|
140
|
-
version: '
|
|
143
|
+
version: '2.6'
|
|
141
144
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
145
|
requirements:
|
|
143
146
|
- - ">="
|
|
144
147
|
- !ruby/object:Gem::Version
|
|
145
148
|
version: 1.3.6
|
|
146
149
|
requirements: []
|
|
147
|
-
|
|
148
|
-
rubygems_version: 2.5.1
|
|
150
|
+
rubygems_version: 3.0.3
|
|
149
151
|
signing_key:
|
|
150
152
|
specification_version: 4
|
|
151
153
|
summary: Library for interacting with the Pardot API
|