Skip to content

Commit

Permalink
Issue201 (#202)
Browse files Browse the repository at this point in the history
* fixing links for CRAN submission

* udpating all http links to https

* reverting RSocrata.Rproj
  • Loading branch information
geneorama authored Sep 16, 2021
1 parent 2e8802b commit 3cd2e2b
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 44 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# See README.md for instructions, or for more configuration options,
# see the wiki:
# http://docs.travis-ci.com/user/languages/r/
# https://docs.travis-ci.com/user/languages/r/
sudo: false

language: r
Expand All @@ -14,7 +14,7 @@ r:
warnings_are_errors: true

before_script:
- Rscript -e 'install.packages("covr", repos="http://mirror.las.iastate.edu/CRAN/")'
- Rscript -e 'install.packages("covr", repos="https://mirror.las.iastate.edu/CRAN/")'

after_success:
- Rscript -e 'library(covr);coveralls()'
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ When you want to make a change, either to fix a bug or introduce a new feature,
* Add unit tests for any new features.
* Document any new functions or new arguments within any existing function.
* Iterate either version or build number in the `DESCRIPTION` file:
* The version number follows the `x.y.z-build` format and increments based on [semantic versioning 2.0.0](http://semver.org/spec/v2.0.0.html). Please update versions corresponding to those guidelines.
* The version number follows the `x.y.z-build` format and increments based on [semantic versioning 2.0.0](https://semver.org/spec/v2.0.0.html). Please update versions corresponding to those guidelines.
* If your contribution takes several commits, please increment the build number (e.g., x.y.z-build) so there is a unique relationship of the version-build number to each commit.
* Update the DESCRIPTION file for any new dependencies on packages or minimum verson of R required (up to the current release of R).
* Run all tests in `tests/testthat/`.
Expand Down
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ Package: RSocrata
Type: Package
Title: Download or Upload 'Socrata' Data Sets
Description: Provides easier interaction with
'Socrata' open data portals <http://dev.socrata.com>.
'Socrata' open data portals <https://dev.socrata.com>.
Users can provide a 'Socrata' data set resource URL,
or a 'Socrata' Open Data API (SoDA) web query,
or a 'Socrata' "human-friendly" URL,
returns an R data frame. Converts dates to 'POSIX'
format and manages throttling by 'Socrata'.
Users can upload data to 'Socrata' portals directly
from R.
Version: 1.7.11-1
Date: 2021-09-10
Version: 1.7.11-2
Date: 2021-09-13
Author: Hugh Devlin, Ph. D., Tom Schenk, Jr., Gene Leynes, Nick Lucius, John Malc, Mark Silverberg, and Peter Schmeideskamp
Maintainer: "Tom Schenk Jr." <developers@cityofchicago.org>
Depends:
Expand Down
14 changes: 7 additions & 7 deletions R/RSocrata.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ isFourByFour <- function(fourByFour) {
#' resolve conflicting API token by deferring to original URL.
#' @param url - a string; character vector of length one
#' @param app_token - a string; SODA API token used to query the data
#' portal \url{http://dev.socrata.com/consumers/getting-started.html}
#' portal \url{https://dev.socrata.com/consumers/getting-started.html}
#' @return a - valid Url
#' @importFrom httr parse_url build_url
#' @author Tom Schenk Jr \email{tom.schenk@@cityofchicago.org}
Expand Down Expand Up @@ -296,7 +296,7 @@ getSodaTypes <- function(response) {
#' May include SoQL parameters,
#' but is assumed to not include a SODA offset parameter
#' @param app_token - a string; SODA API token used to query the data
#' portal \url{http://dev.socrata.com/consumers/getting-started.html}
#' portal \url{https://dev.socrata.com/consumers/getting-started.html}
#' @param email - Optional. The email to the Socrata account with read access to the dataset
#' @param password - Optional. The password associated with the email to the Socrata account
#' @param stringsAsFactors - Optional. Should character columns be converted to factor (TRUE or FALSE)?
Expand All @@ -308,15 +308,15 @@ getSodaTypes <- function(response) {
#' url <- "https://soda.demo.socrata.com/dataset/USGS-Earthquakes-for-2012-11-01-API/4334-bgaj"
#' df <- read.socrata(url)
#' # SoDA URL:
#' df <- read.socrata("http://soda.demo.socrata.com/resource/4334-bgaj.csv")
#' df <- read.socrata("https://soda.demo.socrata.com/resource/4334-bgaj.csv")
#' # Download private dataset
#' socrataEmail <- Sys.getenv("SOCRATA_EMAIL", "mark.silverberg+soda.demo@@socrata.com")
#' socrataPassword <- Sys.getenv("SOCRATA_PASSWORD", "7vFDsGFDUG")
#' privateResourceToReadCsvUrl <- "https://soda.demo.socrata.com/resource/a9g2-feh2.csv" # dataset
#' read.socrata(url = privateResourceToReadCsvUrl, email = socrataEmail, password = socrataPassword)
#' # Using an API key to read datasets (reduces throttling)
#' token <- "ew2rEMuESuzWPqMkyPfOSGJgE"
#' df <- read.socrata("http://soda.demo.socrata.com/resource/4334-bgaj.csv",
#' df <- read.socrata("https://soda.demo.socrata.com/resource/4334-bgaj.csv",
#' app_token = token)
#' nrow(df)
#' closeAllConnections()
Expand Down Expand Up @@ -396,7 +396,7 @@ read.socrata <- function(url, app_token = NULL, email = NULL, password = NULL,
#' @author Peter Schmiedeskamp \email{pschmied@@uw.edu}
#' @examples
#' # Download list of data sets
#' df <- ls.socrata("http://soda.demo.socrata.com")
#' df <- ls.socrata("https://soda.demo.socrata.com")
#' # Check schema definition for metadata
#' attributes(df)
#' @importFrom jsonlite fromJSON
Expand Down Expand Up @@ -466,11 +466,11 @@ checkUpdateResponse <- function(json_data_to_upload, url, http_verb, email, pass
#'
#' @param dataframe - dataframe to upload to Socrata
#' @param dataset_json_endpoint - Socrata Open Data Application Program Interface (SODA) endpoint (JSON only for now)
#' @param update_mode - "UPSERT" or "REPLACE"; consult http://dev.socrata.com/publishers/getting-started.html
#' @param update_mode - "UPSERT" or "REPLACE"; consult https://dev.socrata.com/publishers/getting-started.html
#' @param email - The email to the Socrata account with read access to the dataset
#' @param password - The password associated with the email to the Socrata account
#' @param app_token - a (non-required) string; SODA API token can be used to query the data
#' portal \url{http://dev.socrata.com/consumers/getting-started.html}
#' portal \url{https://dev.socrata.com/consumers/getting-started.html}
#' @author Mark Silverberg \email{mark.silverberg@@socrata.com}
#' @importFrom httr parse_url build_url
#' @examples
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,32 @@ RSocrata
========

[![Gitter](https://badges.gitter.im/gitterHQ/gitter.svg)](https://gitter.im/Chicago/RSocrata)
[![downloads](http://cranlogs.r-pkg.org/badges/RSocrata)](https://CRAN.R-project.org/package=RSocrata)
[![cran version](http://www.r-pkg.org/badges/version/RSocrata)](https://CRAN.R-project.org/package=RSocrata)
[![downloads](https://cranlogs.r-pkg.org/badges/RSocrata)](https://CRAN.R-project.org/package=RSocrata)
[![cran version](https://www.r-pkg.org/badges/version/RSocrata)](https://CRAN.R-project.org/package=RSocrata)

**Master**

Stable beta branch. Test about-to-be-released features in a stable pre-release build before it is submitted to CRAN.

[![Linux build - Master](https://img.shields.io/travis/Chicago/RSocrata/master.svg?style=flat-square&label=Linux%20build)](https://travis-ci.org/Chicago/RSocrata)[![Windows build - Master](https://img.shields.io/appveyor/ci/tomschenkjr/RSocrata/master.svg?style=flat-square&label=Windows%20build)](https://ci.appveyor.com/project/tomschenkjr/rsocrata/branch/master)[![Coverage - Master](https://img.shields.io/coveralls/Chicago/RSocrata/master.svg?style=flat-square&label=Coverage)](https://coveralls.io/r/Chicago/RSocrata?branch=master)
[![Linux build - Master](https://img.shields.io/travis/Chicago/RSocrata/master.svg?style=flat-square&label=Linux%20build)](https://travis-ci.org/Chicago/RSocrata)[![Windows build - Master](https://img.shields.io/appveyor/ci/tomschenkjr/RSocrata/master.svg?style=flat-square&label=Windows%20build)](https://ci.appveyor.com/project/tomschenkjr/rsocrata/branch/master)[![Coverage - Master](https://img.shields.io/coveralls/Chicago/RSocrata/master.svg?style=flat-square&label=Coverage)](https://coveralls.io/github/Chicago/RSocrata?branch=master)

**Dev**

"Nightly" alpha branch. Test the latest features and bug fixes -- enjoy at your own risk.

[![Linux build - Dev](https://img.shields.io/travis/Chicago/RSocrata/dev.svg?style=flat-square&label=Linux%20build)](https://travis-ci.org/Chicago/RSocrata)[![Windows build - Dev](https://img.shields.io/appveyor/ci/tomschenkjr/RSocrata/dev.svg?style=flat-square&label=Windows%20build)](https://ci.appveyor.com/project/tomschenkjr/rsocrata/branch/dev)[![Coverage - Dev](https://img.shields.io/coveralls/Chicago/RSocrata/dev.svg?style=flat-square&label=Coverage)](https://coveralls.io/r/Chicago/RSocrata?branch=dev)
[![Linux build - Dev](https://img.shields.io/travis/Chicago/RSocrata/dev.svg?style=flat-square&label=Linux%20build)](https://travis-ci.org/Chicago/RSocrata)[![Windows build - Dev](https://img.shields.io/appveyor/ci/tomschenkjr/RSocrata/dev.svg?style=flat-square&label=Windows%20build)](https://ci.appveyor.com/project/tomschenkjr/rsocrata/branch/dev)[![Coverage - Dev](https://img.shields.io/coveralls/Chicago/RSocrata/dev.svg?style=flat-square&label=Coverage)](https://coveralls.io/github/Chicago/RSocrata?branch=dev)

A tool for downloading and uploading Socrata datasets
-----------------------------------------------------

Provided with a URL to a dataset resource published on a [Socrata](http://www.socrata.com) webserver,
or a Socrata [SoDA (Socrata Open Data Application Program Interface) web API](http://dev.socrata.com) query,
Provided with a URL to a dataset resource published on a [Socrata](https://www.socrata.com) webserver,
or a Socrata [SoDA (Socrata Open Data Application Program Interface) web API](https://dev.socrata.com) query,
or a Socrata "human-friendly" URL, ```read.socrata()```
returns an [R data frame](http://stat.ethz.ch/R-manual/R-devel/library/base/html/data.frame.html).
Converts dates to [POSIX](http://stat.ethz.ch/R-manual/R-devel/library/base/html/DateTimeClasses.html) format.
returns an [R data frame](https://stat.ethz.ch/R-manual/R-devel/library/base/html/data.frame.html).
Converts dates to [POSIX](https://stat.ethz.ch/R-manual/R-devel/library/base/html/DateTimeClasses.html) format.
Supports CSV and JSON download file formats from Socrata.
Manages the throttling of data returned from Socrata and allows users to provide an [application token](http://dev.socrata.com/docs/app-tokens.html).
Supports [SoDA query parameters](http://dev.socrata.com/docs/queries.html) in the URL string for further filtering, sorting, and queries.
Manages the throttling of data returned from Socrata and allows users to provide an [application token](https://dev.socrata.com/docs/app-tokens.html).
Supports [SoDA query parameters](https://dev.socrata.com/docs/queries.html) in the URL string for further filtering, sorting, and queries.
Upload data to Socrata data portals using "upsert" and "replace" methods.

Use ```ls.socrata()``` to list all datasets available on a Socrata webserver.
Expand Down Expand Up @@ -62,7 +62,7 @@ Examples

### Reading SoDA valid URLs
```r
earthquakesDataFrame <- read.socrata("http://soda.demo.socrata.com/resource/4334-bgaj.csv")
earthquakesDataFrame <- read.socrata("https://soda.demo.socrata.com/resource/4334-bgaj.csv")
nrow(earthquakesDataFrame) # 1007 (two "pages")
class(earthquakesDataFrame$Datetime[1]) # POSIXlt
```
Expand All @@ -77,7 +77,7 @@ class(earthquakesDataFrame$Datetime[1]) # POSIXlt
### Using API key to read datasets
```r
token <- "ew2rEMuESuzWPqMkyPfOSGJgE"
earthquakesDataFrame <- read.socrata("http://soda.demo.socrata.com/resource/4334-bgaj.csv", app_token = token)
earthquakesDataFrame <- read.socrata("https://soda.demo.socrata.com/resource/4334-bgaj.csv", app_token = token)
nrow(earthquakesDataFrame)
```

Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ version: '{build}'
init:
ps: |
$ErrorActionPreference = "Stop"
Invoke-WebRequest http://raw.github.com/krlmlr/r-appveyor/master/scripts/appveyor-tool.ps1 -OutFile "..\appveyor-tool.ps1"
Invoke-WebRequest https://raw.github.com/krlmlr/r-appveyor/master/scripts/appveyor-tool.ps1 -OutFile "..\appveyor-tool.ps1"
Import-Module '..\appveyor-tool.ps1'
install:
ps: Bootstrap
Expand All @@ -15,7 +15,7 @@ build_script:
- travis-tool.sh install_deps

test_script:
- Rscript -e "install.packages('roxygen2', repos='http://cran.us.r-project.org'); library(roxygen2); roxygen2::roxygenize(package.dir='.', roclets=c('rd', 'collate', 'namespace'))"
- Rscript -e "install.packages('roxygen2', repos='https://cran.us.r-project.org'); library(roxygen2); roxygen2::roxygenize(package.dir='.', roclets=c('rd', 'collate', 'namespace'))"
- travis-tool.sh run_tests

on_failure:
Expand Down
2 changes: 1 addition & 1 deletion man/ls.socrata.Rd

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

6 changes: 3 additions & 3 deletions man/read.socrata.Rd

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

2 changes: 1 addition & 1 deletion man/validateUrl.Rd

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

4 changes: 2 additions & 2 deletions man/write.socrata.Rd

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

20 changes: 10 additions & 10 deletions tests/testthat/test-all.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ socrataPassword <- Sys.getenv("SOCRATA_PASSWORD", "7vFDsGFDUG")
context("posixify function")

test_that("read Socrata CSV is compatible with posixify", {
df <- read.socrata('http://soda.demo.socrata.com/resource/4334-bgaj.csv')
df <- read.socrata('https://soda.demo.socrata.com/resource/4334-bgaj.csv')
dt <- posixify("09/14/2012 10:38:01 PM")
expect_equal(dt, df$datetime[1]) ## Check that download matches test
})
Expand Down Expand Up @@ -57,7 +57,7 @@ test_that("posixify returns Short format", {
context("Socrata Calendar")

test_that("Calendar Date Short", {
df <- read.socrata('http://data.cityofchicago.org/resource/y93d-d9e3.csv?$order=debarment_date')
df <- read.socrata('https://data.cityofchicago.org/resource/y93d-d9e3.csv?$order=debarment_date')
dt <- df$debarment_date[1] # "05/21/1981"
expect_equal("POSIXct", class(dt)[1], label="data type of a date")
expect_equal("81", format(dt, "%y"), label="year")
Expand All @@ -71,7 +71,7 @@ test_that("Calendar Date Short", {
test_that("Date is not entirely NA if the first record is bad (issue 68)", {

## Define and test issue 68
# df <- read.socrata('http://data.cityofchicago.org/resource/me59-5fac.csv')
# df <- read.socrata('https://data.cityofchicago.org/resource/me59-5fac.csv')
# expect_false(object = all(is.na(df$Creation.Date)),
# "Testing issue 68 https://github.com/Chicago/RSocrata/issues/68")

Expand Down Expand Up @@ -228,13 +228,13 @@ test_that("read Socrata No Scheme", {
})

test_that("readSoQL", {
df <- read.socrata('http://soda.demo.socrata.com/resource/4334-bgaj.csv?$select=region')
df <- read.socrata('https://soda.demo.socrata.com/resource/4334-bgaj.csv?$select=region')
expect_equal(1007, nrow(df), label="rows")
expect_equal(1, ncol(df), label="columns")
})

test_that("URL is private (Unauthorized) (will fail)", {
expect_error(read.socrata('http://data.cityofchicago.org/resource/j8vp-2qpg.json'))
expect_error(read.socrata('https://data.cityofchicago.org/resource/j8vp-2qpg.json'))
})

test_that("readSocrataHumanReadable", {
Expand Down Expand Up @@ -268,7 +268,7 @@ test_that("Read URL provided by data.json from ls.socrata() - JSON", {

test_that("format is not supported", {
# Unsupported data formats
expect_error(read.socrata('http://soda.demo.socrata.com/resource/4334-bgaj.xml'))
expect_error(read.socrata('https://soda.demo.socrata.com/resource/4334-bgaj.xml'))
})

test_that("read Socrata JSON with missing fields (issue 19 - bind within page)", {
Expand All @@ -290,16 +290,16 @@ test_that("read Socrata JSON with missing fields (issue 19 - binding pages toget

test_that("Accept a URL with a $limit= clause and properly limit the results", {
## Define and test issue 83
df <- read.socrata("http://soda.demo.socrata.com/resource/4334-bgaj.json?$LIMIT=500") # uppercase
df <- read.socrata("https://soda.demo.socrata.com/resource/4334-bgaj.json?$LIMIT=500") # uppercase
expect_equal(500, nrow(df), label="rows",
info = "$LIMIT in uppercase https://github.com/Chicago/RSocrata/issues/83")
df <- read.socrata("http://soda.demo.socrata.com/resource/4334-bgaj.json?$limit=500") # lowercase
df <- read.socrata("https://soda.demo.socrata.com/resource/4334-bgaj.json?$limit=500") # lowercase
expect_equal(500, nrow(df), label="rows",
info = "$limit in lowercase https://github.com/Chicago/RSocrata/issues/83")
df <- read.socrata("http://soda.demo.socrata.com/resource/4334-bgaj.json?$LIMIT=1001&$order=:id") # uppercase
df <- read.socrata("https://soda.demo.socrata.com/resource/4334-bgaj.json?$LIMIT=1001&$order=:id") # uppercase
expect_equal(1001, nrow(df), label="rows",
info = "$LIMIT in uppercase with 2 queries https://github.com/Chicago/RSocrata/issues/83")
df <- read.socrata("http://soda.demo.socrata.com/resource/4334-bgaj.json?$limit=1001&$order=:id") # lowercase
df <- read.socrata("https://soda.demo.socrata.com/resource/4334-bgaj.json?$limit=1001&$order=:id") # lowercase
expect_equal(1001, nrow(df), label="rows lowercase",
info = "$LIMIT in lowercase with 2 queries https://github.com/Chicago/RSocrata/issues/83")
})
Expand Down

0 comments on commit 3cd2e2b

Please sign in to comment.