Skip to content

Commit

Permalink
Merge pull request #86 from StevenMMortimer/dev
Browse files Browse the repository at this point in the history
Version bump, no need to wait for dplyr
  • Loading branch information
StevenMMortimer authored Aug 22, 2020
2 parents 6b2d10d + c979e35 commit 551c2fd
Show file tree
Hide file tree
Showing 343 changed files with 4,319 additions and 1,102 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: salesforcer
Title: An Implementation of 'Salesforce' APIs Using Tidy Principles
Version: 0.2.0.9000
Date: 2020-08-17
Version: 0.2.1
Date: 2020-08-21
Description: Functions connecting to the 'Salesforce' Platform APIs (REST, SOAP,
Bulk 1.0, Bulk 2.0, Metadata, Reports and Dashboards)
<https://trailhead.salesforce.com/en/content/learn/modules/api_basics/api_basics_overview>.
Expand Down
9 changes: 7 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
## salesforcer 0.2.0.9000
## salesforcer 0.2.1

### Dependencies

* **CAUTION: This release requires {dplyr 1.0.0} because {dplyr 1.0.1} introduced
a bug in `bind_rows()` with how it binds lists where the list elements have differing
lengths. This is documented in tidyverse/dplyr#5417 and r-lib/vctrs#1073. The
timeline for a fix is unknown as of Aug 16, 2020.**
timeline for a fix is unknown as of Aug 16, 2020.** You can install the older
version of {dplyr} using the following command:

```r
remotes::install_version("dplyr", "1.0.0")
```

### Features

