From 8de6325a6aea806432fefbca857b4e62e8a6b6ac Mon Sep 17 00:00:00 2001 From: Jared Pearson Date: Wed, 19 Aug 2020 09:30:54 -0700 Subject: [PATCH] [W-7879842] Update httparty and rspec versions (#51) --- Gemfile.lock | 37 +++++++++++-------- README.rdoc | 2 + ruby-pardot.gemspec | 4 +- spec/pardot/authentication_spec.rb | 20 +++++----- spec/pardot/client_spec.rb | 12 +++--- spec/pardot/error_spec.rb | 4 +- spec/pardot/http_spec.rb | 33 +++++++++-------- spec/pardot/objects/custom_fields_spec.rb | 4 +- spec/pardot/objects/emails_spec.rb | 6 +-- spec/pardot/objects/lists_spec.rb | 4 +- spec/pardot/objects/opportunities_spec.rb | 6 +-- spec/pardot/objects/prospect_accounts_spec.rb | 8 ++-- spec/pardot/objects/prospects_spec.rb | 6 +-- spec/pardot/objects/users_spec.rb | 6 +-- .../pardot/objects/visitor_activities_spec.rb | 6 +-- spec/pardot/objects/visitors_spec.rb | 6 +-- spec/pardot/objects/visits_spec.rb | 6 +-- 17 files changed, 90 insertions(+), 80 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 9c895ad..6cae5e4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,28 +3,35 @@ PATH specs: ruby-pardot (1.3.2) crack (= 0.4.3) - httparty (= 0.13.1) + httparty (= 0.18.1) GEM remote: http://rubygems.org/ specs: crack (0.4.3) safe_yaml (~> 1.0.0) - diff-lcs (1.1.2) + diff-lcs (1.4.4) fakeweb (1.3.0) - httparty (0.13.1) - json (~> 1.8) + httparty (0.18.1) + mime-types (~> 3.0) multi_xml (>= 0.5.2) - json (1.8.6) + mime-types (3.3.1) + mime-types-data (~> 3.2015) + mime-types-data (3.2020.0512) multi_xml (0.6.0) - rspec (2.5.0) - rspec-core (~> 2.5.0) - rspec-expectations (~> 2.5.0) - rspec-mocks (~> 2.5.0) - rspec-core (2.5.1) - rspec-expectations (2.5.0) - diff-lcs (~> 1.1.2) - rspec-mocks (2.5.0) + rspec (3.5.0) + rspec-core (~> 3.5.0) + rspec-expectations (~> 3.5.0) + rspec-mocks (~> 3.5.0) + rspec-core (3.5.4) + rspec-support (~> 3.5.0) + rspec-expectations (3.5.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.5.0) + rspec-mocks (3.5.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.5.0) + rspec-support (3.5.0) safe_yaml (1.0.5) PLATFORMS @@ -33,8 +40,8 @@ PLATFORMS DEPENDENCIES bundler (>= 1.10) fakeweb - rspec + rspec (= 3.5.0) ruby-pardot! BUNDLED WITH - 2.0.2 + 2.1.4 diff --git a/README.rdoc b/README.rdoc index 0c7891d..db4a44c 100644 --- a/README.rdoc +++ b/README.rdoc @@ -10,6 +10,8 @@ Add the following to your Gemfile The client will authenticate before performing other API calls, but you can manually authenticate as well + require "ruby-pardot" + client = Pardot::Client.new email, password, user_key # will raise a Pardot::ResponseError if login fails diff --git a/ruby-pardot.gemspec b/ruby-pardot.gemspec index 4e46b42..4348878 100644 --- a/ruby-pardot.gemspec +++ b/ruby-pardot.gemspec @@ -15,10 +15,10 @@ Gem::Specification.new do |s| s.rubyforge_project = "ruby-pardot" s.add_dependency "crack", "0.4.3" - s.add_dependency "httparty", "0.13.1" + s.add_dependency "httparty", "0.18.1" s.add_development_dependency "bundler", ">= 1.10" - s.add_development_dependency "rspec" + s.add_development_dependency "rspec", "3.5.0" s.add_development_dependency "fakeweb" s.files = `git ls-files`.split("\n") diff --git a/spec/pardot/authentication_spec.rb b/spec/pardot/authentication_spec.rb index fa74aaa..696e9fa 100644 --- a/spec/pardot/authentication_spec.rb +++ b/spec/pardot/authentication_spec.rb @@ -20,28 +20,28 @@ def authenticate end def verifyBody - FakeWeb.last_request.body.should == 'email=user%40test.com&password=foo&user_key=bar' + expect(FakeWeb.last_request.body).to eq('email=user%40test.com&password=foo&user_key=bar') end it "should return the api key" do - authenticate.should == "my_api_key" + expect(authenticate).to eq("my_api_key") end it "should set the api key" do authenticate - @client.api_key.should == "my_api_key" + expect(@client.api_key).to eq("my_api_key") verifyBody end it "should make authenticated? true" do authenticate - @client.authenticated?.should == true + expect(@client.authenticated?).to eq(true) verifyBody end it "should use version 3" do authenticate - @client.version.to_i.should == 3 + expect(@client.version.to_i).to eq(3) verifyBody end @@ -61,28 +61,28 @@ def authenticate end def verifyBody - FakeWeb.last_request.body.should == 'email=user%40test.com&password=foo&user_key=bar' + expect(FakeWeb.last_request.body).to eq('email=user%40test.com&password=foo&user_key=bar') end it "should return the api key" do - authenticate.should == "my_api_key" + expect(authenticate).to eq("my_api_key") end it "should set the api key" do authenticate - @client.api_key.should == "my_api_key" + expect(@client.api_key).to eq("my_api_key") verifyBody end it "should make authenticated? true" do authenticate - @client.authenticated?.should == true + expect(@client.authenticated?).to eq(true) verifyBody end it "should use version 4" do authenticate - @client.version.to_i.should == 4 + expect(@client.version.to_i).to eq(4) verifyBody end diff --git a/spec/pardot/client_spec.rb b/spec/pardot/client_spec.rb index 324f2e4..7a2b96e 100644 --- a/spec/pardot/client_spec.rb +++ b/spec/pardot/client_spec.rb @@ -8,20 +8,20 @@ def create_client describe "client" do after do - @client.email.should == "user@test.com" - @client.password.should == "password" - @client.user_key.should == "user_key" - @client.format.should == "simple" + expect(@client.email).to eq("user@test.com") + expect(@client.password).to eq("password") + expect(@client.user_key).to eq("user_key") + expect(@client.format).to eq("simple") end it "should set variables without version" do @client = Pardot::Client.new "user@test.com", "password", "user_key" - @client.version.should == 3 + expect(@client.version).to eq(3) end it "should set variables with version" do @client = Pardot::Client.new "user@test.com", "password", "user_key", 4 - @client.version.should == 4 + expect(@client.version).to eq(4) end end diff --git a/spec/pardot/error_spec.rb b/spec/pardot/error_spec.rb index 659dc5d..f755e2d 100644 --- a/spec/pardot/error_spec.rb +++ b/spec/pardot/error_spec.rb @@ -21,10 +21,10 @@ described_class.new(@res) end specify do - subject.to_s.should == @res["__content__"] + expect(subject.to_s).to eq(@res["__content__"]) end specify do - subject.message.should == @res["__content__"] + expect(subject.message).to eq(@res["__content__"]) end end diff --git a/spec/pardot/http_spec.rb b/spec/pardot/http_spec.rb index 747ca4e..72dcbae 100644 --- a/spec/pardot/http_spec.rb +++ b/spec/pardot/http_spec.rb @@ -21,20 +21,21 @@ def get object = "foo", path = "/bar", params = {} fake_get "/api/foo/version/3/bar?format=simple", %(?xml version="1.0" encoding="UTF-8"?>\n\n Login failed\n\n) - lambda { get }.should raise_error(Pardot::ResponseError) + + expect(lambda { get }).to raise_error(Pardot::ResponseError) end it "should catch and reraise SocketErrors as Pardot::NetError" do - Pardot::Client.should_receive(:get).and_raise(SocketError) + expect(Pardot::Client).to receive(:get).and_raise(SocketError) - lambda { get }.should raise_error(Pardot::NetError) + expect(lambda { get }).to raise_error(Pardot::NetError) end it "should call handle_expired_api_key when the api key expires" do fake_get "/api/foo/version/3/bar?format=simple", %(?xml version="1.0" encoding="UTF-8"?>\n\n Invalid API key or user key\n\n) - @client.should_receive(:handle_expired_api_key) + expect(@client).to receive(:handle_expired_api_key) get end @@ -50,20 +51,20 @@ def post object = "foo", path = "/bar", params = {} fake_post "/api/foo/version/3/bar?format=simple", %(?xml version="1.0" encoding="UTF-8"?>\n\n Login failed\n\n) - lambda { post }.should raise_error(Pardot::ResponseError) + expect(lambda { post }).to raise_error(Pardot::ResponseError) end it "should catch and reraise SocketErrors as Pardot::NetError" do - Pardot::Client.should_receive(:post).and_raise(SocketError) + expect(Pardot::Client).to receive(:post).and_raise(SocketError) - lambda { post }.should raise_error(Pardot::NetError) + expect(lambda { post }).to raise_error(Pardot::NetError) end it "should call handle_expired_api_key when the api key expires" do fake_post "/api/foo/version/3/bar?format=simple", %(?xml version="1.0" encoding="UTF-8"?>\n\n Invalid API key or user key\n\n) - @client.should_receive(:handle_expired_api_key) + expect(@client).to receive(:handle_expired_api_key) post end @@ -80,20 +81,20 @@ def get object = "foo", path = "/bar", params = {} fake_get "/api/foo/version/4/bar?format=simple", %(?xml version="1.0" encoding="UTF-8"?>\n\n Login failed\n\n) - lambda { get }.should raise_error(Pardot::ResponseError) + expect(lambda { get }).to raise_error(Pardot::ResponseError) end it "should catch and reraise SocketErrors as Pardot::NetError" do - Pardot::Client.should_receive(:get).and_raise(SocketError) + expect(Pardot::Client).to receive(:get).and_raise(SocketError) - lambda { get }.should raise_error(Pardot::NetError) + expect(lambda { get }).to raise_error(Pardot::NetError) end it "should call handle_expired_api_key when the api key expires" do fake_get "/api/foo/version/4/bar?format=simple", %(?xml version="1.0" encoding="UTF-8"?>\n\n Invalid API key or user key\n\n) - @client.should_receive(:handle_expired_api_key) + expect(@client).to receive(:handle_expired_api_key) get end @@ -110,20 +111,20 @@ def post object = "foo", path = "/bar", params = {} fake_post "/api/foo/version/4/bar?format=simple", %(?xml version="1.0" encoding="UTF-8"?>\n\n Login failed\n\n) - lambda { post }.should raise_error(Pardot::ResponseError) + expect(lambda { post }).to raise_error(Pardot::ResponseError) end it "should catch and reraise SocketErrors as Pardot::NetError" do - Pardot::Client.should_receive(:post).and_raise(SocketError) + expect(Pardot::Client).to receive(:post).and_raise(SocketError) - lambda { post }.should raise_error(Pardot::NetError) + expect(lambda { post }).to raise_error(Pardot::NetError) end it "should call handle_expired_api_key when the api key expires" do fake_post "/api/foo/version/4/bar?format=simple", %(?xml version="1.0" encoding="UTF-8"?>\n\n Invalid API key or user key\n\n) - @client.should_receive(:handle_expired_api_key) + expect(@client).to receive(:handle_expired_api_key) post end diff --git a/spec/pardot/objects/custom_fields_spec.rb b/spec/pardot/objects/custom_fields_spec.rb index 1f31940..1dac60e 100644 --- a/spec/pardot/objects/custom_fields_spec.rb +++ b/spec/pardot/objects/custom_fields_spec.rb @@ -35,7 +35,7 @@ def sample_results it "should take in some arguments" do fake_get "/api/customField/version/3/do/query?id_greater_than=200&format=simple", sample_results - @client.custom_fields.query(:id_greater_than => 200).should == {"total_results" => 1, + expect(@client.custom_fields.query(:id_greater_than => 200)).to eq({"total_results" => 1, "customField"=> { "id"=>"8932", @@ -49,7 +49,7 @@ def sample_results "created_at"=>"2019-11-26 13:40:37", "updated_at"=>"2019-11-26 13:40:37" } - } + }) assert_authorization_header end diff --git a/spec/pardot/objects/emails_spec.rb b/spec/pardot/objects/emails_spec.rb index d16391b..237c88c 100644 --- a/spec/pardot/objects/emails_spec.rb +++ b/spec/pardot/objects/emails_spec.rb @@ -20,19 +20,19 @@ def sample_response it "should take in the email ID" do fake_get "/api/email/version/3/do/read/id/12?format=simple", sample_response - @client.emails.read_by_id(12).should == {"name" => "My Email"} + expect(@client.emails.read_by_id(12)).to eq({"name" => "My Email"}) assert_authorization_header end it 'should send to a prospect' do fake_post '/api/email/version/3/do/send/prospect_id/42?campaign_id=765&email_template_id=86&format=simple', sample_response - @client.emails.send_to_prospect(42, :campaign_id => 765, :email_template_id => 86).should == {"name" => "My Email"} + expect(@client.emails.send_to_prospect(42, :campaign_id => 765, :email_template_id => 86)).to eq({"name" => "My Email"}) assert_authorization_header end it 'should send to a list' do fake_post '/api/email/version/3/do/send?email_template_id=200&list_ids[]=235&campaign_id=654&format=simple', sample_response - @client.emails.send_to_list(:email_template_id => 200, 'list_ids[]' => 235, :campaign_id => 654).should == {"name" => "My Email"} + expect(@client.emails.send_to_list(:email_template_id => 200, 'list_ids[]' => 235, :campaign_id => 654)).to eq({"name" => "My Email"}) assert_authorization_header end diff --git a/spec/pardot/objects/lists_spec.rb b/spec/pardot/objects/lists_spec.rb index 990aa28..e2625ad 100644 --- a/spec/pardot/objects/lists_spec.rb +++ b/spec/pardot/objects/lists_spec.rb @@ -29,11 +29,11 @@ def sample_results it "should take in some arguments" do fake_get "/api/list/version/3/do/query?id_greater_than=200&format=simple", sample_results - @client.lists.query(:id_greater_than => 200).should == {"total_results" => 2, + expect(@client.lists.query(:id_greater_than => 200)).to eq({"total_results" => 2, "list"=>[ {"name"=>"Asdf List"}, {"name"=>"Qwerty List"} - ]} + ]}) assert_authorization_header end diff --git a/spec/pardot/objects/opportunities_spec.rb b/spec/pardot/objects/opportunities_spec.rb index 548519c..7cb3bac 100644 --- a/spec/pardot/objects/opportunities_spec.rb +++ b/spec/pardot/objects/opportunities_spec.rb @@ -31,11 +31,11 @@ def sample_results it "should take in some arguments" do fake_get "/api/opportunity/version/3/do/query?id_greater_than=200&format=simple", sample_results - @client.opportunities.query(:id_greater_than => 200).should == {"total_results" => 2, + expect(@client.opportunities.query(:id_greater_than => 200)).to eq({"total_results" => 2, "opportunity"=>[ {"type"=>"Great", "name"=>"Jim"}, {"type"=>"Good", "name"=>"Sue"} - ]} + ]}) assert_authorization_header end @@ -56,7 +56,7 @@ def sample_results it "should return the prospect" do fake_post "/api/opportunity/version/3/do/create/prospect_email/user@test.com?type=Good&format=simple&name=Jim", sample_results - @client.opportunities.create_by_email("user@test.com", :name => "Jim", :type => "Good").should == {"name"=>"Jim", "type"=>"Good"} + expect(@client.opportunities.create_by_email("user@test.com", :name => "Jim", :type => "Good")).to eq({"name"=>"Jim", "type"=>"Good"}) assert_authorization_header end diff --git a/spec/pardot/objects/prospect_accounts_spec.rb b/spec/pardot/objects/prospect_accounts_spec.rb index 528bdf0..b90f873 100644 --- a/spec/pardot/objects/prospect_accounts_spec.rb +++ b/spec/pardot/objects/prospect_accounts_spec.rb @@ -26,11 +26,11 @@ def sample_results it "should take in some arguments and respond with valid items" do fake_get "/api/prospectAccount/version/3/do/query?assigned=true&format=simple", sample_results - @client.prospect_accounts.query(:assigned => true).should == {'total_results' => 2, + expect(@client.prospect_accounts.query(:assigned => true)).to eq({'total_results' => 2, 'prospectAccount'=>[ {'name'=>'Spaceships R Us'}, {'name'=>'Monsters Inc'} - ]} + ]}) assert_authorization_header end @@ -50,7 +50,7 @@ def sample_results it 'should return a valid account' do fake_post '/api/prospectAccount/version/3/do/read/id/1234?assigned=true&format=simple', sample_results - @client.prospect_accounts.read('1234', :assigned => true).should == {'id' => '1234', 'name' => 'SupaDupaPanda' } + expect(@client.prospect_accounts.read('1234', :assigned => true)).to eq({'id' => '1234', 'name' => 'SupaDupaPanda' }) assert_authorization_header end @@ -71,7 +71,7 @@ def sample_results it 'should return the prospect account' do fake_post '/api/prospectAccount/version/3/do/create?format=simple&name=SuperPanda', sample_results - @client.prospect_accounts.create(:name => 'SuperPanda').should == {"name"=>"SuperPanda"} + expect(@client.prospect_accounts.create(:name => 'SuperPanda')).to eq({"name"=>"SuperPanda"}) assert_authorization_header end diff --git a/spec/pardot/objects/prospects_spec.rb b/spec/pardot/objects/prospects_spec.rb index 17f85fd..f4b2be7 100644 --- a/spec/pardot/objects/prospects_spec.rb +++ b/spec/pardot/objects/prospects_spec.rb @@ -28,11 +28,11 @@ def sample_results it "should take in some arguments" do fake_get "/api/prospect/version/3/do/query?assigned=true&format=simple", sample_results - @client.prospects.query(:assigned => true).should == {"total_results" => 2, + expect(@client.prospects.query(:assigned => true)).to eq({"total_results" => 2, "prospect"=>[ {"last_name"=>"Smith", "first_name"=>"Jim"}, {"last_name"=>"Green", "first_name"=>"Sue"} - ]} + ]}) assert_authorization_header end @@ -53,7 +53,7 @@ def sample_results it "should return the prospect" do fake_post "/api/prospect/version/3/do/create/email/user%40test.com?first_name=Jim&format=simple", sample_results - @client.prospects.create("user@test.com", :first_name => "Jim").should == {"last_name"=>"Smith", "first_name"=>"Jim"} + expect(@client.prospects.create("user@test.com", :first_name => "Jim")).to eq({"last_name"=>"Smith", "first_name"=>"Jim"}) assert_authorization_header end diff --git a/spec/pardot/objects/users_spec.rb b/spec/pardot/objects/users_spec.rb index 76503b1..b33840e 100644 --- a/spec/pardot/objects/users_spec.rb +++ b/spec/pardot/objects/users_spec.rb @@ -31,11 +31,11 @@ def sample_results it "should take in some arguments" do fake_get "/api/user/version/3/do/query?id_greater_than=200&format=simple", sample_results - @client.users.query(:id_greater_than => 200).should == {"total_results" => 2, + expect(@client.users.query(:id_greater_than => 200)).to eq({"total_results" => 2, "user"=>[ {"email"=>"user@test.com", "first_name"=>"Jim"}, {"email"=>"user@example.com", "first_name"=>"Sue"} - ]} + ]}) assert_authorization_header end @@ -56,7 +56,7 @@ def sample_results it "should return the prospect" do fake_post "/api/user/version/3/do/read/email/user@test.com?format=simple", sample_results - @client.users.read_by_email("user@test.com").should == {"email"=>"user@example.com", "first_name"=>"Sue"} + expect(@client.users.read_by_email("user@test.com")).to eq({"email"=>"user@example.com", "first_name"=>"Sue"}) assert_authorization_header end diff --git a/spec/pardot/objects/visitor_activities_spec.rb b/spec/pardot/objects/visitor_activities_spec.rb index 864f356..30050ad 100644 --- a/spec/pardot/objects/visitor_activities_spec.rb +++ b/spec/pardot/objects/visitor_activities_spec.rb @@ -31,11 +31,11 @@ def sample_results it "should take in some arguments" do fake_get "/api/visitorActivity/version/3/do/query?id_greater_than=200&format=simple", sample_results - @client.visitor_activities.query(:id_greater_than => 200).should == {"total_results" => 2, + expect(@client.visitor_activities.query(:id_greater_than => 200)).to eq({"total_results" => 2, "visitorActivity"=>[ {"type_name"=>"Read", "details"=>"Some details"}, {"type_name"=>"Write", "details"=>"More details"} - ]} + ]}) assert_authorization_header end @@ -56,7 +56,7 @@ def sample_results it "should return the prospect" do fake_post "/api/visitorActivity/version/3/do/read/id/10?format=simple", sample_results - @client.visitor_activities.read(10).should == {"details"=>"More details", "type_name"=>"Write"} + expect(@client.visitor_activities.read(10)).to eq({"details"=>"More details", "type_name"=>"Write"}) assert_authorization_header end diff --git a/spec/pardot/objects/visitors_spec.rb b/spec/pardot/objects/visitors_spec.rb index 563be10..1d7c5a8 100644 --- a/spec/pardot/objects/visitors_spec.rb +++ b/spec/pardot/objects/visitors_spec.rb @@ -31,11 +31,11 @@ def sample_results it "should take in some arguments" do fake_get "/api/visitor/version/3/do/query?id_greater_than=200&format=simple", sample_results - @client.visitors.query(:id_greater_than => 200).should == {"total_results" => 2, + expect(@client.visitors.query(:id_greater_than => 200)).to eq({"total_results" => 2, "visitor"=>[ {"browser"=>"Firefox", "language"=>"en"}, {"browser"=>"Chrome", "language"=>"es"} - ]} + ]}) assert_authorization_header end @@ -56,7 +56,7 @@ def sample_results it "should return the prospect" do fake_post "/api/visitor/version/3/do/assign/id/10?type=Good&format=simple&name=Jim", sample_results - @client.visitors.assign(10, :name => "Jim", :type => "Good").should == {"browser"=>"Chrome", "language"=>"es"} + expect(@client.visitors.assign(10, :name => "Jim", :type => "Good")).to eq({"browser"=>"Chrome", "language"=>"es"}) assert_authorization_header end diff --git a/spec/pardot/objects/visits_spec.rb b/spec/pardot/objects/visits_spec.rb index 6e71742..36ac82d 100644 --- a/spec/pardot/objects/visits_spec.rb +++ b/spec/pardot/objects/visits_spec.rb @@ -31,11 +31,11 @@ def sample_results it "should take in some arguments" do fake_get "/api/visit/version/3/do/query?id_greater_than=200&format=simple", sample_results - @client.visits.query(:id_greater_than => 200).should == {"total_results" => 2, + expect(@client.visits.query(:id_greater_than => 200)).to eq({"total_results" => 2, "visit"=>[ {"duration_in_seconds"=>"50", "visitor_page_view_count"=>"3"}, {"duration_in_seconds"=>"10", "visitor_page_view_count"=>"1"} - ]} + ]}) assert_authorization_header end @@ -56,7 +56,7 @@ def sample_results it "should return the prospect" do fake_post "/api/visit/version/3/do/read/id/10?format=simple", sample_results - @client.visits.read(10).should == {"visitor_page_view_count"=>"1", "duration_in_seconds"=>"10"} + expect(@client.visits.read(10)).to eq({"visitor_page_view_count"=>"1", "duration_in_seconds"=>"10"}) assert_authorization_header end