Skip to content

Commit 9b7c93d

Browse files
committed
update name of main class to plumber2
1 parent caa2870 commit 9b7c93d

File tree

12 files changed

+87
-80
lines changed

12 files changed

+87
-80
lines changed

NAMESPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ S3method(roxy_tag_parse,roxy_tag_tag)
3838
S3method(roxy_tag_parse,roxy_tag_trace)
3939
export(Break)
4040
export(Next)
41-
export(Plumber)
41+
export(Plumber2)
4242
export(abort_bad_request)
4343
export(abort_conflict)
4444
export(abort_forbidden)

R/Plumber.R

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
#' The Plumber Class
1+
#' The Plumber2 Class
22
#'
33
#' @description
44
#' This class encapsulates all of the logic of a plumber2 api, and is what gets
5-
#' passed around in the functional api of plumber2. The Plumber class is a
5+
#' passed around in the functional api of plumber2. The Plumber2 class is a
66
#' subclass of the [fiery::Fire] class. Please consult the documentation for
77
#' this for additional information on what this type of server is capable of.
8-
#' Note that the Plumber objects are reference objects, meaning that any change
8+
#' Note that the Plumber2 objects are reference objects, meaning that any change
99
#' to it will change all instances of the object.
1010
#'
1111
#' ## Initialization
12-
#' A new 'Plumber'-object is initialized using the `new()` method on the
12+
#' A new 'Plumber2'-object is initialized using the `new()` method on the
1313
#' generator:
1414
#'
1515
#' \tabular{l}{
16-
#' `api <- Plumber$new()`
16+
#' `api <- Plumber2$new()`
1717
#' }
1818
#'
1919
#' However, most users will use the functional api of the package and thus
2020
#' construct one using [api()]
2121
#'
2222
#' ## Copying
23-
#' As `Plumber` objects are using reference semantics new copies of an api cannot
24-
#' be made simply be assigning it to a new variable. If a true copy of a `Plumber`
23+
#' As `Plumber2` objects are using reference semantics new copies of an api cannot
24+
#' be made simply be assigning it to a new variable. If a true copy of a `Plumber2`
2525
#' object is desired, use the `clone()` method.
2626
#'
2727
#' @importFrom R6 R6Class
@@ -32,11 +32,11 @@
3232
#'
3333
#' @export
3434
#'
35-
Plumber <- R6Class(
36-
"Plumber",
35+
Plumber2 <- R6Class(
36+
"Plumber2",
3737
inherit = Fire,
3838
public = list(
39-
#' @description Create a new `Plumber` api
39+
#' @description Create a new `Plumber2` api
4040
#' @param host A string overriding the default host
4141
#' @param port An port number overriding the default port
4242
#' @param doc_type The type of API documentation to generate. Can be either
@@ -72,7 +72,7 @@ Plumber <- R6Class(
7272
#' handling
7373
#' @param env An environment that will be used as the default execution
7474
#' environment for the API
75-
#' @return A `Plumber` object
75+
#' @return A `Plumber2` object
7676
initialize = function(
7777
host = get_opts("host", "127.0.0.1"),
7878
port = get_opts("port", 8080),
@@ -176,7 +176,7 @@ Plumber <- R6Class(
176176

177177
if (!silent)
178178
cli::cli_text(
179-
"Plumber server started at http://{self$host}:{self$port}"
179+
"Plumber2 server started at http://{self$host}:{self$port}"
180180
)
181181
super$ignite(block = block, showcase = showcase, ..., silent = TRUE)
182182
},

R/api.R

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#' Create a new plumber API, optionally based on one or more plumber files
22
#'
3-
#' This is the main way to create a new Plumber object that encapsulates your
3+
#' This is the main way to create a new Plumber2 object that encapsulates your
44
#' full api. It is also possible to add files to the API after creation using
5+
#' `api_parse()`
56
#'
67
#' @param ... plumber files or directories containing plumber files to be parsed
78
#' in the given order. The order of parsing determines the final order of the
@@ -47,7 +48,7 @@
4748
#' evaluated in. Each file will be evaluated in it's own environment so they
4849
#' don't interfere with each other
4950
#'
50-
#' @return A Plumber object
51+
#' @return A [Plumber2] object
5152
#'
5253
#' @export
5354
#'
@@ -82,7 +83,7 @@ api <- function(
8283
)
8384
}
8485
} else {
85-
api <- Plumber$new(
86+
api <- Plumber2$new(
8687
host = server_yml$options$host %||% host,
8788
port = server_yml$options$port %||% port,
8889
doc_type = server_yml$options$docType %||% doc_type,
@@ -105,7 +106,7 @@ api <- function(
105106
server_yml$routes
106107
)
107108
} else {
108-
api <- Plumber$new(
109+
api <- Plumber2$new(
109110
host = host,
110111
port = port,
111112
doc_type = doc_type,
@@ -125,7 +126,7 @@ api <- function(
125126
#' @param x An object to test for whether it is a plumber api
126127
#' @export
127128
#'
128-
is_plumber_api <- function(x) inherits(x, "Plumber")
129+
is_plumber_api <- function(x) inherits(x, "Plumber2")
129130

130131
#' @rdname api
131132
#' @param api A plumber2 api object to parse files into

R/api_handlers.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ handle_constructor <- function(method, header = FALSE) {
150150
#' object
151151
#' * `response`: The response being returned to the client as a
152152
#' [reqres::Response] object
153-
#' * `server`: The [Plumber] object representing your server implementation
153+
#' * `server`: The [Plumber2] object representing your server implementation
154154
#' * `client_id`: A string uniquely identifying the session the request comes
155155
#' from
156156
#' * `query`: A list giving any additional arguments passed into the handler as
@@ -389,7 +389,7 @@ api_add_route <- function(
389389
#' The handler can take any of the following arguments:
390390
#' * `message`: Either a raw vector if the message recieved is in binary form or
391391
#' a single string, giving the message sent from the client
392-
#' * `server`: The [Plumber] object representing your server implementation
392+
#' * `server`: The [Plumber2] object representing your server implementation
393393
#' * `client_id`: A string uniquely identifying the session the request comes
394394
#' from
395395
#' * `request`: The request that was initially used to establish the websocket

R/api_logger.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#' Set logging function and access log format for the API
22
#'
3-
#' Plumber has a build-in logging facility that takes care of logging any
3+
#' Plumber2 has a build-in logging facility that takes care of logging any
44
#' conditions that are caught, as well as access logs. Further it is possible to
55
#' log custom messages using the `log()` method on the api object. However, the
66
#' actual logging is handled by a customizable function that can be set. You can

R/parse_plumber_file.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ parse_plumber_file <- function(
9494
modifier <- function(api) {
9595
for (mod in modifiers) {
9696
api <- mod(api)
97-
if (!inherits(api, "Plumber")) {
97+
if (!is_plumber_api(api)) {
9898
cli::cli_abort("All modifiers must return the plumber api")
9999
}
100100
}

_pkgdown.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ reference:
5959
- async_evaluaters
6060
- title: "Advanced"
6161
contents:
62-
- Plumber
62+
- Plumber2
6363
- api_logger
6464
- api_doc_add
6565
- api_on

0 commit comments

Comments
 (0)