Expand Down
3 changes: 2 additions & 1 deletion R/bulk-operation.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ sf_create_job_bulk <- function(operation = c("insert", "delete", "upsert", "upda
control_args$operation <- operation

if(is_present(line_ending)) {
deprecate_warn("0.1.3", "sf_create_job_bulk(line_ending = )", "sf_create_job_bulk(LineEndingHeader = )",
deprecate_warn("0.1.3", "salesforcer::sf_create_job_bulk(line_ending = )",
"sf_create_job_bulk(LineEndingHeader = )",
details = paste0("You can pass the line ending directly ",
"as shown above or via the `control` argument."))
control_args$LineEndingHeader <- list(`Sforce-Line-Ending` = line_ending)
Expand Down
24 changes: 12 additions & 12 deletions R/compatibility.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#' @export
rforcecom.login <- function(username, password, loginURL="https://login.salesforce.com/", apiVersion="35.0"){

deprecate_soft("0.1.0", "rforcecom.login()", "sf_auth()")
deprecate_soft("0.1.0", "salesforcer::rforcecom.login()", "sf_auth()")

if(!is.null(loginURL)){
options(salesforcer.login_url = loginURL)
Expand Down Expand Up @@ -70,7 +70,7 @@ rforcecom.login <- function(username, password, loginURL="https://login.salesfor
#' @export
rforcecom.getServerTimestamp <- function(session){

deprecate_soft("0.1.0", "rforcecom.getServerTimestamp()", "sf_server_timestamp()")
deprecate_soft("0.1.0", "salesforcer::rforcecom.getServerTimestamp()", "sf_server_timestamp()")

result <- sf_server_timestamp()
# format like rforcecom.getServerTimestamp()
Expand All @@ -92,7 +92,7 @@ rforcecom.getServerTimestamp <- function(session){
#' @export
rforcecom.getObjectDescription <- function(session, objectName){

deprecate_soft("0.1.0", "rforcecom.getObjectDescription()", "sf_describe_objects()")
deprecate_soft("0.1.0", "salesforcer::rforcecom.getObjectDescription()", "sf_describe_objects()")

obj_dat <- sf_describe_objects(object_names = objectName,
api_type="SOAP")[[1]]
Expand All @@ -117,7 +117,7 @@ rforcecom.getObjectDescription <- function(session, objectName){
#' @export
rforcecom.create <- function(session, objectName, fields){

deprecate_soft("0.1.0", "rforcecom.create()", "sf_create()")
deprecate_soft("0.1.0", "salesforcer::rforcecom.create()", "sf_create()")

fields <- as.data.frame(as.list(fields), stringsAsFactors = FALSE)
created_records <- sf_create(input_data = fields, object_name = objectName)
Expand Down Expand Up @@ -155,7 +155,7 @@ rforcecom.retrieve <- function(session, objectName,
offset=NULL, order=NULL,
inverse=NULL, nullsLast=NULL){

deprecate_soft("0.1.0", "rforcecom.retrieve()", "sf_retrieve()")
deprecate_soft("0.1.0", "salesforcer::rforcecom.retrieve()", "sf_retrieve()")

# Make SOQL
fieldList <- paste(fields, collapse=", ")
Expand Down Expand Up @@ -208,7 +208,7 @@ rforcecom.retrieve <- function(session, objectName,
#' @export
rforcecom.update <- function(session, objectName, id, fields){

deprecate_soft("0.1.0", "rforcecom.update()", "sf_update()")
deprecate_soft("0.1.0", "salesforcer::rforcecom.update()", "sf_update()")

fields <- as.data.frame(as.list(fields), stringsAsFactors = FALSE)
fields$id <- id
Expand All @@ -230,7 +230,7 @@ rforcecom.update <- function(session, objectName, id, fields){
#' @export
rforcecom.delete <- function(session, objectName, id){

deprecate_soft("0.1.0", "rforcecom.delete()", "sf_delete()")
deprecate_soft("0.1.0", "salesforcer::rforcecom.delete()", "sf_delete()")

invisible(sf_delete(id, object_name = objectName))
# rforcecom.delete returns NULL if successful??
Expand All @@ -254,7 +254,7 @@ rforcecom.upsert <- function(session, objectName,
externalIdField, externalId,
fields){

deprecate_soft("0.1.0", "rforcecom.upsert()", "sf_upsert()")
deprecate_soft("0.1.0", "salesforcer::rforcecom.upsert()", "sf_upsert()")

fields[externalIdField] <- externalId
fields <- as.data.frame(as.list(fields), stringsAsFactors = FALSE)
Expand All @@ -276,7 +276,7 @@ rforcecom.upsert <- function(session, objectName,
#' @export
rforcecom.search <- function(session, queryString){

deprecate_soft("0.1.0", "rforcecom.search()", "sf_search()")
deprecate_soft("0.1.0", "salesforcer::rforcecom.search()", "sf_search()")

queryString <- paste0("FIND {", queryString, "}", sep="")
resultset <- sf_search(search_string = queryString, is_sosl=TRUE)
Expand All @@ -297,7 +297,7 @@ rforcecom.search <- function(session, queryString){
#' @export
rforcecom.query <- function(session, soqlQuery, queryAll=FALSE){

deprecate_soft("0.1.0", "rforcecom.query()", "sf_query()")
deprecate_soft("0.1.0", "salesforcer::rforcecom.query()", "sf_query()")

sf_query(soql=soqlQuery, queryall=queryAll)
}
Expand All @@ -324,7 +324,7 @@ rforcecom.bulkQuery <- function(session,
max_attempts=100,
verbose=FALSE){

deprecate_soft("0.1.0", "rforcecom.bulkQuery()", "sf_query()")
deprecate_soft("0.1.0", "salesforcer::rforcecom.bulkQuery()", "sf_query()")

sf_query(soql = soqlQuery,
object_name = object,
Expand Down Expand Up @@ -375,7 +375,7 @@ rforcecom.bulkAction <- function(session,
max_attempts=100,
verbose=FALSE){

deprecate_soft("0.1.0", "rforcecom.bulkAction()", "sf_bulk_operation()")
deprecate_soft("0.1.0", "salesforcer::rforcecom.bulkAction()", "sf_bulk_operation()")

operation <- match.arg(operation)
res <- sf_bulk_operation(input_data = data,
Expand Down
3 changes: 1 addition & 2 deletions R/create-metadata.R
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ sf_create_metadata <- function(metadata_type,
control_args$operation <- "insert"

if(is_present(all_or_none)) {
deprecate_warn("0.1.3",
"sf_create_metadata(all_or_none = )",
deprecate_warn("0.1.3", "salesforcer::sf_create_metadata(all_or_none = )",
"sf_create_metadata(AllOrNoneHeader = )",
details = paste0("You can pass the all or none header directly ",
"as shown above or via the `control` argument."))
Expand Down
3 changes: 2 additions & 1 deletion R/create.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ sf_create <- function(input_data,
control_args$operation <- "insert"

if(is_present(all_or_none)) {
deprecate_warn("0.1.3", "sf_create(all_or_none = )", "sf_create(AllOrNoneHeader = )",
deprecate_warn("0.1.3", "salesforcer::sf_create(all_or_none = )",
"sf_create(AllOrNoneHeader = )",
details = paste0("You can pass the all or none header directly ",
"as shown above or via the `control` argument."))
control_args$AllOrNoneHeader <- list(allOrNone = tolower(all_or_none))
Expand Down
3 changes: 1 addition & 2 deletions R/delete-metadata.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ sf_delete_metadata <- function(metadata_type,
control_args$operation <- "delete"

if(is_present(all_or_none)) {
deprecate_warn("0.1.3",
"sf_delete_metadata(all_or_none = )",
deprecate_warn("0.1.3", "salesforcer::sf_delete_metadata(all_or_none = )",
"sf_delete_metadata(AllOrNoneHeader = )",
details = paste0("You can pass the all or none header directly ",
"as shown above or via the `control` argument."))
Expand Down
3 changes: 2 additions & 1 deletion R/delete.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ sf_delete <- function(ids,
control_args$operation <- "delete"

if(is_present(all_or_none)) {
deprecate_warn("0.1.3", "sf_delete(all_or_none = )", "sf_delete(AllOrNoneHeader = )",
deprecate_warn("0.1.3", "salesforcer::sf_delete(all_or_none = )",
"sf_delete(AllOrNoneHeader = )",
details = paste0("You can pass the all or none header directly ",
"as shown above or via the `control` argument."))
control_args$AllOrNoneHeader <- list(allOrNone = tolower(all_or_none))
Expand Down
3 changes: 2 additions & 1 deletion R/query.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ sf_query <- function(soql,
control_args$operation <- if(queryall) "queryall" else "query"

if(is_present(page_size)) {
deprecate_warn("0.1.3", "sf_query(page_size = )", "sf_query(QueryOptions = )",
deprecate_warn("0.1.3", "salesforcer::sf_query(page_size = )",
"sf_query(QueryOptions = )",
details = paste0("You can pass the page/batch size directly ",
"as shown above or via the `control` argument."))
control_args$QueryOptions <- list(batchSize = as.integer(page_size))
Expand Down
3 changes: 1 addition & 2 deletions R/update-metadata.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ sf_update_metadata <- function(metadata_type,
control_args$operation <- "update"

if(is_present(all_or_none)) {
deprecate_warn("0.1.3",
"sf_update_metadata(all_or_none = )",
deprecate_warn("0.1.3", "salesforcer::sf_update_metadata(all_or_none = )",
"sf_update_metadata(AllOrNoneHeader = )",
details = paste0("You can pass the all or none header directly ",
"as shown above or via the `control` argument."))
Expand Down
3 changes: 2 additions & 1 deletion R/update.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ sf_update <- function(input_data,
control_args$operation <- "update"

if(is_present(all_or_none)) {
deprecate_warn("0.1.3", "sf_update(all_or_none = )", "sf_update(AllOrNoneHeader = )",
deprecate_warn("0.1.3", "salesforcer::sf_update(all_or_none = )",
"sf_update(AllOrNoneHeader = )",
details = paste0("You can pass the all or none header directly ",
"as shown above or via the `control` argument."))
control_args$AllOrNoneHeader <- list(allOrNone = tolower(all_or_none))
Expand Down
3 changes: 1 addition & 2 deletions R/upsert-metadata.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ sf_upsert_metadata <- function(metadata_type,
control_args$operation <- "upsert"

if(is_present(all_or_none)) {
deprecate_warn("0.1.3",
"sf_upsert_metadata(all_or_none = )",
deprecate_warn("0.1.3", "salesforcer::sf_upsert_metadata(all_or_none = )",
"sf_upsert_metadata(AllOrNoneHeader = )",
details = paste0("You can pass the all or none header directly ",
"as shown above or via the `control` argument."))
Expand Down
3 changes: 2 additions & 1 deletion R/upsert.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ sf_upsert <- function(input_data,
control_args$operation <- "upsert"

if(is_present(all_or_none)) {
deprecate_warn("0.1.3", "sf_upsert(all_or_none = )", "sf_upsert(AllOrNoneHeader = )",
deprecate_warn("0.1.3", "salesforcer::sf_upsert(all_or_none = )",
"sf_upsert(AllOrNoneHeader = )",
details = paste0("You can pass the all or none header directly ",
"as shown above or via the `control` argument."))
control_args$AllOrNoneHeader <- list(allOrNone = tolower(all_or_none))
Expand Down
2 changes: 1 addition & 1 deletion R/utils-query.R
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ records_list_to_tbl <- function(x,
bind_query_resultsets <- function(resultset, next_records){

# HOLD ON INTRODUCING THIS BECAUSE IT CREATES A {{data.table}} DEPENDENCY
# deprecate_warn("0.2.1", "bind_query_resultsets()", "safe_bind_rows()",
# deprecate_warn("0.2.1", "salesforcer::bind_query_resultsets()", "safe_bind_rows()",
# details = paste0("Consider safe_bind_rows() which silently combines ",
# "all columns regardless if there are mixed datatypes ",
# "in a single column."))
Expand Down
21 changes: 18 additions & 3 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ options(tibble.print_min = 5L, tibble.print_max = 5L)
[![CRAN Status](https://www.r-pkg.org/badges/version/salesforcer)](https://cran.r-project.org/package=salesforcer)
[![Lifecycle: Maturing](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing)
[![Monthly Downloads](https://cranlogs.r-pkg.org/badges/last-month/salesforcer)](https://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)
[![Coverage Status](https://codecov.io/gh/StevenMMortimer/salesforcer/branch/main/graph/badge.svg)](https://codecov.io/gh/StevenMMortimer/salesforcer?branch=main)
<!-- badges: end -->

{salesforcer} is an R package that connects to Salesforce Platform APIs using
Expand Down Expand Up @@ -50,7 +50,22 @@ Package features include:
and list ids of records deleted (`sf_get_deleted()`) or updated (`sf_get_updated()`)
within a specific timeframe
* Passing API call control parameters such as, "All or None", "Duplicate Rule",
"Assignment Rule" execution and many more!
"Assignment Rule" execution and many more!

**CAUTION: The most recent release, {salesforcer 0.2.1}, requires {dplyr 1.0.0}
because {dplyr 1.0.1} introduced a bug in `bind_rows()` with how it binds
lists where the list elements have differing lengths. This is documented in
tidyverse/dplyr#5417 and r-lib/vctrs#1073. The timeline for a fix is unknown as
of August 2020, but a new version of {salesforcer} (0.2.2) will be released
immediately following the {dplyr} fix.**

You can install the older version of {dplyr} using the following command:

```r
# remove.packages("dplyr")
# install.packages("remotes")
remotes::install_version("dplyr", "1.0.0")
```

## Table of Contents
* [Installation](#installation)
Expand All @@ -69,7 +84,7 @@ Package features include:
## Installation

```{r, eval = FALSE}
# install the current CRAN version (0.2.0)
# install the current CRAN version (0.2.1)
install.packages("salesforcer")
# or get the development version on GitHub
Expand Down
45 changes: 31 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Maturing](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www
[![Monthly
Downloads](https://cranlogs.r-pkg.org/badges/last-month/salesforcer)](https://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)
Status](https://codecov.io/gh/StevenMMortimer/salesforcer/branch/main/graph/badge.svg)](https://codecov.io/gh/StevenMMortimer/salesforcer?branch=main)
<!-- badges: end -->

{salesforcer} is an R package that connects to Salesforce Platform APIs
Expand Down Expand Up @@ -51,6 +51,23 @@ Package features include:
- Passing API call control parameters such as, “All or None”,
“Duplicate Rule”, “Assignment Rule” execution and many more\!

**CAUTION: The most recent release, {salesforcer 0.2.1}, requires {dplyr
1.0.0} because {dplyr 1.0.1} introduced a bug in `bind_rows()` with how
it binds lists where the list elements have differing lengths. This is
documented in tidyverse/dplyr\#5417 and r-lib/vctrs\#1073. The timeline
for a fix is unknown as of August 2020, but a new version of
{salesforcer} (0.2.2) will be released immediately following the {dplyr}
fix.**

You can install the older version of {dplyr} using the following
command:

``` r
# remove.packages("dplyr")
# install.packages("remotes")
remotes::install_version("dplyr", "1.0.0")
```

## Table of Contents

- [Installation](#installation)
Expand All @@ -69,7 +86,7 @@ Package features include:
## Installation

``` r
# install the current CRAN version (0.2.0)
# install the current CRAN version (0.2.1)
install.packages("salesforcer")

# or get the development version on GitHub
Expand Down Expand Up @@ -168,8 +185,8 @@ created_records
#> # A tibble: 2 x 2
#> id success
#> <chr> <lgl>
#> 1 0033s000013wZZ3AAM TRUE
#> 2 0033s000013wZZ4AAM TRUE
#> 1 0033s0000149YhZAAU TRUE
#> 2 0033s0000149YhaAAE TRUE
```

### Query
Expand All @@ -194,8 +211,8 @@ queried_records
#> # A tibble: 2 x 3
#> Id FirstName LastName
#> <chr> <chr> <chr>
#> 1 0033s000013wZZ3AAM Test Contact-Create-1
#> 2 0033s000013wZZ4AAM Test Contact-Create-2
#> 1 0033s0000149YhZAAU Test Contact-Create-1
#> 2 0033s0000149YhaAAE Test Contact-Create-2
```

**NOTE**: In the example above, you’ll notice that the `"Account.Name"`
Expand Down Expand Up @@ -232,8 +249,8 @@ updated_records
#> # A tibble: 2 x 2
#> id success
#> <chr> <lgl>
#> 1 0033s000013wZZ3AAM TRUE
#> 2 0033s000013wZZ4AAM TRUE
#> 1 0033s0000149YhZAAU TRUE
#> 2 0033s0000149YhaAAE TRUE
```

### Bulk Operations
Expand Down Expand Up @@ -270,8 +287,8 @@ created_records
#> # A tibble: 2 x 4
#> Id Success Created Error
#> <chr> <lgl> <lgl> <lgl>
#> 1 0033s000013wZXhAAM TRUE TRUE NA
#> 2 0033s000013wZXiAAM TRUE TRUE NA
#> 1 0033s0000149YheAAE TRUE TRUE NA
#> 2 0033s0000149YhfAAE TRUE TRUE NA

# query large recordsets using the Bulk API
my_soql <- sprintf("SELECT Id,
Expand All @@ -286,17 +303,17 @@ queried_records
#> # A tibble: 2 x 3
#> Id FirstName LastName
#> <chr> <chr> <chr>
#> 1 0033s000013wZXhAAM Test Contact-Create-1
#> 2 0033s000013wZXiAAM Test Contact-Create-2
#> 1 0033s0000149YheAAE Test Contact-Create-1
#> 2 0033s0000149YhfAAE Test Contact-Create-2

# delete these records using the Bulk 2.0 API
deleted_records <- sf_delete(queried_records$Id, "Contact", api_type = "Bulk 2.0")
deleted_records
#> # A tibble: 2 x 4
#> Id sf__Id sf__Created sf__Error
#> <chr> <chr> <lgl> <lgl>
#> 1 0033s000013wZXhAAM 0033s000013wZXhAAM FALSE NA
#> 2 0033s000013wZXiAAM 0033s000013wZXiAAM FALSE NA
#> 1 0033s0000149YheAAE 0033s0000149YheAAE FALSE NA
#> 2 0033s0000149YhfAAE 0033s0000149YhfAAE FALSE NA
```

### Using the Metadata API
Expand Down
Loading

0 comments on commit 551c2fd

Please sign in to comment.