Sha256: 39b04c1542289f4c18778564612cffb79cba0d2829208e46d1a8962204931584
Contents?: true
Size: 1.16 KB
Versions: 7
Compression:
Stored size: 1.16 KB
Contents
require 'rubygems' require 'test_helper' # To add log for non-rails app, see http://rails-nutshell.labs.oreilly.com/ch08.html class Salesforce::Rest::RestCreateDeleteTest < ActiveSupport::TestCase #Find a single object with REST API def test_create_rest_resources begin #Salesforce::Rest::Account.format = ActiveResource::Formats::JsonFormat puts "--create a new account--" new_acct = Salesforce::Rest::Account.new(:Name => "test numero uno", :BillingStreet=> "Fairway Meadows", :BillingState => "NY", :ShippingCity => "New York") resp = new_acct.save() # resp = Salesforce::Rest::Account.new("Name" => '123Test').save # See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html # HTTP Code 201 is created successfully. assert (resp.code == 201) j = ActiveSupport::JSON @sf_oid = j.decode(resp.body)["id"] puts "New Object created: id -> " + @sf_oid puts "--delete that newly created account--" del_result = Salesforce::Rest::Account.delete(@sf_oid) assert (del_result.code == 204) puts "Delete Operation HTTP response code: " + del_result.code.to_s end end end
Version data entries
7 entries across 7 versions & 1 rubygems