Skip to content

Commit

Permalink
fix to precision issue for long integer output to character in parsed…
Browse files Browse the repository at this point in the history
… requests, #106
  • Loading branch information
fawda123 committed Oct 22, 2024
1 parent ebbb593 commit 69c6450
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: rStrava
Type: Package
Title: Access the 'Strava' API
Version: 1.3.1.9000
Date: 2024-10-09
Date: 2024-10-22
Description: Functions to access data from the 'Strava v3 API' <https://developers.strava.com/>.
BugReports: https://github.com/fawda123/rStrava/issues
License: CC0
Expand All @@ -13,6 +13,7 @@ Imports:
ggspatial,
googleway,
httr,
jsonlite,
magrittr,
maptiles,
RCurl,
Expand Down
3 changes: 2 additions & 1 deletion R/get_activity.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ get_activity <- function(id, stoken){

req <- GET(url_activities(id), stoken, query = list(include_all_efforts=TRUE))
stop_for_status(req)
dataRaw <- content(req)
dataRaw <- content(req, as = 'text', encoding = 'UTF-8')
dataRaw <- jsonlite::fromJSON(dataRaw, simplifyVector = FALSE, bigint_as_char = TRUE)
return(dataRaw)

}
2 changes: 1 addition & 1 deletion R/get_leaderboard.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#' Retrieve the leaderboard of a segment
#'
#' @param stoken A \code{\link[httr]{config}} object created using the \code{\link{strava_oauth}} function
#' @param id charcater for id of the segment
#' @param id character for id of the segment
#' @param nleaders numeric for number of leaders to retrieve
#' @param All logical to retrieve all of the list
#'
Expand Down
8 changes: 5 additions & 3 deletions R/get_pages.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ get_pages<-function(url_, stoken, per_page = 30, page_id = 1, page_max = 1, befo
if(chk_lead){

req <- GET(url_, stoken, query = c(list(per_page=pmin(200, per_page), page=i), queries))
cont_req <- content(req)$entries
cont_req <- content(req, as = 'text', encoding = 'UTF-8')
cont_req <- jsonlite::fromJSON(cont_req, simplifyVector = FALSE, bigint_as_char = TRUE)$entries

if(length(cont_req) == 200){
per_page <- per_page - length(cont_req)
Expand All @@ -76,9 +77,10 @@ get_pages<-function(url_, stoken, per_page = 30, page_id = 1, page_max = 1, befo
if(per_page == 0) page_max <- i

} else {

req <- GET(url_, stoken, query = c(list(per_page=per_page, page=i, before=before, after=after), queries))
cont_req <- content(req)
cont_req <- content(req, as = 'text', encoding = 'UTF-8')
cont_req <- jsonlite::fromJSON(cont_req, simplifyVector = FALSE, bigint_as_char = TRUE)

}

Expand Down
3 changes: 2 additions & 1 deletion R/get_streams.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ get_streams <- function(stoken, id, request = "activities",
query = list(resolution = resolution, series_type = series_type))
ratelimit(req)
stop_for_status(req)
dataRaw <- content(req)
dataRaw <- content(req, as = 'text', encoding = 'UTF-8')
dataRaw <- jsonlite::fromJSON(dataRaw, simplifyVector = FALSE, bigint_as_char = TRUE)

return(dataRaw)

Expand Down
2 changes: 1 addition & 1 deletion man/get_leaderboard.Rd

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

0 comments on commit 69c6450

Please sign in to comment.