[ARVADOS] updated: 1.1.0-192-g29659ff
Git user
git at public.curoverse.com
Wed Nov 29 08:44:31 EST 2017
Summary of changes:
sdk/R/.RData | Bin 0 -> 54456 bytes
sdk/R/.Rbuildignore | 2 +
sdk/R/ArvadosSDK.Rproj | 20 ++++++++
sdk/R/DESCRIPTION | 14 ++++++
sdk/R/NAMESPACE | 4 ++
sdk/R/R/Arvados.R | 74 ++++++++++++++++++++++++++++
sdk/R/R/HttpParser.R | 26 ++++++++++
sdk/R/R/HttpRequest.R | 117 ++++++++++++++++++++++++++++++++++++++++++++
sdk/R/R/arvados_objects.R | 75 ++++++++++++++++++++++++++++
sdk/R/R/custom_classes.R | 11 +++++
sdk/R/man/Arvados-class.Rd | 19 +++++++
sdk/R/man/Collection.Rd | 67 +++++++++++++++++++++++++
sdk/R/man/collection_get.Rd | 14 ++++++
13 files changed, 443 insertions(+)
create mode 100644 sdk/R/.RData
create mode 100644 sdk/R/.Rbuildignore
create mode 100644 sdk/R/ArvadosSDK.Rproj
create mode 100644 sdk/R/DESCRIPTION
create mode 100644 sdk/R/NAMESPACE
create mode 100644 sdk/R/R/Arvados.R
create mode 100644 sdk/R/R/HttpParser.R
create mode 100644 sdk/R/R/HttpRequest.R
create mode 100644 sdk/R/R/arvados_objects.R
create mode 100644 sdk/R/R/custom_classes.R
create mode 100644 sdk/R/man/Arvados-class.Rd
create mode 100644 sdk/R/man/Collection.Rd
create mode 100644 sdk/R/man/collection_get.Rd
via 29659ffa9e00efe7a845aa303c70ba543c23174d (commit)
from 18f8fa743346e5ac2ddc48dfdf6fdb4788c5b271 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 29659ffa9e00efe7a845aa303c70ba543c23174d
Author: Fuad Muhic <fmuhic at capeannenterprises.com>
Date: Wed Nov 29 14:42:42 2017 +0100
Arvados-DCO-1.1-Signed-off-by: Fuad Muhic <fmuhic at capeannenterprises.com> Init commit
diff --git a/sdk/R/.RData b/sdk/R/.RData
new file mode 100644
index 0000000..167f8c3
Binary files /dev/null and b/sdk/R/.RData differ
diff --git a/sdk/R/.Rbuildignore b/sdk/R/.Rbuildignore
new file mode 100644
index 0000000..91114bf
--- /dev/null
+++ b/sdk/R/.Rbuildignore
@@ -0,0 +1,2 @@
+^.*\.Rproj$
+^\.Rproj\.user$
diff --git a/sdk/R/ArvadosSDK.Rproj b/sdk/R/ArvadosSDK.Rproj
new file mode 100644
index 0000000..a648ce1
--- /dev/null
+++ b/sdk/R/ArvadosSDK.Rproj
@@ -0,0 +1,20 @@
+Version: 1.0
+
+RestoreWorkspace: Default
+SaveWorkspace: Default
+AlwaysSaveHistory: Default
+
+EnableCodeIndexing: Yes
+UseSpacesForTab: Yes
+NumSpacesForTab: 4
+Encoding: UTF-8
+
+RnwWeave: Sweave
+LaTeX: pdfLaTeX
+
+AutoAppendNewline: Yes
+StripTrailingWhitespace: Yes
+
+BuildType: Package
+PackageUseDevtools: Yes
+PackageInstallArgs: --no-multiarch --with-keep.source
diff --git a/sdk/R/DESCRIPTION b/sdk/R/DESCRIPTION
new file mode 100644
index 0000000..35fb870
--- /dev/null
+++ b/sdk/R/DESCRIPTION
@@ -0,0 +1,14 @@
+Package: ArvadosSDK
+Type: Package
+Title: What the Package Does (Title Case)
+Version: 0.1.0
+Author: Who wrote it
+Maintainer: The package maintainer <yourself at somewhere.net>
+Description: More about what it does (maybe more than one line)
+ Use four spaces when indenting paragraphs within the Description.
+License: What license is it under?
+Encoding: UTF-8
+LazyData: true
+RoxygenNote: 6.0.1.9000
+Imports:
+ httr
diff --git a/sdk/R/NAMESPACE b/sdk/R/NAMESPACE
new file mode 100644
index 0000000..41f3994
--- /dev/null
+++ b/sdk/R/NAMESPACE
@@ -0,0 +1,4 @@
+# Generated by roxygen2: do not edit by hand
+
+export(Arvados)
+export(Collection)
diff --git a/sdk/R/R/Arvados.R b/sdk/R/R/Arvados.R
new file mode 100644
index 0000000..b44e105
--- /dev/null
+++ b/sdk/R/R/Arvados.R
@@ -0,0 +1,74 @@
+source("./R/HttpRequest.R")
+source("./R/HttpParser.R")
+
+#' Arvados SDK Object
+#'
+#' All Arvados logic is inside this class
+#'
+#' @field token represents user authentification token.
+#' @field host represents server name we wish to connect to.
+#' @export Arvados
+Arvados <- setRefClass(
+
+ "Arvados",
+
+ fields = list(
+ token = "character",
+ host = "character"
+ ),
+
+ methods = list(
+
+ initialize = function(auth_token, host_name)
+ {
+ #Todo(Fudo): Validate token
+ token <<- auth_token
+ host <<- host_name
+ }
+ )
+)
+
+#' collection_get
+#'
+#' Get Arvados collection
+#'
+#' @name collection_get
+#' @field uuid UUID of the given collection
+Arvados$methods(
+
+ collection_get = function(uuid)
+ {
+ collection_relative_url <- paste0("collections/", uuid)
+ http_request <- HttpRequest("GET", token, host, collection_relative_url)
+ server_response <- http_request$execute()
+
+ httpParser <- HttpParser()
+ collection <- httpParser$parseCollectionGet(server_response)
+ class(collection) <- "ArvadosCollection"
+
+ return(collection)
+ }
+)
+
+#' collection_list
+#'
+#' List Arvados collections based on filter matching
+#'
+#' @name collection_list
+#' @field uuid UUID of the given collection
+Arvados$methods(
+
+ collection_list = function(filters = NULL, limit = NULL, offset = NULL)
+ {
+ #Todo(Fudo): Implement limit and offset
+ collection_relative_url <- "collections"
+ http_request <- HttpRequest("GET", token, host, collection_relative_url, filters)
+ server_response <- http_request$execute()
+
+ httpParser <- HttpParser()
+ collection <- httpParser$parseCollectionGet(server_response)
+ class(collection) <- "ArvadosCollectionList"
+
+ return(collection)
+ }
+)
diff --git a/sdk/R/R/HttpParser.R b/sdk/R/R/HttpParser.R
new file mode 100644
index 0000000..c685fb5
--- /dev/null
+++ b/sdk/R/R/HttpParser.R
@@ -0,0 +1,26 @@
+#' HttpParser
+#'
+HttpParser <- setRefClass(
+
+ "HttrParser",
+
+ fields = list(
+ ),
+
+ methods = list(
+ initialize = function()
+ {
+ },
+
+ parseCollectionGet = function(server_response)
+ {
+ #Todo(Fudo): Implement proper server code checking
+ #if(server_response$response_code != 200)
+ #stop("Error");
+
+ parsed_response <- httr::content(server_response, as = "parsed", type = "application/json")
+
+ #Todo(Fudo): Create new Collection object and populate it
+ }
+ )
+)
diff --git a/sdk/R/R/HttpRequest.R b/sdk/R/R/HttpRequest.R
new file mode 100644
index 0000000..3076eed
--- /dev/null
+++ b/sdk/R/R/HttpRequest.R
@@ -0,0 +1,117 @@
+source("./R/custom_classes.R")
+
+HttpRequest <- setRefClass(
+
+ "HttrRequest",
+
+ fields = list(
+ send_method = "character",
+ server_base_url = "character",
+ server_relative_url = "character",
+ auth_token = "character",
+ allowed_methods = "list",
+ query_filters = "ANY",
+ response_limit = "ANY",
+ query_offset = "ANY"
+ ),
+
+ methods = list(
+ initialize = function(method,
+ token,
+ base_url,
+ relative_url,
+ filters = NULL,
+ limit = 100,
+ offset = 0)
+ {
+ send_method <<- method
+ auth_token <<- token
+ server_base_url <<- base_url
+ server_relative_url <<- relative_url
+ query_filters <<- filters
+ response_limit <<- limit
+ query_offset <<- offset
+ },
+
+ execute = function()
+ {
+ http_method <- switch(send_method,
+ "GET" = .self$getRequest,
+ "POST" = .self$postRequest,
+ "PUT" = .self$putRequest,
+ "DELETE" = .self$deleteRequest,
+ "PATCH" = .self$pathcRequest)
+ http_method()
+ },
+
+ getRequest = function()
+ {
+ requestHeaders <- httr::add_headers(Authorization = .self$getAuthHeader())
+ requestQuery <- .self$generateQuery()
+ url <- paste0(server_base_url, server_relative_url, requestQuery)
+
+ server_data <- httr::GET(url = url,
+ config = requestHeaders)
+ },
+
+ #Todo(Fudo): Try to make this more generic
+ postRequest = function()
+ {
+ #Todo(Fudo): Implement this later on.
+ print("POST method")
+ },
+
+ putRequest = function()
+ {
+ #Todo(Fudo): Implement this later on.
+ print("PUT method")
+ },
+
+ deleteRequest = function()
+ {
+ #Todo(Fudo): Implement this later on.
+ print("DELETE method")
+ },
+
+ pathcRequest = function()
+ {
+ #Todo(Fudo): Implement this later on.
+ print("PATCH method")
+ },
+
+ getAuthHeader = function()
+ {
+ auth_method <- "OAuth2"
+ auth_header <- paste(auth_method, auth_token)
+ },
+
+ generateQuery = function()
+ {
+ finalQuery <- ""
+
+ if(!is.null(query_filters))
+ {
+ filters <- sapply(query_filters, function(filter)
+ {
+ filter <- sapply(filter, function(component)
+ {
+ component <- paste0("\"", component, "\"")
+ })
+
+ queryParameter <- paste(filter, collapse = ",+")
+ queryParameter <- paste0("[[", queryParameter, "]]")
+ })
+
+ encodedQuery <- URLencode(filters, reserved = T, repeated = T)
+
+ #Todo(Fudo): Hardcoded for now. Look for a better solution.
+ finalQuery <- paste0("?alt=json&filters=", encodedQuery)
+
+ #Todo(Fudo): This is a hack for now. Find a proper solution.
+ finalQuery <- str_replace_all(finalQuery, "%2B", "+")
+ }
+
+ finalQuery
+ }
+ )
+)
diff --git a/sdk/R/R/arvados_objects.R b/sdk/R/R/arvados_objects.R
new file mode 100644
index 0000000..88fd515
--- /dev/null
+++ b/sdk/R/R/arvados_objects.R
@@ -0,0 +1,75 @@
+#' Collection Object
+#'
+#' @details
+#' Todo: Update description
+#' Collection
+#'
+#' @param uuid Object ID
+#' @param etag Object version
+#' @param owner_uuid No description
+#' @param created_at No description
+#' @param modified_by_client_uuid No description
+#' @param modified_by_user_uuid No description
+#' @param modified_at No description
+#' @param portable_data_hash No description
+#' @param replication_desired No description
+#' @param replication_confirmed_at No description
+#' @param replication_confirmed No description
+#' @param updated_at No description
+#' @param manifest_text No description
+#' @param name No description
+#' @param description No description
+#' @param properties No description
+#' @param delete_at No description
+#' @param file_names No description
+#' @param trash_at No description
+#' @param is_trashed No description
+#'
+#' @return Collection object
+#'
+#' @family Collection functions
+#' @export
+Collection <- function(uuid = NULL,
+ etag = NULL,
+ owner_uuid = NULL,
+ created_at = NULL,
+ modified_by_client_uuid = NULL,
+ modified_by_user_uuid = NULL,
+ modified_at = NULL,
+ portable_data_hash = NULL,
+ replication_desired = NULL,
+ replication_confirmed_at = NULL,
+ replication_confirmed = NULL,
+ updated_at = NULL,
+ manifest_text = NULL,
+ name = NULL,
+ description = NULL,
+ properties = NULL,
+ delete_at = NULL,
+ file_names = NULL,
+ trash_at = NULL,
+ is_trashed = NULL)
+{
+ structure(list(uuid = uuid,
+ etag = etag,
+ owner_uuid = owner_uuid,
+ created_at = created_at,
+ modified_by_client_uuid = modified_by_client_uuid,
+ modified_by_user_uuid = modified_by_user_uuid,
+ modified_at = modified_at,
+ portable_data_hash = portable_data_hash,
+ replication_desired = replication_desired,
+ replication_confirmed_at = replication_confirmed_at,
+ replication_confirmed = replication_confirmed,
+ updated_at = updated_at,
+ manifest_text = manifest_text,
+ name = name,
+ description = description,
+ properties = properties,
+ delete_at = delete_at,
+ file_names = file_names,
+ trash_at = trash_at,
+ is_trashed = is_trashed),
+ class = "ArvadosCollection")
+}
+
diff --git a/sdk/R/R/custom_classes.R b/sdk/R/R/custom_classes.R
new file mode 100644
index 0000000..89d1d12
--- /dev/null
+++ b/sdk/R/R/custom_classes.R
@@ -0,0 +1,11 @@
+#Study(Fudo): For some reason this doesnt seem to work,
+#see what seems to be a problem.
+
+setOldClass("characterOrNULL")
+setClassUnion("characterOrNULL", c("character", "NULL"))
+
+setClassUnion("listOrNULL", c("list", "NULL"))
+setOldClass("listOrNULL")
+
+setOldClass("numericOrNULL")
+setClassUnion("numericOrNULL", c("numeric", "NULL"))
diff --git a/sdk/R/man/Arvados-class.Rd b/sdk/R/man/Arvados-class.Rd
new file mode 100644
index 0000000..2cc6dd1
--- /dev/null
+++ b/sdk/R/man/Arvados-class.Rd
@@ -0,0 +1,19 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/Arvados.R
+\docType{class}
+\name{Arvados-class}
+\alias{Arvados-class}
+\alias{Arvados}
+\title{Arvados SDK Object}
+\description{
+All Arvados logic is inside this class
+}
+\section{Fields}{
+
+\describe{
+\item{\code{token}}{represents user authentification token.}
+
+\item{\code{host}}{represents server name we wish to connect to.}
+}}
+
+
diff --git a/sdk/R/man/Collection.Rd b/sdk/R/man/Collection.Rd
new file mode 100644
index 0000000..add30b1
--- /dev/null
+++ b/sdk/R/man/Collection.Rd
@@ -0,0 +1,67 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/arvados_objects.R
+\name{Collection}
+\alias{Collection}
+\title{Collection Object}
+\usage{
+Collection(uuid = NULL, etag = NULL, owner_uuid = NULL,
+ created_at = NULL, modified_by_client_uuid = NULL,
+ modified_by_user_uuid = NULL, modified_at = NULL,
+ portable_data_hash = NULL, replication_desired = NULL,
+ replication_confirmed_at = NULL, replication_confirmed = NULL,
+ updated_at = NULL, manifest_text = NULL, name = NULL,
+ description = NULL, properties = NULL, delete_at = NULL,
+ file_names = NULL, trash_at = NULL, is_trashed = NULL)
+}
+\arguments{
+\item{uuid}{Object ID}
+
+\item{etag}{Object version}
+
+\item{owner_uuid}{No description}
+
+\item{created_at}{No description}
+
+\item{modified_by_client_uuid}{No description}
+
+\item{modified_by_user_uuid}{No description}
+
+\item{modified_at}{No description}
+
+\item{portable_data_hash}{No description}
+
+\item{replication_desired}{No description}
+
+\item{replication_confirmed_at}{No description}
+
+\item{replication_confirmed}{No description}
+
+\item{updated_at}{No description}
+
+\item{manifest_text}{No description}
+
+\item{name}{No description}
+
+\item{description}{No description}
+
+\item{properties}{No description}
+
+\item{delete_at}{No description}
+
+\item{file_names}{No description}
+
+\item{trash_at}{No description}
+
+\item{is_trashed}{No description}
+}
+\value{
+Collection object
+}
+\description{
+Collection Object
+}
+\details{
+Todo: Update description
+Collection
+}
+\concept{Collection functions}
diff --git a/sdk/R/man/collection_get.Rd b/sdk/R/man/collection_get.Rd
new file mode 100644
index 0000000..fac67e4
--- /dev/null
+++ b/sdk/R/man/collection_get.Rd
@@ -0,0 +1,14 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/Arvados.R
+\name{collection_get}
+\alias{collection_get}
+\title{collection_get}
+\description{
+Get Arvados collection
+}
+\section{Fields}{
+
+\describe{
+\item{\code{uuid}}{UUID of the given collection}
+}}
+
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list