Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Genesys PGR
genesysr
Commits
7ac98123
Commit
7ac98123
authored
Jun 08, 2018
by
Matija Obreza
Browse files
Prepare for release on CRAN
- Included URL in DESCRIPTION - Ignore generated README.Rmd
parent
65c5af5a
Changes
6
Hide whitespace changes
Inline
Side-by-side
.Rbuildignore
View file @
7ac98123
^.*\.Rproj$
^.*\.Rproj$
^\.Rproj\.user$
^\.Rproj\.user$
^README\.Rmd$
^README-.*\.png$
^cran-comments\.md$
.gitignore
View file @
7ac98123
...
@@ -3,3 +3,5 @@
...
@@ -3,3 +3,5 @@
.RData
.RData
.Ruserdata
.Ruserdata
man
man
README.Rmd
cran-comments.md
DESCRIPTION
View file @
7ac98123
Package: genesysr
Package: genesysr
Title: R client for Genesys PGR (www.genesys-pgr.org)
Version: 0.9.1
Version: 0.1
Title: Genesys PGR Client
Description: Access data on plant genetic resources from genebanks around the world published on Genesys (<https://www.genesys-pgr.org>).
Your use of data is subject to terms and conditions available at <https://www.genesys-pgr.org/content/legal/terms>.
Authors@R: person("Matija", "Obreza", email = "matija.obreza@croptrust.org",
Authors@R: person("Matija", "Obreza", email = "matija.obreza@croptrust.org",
role = c("aut", "cre"))
role = c("aut", "cre"))
Description: Selected Genesys API calls implemented in R.
Allows for authentication and exposes common API calls.
Depends: R (>= 3.1.0)
Depends: R (>= 3.1.0)
License: Apache License 2.0
LazyData: true
Imports:
Imports:
httr
httr,
jsonlite
License: Apache License 2.0 + see LICENSE
RoxygenNote: 6.0.1
RoxygenNote: 6.0.1
URL: https://gitlab.croptrust.org/genesys-pgr/genesysr
NEWS.md
0 → 100644
View file @
7ac98123
# June 2018
First version of the Genesys API client for R is released.
R/api-client.R
View file @
7ac98123
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
#' Setup for Genesys Production
#' Setup for Genesys Production
#'
#'
#' Use the Genesys R Client with
\link{
https://www.genesys-pgr.org
}
requiring \code{\link{user_login}}
#' Use the Genesys R Client with
<
https://www.genesys-pgr.org
>
requiring \code{\link{user_login}}
#'
#'
#' @export
#' @export
setup_production
<-
function
()
{
setup_production
<-
function
()
{
...
@@ -30,7 +30,7 @@ setup_production <- function() {
...
@@ -30,7 +30,7 @@ setup_production <- function() {
#' Setup for Genesys Sandbox
#' Setup for Genesys Sandbox
#'
#'
#' Use the Genesys R Client with
\link{
https://sandbox.genesys-pgr.org
}
requiring \code{\link{user_login}}
#' Use the Genesys R Client with
<
https://sandbox.genesys-pgr.org
>
requiring \code{\link{user_login}}
#'
#'
#' @export
#' @export
setup_sandbox
<-
function
()
{
setup_sandbox
<-
function
()
{
...
@@ -39,7 +39,7 @@ setup_sandbox <- function() {
...
@@ -39,7 +39,7 @@ setup_sandbox <- function() {
#' Configure the Genesys environment
#' Configure the Genesys environment
#'
#'
#' @param server Server base URL (e.g.
\link{
https://www.genesys-pgr.org
}
or
\link{
https://sandbox.genesys-pgr.org
}
)
#' @param server Server base URL (e.g.
"
https://www.genesys-pgr.org
"
or
"
https://sandbox.genesys-pgr.org
"
)
#' @param client_id OAuth client ID
#' @param client_id OAuth client ID
#' @param client_secret OAuth client secret
#' @param client_secret OAuth client secret
#'
#'
...
@@ -67,7 +67,9 @@ print_setup <- function() {
...
@@ -67,7 +67,9 @@ print_setup <- function() {
#' Provide OAuth2 token to use for authorization with Genesys
#' Provide OAuth2 token to use for authorization with Genesys
#'
#'
#' @seealso \code{\link{login}}
#' @param authorization OAuth2 Authorization header obtained from somewhere else (e.g. an ENV variable)
#'
#' @seealso \code{\link{user_login}}, \code{\link{client_login}}
#' @export
#' @export
authorization
<-
function
(
authorization
)
{
authorization
<-
function
(
authorization
)
{
assign
(
"Authorization"
,
authorization
,
envir
=
.genesysEnv
)
assign
(
"Authorization"
,
authorization
,
envir
=
.genesysEnv
)
...
@@ -145,7 +147,7 @@ client_login <- function() {
...
@@ -145,7 +147,7 @@ client_login <- function() {
}
}
api_call
<-
function
(
path
,
method
=
"get"
,
server
=
GENESYS_SERVER
)
{
api_call
<-
function
(
path
,
method
=
"get"
)
{
resp
<-
httr
::
GET
(
api_url
(
path
),
httr
::
add_headers
(
resp
<-
httr
::
GET
(
api_url
(
path
),
httr
::
add_headers
(
Authorization
=
.genesysEnv
$
Authorization
Authorization
=
.genesysEnv
$
Authorization
)
)
...
@@ -162,7 +164,7 @@ api_call <- function(path, method = "get", server = GENESYS_SERVER) {
...
@@ -162,7 +164,7 @@ api_call <- function(path, method = "get", server = GENESYS_SERVER) {
#' Get full Genesys API URL for a specific path
#' Get full Genesys API URL for a specific path
#'
#'
#' @param path
#' @param path
relative path of the API endpoint (e.g. \code{/me})
#'
#'
#' @return Absolute URL to an API call
#' @return Absolute URL to an API call
#' @export
#' @export
...
...
R/filters.R
View file @
7ac98123
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#' See FAO/Bioversity Multi-Crop Passport Descriptors.
#' See FAO/Bioversity Multi-Crop Passport Descriptors.
#'
#'
#' @param filter Existing filters (or blank list if not provided)
#' @param filter Existing filters (or blank list if not provided)
#' @param DOI Accession DOI
#' @param ORIGCTY Country of origin
#' @param ORIGCTY Country of origin
#' @param SAMPSTAT Biological status of sample
#' @param SAMPSTAT Biological status of sample
#'
#'
...
@@ -37,6 +38,8 @@ mcpd_filter <- function(filter = list(), DOI = NULL, ORIGCTY = NULL, SAMPSTAT =
...
@@ -37,6 +38,8 @@ mcpd_filter <- function(filter = list(), DOI = NULL, ORIGCTY = NULL, SAMPSTAT =
}
}
#' Add filter on accession DOI
#' Add filter on accession DOI
#' @param filter Existing filters (or blank list if not provided)
#' @param DOI Accession DOI
#' @export
#' @export
filter_DOI
<-
function
(
filter
=
list
(),
DOI
)
{
filter_DOI
<-
function
(
filter
=
list
(),
DOI
)
{
f
<-
c
(
filter
)
f
<-
c
(
filter
)
...
@@ -47,6 +50,8 @@ filter_DOI <- function(filter = list(), DOI) {
...
@@ -47,6 +50,8 @@ filter_DOI <- function(filter = list(), DOI) {
}
}
#' Add filter on Country of origin of material
#' Add filter on Country of origin of material
#' @param filter Existing filters (or blank list if not provided)
#' @param ORIGCTY Country of origin
#' @export
#' @export
filter_ORIGCTY
<-
function
(
filter
=
list
(),
ORIGCTY
)
{
filter_ORIGCTY
<-
function
(
filter
=
list
(),
ORIGCTY
)
{
f
<-
c
(
filter
)
f
<-
c
(
filter
)
...
@@ -57,6 +62,8 @@ filter_ORIGCTY <- function(filter = list(), ORIGCTY) {
...
@@ -57,6 +62,8 @@ filter_ORIGCTY <- function(filter = list(), ORIGCTY) {
}
}
#' Add filter on Biological status of sample
#' Add filter on Biological status of sample
#' @param filter Existing filters (or blank list if not provided)
#' @param SAMPSTAT Biological status of sample
#' @export
#' @export
filter_SAMPSTAT
<-
function
(
filter
=
list
(),
SAMPSTAT
)
{
filter_SAMPSTAT
<-
function
(
filter
=
list
(),
SAMPSTAT
)
{
f
<-
c
(
filter
)
f
<-
c
(
filter
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment