diff --git a/.travis.yml b/.travis.yml index 79a7973..e27af6a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,8 @@ language: ruby rvm: - - 2.1.0 - - 2.0.0 - - 1.9.3 - - 1.9.2 - - jruby-19mode + - 2.2.0 + - 2.3.0 + - 2.4.0 before_install: - gem update bundler #script: rspec spec diff --git a/README.md b/README.md index e198ad8..816a460 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,15 @@ The Ruby SDK for AppConnect allows you to leverage the AppConnect v2 APIs. [![Build Status](https://travis-ci.org/constantcontact/ruby-sdk.png)](https://travis-ci.org/constantcontact/ruby-sdk) +Requirements +==== +The Constant Contact Ruby SDK requires Ruby 2.2+. + Installation ==== Via bundler: ```ruby -gem 'constantcontact', '~> 3.0.0' +gem 'constantcontact', '~> 4.0.0' ``` Otherwise: ```bash diff --git a/constantcontact.gemspec b/constantcontact.gemspec index 40edfce..fbb1ff1 100644 --- a/constantcontact.gemspec +++ b/constantcontact.gemspec @@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) Gem::Specification.new do |s| s.name = "constantcontact" - s.version = '3.0.0' + s.version = '4.0.0' s.platform = Gem::Platform::RUBY s.authors = ["ConstantContact"] s.homepage = "http://www.constantcontact.com" @@ -24,8 +24,7 @@ Gem::Specification.new do |s| s.require_paths = [ "lib" ] s.test_files = Dir['spec/**/*_spec.rb'] - s.add_runtime_dependency("rest-client", '~> 1.6', '>= 1.6.7') - s.add_runtime_dependency("json", '~> 1.8', '>= 1.8.1') - s.add_runtime_dependency('mime-types', '~> 2.4', '>= 2.4.1') - s.add_development_dependency("rspec", '~> 2.14') + s.add_runtime_dependency("rest-client", '~> 2.0') + s.add_runtime_dependency("json", '~> 2.1') + s.add_development_dependency("rspec", '~> 3.6') end diff --git a/lib/constantcontact/version.rb b/lib/constantcontact/version.rb index c7c3ff1..b9c03fb 100644 --- a/lib/constantcontact/version.rb +++ b/lib/constantcontact/version.rb @@ -7,6 +7,6 @@ module ConstantContact module SDK # Gem version - VERSION = "3.0.0" + VERSION = "4.0.0" end end diff --git a/spec/constantcontact/api_spec.rb b/spec/constantcontact/api_spec.rb index 63b6484..5086855 100644 --- a/spec/constantcontact/api_spec.rb +++ b/spec/constantcontact/api_spec.rb @@ -70,7 +70,7 @@ json_response = load_file('account_info_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) result = @api.get_account_info() @@ -84,7 +84,7 @@ json_response = load_file('verified_email_addresses_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) email_addresses = @api.get_verified_email_addresses() @@ -100,7 +100,7 @@ json_response = load_file('contacts_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) contacts = @api.get_contacts({:limit => 60}) @@ -115,7 +115,7 @@ json_response = load_file('contact_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) contact = @api.get_contact(1) @@ -128,7 +128,7 @@ json_response = load_file('contacts_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) contacts = @api.get_contact_by_email('rmartone@systems.com') @@ -141,7 +141,7 @@ json_response = load_file('contact_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:post).and_return(response) new_contact = ConstantContact::Components::Contact.create(JSON.parse(json_response)) @@ -156,11 +156,11 @@ contact_id = 196 net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) result = @api.delete_contact(contact_id) - result.should be_true + expect(result).to eq true end end @@ -169,11 +169,11 @@ contact_id = 196 net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) result = @api.delete_contact_from_lists(contact_id) - result.should be_true + expect(result).to eq true end end @@ -183,11 +183,11 @@ list_id = 1 net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) result = @api.delete_contact_from_list(contact_id, list_id) - result.should be_true + expect(result).to eq true end end @@ -196,7 +196,7 @@ json = load_file('contact_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:put).and_return(response) contact = ConstantContact::Components::Contact.create(JSON.parse(json)) result = @api.update_contact(contact) @@ -211,7 +211,7 @@ json_response = load_file('lists_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) lists = @api.get_lists() @@ -226,7 +226,7 @@ json = load_file('list_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) list = @api.get_list(1) @@ -240,7 +240,7 @@ json = load_file('list_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) new_list = ConstantContact::Components::ContactList.create(JSON.parse(json)) @@ -255,7 +255,7 @@ json = load_file('list_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:put).and_return(response) list = ConstantContact::Components::ContactList.create(JSON.parse(json)) @@ -271,7 +271,7 @@ json_contacts = load_file('contacts_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_contacts, net_http_resp, {}, @request) + response = RestClient::Response.create(json_contacts, net_http_resp, @request) RestClient.stub(:get).and_return(response) list = ConstantContact::Components::ContactList.create(JSON.parse(json_list)) @@ -292,7 +292,7 @@ json = load_file('events.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) events = @api.get_events() @@ -306,7 +306,7 @@ json = load_file('event.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) event = @api.get_event(1) @@ -319,7 +319,7 @@ json = load_file('event.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) event = ConstantContact::Components::Event.create(JSON.parse(json)) @@ -337,7 +337,7 @@ hash["status"] = "ACTIVE" net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(hash.to_json, net_http_resp, {}, @request) + response = RestClient::Response.create(hash.to_json, net_http_resp, @request) RestClient.stub(:patch).and_return(response) event = ConstantContact::Components::Event.create(JSON.parse(json)) @@ -355,7 +355,7 @@ hash["status"] = "CANCELLED" net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(hash.to_json, net_http_resp, {}, @request) + response = RestClient::Response.create(hash.to_json, net_http_resp, @request) RestClient.stub(:patch).and_return(response) event = ConstantContact::Components::Event.create(JSON.parse(json)) @@ -372,7 +372,7 @@ fees_json = load_file('fees.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(fees_json, net_http_resp, {}, @request) + response = RestClient::Response.create(fees_json, net_http_resp, @request) RestClient.stub(:get).and_return(response) event = ConstantContact::Components::Event.create(JSON.parse(event_json)) fees = @api.get_event_fees(event) @@ -390,7 +390,7 @@ fee_json = load_file('fees.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(fee_json, net_http_resp, {}, @request) + response = RestClient::Response.create(fee_json, net_http_resp, @request) RestClient.stub(:get).and_return(response) event = ConstantContact::Components::Event.create(JSON.parse(event_json)) @@ -406,7 +406,7 @@ fee_json = load_file('fee.json') net_http_resp = Net::HTTPResponse.new(1.0, 201, 'Created') - response = RestClient::Response.create(fee_json, net_http_resp, {}, @request) + response = RestClient::Response.create(fee_json, net_http_resp, @request) RestClient.stub(:post).and_return(response) event = ConstantContact::Components::Event.create(JSON.parse(event_json)) @@ -425,7 +425,7 @@ hash['fee'] += 1 net_http_resp = Net::HTTPResponse.new(1.0, 201, 'Created') - response = RestClient::Response.create(hash.to_json, net_http_resp, {}, @request) + response = RestClient::Response.create(hash.to_json, net_http_resp, @request) RestClient.stub(:put).and_return(response) event = ConstantContact::Components::Event.create(JSON.parse(event_json)) @@ -443,12 +443,12 @@ fee_json = load_file('fees.json') net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) event = ConstantContact::Components::Event.create(JSON.parse(event_json)) fee = ConstantContact::Components::EventFee.create(JSON.parse(fee_json)) - @api.delete_event_fee(event, fee).should be_true + expect(@api.delete_event_fee(event, fee)).to eq true end end @@ -458,7 +458,7 @@ registrants_json = load_file('registrants.json') net_http_resp = Net::HTTPResponse.new(1.0, 201, 'Created') - response = RestClient::Response.create(registrants_json, net_http_resp, {}, @request) + response = RestClient::Response.create(registrants_json, net_http_resp, @request) RestClient.stub(:get).and_return(response) event = ConstantContact::Components::Event.create(JSON.parse(event_json)) @@ -474,7 +474,7 @@ registrant_json = load_file('registrant.json') net_http_resp = Net::HTTPResponse.new(1.0, 201, 'Created') - response = RestClient::Response.create(registrant_json, net_http_resp, {}, @request) + response = RestClient::Response.create(registrant_json, net_http_resp, @request) RestClient.stub(:get).and_return(response) event = ConstantContact::Components::Event.create(JSON.parse(event_json)) @@ -490,7 +490,7 @@ json_response = load_file('event_items_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) results = @api.get_event_items(1) @@ -505,7 +505,7 @@ json = load_file('event_item_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) result = @api.get_event_item(1, 1) @@ -519,7 +519,7 @@ json = load_file('event_item_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) event_item = ConstantContact::Components::EventItem.create(JSON.parse(json)) @@ -533,11 +533,11 @@ it "deletes an event item" do net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) result = @api.delete_event_item(1, 1) - result.should be_true + expect(result).to eq true end end @@ -546,7 +546,7 @@ json = load_file('event_item_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:put).and_return(response) event_item = ConstantContact::Components::EventItem.create(JSON.parse(json)) @@ -561,7 +561,7 @@ json_response = load_file('event_item_attributes_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) results = @api.get_event_item_attributes(1, 1) @@ -576,7 +576,7 @@ json = load_file('event_item_attribute_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) result = @api.get_event_item_attribute(1, 1, 1) @@ -590,7 +590,7 @@ json = load_file('event_item_attribute_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) event_item_attribute = ConstantContact::Components::EventItemAttribute.create(JSON.parse(json)) @@ -604,11 +604,11 @@ it "deletes an event item attribute" do net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) result = @api.delete_event_item_attribute(1, 1, 1) - result.should be_true + expect(result).to eq true end end @@ -617,7 +617,7 @@ json = load_file('event_item_attribute_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:put).and_return(response) event_item_attribute = ConstantContact::Components::EventItemAttribute.create(JSON.parse(json)) @@ -632,7 +632,7 @@ json_response = load_file('promocodes_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) results = @api.get_promocodes(1) @@ -647,7 +647,7 @@ json = load_file('promocode_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) result = @api.get_promocode(1, 1) @@ -661,7 +661,7 @@ json = load_file('promocode_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) promocode = ConstantContact::Components::Promocode.create(JSON.parse(json)) @@ -675,11 +675,11 @@ it "deletes a promocode" do net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) result = @api.delete_promocode(1, 1) - result.should be_true + expect(result).to eq true end end @@ -688,7 +688,7 @@ json = load_file('promocode_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:put).and_return(response) promocode = ConstantContact::Components::Promocode.create(JSON.parse(json)) @@ -703,7 +703,7 @@ json_response = load_file('email_campaigns_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) campaigns = @api.get_email_campaigns({:limit => 2}) @@ -718,7 +718,7 @@ json_response = load_file('email_campaign_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) campaign = @api.get_email_campaign(1) @@ -732,7 +732,7 @@ json_response = load_file('email_campaign_preview_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) campaign_preview = @api.get_email_campaign_preview(1) @@ -746,7 +746,7 @@ json = load_file('email_campaign_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) new_campaign = ConstantContact::Components::Campaign.create(JSON.parse(json)) @@ -761,12 +761,12 @@ json = load_file('email_campaign_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) campaign = ConstantContact::Components::Campaign.create(JSON.parse(json)) result = @api.delete_email_campaign(campaign) - result.should be_true + expect(result).to eq true end end @@ -775,7 +775,7 @@ json = load_file('email_campaign_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:put).and_return(response) campaign = ConstantContact::Components::Campaign.create(JSON.parse(json)) @@ -791,7 +791,7 @@ json = load_file('schedule_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) new_schedule = ConstantContact::Components::Schedule.create(JSON.parse(json)) @@ -807,7 +807,7 @@ json = load_file('schedules_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) schedules = @api.get_email_campaign_schedules(campaign_id) @@ -824,7 +824,7 @@ json = load_file('schedule_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) schedule = @api.get_email_campaign_schedule(campaign_id, schedule_id) @@ -839,11 +839,11 @@ schedule_id = 1 net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) result = @api.delete_email_campaign_schedule(campaign_id, schedule_id) - result.should be_true + expect(result).to eq true end end @@ -853,7 +853,7 @@ json = load_file('schedule_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:put).and_return(response) schedule = ConstantContact::Components::Schedule.create(JSON.parse(json)) @@ -870,7 +870,7 @@ json_response = load_file('test_send_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:post).and_return(response) test_send = ConstantContact::Components::TestSend.create(JSON.parse(json_request)) @@ -887,7 +887,7 @@ json = load_file('campaign_tracking_bounces_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = @api.get_email_campaign_bounces(campaign_id, params) @@ -904,7 +904,7 @@ json = load_file('campaign_tracking_clicks_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = @api.get_email_campaign_clicks(campaign_id, params) @@ -921,7 +921,7 @@ json = load_file('campaign_tracking_forwards_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = @api.get_email_campaign_forwards(campaign_id, params) @@ -938,7 +938,7 @@ json = load_file('campaign_tracking_opens_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = @api.get_email_campaign_opens(campaign_id, params) @@ -955,7 +955,7 @@ json = load_file('campaign_tracking_sends_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = @api.get_email_campaign_sends(campaign_id, params) @@ -972,7 +972,7 @@ json = load_file('campaign_tracking_unsubscribes_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = @api.get_email_campaign_unsubscribes(campaign_id, params) @@ -988,7 +988,7 @@ json = load_file('campaign_tracking_summary_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) summary = @api.get_email_campaign_summary_report(campaign_id) @@ -1004,7 +1004,7 @@ json = load_file('contact_tracking_bounces_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = @api.get_contact_bounces(contact_id, params) @@ -1021,7 +1021,7 @@ json = load_file('contact_tracking_clicks_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = @api.get_contact_clicks(contact_id, params) @@ -1038,7 +1038,7 @@ json = load_file('contact_tracking_forwards_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = @api.get_contact_forwards(contact_id, params) @@ -1055,7 +1055,7 @@ json = load_file('contact_tracking_opens_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = @api.get_contact_opens(contact_id, params) @@ -1072,7 +1072,7 @@ json = load_file('contact_tracking_sends_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = @api.get_contact_sends(contact_id, params) @@ -1089,7 +1089,7 @@ json = load_file('contact_tracking_unsubscribes_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = @api.get_contact_unsubscribes(contact_id, params) @@ -1105,7 +1105,7 @@ json = load_file('contact_tracking_summary_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) summary = @api.get_contact_summary_report(contact_id) @@ -1119,7 +1119,7 @@ json_response = load_file('activities_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) activities = @api.get_activities() @@ -1133,7 +1133,7 @@ json_response = load_file('activity_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) activity = @api.get_activity('a07e1ilbm7shdg6ikeo') @@ -1148,7 +1148,7 @@ json_response = load_file('add_contacts_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:post).and_return(response) contacts = [] @@ -1239,7 +1239,7 @@ lists = 'list1, list2' net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) activity = @api.add_create_contacts_activity_from_file('contacts.txt', content, lists) @@ -1258,7 +1258,7 @@ net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_clear_lists, net_http_resp, {}, @request) + response = RestClient::Response.create(json_clear_lists, net_http_resp, @request) RestClient.stub(:post).and_return(response) activity = @api.add_clear_lists_activity(lists) @@ -1273,7 +1273,7 @@ lists = 'list1, list2' net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) email_addresses = ["djellesma@constantcontact.com"] @@ -1291,7 +1291,7 @@ lists = 'list1, list2' net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) activity = @api.add_remove_contacts_from_lists_activity_from_file('contacts.txt', content, lists) @@ -1306,7 +1306,7 @@ json_response = load_file('export_contacts_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:post).and_return(response) export_contacts = ConstantContact::Components::ExportContacts.new(JSON.parse(json_request)) @@ -1321,7 +1321,7 @@ json_response = load_file('library_info_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) info = @api.get_library_info() @@ -1335,7 +1335,7 @@ json_response = load_file('library_folders_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) folders = @api.get_library_folders({:limit => 2}) @@ -1350,7 +1350,7 @@ json = load_file('library_folder_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) new_folder = ConstantContact::Components::LibraryFolder.create(JSON.parse(json)) @@ -1365,7 +1365,7 @@ json = load_file('library_folder_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) folder = @api.get_library_folder(6) @@ -1379,7 +1379,7 @@ json = load_file('library_folder_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:put).and_return(response) folder = ConstantContact::Components::LibraryFolder.create(JSON.parse(json)) @@ -1394,11 +1394,11 @@ folder_id = 6 net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) result = @api.delete_library_folder(folder_id) - result.should be_true + expect(result).to eq true end end @@ -1407,7 +1407,7 @@ json = load_file('library_trash_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) files = @api.get_library_trash({:sort_by => 'SIZE_DESC'}) @@ -1421,11 +1421,11 @@ it "permanently deletes all files in the Trash folder" do net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) result = @api.delete_library_trash() - result.should be_true + expect(result).to eq true end end @@ -1434,7 +1434,7 @@ json_response = load_file('library_files_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) files = @api.get_library_files({:type => 'ALL'}) @@ -1450,7 +1450,7 @@ json_response = load_file('library_files_by_folder_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response = RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) files = @api.get_library_files_by_folder(folder_id, {:limit => 10}) @@ -1465,7 +1465,7 @@ json = load_file('library_file_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) file = @api.get_library_file(6) @@ -1485,7 +1485,7 @@ net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') net_http_resp.add_field('Location', '"https://api.d1.constantcontact.com/v2/library/files/123456789') - response = RestClient::Response.create("", net_http_resp, {}, @request) + response = RestClient::Response.create("", net_http_resp, @request) RestClient.stub(:post).and_return(response) response = @api.add_library_file(file_name, folder_id, description, source, file_type, contents) @@ -1499,7 +1499,7 @@ json = load_file('library_file_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:put).and_return(response) file = ConstantContact::Components::LibraryFile.create(JSON.parse(json)) @@ -1514,11 +1514,11 @@ file_id = '6, 7' net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) result = @api.delete_library_file(file_id) - result.should be_true + expect(result).to eq true end end @@ -1528,7 +1528,7 @@ json = load_file('library_files_upload_status_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) statuses = @api.get_library_files_upload_status(file_id) @@ -1545,7 +1545,7 @@ json = load_file('library_files_move_results_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:put).and_return(response) results = @api.move_library_files(folder_id, file_id) diff --git a/spec/constantcontact/sdk_spec.rb b/spec/constantcontact/sdk_spec.rb index 6767b20..d4cec7e 100644 --- a/spec/constantcontact/sdk_spec.rb +++ b/spec/constantcontact/sdk_spec.rb @@ -11,7 +11,7 @@ let(:dummy_class) { Class.new { include ConstantContact::SDK } } it "should respond to VERSION" do - expect((dummy_class.const_get("VERSION") rescue nil)).to be_true + expect((dummy_class.const_get("VERSION") rescue nil)).to be_truthy end it "should have a VERSION of type string" do diff --git a/spec/constantcontact/services/account_service_spec.rb b/spec/constantcontact/services/account_service_spec.rb index d3b9d32..5221243 100644 --- a/spec/constantcontact/services/account_service_spec.rb +++ b/spec/constantcontact/services/account_service_spec.rb @@ -17,7 +17,7 @@ json_response = load_file('account_info_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response =RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) result = ConstantContact::Services::AccountService.new(@client).get_account_info() @@ -33,7 +33,7 @@ json_response = load_file('verified_email_addresses_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response =RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) params = {} diff --git a/spec/constantcontact/services/activity_service_spec.rb b/spec/constantcontact/services/activity_service_spec.rb index 95fb6a1..3ecbc85 100644 --- a/spec/constantcontact/services/activity_service_spec.rb +++ b/spec/constantcontact/services/activity_service_spec.rb @@ -17,7 +17,7 @@ json_response = load_file('activities_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response =RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) activities = ConstantContact::Services::ActivityService.new(@client).get_activities() @@ -31,7 +31,7 @@ json_response = load_file('activity_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response =RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) activity = ConstantContact::Services::ActivityService.new(@client).get_activity('a07e1ilbm7shdg6ikeo') @@ -46,7 +46,7 @@ json_response = load_file('add_contacts_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response =RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:post).and_return(response) contacts = [] @@ -137,7 +137,7 @@ lists = 'list1, list2' net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) activity = ConstantContact::Services::ActivityService.new(@client).create_add_contacts_activity_from_file( @@ -157,7 +157,7 @@ net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_clear_lists, net_http_resp, {}, @request) + response =RestClient::Response.create(json_clear_lists, net_http_resp, @request) RestClient.stub(:post).and_return(response) activity = ConstantContact::Services::ActivityService.new(@client).add_clear_lists_activity(lists) @@ -172,7 +172,7 @@ lists = 'list1, list2' net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) email_addresses = ["djellesma@constantcontact.com"] @@ -190,7 +190,7 @@ lists = 'list1, list2' net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) activity = ConstantContact::Services::ActivityService.new(@client).add_remove_contacts_from_lists_activity_from_file( @@ -206,7 +206,7 @@ json_response = load_file('export_contacts_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response =RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:post).and_return(response) export_contacts = ConstantContact::Components::ExportContacts.new(JSON.parse(json_request)) @@ -223,7 +223,7 @@ json_response = load_file('remove_contacts_from_lists_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response =RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:post).and_return(response) request_object = JSON.parse(json_request) diff --git a/spec/constantcontact/services/base_service_spec.rb b/spec/constantcontact/services/base_service_spec.rb index fb3d7a5..71cc58d 100644 --- a/spec/constantcontact/services/base_service_spec.rb +++ b/spec/constantcontact/services/base_service_spec.rb @@ -23,10 +23,10 @@ expect(headers[:authorization]).to be_a String expect(headers[:authorization]).to eq("Bearer #{token}") expect(headers[:user_agent]).to be_a String - expect(headers[:user_agent].include?("Ruby SDK v#{ConstantContact::SDK::VERSION}")).to be_true - expect(headers[:user_agent].include?(RUBY_DESCRIPTION)).to be_true + expect(headers[:user_agent].include?("Ruby SDK v#{ConstantContact::SDK::VERSION}")).to be_truthy + expect(headers[:user_agent].include?(RUBY_DESCRIPTION)).to be_truthy expect(headers[:x_ctct_request_source]).to be_a String - expect(headers[:x_ctct_request_source].include?(ConstantContact::SDK::VERSION)).to be_true + expect(headers[:x_ctct_request_source].include?(ConstantContact::SDK::VERSION)).to be_truthy end end @@ -35,8 +35,8 @@ components = ConstantContact::Services::BaseService.new(@client).send(:build_url, "http://testing.com", :arg1 => 'abc', :arg2 => 123).split('&') expect(components[0]).to eq('http://testing.com?api_key=api+key') expect(components.length).to eq(3) - expect(components.include?('arg1=abc')).to be_true - expect(components.include?('arg2=123')).to be_true + expect(components.include?('arg1=abc')).to be_truthy + expect(components.include?('arg2=123')).to be_truthy end it "does not parse the next param when not in next_link format" do diff --git a/spec/constantcontact/services/campaign_schedule_service_spec.rb b/spec/constantcontact/services/campaign_schedule_service_spec.rb index 79ce2db..fd6b75c 100644 --- a/spec/constantcontact/services/campaign_schedule_service_spec.rb +++ b/spec/constantcontact/services/campaign_schedule_service_spec.rb @@ -18,7 +18,7 @@ json = load_file('schedule_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) new_schedule = ConstantContact::Components::Schedule.create(JSON.parse(json)) @@ -35,7 +35,7 @@ json = load_file('schedules_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) schedules = ConstantContact::Services::CampaignScheduleService.new(@client).get_schedules( @@ -53,7 +53,7 @@ json = load_file('schedule_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) schedule = ConstantContact::Services::CampaignScheduleService.new(@client).get_schedule( @@ -69,12 +69,12 @@ schedule_id = 1 net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) result = ConstantContact::Services::CampaignScheduleService.new(@client).delete_schedule( campaign_id, schedule_id) - result.should be_true + expect(result).to eq true end end @@ -84,7 +84,7 @@ json = load_file('schedule_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:put).and_return(response) schedule = ConstantContact::Components::Schedule.create(JSON.parse(json)) @@ -102,7 +102,7 @@ json_response = load_file('test_send_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response =RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:post).and_return(response) test_send = ConstantContact::Components::TestSend.create(JSON.parse(json_request)) diff --git a/spec/constantcontact/services/campaign_tracking_service_spec.rb b/spec/constantcontact/services/campaign_tracking_service_spec.rb index 6043094..7159cf2 100644 --- a/spec/constantcontact/services/campaign_tracking_service_spec.rb +++ b/spec/constantcontact/services/campaign_tracking_service_spec.rb @@ -19,7 +19,7 @@ json = load_file('campaign_tracking_bounces_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = ConstantContact::Services::CampaignTrackingService.new(@client).get_bounces(campaign_id, params) @@ -36,7 +36,7 @@ json = load_file('campaign_tracking_clicks_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = ConstantContact::Services::CampaignTrackingService.new(@client).get_clicks(campaign_id, params) @@ -53,7 +53,7 @@ json = load_file('campaign_tracking_forwards_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = ConstantContact::Services::CampaignTrackingService.new(@client).get_forwards(campaign_id, params) @@ -70,7 +70,7 @@ json = load_file('campaign_tracking_opens_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = ConstantContact::Services::CampaignTrackingService.new(@client).get_opens(campaign_id, params) @@ -87,7 +87,7 @@ json = load_file('campaign_tracking_sends_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = ConstantContact::Services::CampaignTrackingService.new(@client).get_sends(campaign_id, params) @@ -104,7 +104,7 @@ json = load_file('campaign_tracking_unsubscribes_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = ConstantContact::Services::CampaignTrackingService.new(@client).get_unsubscribes(campaign_id, params) @@ -120,7 +120,7 @@ json = load_file('campaign_tracking_summary_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) summary = ConstantContact::Services::CampaignTrackingService.new(@client).get_summary(campaign_id) diff --git a/spec/constantcontact/services/contact_service_spec.rb b/spec/constantcontact/services/contact_service_spec.rb index 8c4b73e..ec804c1 100644 --- a/spec/constantcontact/services/contact_service_spec.rb +++ b/spec/constantcontact/services/contact_service_spec.rb @@ -17,7 +17,7 @@ json = load_file('contacts_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) contacts = ConstantContact::Services::ContactService.new(@client).get_contacts() contact = contacts.results[0] @@ -32,7 +32,7 @@ json = load_file('contact_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) contact = ConstantContact::Services::ContactService.new(@client).get_contact(1) @@ -45,7 +45,7 @@ json = load_file('contact_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) new_contact = ConstantContact::Components::Contact.create(JSON.parse(json)) contact = ConstantContact::Services::ContactService.new(@client).add_contact(new_contact) @@ -60,11 +60,11 @@ contact_id = 196 net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) result = ConstantContact::Services::ContactService.new(@client).delete_contact(contact_id) - result.should be_true + expect(result).to eq true end end @@ -73,11 +73,11 @@ contact_id = 196 net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) result = ConstantContact::Services::ContactService.new(@client).delete_contact_from_lists(contact_id) - result.should be_true + expect(result).to eq true end end @@ -87,11 +87,11 @@ list_id = 1 net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) result = ConstantContact::Services::ContactService.new(@client).delete_contact_from_list(contact_id, list_id) - result.should be_true + expect(result).to eq true end end @@ -100,7 +100,7 @@ json = load_file('contact_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:put).and_return(response) contact = ConstantContact::Components::Contact.create(JSON.parse(json)) result = ConstantContact::Services::ContactService.new(@client).update_contact(contact) diff --git a/spec/constantcontact/services/contact_tracking_service_spec.rb b/spec/constantcontact/services/contact_tracking_service_spec.rb index 61dea0b..9728300 100644 --- a/spec/constantcontact/services/contact_tracking_service_spec.rb +++ b/spec/constantcontact/services/contact_tracking_service_spec.rb @@ -19,7 +19,7 @@ json = load_file('contact_tracking_bounces_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = ConstantContact::Services::ContactTrackingService.new(@client).get_bounces(contact_id, params) @@ -36,7 +36,7 @@ json = load_file('contact_tracking_clicks_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = ConstantContact::Services::ContactTrackingService.new(@client).get_clicks(contact_id, params) @@ -53,7 +53,7 @@ json = load_file('contact_tracking_forwards_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = ConstantContact::Services::ContactTrackingService.new(@client).get_forwards(contact_id, params) @@ -70,7 +70,7 @@ json = load_file('contact_tracking_opens_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = ConstantContact::Services::ContactTrackingService.new(@client).get_opens(contact_id, params) @@ -87,7 +87,7 @@ json = load_file('contact_tracking_sends_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = ConstantContact::Services::ContactTrackingService.new(@client).get_sends(contact_id, params) @@ -104,7 +104,7 @@ json = load_file('contact_tracking_unsubscribes_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) set = ConstantContact::Services::ContactTrackingService.new(@client).get_unsubscribes(contact_id, params) @@ -120,7 +120,7 @@ json = load_file('contact_tracking_summary_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) summary = ConstantContact::Services::CampaignTrackingService.new(@client).get_summary(contact_id) diff --git a/spec/constantcontact/services/email_marketing_spec.rb b/spec/constantcontact/services/email_marketing_spec.rb index 6f0982b..da60cc5 100644 --- a/spec/constantcontact/services/email_marketing_spec.rb +++ b/spec/constantcontact/services/email_marketing_spec.rb @@ -17,7 +17,7 @@ json_response = load_file('email_campaigns_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response =RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) campaigns = ConstantContact::Services::EmailMarketingService.new(@client).get_campaigns() @@ -32,7 +32,7 @@ json_response = load_file('email_campaign_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response =RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) campaign = ConstantContact::Services::EmailMarketingService.new(@client).get_campaign(1) @@ -46,7 +46,7 @@ json_response = load_file('email_campaign_preview_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response =RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) campaign_preview = ConstantContact::Services::EmailMarketingService.new(@client).get_campaign_preview(1) @@ -60,7 +60,7 @@ json = load_file('email_campaign_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) new_campaign = ConstantContact::Components::Campaign.create(JSON.parse(json)) @@ -75,12 +75,12 @@ json = load_file('email_campaign_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) campaign = ConstantContact::Components::Campaign.create(JSON.parse(json)) result = ConstantContact::Services::EmailMarketingService.new(@client).delete_campaign(campaign) - result.should be_true + expect(result).to eq true end end @@ -89,7 +89,7 @@ json = load_file('email_campaign_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:put).and_return(response) campaign = ConstantContact::Components::Campaign.create(JSON.parse(json)) diff --git a/spec/constantcontact/services/event_spot_spec.rb b/spec/constantcontact/services/event_spot_spec.rb index f5dcdf3..a42e0dc 100644 --- a/spec/constantcontact/services/event_spot_spec.rb +++ b/spec/constantcontact/services/event_spot_spec.rb @@ -17,7 +17,7 @@ json = load_file('events.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) events = ConstantContact::Services::EventSpotService.new(@client).get_events() events.should be_kind_of(ConstantContact::Components::ResultSet) @@ -30,7 +30,7 @@ json = load_file('event.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) event = ConstantContact::Services::EventSpotService.new(@client).get_event(1) @@ -43,7 +43,7 @@ json = load_file('event.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) event = ConstantContact::Components::Event.create(JSON.parse(json)) added = ConstantContact::Services::EventSpotService.new(@client).add_event(event) @@ -60,7 +60,7 @@ hash["status"] = "ACTIVE" net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(hash.to_json, net_http_resp, {}, @request) + response = RestClient::Response.create(hash.to_json, net_http_resp, @request) RestClient.stub(:patch).and_return(response) event = ConstantContact::Components::Event.create(JSON.parse(json)) @@ -78,7 +78,7 @@ hash["status"] = "CANCELLED" net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(hash.to_json, net_http_resp, {}, @request) + response = RestClient::Response.create(hash.to_json, net_http_resp, @request) RestClient.stub(:patch).and_return(response) event = ConstantContact::Components::Event.create(JSON.parse(json)) @@ -95,7 +95,7 @@ fees_json = load_file('fees.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(fees_json, net_http_resp, {}, @request) + response =RestClient::Response.create(fees_json, net_http_resp, @request) RestClient.stub(:get).and_return(response) event = ConstantContact::Components::Event.create(JSON.parse(event_json)) fees = ConstantContact::Services::EventSpotService.new(@client).get_fees(event) @@ -113,7 +113,7 @@ fee_json = load_file('fees.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(fee_json, net_http_resp, {}, @request) + response =RestClient::Response.create(fee_json, net_http_resp, @request) RestClient.stub(:get).and_return(response) event = ConstantContact::Components::Event.create(JSON.parse(event_json)) @@ -129,7 +129,7 @@ fee_json = load_file('fee.json') net_http_resp = Net::HTTPResponse.new(1.0, 201, 'Created') - response = RestClient::Response.create(fee_json, net_http_resp, {}, @request) + response =RestClient::Response.create(fee_json, net_http_resp, @request) RestClient.stub(:post).and_return(response) event = ConstantContact::Components::Event.create(JSON.parse(event_json)) @@ -148,7 +148,7 @@ hash['fee'] += 1 net_http_resp = Net::HTTPResponse.new(1.0, 201, 'Created') - response = RestClient::Response.create(hash.to_json, net_http_resp, {}, @request) + response = RestClient::Response.create(hash.to_json, net_http_resp, @request) RestClient.stub(:put).and_return(response) event = ConstantContact::Components::Event.create(JSON.parse(event_json)) @@ -166,12 +166,12 @@ fee_json = load_file('fees.json') net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) event = ConstantContact::Components::Event.create(JSON.parse(event_json)) fee = ConstantContact::Components::EventFee.create(JSON.parse(fee_json)) - ConstantContact::Services::EventSpotService.new(@client).delete_fee(event, fee).should be_true + expect(ConstantContact::Services::EventSpotService.new(@client).delete_fee(event, fee)).to eq true end end @@ -181,7 +181,7 @@ registrants_json = load_file('registrants.json') net_http_resp = Net::HTTPResponse.new(1.0, 201, 'Created') - response = RestClient::Response.create(registrants_json, net_http_resp, {}, @request) + response =RestClient::Response.create(registrants_json, net_http_resp, @request) RestClient.stub(:get).and_return(response) event = ConstantContact::Components::Event.create(JSON.parse(event_json)) @@ -197,7 +197,7 @@ registrant_json = load_file('registrant.json') net_http_resp = Net::HTTPResponse.new(1.0, 201, 'Created') - response = RestClient::Response.create(registrant_json, net_http_resp, {}, @request) + response =RestClient::Response.create(registrant_json, net_http_resp, @request) RestClient.stub(:get).and_return(response) event = ConstantContact::Components::Event.create(JSON.parse(event_json)) @@ -213,7 +213,7 @@ json_response = load_file('event_items_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response =RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) results = ConstantContact::Services::EventSpotService.new(@client).get_event_items(1) @@ -228,7 +228,7 @@ json = load_file('event_item_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) result = ConstantContact::Services::EventSpotService.new(@client).get_event_item(1, 1) @@ -242,7 +242,7 @@ json = load_file('event_item_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) event_item = ConstantContact::Components::EventItem.create(JSON.parse(json)) @@ -256,11 +256,11 @@ it "deletes an event item" do net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) result = ConstantContact::Services::EventSpotService.new(@client).delete_event_item(1, 1) - result.should be_true + expect(result).to eq true end end @@ -269,7 +269,7 @@ json = load_file('event_item_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:put).and_return(response) event_item = ConstantContact::Components::EventItem.create(JSON.parse(json)) @@ -284,7 +284,7 @@ json_response = load_file('event_item_attributes_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response =RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) results = ConstantContact::Services::EventSpotService.new(@client).get_event_item_attributes(1, 1) @@ -299,7 +299,7 @@ json = load_file('event_item_attribute_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) result = ConstantContact::Services::EventSpotService.new(@client).get_event_item_attribute(1, 1, 1) @@ -313,7 +313,7 @@ json = load_file('event_item_attribute_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) event_item_attribute = ConstantContact::Components::EventItemAttribute.create(JSON.parse(json)) @@ -327,11 +327,11 @@ it "deletes an event item attribute" do net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) result = ConstantContact::Services::EventSpotService.new(@client).delete_event_item_attribute(1, 1, 1) - result.should be_true + expect(result).to eq true end end @@ -340,7 +340,7 @@ json = load_file('event_item_attribute_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:put).and_return(response) event_item_attribute = ConstantContact::Components::EventItemAttribute.create(JSON.parse(json)) @@ -355,7 +355,7 @@ json_response = load_file('promocodes_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response =RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) results = ConstantContact::Services::EventSpotService.new(@client).get_promocodes(1) @@ -370,7 +370,7 @@ json = load_file('promocode_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) result = ConstantContact::Services::EventSpotService.new(@client).get_promocode(1, 1) @@ -384,7 +384,7 @@ json = load_file('promocode_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) promocode = ConstantContact::Components::Promocode.create(JSON.parse(json)) @@ -398,11 +398,11 @@ it "deletes a promocode" do net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) result = ConstantContact::Services::EventSpotService.new(@client).delete_promocode(1, 1) - result.should be_true + expect(result).to eq true end end @@ -411,7 +411,7 @@ json = load_file('promocode_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:put).and_return(response) promocode = ConstantContact::Components::Promocode.create(JSON.parse(json)) diff --git a/spec/constantcontact/services/library_service_spec.rb b/spec/constantcontact/services/library_service_spec.rb index 7c3bc74..8e6f383 100644 --- a/spec/constantcontact/services/library_service_spec.rb +++ b/spec/constantcontact/services/library_service_spec.rb @@ -17,7 +17,7 @@ json_response = load_file('library_info_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response =RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) info = ConstantContact::Services::LibraryService.new(@client).get_library_info() @@ -31,7 +31,7 @@ json_response = load_file('library_folders_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response =RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) folders = ConstantContact::Services::LibraryService.new(@client).get_library_folders({:limit => 2}) @@ -46,7 +46,7 @@ json = load_file('library_folder_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) new_folder = ConstantContact::Components::LibraryFolder.create(JSON.parse(json)) @@ -61,7 +61,7 @@ json = load_file('library_folder_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) folder = ConstantContact::Services::LibraryService.new(@client).get_library_folder(6) @@ -75,7 +75,7 @@ json = load_file('library_folder_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:put).and_return(response) folder = ConstantContact::Components::LibraryFolder.create(JSON.parse(json)) @@ -90,11 +90,11 @@ folder_id = 6 net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) result = ConstantContact::Services::LibraryService.new(@client).delete_library_folder(folder_id) - result.should be_true + expect(result).to eq true end end @@ -103,7 +103,7 @@ json = load_file('library_trash_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) files = ConstantContact::Services::LibraryService.new(@client).get_library_trash({:sort_by => 'SIZE_DESC'}) @@ -117,11 +117,11 @@ it "permanently deletes all files in the Trash folder" do net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) result = ConstantContact::Services::LibraryService.new(@client).delete_library_trash() - result.should be_true + expect(result).to eq true end end @@ -130,7 +130,7 @@ json_response = load_file('library_files_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response =RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) files = ConstantContact::Services::LibraryService.new(@client).get_library_files({:type => 'ALL'}) @@ -146,7 +146,7 @@ json_response = load_file('library_files_by_folder_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response =RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) files = ConstantContact::Services::LibraryService.new(@client).get_library_files_by_folder(folder_id, {:limit => 10}) @@ -161,7 +161,7 @@ json = load_file('library_file_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) file = ConstantContact::Services::LibraryService.new(@client).get_library_file(6) @@ -181,7 +181,7 @@ net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') net_http_resp.add_field('Location', 'https://api.d1.constantcontact.com/v2/library/files/123456789') - response = RestClient::Response.create("", net_http_resp, {}, @request) + response = RestClient::Response.create("", net_http_resp, @request) RestClient.stub(:post).and_return(response) response = ConstantContact::Services::LibraryService.new(@client).add_library_file(file_name, folder_id, description, source, file_type, contents) @@ -195,7 +195,7 @@ json = load_file('library_file_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:put).and_return(response) file = ConstantContact::Components::LibraryFile.create(JSON.parse(json)) @@ -210,11 +210,11 @@ file_id = '6, 7' net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}, @request) + response = RestClient::Response.create('', net_http_resp, @request) RestClient.stub(:delete).and_return(response) result = ConstantContact::Services::LibraryService.new(@client).delete_library_file(file_id) - result.should be_true + expect(result).to eq true end end @@ -224,7 +224,7 @@ json = load_file('library_files_upload_status_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) statuses = ConstantContact::Services::LibraryService.new(@client).get_library_files_upload_status(file_id) @@ -241,7 +241,7 @@ json = load_file('library_files_move_results_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:put).and_return(response) results = ConstantContact::Services::LibraryService.new(@client).move_library_files(folder_id, file_id) diff --git a/spec/constantcontact/services/list_service_spec.rb b/spec/constantcontact/services/list_service_spec.rb index c9944c6..4305c6d 100644 --- a/spec/constantcontact/services/list_service_spec.rb +++ b/spec/constantcontact/services/list_service_spec.rb @@ -17,7 +17,7 @@ json_response = load_file('lists_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_response, net_http_resp, {}, @request) + response =RestClient::Response.create(json_response, net_http_resp, @request) RestClient.stub(:get).and_return(response) lists = ConstantContact::Services::ListService.new(@client).get_lists() @@ -32,7 +32,7 @@ json = load_file('list_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:get).and_return(response) list = ConstantContact::Services::ListService.new(@client).get_list(1) @@ -46,7 +46,7 @@ json = load_file('list_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:post).and_return(response) new_list = ConstantContact::Components::ContactList.create(JSON.parse(json)) @@ -61,7 +61,7 @@ json = load_file('list_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}, @request) + response = RestClient::Response.create(json, net_http_resp, @request) RestClient.stub(:put).and_return(response) list = ConstantContact::Components::ContactList.create(JSON.parse(json)) @@ -77,7 +77,7 @@ json_contacts = load_file('contacts_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_contacts, net_http_resp, {}, @request) + response =RestClient::Response.create(json_contacts, net_http_resp, @request) RestClient.stub(:get).and_return(response) list = ConstantContact::Components::ContactList.create(JSON.parse(json_list))