ruby-pardot 1.3.1 → 1.3.2
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/Gemfile.lock +23 -16
- data/README.rdoc +3 -0
- data/lib/pardot/client.rb +1 -0
- data/lib/pardot/objects/custom_fields.rb +37 -0
- data/lib/pardot/version.rb +1 -1
- data/lib/ruby-pardot.rb +1 -0
- data/ruby-pardot.gemspec +2 -2
- data/spec/pardot/authentication_spec.rb +10 -10
- data/spec/pardot/client_spec.rb +6 -6
- data/spec/pardot/error_spec.rb +2 -2
- data/spec/pardot/http_spec.rb +17 -16
- data/spec/pardot/objects/custom_fields_spec.rb +58 -0
- data/spec/pardot/objects/emails_spec.rb +3 -3
- data/spec/pardot/objects/lists_spec.rb +2 -2
- data/spec/pardot/objects/opportunities_spec.rb +3 -3
- data/spec/pardot/objects/prospect_accounts_spec.rb +4 -4
- data/spec/pardot/objects/prospects_spec.rb +6 -6
- data/spec/pardot/objects/users_spec.rb +3 -3
- data/spec/pardot/objects/visitor_activities_spec.rb +3 -3
- data/spec/pardot/objects/visitors_spec.rb +3 -3
- data/spec/pardot/objects/visits_spec.rb +3 -3
- metadata +11 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e618137557812f8899ff1d06b37bedb49d72cc51e191a091c15b5135780e3bd5
|
4
|
+
data.tar.gz: 22b0992ead0f91fa432af3ccfbad1ea1b1cb65080c7898b8ed9cc9695fbcfa64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3038da0a48d2608cb4395e4ec8ce0a8fcbd3962357279a4ce76b9e74eb936ea22f4942ded8261aa9507af0bb93501b0a07a8c91b05f1fdb6c1b7fb3cf188c87a
|
7
|
+
data.tar.gz: 7fffe6dd67e999a0c294c170dea8929e2885b4957d08bdfc812338696497db02af39015751fed5ea708b9e5090d09fbbb8594f20b548ad4c5a1d5e16e0b5577f
|
data/Gemfile.lock
CHANGED
@@ -1,30 +1,37 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ruby-pardot (1.3.
|
4
|
+
ruby-pardot (1.3.2)
|
5
5
|
crack (= 0.4.3)
|
6
|
-
httparty (= 0.
|
6
|
+
httparty (= 0.18.1)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: http://rubygems.org/
|
10
10
|
specs:
|
11
11
|
crack (0.4.3)
|
12
12
|
safe_yaml (~> 1.0.0)
|
13
|
-
diff-lcs (1.
|
13
|
+
diff-lcs (1.4.4)
|
14
14
|
fakeweb (1.3.0)
|
15
|
-
httparty (0.
|
16
|
-
|
15
|
+
httparty (0.18.1)
|
16
|
+
mime-types (~> 3.0)
|
17
17
|
multi_xml (>= 0.5.2)
|
18
|
-
|
18
|
+
mime-types (3.3.1)
|
19
|
+
mime-types-data (~> 3.2015)
|
20
|
+
mime-types-data (3.2020.0512)
|
19
21
|
multi_xml (0.6.0)
|
20
|
-
rspec (
|
21
|
-
rspec-core (~>
|
22
|
-
rspec-expectations (~>
|
23
|
-
rspec-mocks (~>
|
24
|
-
rspec-core (
|
25
|
-
|
26
|
-
|
27
|
-
|
22
|
+
rspec (3.5.0)
|
23
|
+
rspec-core (~> 3.5.0)
|
24
|
+
rspec-expectations (~> 3.5.0)
|
25
|
+
rspec-mocks (~> 3.5.0)
|
26
|
+
rspec-core (3.5.4)
|
27
|
+
rspec-support (~> 3.5.0)
|
28
|
+
rspec-expectations (3.5.0)
|
29
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
30
|
+
rspec-support (~> 3.5.0)
|
31
|
+
rspec-mocks (3.5.0)
|
32
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
33
|
+
rspec-support (~> 3.5.0)
|
34
|
+
rspec-support (3.5.0)
|
28
35
|
safe_yaml (1.0.5)
|
29
36
|
|
30
37
|
PLATFORMS
|
@@ -33,8 +40,8 @@ PLATFORMS
|
|
33
40
|
DEPENDENCIES
|
34
41
|
bundler (>= 1.10)
|
35
42
|
fakeweb
|
36
|
-
rspec
|
43
|
+
rspec (= 3.5.0)
|
37
44
|
ruby-pardot!
|
38
45
|
|
39
46
|
BUNDLED WITH
|
40
|
-
2.
|
47
|
+
2.1.4
|
data/README.rdoc
CHANGED
@@ -10,6 +10,8 @@ Add the following to your Gemfile
|
|
10
10
|
|
11
11
|
The client will authenticate before performing other API calls, but you can manually authenticate as well
|
12
12
|
|
13
|
+
require "ruby-pardot"
|
14
|
+
|
13
15
|
client = Pardot::Client.new email, password, user_key
|
14
16
|
|
15
17
|
# will raise a Pardot::ResponseError if login fails
|
@@ -20,6 +22,7 @@ The client will authenticate before performing other API calls, but you can manu
|
|
20
22
|
|
21
23
|
The available objects are:
|
22
24
|
|
25
|
+
* custom_fields
|
23
26
|
* emails
|
24
27
|
* lists
|
25
28
|
* opportunities
|
data/lib/pardot/client.rb
CHANGED
@@ -0,0 +1,37 @@
|
|
1
|
+
module Pardot
|
2
|
+
module Objects
|
3
|
+
module CustomFields
|
4
|
+
|
5
|
+
def custom_fields
|
6
|
+
@custom_fields ||= CustomFields.new self
|
7
|
+
end
|
8
|
+
|
9
|
+
class CustomFields
|
10
|
+
|
11
|
+
def initialize client
|
12
|
+
@client = client
|
13
|
+
end
|
14
|
+
|
15
|
+
def query params
|
16
|
+
result = get "/do/query", params, "result"
|
17
|
+
result["total_results"] = result["total_results"].to_i if result["total_results"]
|
18
|
+
result
|
19
|
+
end
|
20
|
+
|
21
|
+
protected
|
22
|
+
|
23
|
+
def get path, params = {}, result = "customField"
|
24
|
+
response = @client.get "customField", path, params
|
25
|
+
result ? response[result] : response
|
26
|
+
end
|
27
|
+
|
28
|
+
def post path, params = {}, result = "user"
|
29
|
+
response = @client.post "customField", path, params
|
30
|
+
result ? response[result] : response
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/lib/pardot/version.rb
CHANGED
data/lib/ruby-pardot.rb
CHANGED
data/ruby-pardot.gemspec
CHANGED
@@ -15,10 +15,10 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.rubyforge_project = "ruby-pardot"
|
16
16
|
|
17
17
|
s.add_dependency "crack", "0.4.3"
|
18
|
-
s.add_dependency "httparty", "0.
|
18
|
+
s.add_dependency "httparty", "0.18.1"
|
19
19
|
|
20
20
|
s.add_development_dependency "bundler", ">= 1.10"
|
21
|
-
s.add_development_dependency "rspec"
|
21
|
+
s.add_development_dependency "rspec", "3.5.0"
|
22
22
|
s.add_development_dependency "fakeweb"
|
23
23
|
|
24
24
|
s.files = `git ls-files`.split("\n")
|
@@ -20,28 +20,28 @@ describe Pardot::Authentication do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def verifyBody
|
23
|
-
FakeWeb.last_request.body.
|
23
|
+
expect(FakeWeb.last_request.body).to eq('email=user%40test.com&password=foo&user_key=bar')
|
24
24
|
end
|
25
25
|
|
26
26
|
it "should return the api key" do
|
27
|
-
authenticate.
|
27
|
+
expect(authenticate).to eq("my_api_key")
|
28
28
|
end
|
29
29
|
|
30
30
|
it "should set the api key" do
|
31
31
|
authenticate
|
32
|
-
@client.api_key.
|
32
|
+
expect(@client.api_key).to eq("my_api_key")
|
33
33
|
verifyBody
|
34
34
|
end
|
35
35
|
|
36
36
|
it "should make authenticated? true" do
|
37
37
|
authenticate
|
38
|
-
@client.authenticated
|
38
|
+
expect(@client.authenticated?).to eq(true)
|
39
39
|
verifyBody
|
40
40
|
end
|
41
41
|
|
42
42
|
it "should use version 3" do
|
43
43
|
authenticate
|
44
|
-
@client.version.to_i.
|
44
|
+
expect(@client.version.to_i).to eq(3)
|
45
45
|
verifyBody
|
46
46
|
end
|
47
47
|
|
@@ -61,28 +61,28 @@ describe Pardot::Authentication do
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def verifyBody
|
64
|
-
FakeWeb.last_request.body.
|
64
|
+
expect(FakeWeb.last_request.body).to eq('email=user%40test.com&password=foo&user_key=bar')
|
65
65
|
end
|
66
66
|
|
67
67
|
it "should return the api key" do
|
68
|
-
authenticate.
|
68
|
+
expect(authenticate).to eq("my_api_key")
|
69
69
|
end
|
70
70
|
|
71
71
|
it "should set the api key" do
|
72
72
|
authenticate
|
73
|
-
@client.api_key.
|
73
|
+
expect(@client.api_key).to eq("my_api_key")
|
74
74
|
verifyBody
|
75
75
|
end
|
76
76
|
|
77
77
|
it "should make authenticated? true" do
|
78
78
|
authenticate
|
79
|
-
@client.authenticated
|
79
|
+
expect(@client.authenticated?).to eq(true)
|
80
80
|
verifyBody
|
81
81
|
end
|
82
82
|
|
83
83
|
it "should use version 4" do
|
84
84
|
authenticate
|
85
|
-
@client.version.to_i.
|
85
|
+
expect(@client.version.to_i).to eq(4)
|
86
86
|
verifyBody
|
87
87
|
end
|
88
88
|
|
data/spec/pardot/client_spec.rb
CHANGED
@@ -8,20 +8,20 @@ describe Pardot::Client do
|
|
8
8
|
|
9
9
|
describe "client" do
|
10
10
|
after do
|
11
|
-
@client.email.
|
12
|
-
@client.password.
|
13
|
-
@client.user_key.
|
14
|
-
@client.format.
|
11
|
+
expect(@client.email).to eq("user@test.com")
|
12
|
+
expect(@client.password).to eq("password")
|
13
|
+
expect(@client.user_key).to eq("user_key")
|
14
|
+
expect(@client.format).to eq("simple")
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should set variables without version" do
|
18
18
|
@client = Pardot::Client.new "user@test.com", "password", "user_key"
|
19
|
-
@client.version.
|
19
|
+
expect(@client.version).to eq(3)
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should set variables with version" do
|
23
23
|
@client = Pardot::Client.new "user@test.com", "password", "user_key", 4
|
24
|
-
@client.version.
|
24
|
+
expect(@client.version).to eq(4)
|
25
25
|
end
|
26
26
|
|
27
27
|
end
|
data/spec/pardot/error_spec.rb
CHANGED
@@ -21,10 +21,10 @@ describe Pardot::ResponseError do
|
|
21
21
|
described_class.new(@res)
|
22
22
|
end
|
23
23
|
specify do
|
24
|
-
subject.to_s.
|
24
|
+
expect(subject.to_s).to eq(@res["__content__"])
|
25
25
|
end
|
26
26
|
specify do
|
27
|
-
subject.message.
|
27
|
+
expect(subject.message).to eq(@res["__content__"])
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
data/spec/pardot/http_spec.rb
CHANGED
@@ -21,20 +21,21 @@ describe Pardot::Http do
|
|
21
21
|
fake_get "/api/foo/version/3/bar?format=simple",
|
22
22
|
%(?xml version="1.0" encoding="UTF-8"?>\n<rsp stat="fail" version="1.0">\n <err code="15">Login failed</err>\n</rsp>\n)
|
23
23
|
|
24
|
-
|
24
|
+
|
25
|
+
expect(lambda { get }).to raise_error(Pardot::ResponseError)
|
25
26
|
end
|
26
27
|
|
27
28
|
it "should catch and reraise SocketErrors as Pardot::NetError" do
|
28
|
-
Pardot::Client.
|
29
|
+
expect(Pardot::Client).to receive(:get).and_raise(SocketError)
|
29
30
|
|
30
|
-
lambda { get }.
|
31
|
+
expect(lambda { get }).to raise_error(Pardot::NetError)
|
31
32
|
end
|
32
33
|
|
33
34
|
it "should call handle_expired_api_key when the api key expires" do
|
34
35
|
fake_get "/api/foo/version/3/bar?format=simple",
|
35
36
|
%(?xml version="1.0" encoding="UTF-8"?>\n<rsp stat="fail" version="1.0">\n <err code="15">Invalid API key or user key</err>\n</rsp>\n)
|
36
37
|
|
37
|
-
@client.
|
38
|
+
expect(@client).to receive(:handle_expired_api_key)
|
38
39
|
get
|
39
40
|
end
|
40
41
|
|
@@ -50,20 +51,20 @@ describe Pardot::Http do
|
|
50
51
|
fake_post "/api/foo/version/3/bar?format=simple",
|
51
52
|
%(?xml version="1.0" encoding="UTF-8"?>\n<rsp stat="fail" version="1.0">\n <err code="15">Login failed</err>\n</rsp>\n)
|
52
53
|
|
53
|
-
lambda { post }.
|
54
|
+
expect(lambda { post }).to raise_error(Pardot::ResponseError)
|
54
55
|
end
|
55
56
|
|
56
57
|
it "should catch and reraise SocketErrors as Pardot::NetError" do
|
57
|
-
Pardot::Client.
|
58
|
+
expect(Pardot::Client).to receive(:post).and_raise(SocketError)
|
58
59
|
|
59
|
-
lambda { post }.
|
60
|
+
expect(lambda { post }).to raise_error(Pardot::NetError)
|
60
61
|
end
|
61
62
|
|
62
63
|
it "should call handle_expired_api_key when the api key expires" do
|
63
64
|
fake_post "/api/foo/version/3/bar?format=simple",
|
64
65
|
%(?xml version="1.0" encoding="UTF-8"?>\n<rsp stat="fail" version="1.0">\n <err code="15">Invalid API key or user key</err>\n</rsp>\n)
|
65
66
|
|
66
|
-
@client.
|
67
|
+
expect(@client).to receive(:handle_expired_api_key)
|
67
68
|
post
|
68
69
|
end
|
69
70
|
|
@@ -80,20 +81,20 @@ describe Pardot::Http do
|
|
80
81
|
fake_get "/api/foo/version/4/bar?format=simple",
|
81
82
|
%(?xml version="1.0" encoding="UTF-8"?>\n<rsp stat="fail" version="1.0">\n <err code="15">Login failed</err>\n</rsp>\n)
|
82
83
|
|
83
|
-
lambda { get }.
|
84
|
+
expect(lambda { get }).to raise_error(Pardot::ResponseError)
|
84
85
|
end
|
85
86
|
|
86
87
|
it "should catch and reraise SocketErrors as Pardot::NetError" do
|
87
|
-
Pardot::Client.
|
88
|
+
expect(Pardot::Client).to receive(:get).and_raise(SocketError)
|
88
89
|
|
89
|
-
lambda { get }.
|
90
|
+
expect(lambda { get }).to raise_error(Pardot::NetError)
|
90
91
|
end
|
91
92
|
|
92
93
|
it "should call handle_expired_api_key when the api key expires" do
|
93
94
|
fake_get "/api/foo/version/4/bar?format=simple",
|
94
95
|
%(?xml version="1.0" encoding="UTF-8"?>\n<rsp stat="fail" version="1.0">\n <err code="15">Invalid API key or user key</err>\n</rsp>\n)
|
95
96
|
|
96
|
-
@client.
|
97
|
+
expect(@client).to receive(:handle_expired_api_key)
|
97
98
|
get
|
98
99
|
end
|
99
100
|
|
@@ -110,20 +111,20 @@ describe Pardot::Http do
|
|
110
111
|
fake_post "/api/foo/version/4/bar?format=simple",
|
111
112
|
%(?xml version="1.0" encoding="UTF-8"?>\n<rsp stat="fail" version="1.0">\n <err code="15">Login failed</err>\n</rsp>\n)
|
112
113
|
|
113
|
-
lambda { post }.
|
114
|
+
expect(lambda { post }).to raise_error(Pardot::ResponseError)
|
114
115
|
end
|
115
116
|
|
116
117
|
it "should catch and reraise SocketErrors as Pardot::NetError" do
|
117
|
-
Pardot::Client.
|
118
|
+
expect(Pardot::Client).to receive(:post).and_raise(SocketError)
|
118
119
|
|
119
|
-
lambda { post }.
|
120
|
+
expect(lambda { post }).to raise_error(Pardot::NetError)
|
120
121
|
end
|
121
122
|
|
122
123
|
it "should call handle_expired_api_key when the api key expires" do
|
123
124
|
fake_post "/api/foo/version/4/bar?format=simple",
|
124
125
|
%(?xml version="1.0" encoding="UTF-8"?>\n<rsp stat="fail" version="1.0">\n <err code="15">Invalid API key or user key</err>\n</rsp>\n)
|
125
126
|
|
126
|
-
@client.
|
127
|
+
expect(@client).to receive(:handle_expired_api_key)
|
127
128
|
post
|
128
129
|
end
|
129
130
|
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
2
|
+
|
3
|
+
describe Pardot::Objects::CustomFields do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@client = create_client
|
7
|
+
end
|
8
|
+
|
9
|
+
describe "query" do
|
10
|
+
|
11
|
+
def sample_results
|
12
|
+
%(<?xml version="1.0" encoding="UTF-8"?>\n<rsp stat="ok" version="1.0">
|
13
|
+
<result>
|
14
|
+
<total_results>1</total_results>
|
15
|
+
<customField>
|
16
|
+
<created_at>2019-11-26 13:40:37</created_at>
|
17
|
+
<crm_id null="true" />
|
18
|
+
<field_id>CustomObject1574793618883</field_id>
|
19
|
+
<id>8932</id>
|
20
|
+
<is_record_multiple_responses>false</is_record_multiple_responses>
|
21
|
+
<is_use_values>false</is_use_values>
|
22
|
+
<name>Ω≈ç√∫˜µ≤≥÷</name>
|
23
|
+
<type>Text</type>
|
24
|
+
<type_id>1</type_id>
|
25
|
+
<updated_at>2019-11-26 13:40:37</updated_at>
|
26
|
+
</customField>
|
27
|
+
</result>
|
28
|
+
</rsp>)
|
29
|
+
end
|
30
|
+
|
31
|
+
before do
|
32
|
+
@client = create_client
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should take in some arguments" do
|
36
|
+
fake_get "/api/customField/version/3/do/query?id_greater_than=200&format=simple", sample_results
|
37
|
+
|
38
|
+
expect(@client.custom_fields.query(:id_greater_than => 200)).to eq({"total_results" => 1,
|
39
|
+
"customField"=>
|
40
|
+
{
|
41
|
+
"id"=>"8932",
|
42
|
+
"name"=>"Ω≈ç√∫˜µ≤≥÷",
|
43
|
+
"field_id"=>"CustomObject1574793618883",
|
44
|
+
"type"=>"Text",
|
45
|
+
"type_id"=>"1",
|
46
|
+
"crm_id"=>{"null"=>"true"},
|
47
|
+
"is_record_multiple_responses"=>"false",
|
48
|
+
"is_use_values"=>"false",
|
49
|
+
"created_at"=>"2019-11-26 13:40:37",
|
50
|
+
"updated_at"=>"2019-11-26 13:40:37"
|
51
|
+
}
|
52
|
+
})
|
53
|
+
assert_authorization_header
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
@@ -20,19 +20,19 @@ describe Pardot::Objects::Emails do
|
|
20
20
|
|
21
21
|
it "should take in the email ID" do
|
22
22
|
fake_get "/api/email/version/3/do/read/id/12?format=simple", sample_response
|
23
|
-
@client.emails.read_by_id(12).
|
23
|
+
expect(@client.emails.read_by_id(12)).to eq({"name" => "My Email"})
|
24
24
|
assert_authorization_header
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'should send to a prospect' do
|
28
28
|
fake_post '/api/email/version/3/do/send/prospect_id/42?campaign_id=765&email_template_id=86&format=simple', sample_response
|
29
|
-
@client.emails.send_to_prospect(42, :campaign_id => 765, :email_template_id => 86).
|
29
|
+
expect(@client.emails.send_to_prospect(42, :campaign_id => 765, :email_template_id => 86)).to eq({"name" => "My Email"})
|
30
30
|
assert_authorization_header
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'should send to a list' do
|
34
34
|
fake_post '/api/email/version/3/do/send?email_template_id=200&list_ids[]=235&campaign_id=654&format=simple', sample_response
|
35
|
-
@client.emails.send_to_list(:email_template_id => 200, 'list_ids[]' => 235, :campaign_id => 654).
|
35
|
+
expect(@client.emails.send_to_list(:email_template_id => 200, 'list_ids[]' => 235, :campaign_id => 654)).to eq({"name" => "My Email"})
|
36
36
|
assert_authorization_header
|
37
37
|
end
|
38
38
|
|
@@ -29,11 +29,11 @@ describe Pardot::Objects::Lists do
|
|
29
29
|
it "should take in some arguments" do
|
30
30
|
fake_get "/api/list/version/3/do/query?id_greater_than=200&format=simple", sample_results
|
31
31
|
|
32
|
-
@client.lists.query(:id_greater_than => 200).
|
32
|
+
expect(@client.lists.query(:id_greater_than => 200)).to eq({"total_results" => 2,
|
33
33
|
"list"=>[
|
34
34
|
{"name"=>"Asdf List"},
|
35
35
|
{"name"=>"Qwerty List"}
|
36
|
-
]}
|
36
|
+
]})
|
37
37
|
assert_authorization_header
|
38
38
|
end
|
39
39
|
|
@@ -31,11 +31,11 @@ describe Pardot::Objects::Opportunities do
|
|
31
31
|
it "should take in some arguments" do
|
32
32
|
fake_get "/api/opportunity/version/3/do/query?id_greater_than=200&format=simple", sample_results
|
33
33
|
|
34
|
-
@client.opportunities.query(:id_greater_than => 200).
|
34
|
+
expect(@client.opportunities.query(:id_greater_than => 200)).to eq({"total_results" => 2,
|
35
35
|
"opportunity"=>[
|
36
36
|
{"type"=>"Great", "name"=>"Jim"},
|
37
37
|
{"type"=>"Good", "name"=>"Sue"}
|
38
|
-
]}
|
38
|
+
]})
|
39
39
|
assert_authorization_header
|
40
40
|
end
|
41
41
|
|
@@ -56,7 +56,7 @@ describe Pardot::Objects::Opportunities do
|
|
56
56
|
it "should return the prospect" do
|
57
57
|
fake_post "/api/opportunity/version/3/do/create/prospect_email/user@test.com?type=Good&format=simple&name=Jim", sample_results
|
58
58
|
|
59
|
-
@client.opportunities.create_by_email("user@test.com", :name => "Jim", :type => "Good").
|
59
|
+
expect(@client.opportunities.create_by_email("user@test.com", :name => "Jim", :type => "Good")).to eq({"name"=>"Jim", "type"=>"Good"})
|
60
60
|
|
61
61
|
assert_authorization_header
|
62
62
|
end
|
@@ -26,11 +26,11 @@ describe Pardot::Objects::ProspectAccounts do
|
|
26
26
|
it "should take in some arguments and respond with valid items" do
|
27
27
|
fake_get "/api/prospectAccount/version/3/do/query?assigned=true&format=simple", sample_results
|
28
28
|
|
29
|
-
@client.prospect_accounts.query(:assigned => true).
|
29
|
+
expect(@client.prospect_accounts.query(:assigned => true)).to eq({'total_results' => 2,
|
30
30
|
'prospectAccount'=>[
|
31
31
|
{'name'=>'Spaceships R Us'},
|
32
32
|
{'name'=>'Monsters Inc'}
|
33
|
-
]}
|
33
|
+
]})
|
34
34
|
assert_authorization_header
|
35
35
|
end
|
36
36
|
|
@@ -50,7 +50,7 @@ describe Pardot::Objects::ProspectAccounts do
|
|
50
50
|
it 'should return a valid account' do
|
51
51
|
fake_post '/api/prospectAccount/version/3/do/read/id/1234?assigned=true&format=simple', sample_results
|
52
52
|
|
53
|
-
@client.prospect_accounts.read('1234', :assigned => true).
|
53
|
+
expect(@client.prospect_accounts.read('1234', :assigned => true)).to eq({'id' => '1234', 'name' => 'SupaDupaPanda' })
|
54
54
|
assert_authorization_header
|
55
55
|
end
|
56
56
|
|
@@ -71,7 +71,7 @@ describe Pardot::Objects::ProspectAccounts do
|
|
71
71
|
it 'should return the prospect account' do
|
72
72
|
fake_post '/api/prospectAccount/version/3/do/create?format=simple&name=SuperPanda', sample_results
|
73
73
|
|
74
|
-
@client.prospect_accounts.create(:name => 'SuperPanda').
|
74
|
+
expect(@client.prospect_accounts.create(:name => 'SuperPanda')).to eq({"name"=>"SuperPanda"})
|
75
75
|
assert_authorization_header
|
76
76
|
end
|
77
77
|
|
@@ -28,11 +28,11 @@ describe Pardot::Objects::Prospects do
|
|
28
28
|
it "should take in some arguments" do
|
29
29
|
fake_get "/api/prospect/version/3/do/query?assigned=true&format=simple", sample_results
|
30
30
|
|
31
|
-
@client.prospects.query(:assigned => true).
|
31
|
+
expect(@client.prospects.query(:assigned => true)).to eq({"total_results" => 2,
|
32
32
|
"prospect"=>[
|
33
33
|
{"last_name"=>"Smith", "first_name"=>"Jim"},
|
34
34
|
{"last_name"=>"Green", "first_name"=>"Sue"}
|
35
|
-
]}
|
35
|
+
]})
|
36
36
|
assert_authorization_header
|
37
37
|
end
|
38
38
|
|
@@ -51,12 +51,12 @@ describe Pardot::Objects::Prospects do
|
|
51
51
|
end
|
52
52
|
|
53
53
|
it "should return the prospect" do
|
54
|
-
fake_post "/api/prospect/version/3/do/create/email/user
|
55
|
-
|
56
|
-
@client.prospects.create("user@test.com", :first_name => "Jim").
|
54
|
+
fake_post "/api/prospect/version/3/do/create/email/user%40test.com?first_name=Jim&format=simple", sample_results
|
55
|
+
|
56
|
+
expect(@client.prospects.create("user@test.com", :first_name => "Jim")).to eq({"last_name"=>"Smith", "first_name"=>"Jim"})
|
57
57
|
assert_authorization_header
|
58
58
|
end
|
59
59
|
|
60
60
|
end
|
61
61
|
|
62
|
-
end
|
62
|
+
end
|
@@ -31,11 +31,11 @@ describe Pardot::Objects::Users do
|
|
31
31
|
it "should take in some arguments" do
|
32
32
|
fake_get "/api/user/version/3/do/query?id_greater_than=200&format=simple", sample_results
|
33
33
|
|
34
|
-
@client.users.query(:id_greater_than => 200).
|
34
|
+
expect(@client.users.query(:id_greater_than => 200)).to eq({"total_results" => 2,
|
35
35
|
"user"=>[
|
36
36
|
{"email"=>"user@test.com", "first_name"=>"Jim"},
|
37
37
|
{"email"=>"user@example.com", "first_name"=>"Sue"}
|
38
|
-
]}
|
38
|
+
]})
|
39
39
|
assert_authorization_header
|
40
40
|
end
|
41
41
|
|
@@ -56,7 +56,7 @@ describe Pardot::Objects::Users do
|
|
56
56
|
it "should return the prospect" do
|
57
57
|
fake_post "/api/user/version/3/do/read/email/user@test.com?format=simple", sample_results
|
58
58
|
|
59
|
-
@client.users.read_by_email("user@test.com").
|
59
|
+
expect(@client.users.read_by_email("user@test.com")).to eq({"email"=>"user@example.com", "first_name"=>"Sue"})
|
60
60
|
assert_authorization_header
|
61
61
|
end
|
62
62
|
|
@@ -31,11 +31,11 @@ describe Pardot::Objects::VisitorActivities do
|
|
31
31
|
it "should take in some arguments" do
|
32
32
|
fake_get "/api/visitorActivity/version/3/do/query?id_greater_than=200&format=simple", sample_results
|
33
33
|
|
34
|
-
@client.visitor_activities.query(:id_greater_than => 200).
|
34
|
+
expect(@client.visitor_activities.query(:id_greater_than => 200)).to eq({"total_results" => 2,
|
35
35
|
"visitorActivity"=>[
|
36
36
|
{"type_name"=>"Read", "details"=>"Some details"},
|
37
37
|
{"type_name"=>"Write", "details"=>"More details"}
|
38
|
-
]}
|
38
|
+
]})
|
39
39
|
assert_authorization_header
|
40
40
|
end
|
41
41
|
|
@@ -56,7 +56,7 @@ describe Pardot::Objects::VisitorActivities do
|
|
56
56
|
it "should return the prospect" do
|
57
57
|
fake_post "/api/visitorActivity/version/3/do/read/id/10?format=simple", sample_results
|
58
58
|
|
59
|
-
@client.visitor_activities.read(10).
|
59
|
+
expect(@client.visitor_activities.read(10)).to eq({"details"=>"More details", "type_name"=>"Write"})
|
60
60
|
assert_authorization_header
|
61
61
|
end
|
62
62
|
|
@@ -31,11 +31,11 @@ describe Pardot::Objects::Visitors do
|
|
31
31
|
it "should take in some arguments" do
|
32
32
|
fake_get "/api/visitor/version/3/do/query?id_greater_than=200&format=simple", sample_results
|
33
33
|
|
34
|
-
@client.visitors.query(:id_greater_than => 200).
|
34
|
+
expect(@client.visitors.query(:id_greater_than => 200)).to eq({"total_results" => 2,
|
35
35
|
"visitor"=>[
|
36
36
|
{"browser"=>"Firefox", "language"=>"en"},
|
37
37
|
{"browser"=>"Chrome", "language"=>"es"}
|
38
|
-
]}
|
38
|
+
]})
|
39
39
|
assert_authorization_header
|
40
40
|
end
|
41
41
|
|
@@ -56,7 +56,7 @@ describe Pardot::Objects::Visitors do
|
|
56
56
|
it "should return the prospect" do
|
57
57
|
fake_post "/api/visitor/version/3/do/assign/id/10?type=Good&format=simple&name=Jim", sample_results
|
58
58
|
|
59
|
-
@client.visitors.assign(10, :name => "Jim", :type => "Good").
|
59
|
+
expect(@client.visitors.assign(10, :name => "Jim", :type => "Good")).to eq({"browser"=>"Chrome", "language"=>"es"})
|
60
60
|
assert_authorization_header
|
61
61
|
end
|
62
62
|
|
@@ -31,11 +31,11 @@ describe Pardot::Objects::Visits do
|
|
31
31
|
it "should take in some arguments" do
|
32
32
|
fake_get "/api/visit/version/3/do/query?id_greater_than=200&format=simple", sample_results
|
33
33
|
|
34
|
-
@client.visits.query(:id_greater_than => 200).
|
34
|
+
expect(@client.visits.query(:id_greater_than => 200)).to eq({"total_results" => 2,
|
35
35
|
"visit"=>[
|
36
36
|
{"duration_in_seconds"=>"50", "visitor_page_view_count"=>"3"},
|
37
37
|
{"duration_in_seconds"=>"10", "visitor_page_view_count"=>"1"}
|
38
|
-
]}
|
38
|
+
]})
|
39
39
|
assert_authorization_header
|
40
40
|
end
|
41
41
|
|
@@ -56,7 +56,7 @@ describe Pardot::Objects::Visits do
|
|
56
56
|
it "should return the prospect" do
|
57
57
|
fake_post "/api/visit/version/3/do/read/id/10?format=simple", sample_results
|
58
58
|
|
59
|
-
@client.visits.read(10).
|
59
|
+
expect(@client.visits.read(10)).to eq({"visitor_page_view_count"=>"1", "duration_in_seconds"=>"10"})
|
60
60
|
assert_authorization_header
|
61
61
|
end
|
62
62
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-pardot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
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: 2020-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: crack
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
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: 0.
|
40
|
+
version: 0.18.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -56,16 +56,16 @@ 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
|
@@ -97,6 +97,7 @@ files:
|
|
97
97
|
- lib/pardot/client.rb
|
98
98
|
- lib/pardot/error.rb
|
99
99
|
- lib/pardot/http.rb
|
100
|
+
- lib/pardot/objects/custom_fields.rb
|
100
101
|
- lib/pardot/objects/emails.rb
|
101
102
|
- lib/pardot/objects/list_memberships.rb
|
102
103
|
- lib/pardot/objects/lists.rb
|
@@ -114,6 +115,7 @@ files:
|
|
114
115
|
- spec/pardot/client_spec.rb
|
115
116
|
- spec/pardot/error_spec.rb
|
116
117
|
- spec/pardot/http_spec.rb
|
118
|
+
- spec/pardot/objects/custom_fields_spec.rb
|
117
119
|
- spec/pardot/objects/emails_spec.rb
|
118
120
|
- spec/pardot/objects/lists_spec.rb
|
119
121
|
- spec/pardot/objects/opportunities_spec.rb
|
@@ -144,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
146
|
- !ruby/object:Gem::Version
|
145
147
|
version: 1.3.6
|
146
148
|
requirements: []
|
147
|
-
rubygems_version: 3.0.
|
149
|
+
rubygems_version: 3.0.3
|
148
150
|
signing_key:
|
149
151
|
specification_version: 4
|
150
152
|
summary: Library for interacting with the Pardot API
|