Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

salesforce_bulk_oauth2

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

salesforce_bulk_oauth2

  • 0.0.5
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= salesforce-bulk

==Overview

Salesforce Bulk Oauth2 is an extension of jorgevaldivia's Salesforce Bulk ruby gem for connecting to and using the Salesforce Bulk API (http://www.salesforce.com/us/developer/docs/api_asynch/index.htm) via Oauth2 service instead of username/password.

==Installation

sudo gem install salesforce_bulk

==How to use

Using this gem is simple and straight forward.

To initialize:

require 'salesforce_bulk' salesforce = SalesforceBulk::Api.new(:token=>"YOUR_SALESFORCE_TOKEN", :instance_url=>"YOUR_SALESFORCE_INSTANCE_URL")

Sample operations:

Same as mentioned on (https://github.com/jorgevaldivia/salesforce_bulk).

Insert/Create

new_account = Hash["name" => "Test Account", "type" => "Other"] # Add as many fields per record as needed. records_to_insert = Array.new records_to_insert.push(new_account) # You can add as many records as you want here, just keep in mind that Salesforce has governor limits. result = salesforce.create("Account", records_to_insert) puts "result is: #{result.inspect}"

Update

updated_account = Hash["name" => "Test Account -- Updated", "id" => "a00A0001009zA2m"] # Nearly identical to an insert, but we need to pass the salesforce id. records_to_update = Array.new records_to_update.push(updated_account) salesforce.update("Account", records_to_update)

Upsert

upserted_account = Hash["name" => "Test Account -- Upserted", "External_Field_Name" => "123456"] # Fields to be updated. External field must be included records_to_upsert = Array.new records_to_upsert.push(upserted_account) salesforce.upsert("Account", records_to_upsert, "External_Field_Name") # Note that upsert accepts an extra parameter for the external field name

OR

salesforce.upsert("Account", records_to_upsert, "External_Field_Name", true) # last parameter indicates whether to wait until the batch finishes

Delete

deleted_account = Hash["id" => "a00A0001009zA2m"] # We only specify the id of the records to delete records_to_delete = Array.new records_to_delete.push(deleted_account) salesforce.delete("Account", records_to_delete)

Query

res = salesforce.query("Account", "select id, name, createddate from Account limit 3") # We just need to pass the sobject name and the query string puts res.result.records.inspect

Result reporting:

array of true/false depending on wether record was pushed

example: if you push an array having 10 records. Result maybe result = [true,true,true,true,false,true,false,true,true,true]

Thanks to jorgevaldivia for Salesforce Bulk gem

== Copyright

Copyright (c) 2012 Bhushan Lodha.

===end

FAQs

Package last updated on 31 Aug 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc