spec/constantcontact/services/library_service_spec.rb in constantcontact-1.3.2 vs spec/constantcontact/services/library_service_spec.rb in constantcontact-2.0.0

- old
+ new

@@ -13,11 +13,11 @@ net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') response = RestClient::Response.create(json_response, net_http_resp, {}) RestClient.stub(:get).and_return(response) - info = ConstantContact::Services::LibraryService.get_library_info('token') + info = ConstantContact::Services::LibraryService.get_library_info() info.should be_kind_of(ConstantContact::Components::LibrarySummary) info.usage_summary['folder_count'].should eq(6) end end @@ -27,11 +27,11 @@ net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') response = RestClient::Response.create(json_response, net_http_resp, {}) RestClient.stub(:get).and_return(response) - folders = ConstantContact::Services::LibraryService.get_library_folders('token', {:limit => 2}) + folders = ConstantContact::Services::LibraryService.get_library_folders({:limit => 2}) folders.should be_kind_of(ConstantContact::Components::ResultSet) folders.results.first.should be_kind_of(ConstantContact::Components::LibraryFolder) folders.results.first.name.should eq('backgrounds') end end @@ -43,11 +43,11 @@ response = RestClient::Response.create(json, net_http_resp, {}) RestClient.stub(:post).and_return(response) new_folder = ConstantContact::Components::LibraryFolder.create(JSON.parse(json)) - folder = ConstantContact::Services::LibraryService.add_library_folder('token', new_folder) + folder = ConstantContact::Services::LibraryService.add_library_folder(new_folder) folder.should be_kind_of(ConstantContact::Components::LibraryFolder) folder.name.should eq('wildflowers') end end @@ -57,11 +57,11 @@ net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') response = RestClient::Response.create(json, net_http_resp, {}) RestClient.stub(:get).and_return(response) - folder = ConstantContact::Services::LibraryService.get_library_folder('token', 6) + folder = ConstantContact::Services::LibraryService.get_library_folder(6) folder.should be_kind_of(ConstantContact::Components::LibraryFolder) folder.name.should eq('wildflowers') end end @@ -72,11 +72,11 @@ response = RestClient::Response.create(json, net_http_resp, {}) RestClient.stub(:put).and_return(response) folder = ConstantContact::Components::LibraryFolder.create(JSON.parse(json)) - response = ConstantContact::Services::LibraryService.update_library_folder('token', folder) + response = ConstantContact::Services::LibraryService.update_library_folder(folder) response.should be_kind_of(ConstantContact::Components::LibraryFolder) response.name.should eq('wildflowers') end end @@ -86,11 +86,11 @@ net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') response = RestClient::Response.create('', net_http_resp, {}) RestClient.stub(:delete).and_return(response) - result = ConstantContact::Services::LibraryService.delete_library_folder('token', folder_id) + result = ConstantContact::Services::LibraryService.delete_library_folder(folder_id) result.should be_true end end describe "#get_library_trash" do @@ -99,11 +99,11 @@ net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') response = RestClient::Response.create(json, net_http_resp, {}) RestClient.stub(:get).and_return(response) - files = ConstantContact::Services::LibraryService.get_library_trash('token', {:sort_by => 'SIZE_DESC'}) + files = ConstantContact::Services::LibraryService.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) files.results.first.name.should eq('menu_form.pdf') end end @@ -113,11 +113,11 @@ net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') response = RestClient::Response.create('', net_http_resp, {}) RestClient.stub(:delete).and_return(response) - result = ConstantContact::Services::LibraryService.delete_library_trash('token') + result = ConstantContact::Services::LibraryService.delete_library_trash() result.should be_true end end describe "#get_library_files" do @@ -126,11 +126,11 @@ net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') response = RestClient::Response.create(json_response, net_http_resp, {}) RestClient.stub(:get).and_return(response) - files = ConstantContact::Services::LibraryService.get_library_files('token', {:type => 'ALL'}) + files = ConstantContact::Services::LibraryService.get_library_files({:type => 'ALL'}) files.should be_kind_of(ConstantContact::Components::ResultSet) files.results.first.should be_kind_of(ConstantContact::Components::LibraryFile) files.results.first.name.should eq('IMG_0341.JPG') end end @@ -142,11 +142,11 @@ net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') response = RestClient::Response.create(json_response, net_http_resp, {}) RestClient.stub(:get).and_return(response) - files = ConstantContact::Services::LibraryService.get_library_files_by_folder('token', folder_id, {:limit => 10}) + files = ConstantContact::Services::LibraryService.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) files.results.first.name.should eq('IMG_0341.JPG') end end @@ -157,11 +157,11 @@ net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') response = RestClient::Response.create(json, net_http_resp, {}) RestClient.stub(:get).and_return(response) - file = ConstantContact::Services::LibraryService.get_library_file('token', 6) + file = ConstantContact::Services::LibraryService.get_library_file(6) file.should be_kind_of(ConstantContact::Components::LibraryFile) file.name.should eq('IMG_0261.JPG') end end @@ -177,11 +177,11 @@ net_http_resp.add_field('Location', 'https://api.d1.constantcontact.com/v2/library/files/123456789') response = RestClient::Response.create("", net_http_resp, {}) RestClient.stub(:post).and_return(response) - response = ConstantContact::Services::LibraryService.add_library_file('token', file_name, folder_id, description, source, file_type, contents) + response = ConstantContact::Services::LibraryService.add_library_file(file_name, folder_id, description, source, file_type, contents) response.should be_kind_of(String) response.should eq('123456789') end end @@ -192,11 +192,11 @@ response = RestClient::Response.create(json, net_http_resp, {}) RestClient.stub(:put).and_return(response) file = ConstantContact::Components::LibraryFile.create(JSON.parse(json)) - response = ConstantContact::Services::LibraryService.update_library_file('token', file) + response = ConstantContact::Services::LibraryService.update_library_file(file) response.should be_kind_of(ConstantContact::Components::LibraryFile) response.name.should eq('IMG_0261.JPG') end end @@ -206,11 +206,11 @@ net_http_resp = Net::HTTPResponse.new(1.0, 204, 'No Content') response = RestClient::Response.create('', net_http_resp, {}) RestClient.stub(:delete).and_return(response) - result = ConstantContact::Services::LibraryService.delete_library_file('token', file_id) + result = ConstantContact::Services::LibraryService.delete_library_file(file_id) result.should be_true end end describe "#get_library_files_upload_status" do @@ -220,11 +220,11 @@ net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') response = RestClient::Response.create(json, net_http_resp, {}) RestClient.stub(:get).and_return(response) - statuses = ConstantContact::Services::LibraryService.get_library_files_upload_status('token', file_id) + statuses = ConstantContact::Services::LibraryService.get_library_files_upload_status(file_id) statuses.should be_kind_of(Array) statuses.first.should be_kind_of(ConstantContact::Components::UploadStatus) statuses.first.status.should eq('Active') end end @@ -237,10 +237,10 @@ net_http_resp = Net::HTTPResponse.new(1.0, 200, 'OK') response = RestClient::Response.create(json, net_http_resp, {}) RestClient.stub(:put).and_return(response) - results = ConstantContact::Services::LibraryService.move_library_files('token', folder_id, file_id) + results = ConstantContact::Services::LibraryService.move_library_files(folder_id, file_id) results.should be_kind_of(Array) results.first.should be_kind_of(ConstantContact::Components::MoveResults) results.first.uri.should eq('https://api.d1.constantcontact.com/v2/library/files/9') end end \ No newline at end of file