33analyze_response <- function (x ) {
44 # stop if not return json
55 if (httr :: http_type(x ) != " application/json" ) {
6- stop (" Server not responded correctly" )
6+ rlang :: abort (" Server not responded correctly" )
77 }
88
99 # stop if server responding with error
@@ -49,26 +49,26 @@ prep_frequency <- function(x) {
4949 }
5050
5151 lkp <- data.table :: fread(
52- ' "freq","formatted"
53- "1 minute","1min"
54- "3 minutes","3min"
55- "5 minutes","5min"
56- "15 minutes","15min"
57- "30 minutes","30min"
58- "1 hour","1hour"
59- "2 hours","2hour"
60- "4 hours","4hour"
61- "6 hours","6hour"
62- "8 hours","8hour"
63- "12 hours","12hour"
64- "1 day","1day"
65- "1 week","1week"'
52+ ' "freq", "formatted"
53+ "1 minute", "1min"
54+ "3 minutes", "3min"
55+ "5 minutes", "5min"
56+ "15 minutes", "15min"
57+ "30 minutes", "30min"
58+ "1 hour", "1hour"
59+ "2 hours", "2hour"
60+ "4 hours", "4hour"
61+ "6 hours", "6hour"
62+ "8 hours", "8hour"
63+ "12 hours", "12hour"
64+ "1 day", "1day"
65+ "1 week", "1week"'
6666 )
6767
6868 x <- lkp [freq == x , ]$ formatted
6969
7070 if (length(x ) == 0 ) {
71- rlang :: abort(" Unsupported frequency! See function documentation for helps " )
71+ rlang :: abort(" Unsupported frequency! See function documentation for help " )
7272 }
7373
7474 return (x )
@@ -130,7 +130,6 @@ prep_datetime_range <- function(from, to, frequency) {
130130}
131131
132132prep_query_strings <- function (queries ) {
133-
134133 # convert to query strings
135134 if (length(queries ) > 0 ) {
136135 results <- c()
@@ -139,6 +138,7 @@ prep_query_strings <- function(queries) {
139138 result <- paste(i , queries [[i ]], sep = " =" )
140139 results <- c(results , result )
141140 }
141+
142142 results <- paste0(" ?" , paste0(results , collapse = " &" ))
143143 } else {
144144 results <- " "
@@ -183,9 +183,6 @@ get_paths <- function(x, type = "path", append = NULL) {
183183 "deposit-addresses", "/api/v2/deposit-addresses", "api/v2/deposit-addresses"'
184184 )
185185
186- # convert to data frame
187- # lkp <- as.data.frame(lkp)
188-
189186 # get specified endpoint
190187 results <- lkp [x == this.x , ][[type ]]
191188
0 commit comments