spec/constantcontact/api_spec.rb in constantcontact-2.0.0 vs spec/constantcontact/api_spec.rb in constantcontact-2.0.1

- old
+ new

@@ -6,17 +6,17 @@ require 'spec_helper' describe ConstantContact::Api do - before(:all) { + before(:all) do ConstantContact::Util::Config.configure do |config| config[:auth].delete :api_key config[:auth].delete :api_secret config[:auth].delete :redirect_uri end - } + end it "without api_key defined" do lambda { ConstantContact::Api.new }.should raise_error(ArgumentError, ConstantContact::Util::Config.get('errors.api_key_missing')) @@ -62,18 +62,19 @@ end describe "test methods" do before(:each) do @api = ConstantContact::Api.new('api key', 'access token') + @request = double('http request', :user => nil, :password => nil, :url => 'http://example.com', :redirection_history => nil) end describe "#get_account_info" do it "gets a summary of account information" do 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, {}) + response = RestClient::Response.create(json_response, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) result = @api.get_account_info() result.should be_kind_of(ConstantContact::Components::AccountInfo) result.website.should eq('http://www.example.com') @@ -83,11 +84,11 @@ describe "#get_verified_email_addresses" do it "gets verified addresses for the account" do 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, {}) + response = RestClient::Response.create(json_response, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) email_addresses = @api.get_verified_email_addresses() email_addresses.should be_kind_of(Array) @@ -99,11 +100,11 @@ describe "#get_contacts" do it "returns an array of contacts" do 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, {}) + response = RestClient::Response.create(json_response, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) contacts = @api.get_contacts({:limit => 60}) contacts.should be_kind_of(ConstantContact::Components::ResultSet) contacts.results.first.should be_kind_of(ConstantContact::Components::Contact) @@ -114,11 +115,11 @@ describe "#get_contact" do it "returns a contact" do 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, {}) + response = RestClient::Response.create(json_response, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) contact = @api.get_contact(1) contact.should be_kind_of(ConstantContact::Components::Contact) end @@ -127,11 +128,11 @@ describe "#get_contact_by_email" do it "returns a contact" do 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, {}) + 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') contacts.results.first.should be_kind_of(ConstantContact::Components::Contact) end @@ -140,11 +141,11 @@ describe "#add_contact" do it "adds a contact" do 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, {}) + 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)) contact = @api.add_contact(new_contact) contact.should be_kind_of(ConstantContact::Components::Contact) @@ -155,11 +156,11 @@ describe "#delete_contact" do it "deletes a contact" do contact_id = 196 net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}) + response = RestClient::Response.create('', net_http_resp, {}, @request) RestClient.stub(:delete).and_return(response) result = @api.delete_contact(contact_id) result.should be_true end @@ -168,11 +169,11 @@ describe "#delete_contact_from_lists" do it "deletes a contact" do contact_id = 196 net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}) + 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 end @@ -182,11 +183,11 @@ it "deletes a contact" do contact_id = 196 list_id = 1 net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}) + 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 end @@ -195,11 +196,11 @@ describe "#update_contact" do it "updates a contact" do json = load_file('contact_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}) + 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) result.should be_kind_of(ConstantContact::Components::Contact) @@ -210,11 +211,11 @@ describe "#get_lists" do it "returns an array of lists" do 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, {}) + response = RestClient::Response.create(json_response, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) lists = @api.get_lists() lists.should be_kind_of(Array) lists.first.should be_kind_of(ConstantContact::Components::ContactList) @@ -225,11 +226,11 @@ describe "#get_list" do it "returns a list" do json = load_file('list_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) list = @api.get_list(1) list.should be_kind_of(ConstantContact::Components::ContactList) list.name.should eq('Monthly Specials') @@ -239,11 +240,11 @@ describe "#add_list" do it "adds a list" do json = load_file('list_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:post).and_return(response) new_list = ConstantContact::Components::ContactList.create(JSON.parse(json)) list = @api.add_list(new_list) list.should be_kind_of(ConstantContact::Components::ContactList) @@ -254,11 +255,11 @@ describe "#update_list" do it "updates a list" do json = load_file('list_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:put).and_return(response) list = ConstantContact::Components::ContactList.create(JSON.parse(json)) result = @api.update_list(list) result.should be_kind_of(ConstantContact::Components::ContactList) @@ -270,11 +271,11 @@ it "returns an array of contacts" do json_list = load_file('list_response.json') 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, {}) + 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)) contacts = @api.get_contacts_from_list(list, "?limit=4&next=true") contacts.should be_kind_of(ConstantContact::Components::ResultSet) @@ -291,11 +292,11 @@ describe "#get_events" do it "returns an array of events" do json = load_file('events.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) events = @api.get_events() events.should be_kind_of(ConstantContact::Components::ResultSet) events.results.collect{|e| e.should be_kind_of(ConstantContact::Components::Event) } @@ -305,11 +306,11 @@ describe "#get_event" do it "returns an event" do json = load_file('event.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) event = @api.get_event(1) event.should be_kind_of(ConstantContact::Components::Event) end @@ -318,11 +319,11 @@ describe "#add_event" do it "adds an event" do json = load_file('event.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:post).and_return(response) event = ConstantContact::Components::Event.create(JSON.parse(json)) added = @api.add_event(event) @@ -336,11 +337,11 @@ json = load_file('event.json') hash = JSON.parse json hash["status"] = "ACTIVE" net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(hash.to_json, net_http_resp, {}) + 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)) updated = @api.publish_event(event) updated.should be_kind_of(ConstantContact::Components::Event) @@ -354,11 +355,11 @@ json = load_file('event.json') hash = JSON.parse json hash["status"] = "CANCELLED" net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(hash.to_json, net_http_resp, {}) + 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)) updated = @api.cancel_event(event) updated.should be_kind_of(ConstantContact::Components::Event) @@ -371,11 +372,11 @@ it "returns an array of fees for an event" do event_json = load_file('event.json') 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, {}) + 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) #fees.should be_kind_of(ConstantContact::Components::ResultSet) #fees.results.collect{|f| f.should be_kind_of(ConstantContact::Components::Fee) } @@ -389,11 +390,11 @@ it "return an event fee" do event_json = load_file('event.json') 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, {}) + 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)) fee = ConstantContact::Components::EventFee.create(JSON.parse(fee_json)) retrieved = @api.get_event_fee(event, fee) @@ -405,11 +406,11 @@ it "adds an event fee" do event_json = load_file('event.json') 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, {}) + 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)) fee = ConstantContact::Components::EventFee.create(JSON.parse(fee_json)) added = @api.add_event_fee(event, fee) @@ -424,11 +425,11 @@ fee_json = load_file('fee.json') hash = JSON.parse fee_json hash['fee'] += 1 net_http_resp = Net::HTTPResponse.new(1.0, 201, 'Created') - response = RestClient::Response.create(hash.to_json, net_http_resp, {}) + 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)) fee = ConstantContact::Components::EventFee.create(JSON.parse(fee_json)) updated = @api.update_event_fee(event, fee) @@ -442,11 +443,11 @@ it "deletes an event fee" do event_json = load_file('event.json') fee_json = load_file('fees.json') net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}) + 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 @@ -457,11 +458,11 @@ it "returns an array of event registrants" do event_json = load_file('event.json') 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, {}) + 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)) registrants = @api.get_event_registrants(event) registrants.should be_kind_of(ConstantContact::Components::ResultSet) @@ -473,11 +474,11 @@ it "returns an event registrant" do event_json = load_file('event.json') 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, {}) + 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)) registrant = ConstantContact::Components::Registrant.create(JSON.parse(registrant_json)) retrieved = @api.get_event_registrant(event, registrant) @@ -489,11 +490,11 @@ describe "#get_event_items" do it "returns an array of event items" do 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, {}) + response = RestClient::Response.create(json_response, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) results = @api.get_event_items(1) results.should be_kind_of(Array) results.first.should be_kind_of(ConstantContact::Components::EventItem) @@ -504,11 +505,11 @@ describe "#get_event_item" do it "returns an event item" do 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, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) result = @api.get_event_item(1, 1) result.should be_kind_of(ConstantContact::Components::EventItem) result.name.should eq('Running Belt') @@ -518,11 +519,11 @@ describe "#add_event_item" do it "adds an event item" do 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, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:post).and_return(response) event_item = ConstantContact::Components::EventItem.create(JSON.parse(json)) result = @api.add_event_item(1, event_item) result.should be_kind_of(ConstantContact::Components::EventItem) @@ -532,11 +533,11 @@ describe "#delete_event_item" do it "deletes an event item" do net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}) + 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 end @@ -545,11 +546,11 @@ describe "#update_event_item" do it "updates an event item" do 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, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:put).and_return(response) event_item = ConstantContact::Components::EventItem.create(JSON.parse(json)) result = @api.update_event_item(1, event_item) result.should be_kind_of(ConstantContact::Components::EventItem) @@ -560,11 +561,11 @@ describe "#get_event_item_attributes" do it "returns an array of event item attributes" do 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, {}) + response = RestClient::Response.create(json_response, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) results = @api.get_event_item_attributes(1, 1) results.should be_kind_of(Array) results.first.should be_kind_of(ConstantContact::Components::EventItemAttribute) @@ -575,11 +576,11 @@ describe "#get_event_item_attribute" do it "returns an event item attribute" do 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, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) result = @api.get_event_item_attribute(1, 1, 1) result.should be_kind_of(ConstantContact::Components::EventItemAttribute) result.name.should eq('Hi-Vis Green') @@ -589,11 +590,11 @@ describe "#add_event_item_attribute" do it "adds an event item attribute" do 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, {}) + 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)) result = @api.add_event_item_attribute(1, 1, event_item_attribute) result.should be_kind_of(ConstantContact::Components::EventItemAttribute) @@ -603,11 +604,11 @@ describe "#delete_event_item_attribute" do 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, {}) + 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 end @@ -616,11 +617,11 @@ describe "#update_event_item_attribute" do it "updates an event item attribute" do 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, {}) + 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)) result = @api.update_event_item_attribute(1, 1, event_item_attribute) result.should be_kind_of(ConstantContact::Components::EventItemAttribute) @@ -631,11 +632,11 @@ describe "#get_promocodes" do it "returns an array of promocodes" do 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, {}) + response = RestClient::Response.create(json_response, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) results = @api.get_promocodes(1) results.should be_kind_of(Array) results.first.should be_kind_of(ConstantContact::Components::Promocode) @@ -646,11 +647,11 @@ describe "#get_promocode" do it "returns a promocode" do json = load_file('promocode_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) result = @api.get_promocode(1, 1) result.should be_kind_of(ConstantContact::Components::Promocode) result.code_name.should eq('TOTAL_FEE') @@ -660,11 +661,11 @@ describe "#add_promocode" do it "adds a promocode" do json = load_file('promocode_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:post).and_return(response) promocode = ConstantContact::Components::Promocode.create(JSON.parse(json)) result = @api.add_promocode(1, promocode) result.should be_kind_of(ConstantContact::Components::Promocode) @@ -674,11 +675,11 @@ describe "#delete_promocode" do it "deletes a promocode" do net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}) + response = RestClient::Response.create('', net_http_resp, {}, @request) RestClient.stub(:delete).and_return(response) result = @api.delete_promocode(1, 1) result.should be_true end @@ -687,11 +688,11 @@ describe "#update_promocode" do it "updates an event item" do json = load_file('promocode_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:put).and_return(response) promocode = ConstantContact::Components::Promocode.create(JSON.parse(json)) result = @api.update_promocode(1, promocode) result.should be_kind_of(ConstantContact::Components::Promocode) @@ -702,11 +703,11 @@ describe "#get_email_campaigns" do it "gets a set of campaigns" do 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, {}) + response = RestClient::Response.create(json_response, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) campaigns = @api.get_email_campaigns({:limit => 2}) campaigns.should be_kind_of(ConstantContact::Components::ResultSet) campaigns.results.first.should be_kind_of(ConstantContact::Components::Campaign) @@ -717,11 +718,11 @@ describe "#get_email_campaign" do it "gets an individual campaign" do 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, {}) + response = RestClient::Response.create(json_response, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) campaign = @api.get_email_campaign(1) campaign.should be_kind_of(ConstantContact::Components::Campaign) campaign.name.should eq('Campaign Name') @@ -731,11 +732,11 @@ describe "#add_email_campaign" do it "creates a new campaign" do 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, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:post).and_return(response) new_campaign = ConstantContact::Components::Campaign.create(JSON.parse(json)) campaign = @api.add_email_campaign(new_campaign) campaign.should be_kind_of(ConstantContact::Components::Campaign) @@ -746,11 +747,11 @@ describe "#delete_email_campaign" do it "deletes an individual campaign" do 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, {}) + 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 @@ -760,11 +761,11 @@ describe "#update_email_campaign" do it "updates a specific campaign" do 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, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:put).and_return(response) campaign = ConstantContact::Components::Campaign.create(JSON.parse(json)) result = @api.update_email_campaign(campaign) result.should be_kind_of(ConstantContact::Components::Campaign) @@ -776,11 +777,11 @@ it "schedules a campaign to be sent" do campaign_id = 1 json = load_file('schedule_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:post).and_return(response) new_schedule = ConstantContact::Components::Schedule.create(JSON.parse(json)) schedule = @api.add_email_campaign_schedule(campaign_id, new_schedule) schedule.should be_kind_of(ConstantContact::Components::Schedule) @@ -792,11 +793,11 @@ it "gets an array of schedules associated with a given campaign" do campaign_id = 1 json = load_file('schedules_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) schedules = @api.get_email_campaign_schedules(campaign_id) schedules.first.should be_kind_of(ConstantContact::Components::Schedule) schedules.first.scheduled_date.should eq('2012-12-16T11:07:43.626Z') @@ -809,11 +810,11 @@ schedule_id = 1 json = load_file('schedule_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}) + 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) schedule.should be_kind_of(ConstantContact::Components::Schedule) schedule.scheduled_date.should eq('2013-05-10T11:07:43.626Z') @@ -824,11 +825,11 @@ it "deletes a specific schedule associated with a given campaign" do campaign_id = 1 schedule_id = 1 net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}) + 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 end @@ -838,11 +839,11 @@ it "updates a specific schedule associated with a given campaign" do campaign_id = 1 json = load_file('schedule_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:put).and_return(response) schedule = ConstantContact::Components::Schedule.create(JSON.parse(json)) result = @api.update_email_campaign_schedule(campaign_id, schedule) result.should be_kind_of(ConstantContact::Components::Schedule) @@ -855,11 +856,11 @@ campaign_id = 1 json_request = load_file('test_send_request.json') 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, {}) + 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)) result = @api.send_email_campaign_test(campaign_id, test_send) result.should be_kind_of(ConstantContact::Components::TestSend) @@ -872,11 +873,11 @@ campaign_id = 1 params = {:limit => 5} 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, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) set = @api.get_email_campaign_bounces(campaign_id, params) set.should be_kind_of(ConstantContact::Components::ResultSet) set.results.first.should be_kind_of(ConstantContact::Components::BounceActivity) @@ -889,11 +890,11 @@ campaign_id = 1 params = {:limit => 5} 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, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) set = @api.get_email_campaign_clicks(campaign_id, params) set.should be_kind_of(ConstantContact::Components::ResultSet) set.results.first.should be_kind_of(ConstantContact::Components::ClickActivity) @@ -906,11 +907,11 @@ campaign_id = 1 params = {:limit => 5} 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, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) set = @api.get_email_campaign_forwards(campaign_id, params) set.should be_kind_of(ConstantContact::Components::ResultSet) set.results.first.should be_kind_of(ConstantContact::Components::ForwardActivity) @@ -923,11 +924,11 @@ campaign_id = 1 params = {:limit => 5} 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, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) set = @api.get_email_campaign_opens(campaign_id, params) set.should be_kind_of(ConstantContact::Components::ResultSet) set.results.first.should be_kind_of(ConstantContact::Components::OpenActivity) @@ -940,11 +941,11 @@ campaign_id = 1 params = {:limit => 5} 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, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) set = @api.get_email_campaign_sends(campaign_id, params) set.should be_kind_of(ConstantContact::Components::ResultSet) set.results.first.should be_kind_of(ConstantContact::Components::SendActivity) @@ -957,11 +958,11 @@ campaign_id = 1 params = {:limit => 5} 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, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) set = @api.get_email_campaign_unsubscribes(campaign_id, params) set.should be_kind_of(ConstantContact::Components::ResultSet) set.results.first.should be_kind_of(ConstantContact::Components::UnsubscribeActivity) @@ -973,11 +974,11 @@ it "gets a reporting summary for a campaign" do campaign_id = 1 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, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) summary = @api.get_email_campaign_summary_report(campaign_id) summary.should be_kind_of(ConstantContact::Components::TrackingSummary) summary.sends.should eq(15) @@ -989,11 +990,11 @@ contact_id = 1 params = {:limit => 5} 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, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) set = @api.get_contact_bounces(contact_id, params) set.should be_kind_of(ConstantContact::Components::ResultSet) set.results.first.should be_kind_of(ConstantContact::Components::BounceActivity) @@ -1006,11 +1007,11 @@ contact_id = 1 params = {:limit => 5} 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, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) set = @api.get_contact_clicks(contact_id, params) set.should be_kind_of(ConstantContact::Components::ResultSet) set.results.first.should be_kind_of(ConstantContact::Components::ClickActivity) @@ -1023,11 +1024,11 @@ contact_id = 1 params = {:limit => 5} 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, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) set = @api.get_contact_forwards(contact_id, params) set.should be_kind_of(ConstantContact::Components::ResultSet) set.results.first.should be_kind_of(ConstantContact::Components::ForwardActivity) @@ -1040,11 +1041,11 @@ contact_id = 1 params = {:limit => 5} 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, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) set = @api.get_contact_opens(contact_id, params) set.should be_kind_of(ConstantContact::Components::ResultSet) set.results.first.should be_kind_of(ConstantContact::Components::OpenActivity) @@ -1057,11 +1058,11 @@ contact_id = 1 params = {:limit => 5} 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, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) set = @api.get_contact_sends(contact_id, params) set.should be_kind_of(ConstantContact::Components::ResultSet) set.results.first.should be_kind_of(ConstantContact::Components::SendActivity) @@ -1074,11 +1075,11 @@ contact_id = 1 params = {:limit => 5} 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, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) set = @api.get_contact_unsubscribes(contact_id, params) set.should be_kind_of(ConstantContact::Components::ResultSet) set.results.first.should be_kind_of(ConstantContact::Components::UnsubscribeActivity) @@ -1090,11 +1091,11 @@ it "gets a reporting summary for a Contact" do contact_id = 1 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, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) summary = @api.get_contact_summary_report(contact_id) summary.should be_kind_of(ConstantContact::Components::TrackingSummary) summary.sends.should eq(15) @@ -1104,11 +1105,11 @@ describe "#get_activities" do it "gets an array of activities" do 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, {}) + response = RestClient::Response.create(json_response, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) activities = @api.get_activities() activities.first.should be_kind_of(ConstantContact::Components::Activity) activities.first.type.should eq('REMOVE_CONTACTS_FROM_LISTS') @@ -1118,11 +1119,11 @@ describe "#update_email_campaign" do it "updates a specific campaign" do 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, {}) + response = RestClient::Response.create(json_response, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) activity = @api.get_activity('a07e1ilbm7shdg6ikeo') activity.should be_kind_of(ConstantContact::Components::Activity) activity.type.should eq('REMOVE_CONTACTS_FROM_LISTS') @@ -1134,11 +1135,11 @@ json_add_contacts = load_file('add_contacts_response.json') json_lists = load_file('lists_response.json') json_contacts = load_file('contacts_response.json') net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_add_contacts, net_http_resp, {}) + response = RestClient::Response.create(json_add_contacts, net_http_resp, {}, @request) RestClient.stub(:post).and_return(response) import = ConstantContact::Components::AddContactsImportData.new address = ConstantContact::Components::Address.create( :line1 => "1601 Trapelo Rd", @@ -1180,11 +1181,11 @@ content = load_file('add_contacts_request.csv') json = load_file('add_contacts_response.json') lists = 'list1, list2' net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}) + 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) activity.should be_kind_of(ConstantContact::Components::Activity) activity.type.should eq('ADD_CONTACTS') @@ -1199,11 +1200,11 @@ lists = [] lists << ConstantContact::Components::ContactList.create(JSON.parse(json_list)) net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json_clear_lists, net_http_resp, {}) + response = RestClient::Response.create(json_clear_lists, net_http_resp, {}, @request) RestClient.stub(:post).and_return(response) activity = @api.add_clear_lists_activity(lists) activity.should be_kind_of(ConstantContact::Components::Activity) activity.type.should eq('CLEAR_CONTACTS_FROM_LISTS') @@ -1214,11 +1215,11 @@ it "adds a Remove Contacts From Lists Activity" do json = load_file('remove_contacts_response.json') lists = 'list1, list2' net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:post).and_return(response) email_addresses = ["djellesma@constantcontact.com"] activity = @api.add_remove_contacts_from_lists_activity( email_addresses, lists) @@ -1232,11 +1233,11 @@ content = load_file('remove_contacts_request.txt') json = load_file('remove_contacts_response.json') lists = 'list1, list2' net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') - response = RestClient::Response.create(json, net_http_resp, {}) + 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) activity.should be_kind_of(ConstantContact::Components::Activity) activity.type.should eq('REMOVE_CONTACTS_FROM_LISTS') @@ -1247,11 +1248,11 @@ it "creates an Export Contacts Activity" do json_request = load_file('export_contacts_request.json') 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, {}) + 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)) activity = @api.add_export_contacts_activity(export_contacts) activity.should be_kind_of(ConstantContact::Components::Activity) @@ -1262,11 +1263,11 @@ describe "#get_library_info" do it "retrieves a MyLibrary usage information" do 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, {}) + response = RestClient::Response.create(json_response, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) info = @api.get_library_info() info.should be_kind_of(ConstantContact::Components::LibrarySummary) info.usage_summary['folder_count'].should eq(6) @@ -1276,11 +1277,11 @@ describe "#get_library_folders" do it "retrieves a list of MyLibrary folders" do 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, {}) + response = RestClient::Response.create(json_response, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) folders = @api.get_library_folders({:limit => 2}) folders.should be_kind_of(ConstantContact::Components::ResultSet) folders.results.first.should be_kind_of(ConstantContact::Components::LibraryFolder) @@ -1291,11 +1292,11 @@ describe "#add_library_folder" do it "creates a new MyLibrary folder" do 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, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:post).and_return(response) new_folder = ConstantContact::Components::LibraryFolder.create(JSON.parse(json)) folder = @api.add_library_folder(new_folder) folder.should be_kind_of(ConstantContact::Components::LibraryFolder) @@ -1306,11 +1307,11 @@ describe "#get_library_folder" do it "retrieves a specific MyLibrary folder using the folder_id path parameter" do 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, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) folder = @api.get_library_folder(6) folder.should be_kind_of(ConstantContact::Components::LibraryFolder) folder.name.should eq('wildflowers') @@ -1320,11 +1321,11 @@ describe "#update_library_folder" do it "retrieves a specific MyLibrary folder using the folder_id path parameter" do 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, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:put).and_return(response) folder = ConstantContact::Components::LibraryFolder.create(JSON.parse(json)) response = @api.update_library_folder(folder) response.should be_kind_of(ConstantContact::Components::LibraryFolder) @@ -1335,11 +1336,11 @@ describe "#delete_library_folder" do it "deletes a MyLibrary folder" do folder_id = 6 net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}) + 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 end @@ -1348,11 +1349,11 @@ describe "#get_library_trash" do it "retrieve all files in the Trash folder" do 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, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) files = @api.get_library_trash({:sort_by => 'SIZE_DESC'}) files.should be_kind_of(ConstantContact::Components::ResultSet) files.results.first.should be_kind_of(ConstantContact::Components::LibraryFile) @@ -1362,11 +1363,11 @@ describe "#delete_library_trash" do 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, {}) + response = RestClient::Response.create('', net_http_resp, {}, @request) RestClient.stub(:delete).and_return(response) result = @api.delete_library_trash() result.should be_true end @@ -1375,11 +1376,11 @@ describe "#get_library_files" do it "retrieves a collection of MyLibrary files in the Constant Contact account" do 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, {}) + response = RestClient::Response.create(json_response, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) files = @api.get_library_files({:type => 'ALL'}) files.should be_kind_of(ConstantContact::Components::ResultSet) files.results.first.should be_kind_of(ConstantContact::Components::LibraryFile) @@ -1391,11 +1392,11 @@ it "retrieves a collection of MyLibrary files in the Constant Contact account" do folder_id = -1 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, {}) + 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}) files.should be_kind_of(ConstantContact::Components::ResultSet) files.results.first.should be_kind_of(ConstantContact::Components::LibraryFile) @@ -1406,11 +1407,11 @@ describe "#get_library_file" do it "retrieve a MyLibrary file using the file_id path parameter" do 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, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) file = @api.get_library_file(6) file.should be_kind_of(ConstantContact::Components::LibraryFile) file.name.should eq('IMG_0261.JPG') @@ -1426,11 +1427,11 @@ file_type = 'JPG' contents = load_file('logo.jpg') 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, {}) + 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) response.should be_kind_of(String) response.should eq('123456789') @@ -1440,11 +1441,11 @@ describe "#update_library_file" do it "updates information for a specific MyLibrary file" do 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, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:put).and_return(response) file = ConstantContact::Components::LibraryFile.create(JSON.parse(json)) response = @api.update_library_file(file) response.should be_kind_of(ConstantContact::Components::LibraryFile) @@ -1455,11 +1456,11 @@ describe "#delete_library_file" do it "deletes one or more MyLibrary files specified by the fileId path parameter" do file_id = '6, 7' net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') - response = RestClient::Response.create('', net_http_resp, {}) + 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 end @@ -1469,11 +1470,11 @@ it "retrieves the upload status for one or more MyLibrary files using the file_id path parameter" do file_id = '6, 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, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:get).and_return(response) statuses = @api.get_library_files_upload_status(file_id) statuses.should be_kind_of(Array) statuses.first.should be_kind_of(ConstantContact::Components::UploadStatus) @@ -1486,10 +1487,10 @@ folder_id = 1 file_id = '8, 9' 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, {}) + response = RestClient::Response.create(json, net_http_resp, {}, @request) RestClient.stub(:put).and_return(response) results = @api.move_library_files(folder_id, file_id) results.should be_kind_of(Array) results.first.should be_kind_of(ConstantContact::Components::MoveResults) \ No newline at end of file