Skip to content

Commit

Permalink
Version Bump
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenMMortimer committed Apr 12, 2018
1 parent a6cb29a commit c1644b6
Show file tree
Hide file tree
Showing 17 changed files with 151 additions and 130 deletions.
10 changes: 5 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Package: salesforcer
Title: An Implementation of 'Salesforce' APIs Using Tidy Principles
Version: 0.1.1.9000
Date: 2018-04-08
Version: 0.1.2
Date: 2018-04-12
Description: An implementation of the 'Salesforce' Platform APIs (REST, SOAP,
Bulk, and Metadata) <https://developer.salesforce.com/page/Salesforce_APIs>.
Bulk 1.0, Bulk 2.0, and Metadata) <https://developer.salesforce.com/page/Salesforce_APIs>.
This package is an articulation of the most API methods into R. The API calls
return XML or JSON that is parsed into lists and tibbles using tidy data principles.
For more details please see the 'Salesforces' API references and this package's website
return XML or JSON that is parsed tidy data structures. For more details please
see the 'Salesforces' API references and this package's website
<https://stevenmmortimer.github.io/salesforcer/> for more information,
documentation, and examples.
Authors@R: c(
Expand Down
13 changes: 7 additions & 6 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
## salesforcer 0.1.1.9000
## salesforcer 0.1.2

### Features

* Nothing Yet!

### Bug Fixes

* Nothing Yet!
* Add support for Bulk 1.0 operations of "create", "update", "upsert", "delete" and "hardDelete"
* Bulk 2.0 operations, by default, now return a single `tbl_df` containing all
of the successful records, error records, and unprocessed records
* Created internal functions that explicity call each API for an operation. For
example, `sf_create()` routes into `sf_create_soap()`, `sf_create_rest()`, and
`sf_bulk_operation()`.

---

Expand Down
9 changes: 7 additions & 2 deletions R/bulk-operation.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ sf_create_job_bulk <- function(operation = c("insert", "delete", "upsert", "upda
verbose=FALSE){

api_type <- match.arg(api_type)
operation <- match.arg(operation)
content_type <- match.arg(content_type)
if(api_type == "Bulk 1.0"){
job_response <- sf_create_job_bulk_v1(operation=operation,
object_name=object_name,
Expand All @@ -65,10 +67,13 @@ sf_create_job_bulk <- function(operation = c("insert", "delete", "upsert", "upda
if(!(operation %in% c("insert", "delete", "upsert", "update"))){
stop('Bulk 2.0 only supports the following operations: "insert", "delete", "upsert", and "update"')
}
if(!(content_type %in% c("CSV"))){
stop('Bulk 2.0 only supports the "CSV" content type.')
}
job_response <- sf_create_job_bulk_v2(operation=operation,
object_name=object_name,
external_id_fieldname=external_id_fieldname,
content_type='CSV',
content_type=content_type,
line_ending=line_ending,
column_delimiter=column_delimiter,
verbose=verbose)
Expand Down Expand Up @@ -153,7 +158,7 @@ sf_create_job_bulk_v2 <- function(operation = c("insert", "delete", "upsert", "u
verbose=FALSE){

operation <- match.arg(operation)
#content_type <- match.arg(content_type)
content_type <- match.arg(content_type)
line_ending <- match.arg(line_ending)
column_delimiter <- match.arg(column_delimiter)
if(column_delimiter != "COMMA"){
Expand Down
32 changes: 21 additions & 11 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ knitr::opts_chunk$set(
[![Coverage Status](https://codecov.io/gh/StevenMMortimer/salesforcer/branch/master/graph/badge.svg)](https://codecov.io/gh/StevenMMortimer/salesforcer?branch=master)

**salesforcer** is an R package that connects to Salesforce Platform APIs using
tidy principles. The package implements most actions from the SOAP, REST, Bulk,
and Metadata APIs. Package features include:
tidy principles. The package implements most actions from the SOAP, REST, Bulk 1.0,
Bulk 2.0, and Metadata APIs. Package features include:

* OAuth 2.0 and Basic authentication methods (`sf_auth()`)
* CRUD (Create, Retrieve, Update, Delete) methods for records using the REST and Bulk APIs
* Query records via REST and Bulk APIs (`sf_query()`)
* OAuth 2.0 (Single Sign On) and Basic (Username-Password) Authentication methods (`sf_auth()`)
* CRUD (Create, Retrieve, Update, Delete) methods for records using the SOAP, REST, and Bulk APIs
* Query records via the SOAP, REST, and Bulk 1.0 APIs using `sf_query()`
* Retrieve and modify metadata (Custom Objects, Fields, etc.) using the Metadata API with:
* `sf_describe_objects()`, `sf_create_metadata()`, `sf_update_metadata()`
* Utilize backwards compatible functions for the **RForcecom** package, such as:
Expand Down Expand Up @@ -167,12 +167,22 @@ deleted_records
### Bulk Operations

For really large operations (inserts, updates, upserts, deletes, and queries) Salesforce
provides a [Bulk API](https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/asynch_api_intro.htm). In order to use the Bulk API in **salesforcer** you can just add
`api_type = "Bulk"` to your functions and the operation will be executed using the Bulk API.
It's that simple. The benefits of using the Bulk API for larger datasets is that
provides the [Bulk 1.0](https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/asynch_api_intro.htm)
and [Bulk 2.0](https://developer.salesforce.com/docs/atlas.en-us.api_bulk_v2.meta/api_bulk_v2/introduction_bulk_api_2.htm)
APIs. In order to use the Bulk APIs in **salesforcer** you can just add `api_type = "Bulk 1.0"`
or `api_type = "Bulk 2.0"` to your functions and the operation will be executed using the Bulk APIs.
It's that simple.

The benefits of using the Bulk API for larger datasets is that
the operation will reduce the number of individual API calls (organization usually
have a limit on total calls) and batching the requests in Bulk is usually quicker
than running thousands of individuals calls when your data is large.
have a limit on total calls) and batching the requests in bulk is usually quicker
than running thousands of individuals calls when your data is large. **Note:** the
Bulk 2.0 API does **NOT** guarantee the order of the data submitted is preserved in
the output. This means that you must join on other data columns to match up the Ids that
are returned in the output with the data you submitted. For this reason, Bulk 2.0 may not
be a good solution for creating, updating, or upserting records where you need to keep
track of the created Ids. The Bulk 2.0 API would be fine for deleting records where
you only need to know which Ids were successfully deleted.

```{r}
# create contacts using the Bulk API
Expand Down Expand Up @@ -305,7 +315,7 @@ as they are explained better there.
More information is also available on the `pkgdown` site at
https://StevenMMortimer.github.io/salesforcer.

[Top](#salesforcer-)
[Top](#salesforcer)

---
Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md).
Expand Down
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ salesforcer<img src="man/figures/salesforcer.png" width="120px" align="right" />

[![Build Status](https://travis-ci.org/StevenMMortimer/salesforcer.svg?branch=master)](https://travis-ci.org/StevenMMortimer/salesforcer) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/StevenMMortimer/salesforcer?branch=master&svg=true)](https://ci.appveyor.com/project/StevenMMortimer/salesforcer) [![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/salesforcer)](http://cran.r-project.org/package=salesforcer) [![Coverage Status](https://codecov.io/gh/StevenMMortimer/salesforcer/branch/master/graph/badge.svg)](https://codecov.io/gh/StevenMMortimer/salesforcer?branch=master)

**salesforcer** is an R package that connects to Salesforce Platform APIs using tidy principles. The package implements most actions from the SOAP, REST, Bulk, and Metadata APIs. Package features include:
**salesforcer** is an R package that connects to Salesforce Platform APIs using tidy principles. The package implements most actions from the SOAP, REST, Bulk 1.0, Bulk 2.0, and Metadata APIs. Package features include:

- OAuth 2.0 and Basic authentication methods (`sf_auth()`)
- CRUD (Create, Retrieve, Update, Delete) methods for records using the REST and Bulk APIs
- Query records via REST and Bulk APIs (`sf_query()`)
- OAuth 2.0 (Single Sign On) and Basic (Username-Password) Authentication methods (`sf_auth()`)
- CRUD (Create, Retrieve, Update, Delete) methods for records using the SOAP, REST, and Bulk APIs
- Query records via the SOAP, REST, and Bulk 1.0 APIs using `sf_query()`
- Retrieve and modify metadata (Custom Objects, Fields, etc.) using the Metadata API with:
- `sf_describe_objects()`, `sf_create_metadata()`, `sf_update_metadata()`
- Utilize backwards compatible functions for the **RForcecom** package, such as:
Expand Down Expand Up @@ -93,8 +93,8 @@ created_records
#> # A tibble: 2 x 2
#> id success
#> <chr> <chr>
#> 1 0036A00000SnhBRQAZ true
#> 2 0036A00000SnhBSQAZ true
#> 1 0036A00000SnhbfQAB true
#> 2 0036A00000SnhbgQAB true
```

### Query
Expand All @@ -115,8 +115,8 @@ queried_records
#> # A tibble: 2 x 4
#> Id Account FirstName LastName
#> * <chr> <lgl> <chr> <chr>
#> 1 0036A00000SnhBRQAZ NA Test Contact-Create-1
#> 2 0036A00000SnhBSQAZ NA Test Contact-Create-2
#> 1 0036A00000SnhbfQAB NA Test Contact-Create-1
#> 2 0036A00000SnhbgQAB NA Test Contact-Create-2
```

### Update
Expand All @@ -134,13 +134,15 @@ updated_records
#> # A tibble: 2 x 2
#> id success
#> <chr> <chr>
#> 1 0036A00000SnhBRQAZ true
#> 2 0036A00000SnhBSQAZ true
#> 1 0036A00000SnhbfQAB true
#> 2 0036A00000SnhbgQAB true
```

### Bulk Operations

For really large operations (inserts, updates, upserts, deletes, and queries) Salesforce provides a [Bulk API](https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/asynch_api_intro.htm). In order to use the Bulk API in **salesforcer** you can just add `api_type = "Bulk"` to your functions and the operation will be executed using the Bulk API. It's that simple. The benefits of using the Bulk API for larger datasets is that the operation will reduce the number of individual API calls (organization usually have a limit on total calls) and batching the requests in Bulk is usually quicker than running thousands of individuals calls when your data is large.
For really large operations (inserts, updates, upserts, deletes, and queries) Salesforce provides the [Bulk 1.0](https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/asynch_api_intro.htm) and [Bulk 2.0](https://developer.salesforce.com/docs/atlas.en-us.api_bulk_v2.meta/api_bulk_v2/introduction_bulk_api_2.htm) APIs. In order to use the Bulk APIs in **salesforcer** you can just add `api_type = "Bulk 1.0"` or `api_type = "Bulk 2.0"` to your functions and the operation will be executed using the Bulk APIs. It's that simple.

The benefits of using the Bulk API for larger datasets is that the operation will reduce the number of individual API calls (organization usually have a limit on total calls) and batching the requests in bulk is usually quicker than running thousands of individuals calls when your data is large. **Note:** the Bulk 2.0 API does **NOT** guarantee the order of the data submitted is preserved in the output. This means that you must join on other data columns to match up the Ids that are returned in the output with the data you submitted. For this reason, Bulk 2.0 may not be a good solution for creating, updating, or upserting records where you need to keep track of the created Ids. The Bulk 2.0 API would be fine for deleting records where you only need to know which Ids were successfully deleted.

``` r
# create contacts using the Bulk API
Expand Down Expand Up @@ -284,7 +286,7 @@ Salesforce provides client libraries and examples in many programming langauges

More information is also available on the `pkgdown` site at <https://StevenMMortimer.github.io/salesforcer>.

[Top](#salesforcer-)
[Top](#salesforcer)

------------------------------------------------------------------------

Expand Down
1 change: 0 additions & 1 deletion cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@
Possibly mis-spelled words in DESCRIPTION:
APIs (2:42, 5:61)
JSON (8:19)
tibbles (8:54)
19 changes: 7 additions & 12 deletions docs/NEWS.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c1644b6

Please sign in to comment.