boB Rudis
6 years ago
commit
e6c85d8958
29 changed files with 794 additions and 0 deletions
@ -0,0 +1,12 @@ |
|||
^.*\.Rproj$ |
|||
^\.Rproj\.user$ |
|||
^\.travis\.yml$ |
|||
^README\.*Rmd$ |
|||
^README\.*html$ |
|||
^NOTES\.*Rmd$ |
|||
^NOTES\.*html$ |
|||
^\.codecov\.yml$ |
|||
^README_files$ |
|||
^doc$ |
|||
^\.httr-oauth$ |
|||
^CONDUCT\.md$ |
@ -0,0 +1 @@ |
|||
comment: false |
@ -0,0 +1,9 @@ |
|||
.DS_Store |
|||
.Rproj.user |
|||
.Rhistory |
|||
.RData |
|||
.Rproj |
|||
src/*.o |
|||
src/*.so |
|||
src/*.dll |
|||
.httr-oauth |
@ -0,0 +1,31 @@ |
|||
language: r |
|||
|
|||
warnings_are_errors: true |
|||
|
|||
sudo: required |
|||
|
|||
cache: packages |
|||
|
|||
r: |
|||
- oldrel |
|||
- release |
|||
- devel |
|||
|
|||
apt_packages: |
|||
- libv8-dev |
|||
- xclip |
|||
|
|||
env: |
|||
global: |
|||
- CRAN: http://cran.rstudio.com |
|||
|
|||
after_success: |
|||
- Rscript -e 'covr::codecov()' |
|||
|
|||
notifications: |
|||
email: |
|||
- bob@rud.is |
|||
irc: |
|||
channels: |
|||
- "104.236.112.222#builds" |
|||
nick: travisci |
@ -0,0 +1,25 @@ |
|||
# Contributor Code of Conduct |
|||
|
|||
As contributors and maintainers of this project, we pledge to respect all people who |
|||
contribute through reporting issues, posting feature requests, updating documentation, |
|||
submitting pull requests or patches, and other activities. |
|||
|
|||
We are committed to making participation in this project a harassment-free experience for |
|||
everyone, regardless of level of experience, gender, gender identity and expression, |
|||
sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion. |
|||
|
|||
Examples of unacceptable behavior by participants include the use of sexual language or |
|||
imagery, derogatory comments or personal attacks, trolling, public or private harassment, |
|||
insults, or other unprofessional conduct. |
|||
|
|||
Project maintainers have the right and responsibility to remove, edit, or reject comments, |
|||
commits, code, wiki edits, issues, and other contributions that are not aligned to this |
|||
Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed |
|||
from the project team. |
|||
|
|||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by |
|||
opening an issue or contacting one or more of the project maintainers. |
|||
|
|||
This Code of Conduct is adapted from the Contributor Covenant |
|||
(http:contributor-covenant.org), version 1.0.0, available at |
|||
http://contributor-covenant.org/version/1/0/0/ |
@ -0,0 +1,31 @@ |
|||
Package: pressur |
|||
Type: Package |
|||
Title: Query and Orchestrate the 'WordPress' 'API' |
|||
Version: 0.1.0 |
|||
Date: 2017-12-27 |
|||
Authors@R: c( |
|||
person("Bob", "Rudis", email = "bob@rud.is", role = c("aut", "cre"), |
|||
comment = c(ORCID = "0000-0001-5670-2640")) |
|||
) |
|||
Maintainer: Bob Rudis <bob@rud.is> |
|||
Description: 'WordPress' has a fairly comprehensive 'API' <https://developer.wordpress.com/> |
|||
that makes it possible to perform blog orchestration ('CRUD' operations on posts, users, |
|||
sites, etc.) as well as retrieve and process blog statistics. Tools are provided to work |
|||
with the 'WordPress' 'API' functions. |
|||
URL: https://github.com/hrbrmstr/pressur |
|||
BugReports: https://github.com/hrbrmstr/pressur/issues |
|||
License: AGPL |
|||
Encoding: UTF-8 |
|||
Suggests: |
|||
testthat, |
|||
covr |
|||
Depends: |
|||
R (>= 3.2.0) |
|||
Imports: |
|||
purrr, |
|||
httr, |
|||
stringi, |
|||
crayon, |
|||
tibble, |
|||
anytime |
|||
RoxygenNote: 6.0.1.9000 |
@ -0,0 +1,14 @@ |
|||
# Generated by roxygen2: do not edit by hand |
|||
|
|||
export(wp_about_me) |
|||
export(wp_auth) |
|||
export(wp_get_my_posts) |
|||
export(wp_post_stats) |
|||
export(wp_site_info) |
|||
export(wp_site_stats) |
|||
import(anytime) |
|||
import(crayon) |
|||
import(httr) |
|||
import(purrr) |
|||
import(stringi) |
|||
importFrom(tibble,data_frame) |
@ -0,0 +1,2 @@ |
|||
0.1.0 |
|||
* Initial release |
@ -0,0 +1 @@ |
|||
.pkg <- new.env(parent = emptyenv()) |
@ -0,0 +1,22 @@ |
|||
#' Get your user information |
|||
#' |
|||
#' @md |
|||
#' @references <https://developer.wordpress.com/docs/api/1.1/get/me/> |
|||
#' @export |
|||
#' @examples \dontrun{ |
|||
#' wp_auth() |
|||
#' wp_about_me() |
|||
#' } |
|||
wp_about_me <- function() { |
|||
|
|||
httr::GET( |
|||
url = sprintf("https://public-api.wordpress.com/rest/v1.1/me"), |
|||
.add_bearer_token(), |
|||
httr::accept_json() |
|||
) -> res |
|||
|
|||
httr::stop_for_status(res) |
|||
|
|||
httr::content(res) |
|||
|
|||
} |
@ -0,0 +1,113 @@ |
|||
.wp_next_posts_page <- function(.x) { |
|||
|
|||
ret <- NULL |
|||
|
|||
if (!is.null(.x$meta$next_page)) { |
|||
|
|||
httr::GET( |
|||
url = "https://public-api.wordpress.com/rest/v1.1/me/posts", |
|||
query = list(page_handle = .x$meta$next_page), |
|||
.add_bearer_token(), |
|||
httr::accept_json() |
|||
) -> res |
|||
|
|||
return(httr::content(res)) |
|||
|
|||
} |
|||
|
|||
return(ret) |
|||
|
|||
} |
|||
|
|||
#' Get all 'my' posts across all sites |
|||
#' |
|||
#' @md |
|||
#' @references <https://developer.wordpress.com/docs/api/1.1/get/me/posts/> |
|||
#' @param quiet if `TRUE` then no progress information will be displayed |
|||
#' @export |
|||
#' @examples \dontrun{ |
|||
#' wp_auth() |
|||
#' my_posts <- wp_get_my_posts() |
|||
#' } |
|||
wp_get_my_posts <- function(.quiet=FALSE) { |
|||
|
|||
httr::GET( |
|||
url = "https://public-api.wordpress.com/rest/v1.1/me/posts", |
|||
.add_bearer_token(), |
|||
httr::accept_json() |
|||
) -> res |
|||
|
|||
httr::stop_for_status(res) |
|||
|
|||
pg <- httr::content(res) |
|||
|
|||
.posts <- list() |
|||
.posts[[1]] <- pg |
|||
|
|||
n_pages <- ceiling(pg$found / 20) |
|||
|
|||
for (idx in 2:n_pages) { |
|||
if (!.quiet) cat(crayon::green("."), sep="") |
|||
pg <- .wp_next_posts_page(pg) |
|||
.posts[[idx]] <- pg |
|||
} |
|||
if (!.quiet) cat("\n",sep="") |
|||
|
|||
purrr::map_df(.posts, ~{ |
|||
|
|||
purrr::map_df(.x$posts, ~{ |
|||
|
|||
list( |
|||
post_id = as.character(.x$ID), |
|||
site_id = as.character(.x$site_ID), |
|||
author = list(.x$author), |
|||
date = .x$date, |
|||
modified = .x$modified, |
|||
title = .x$title, |
|||
url = .x$URL, |
|||
short_url = .x$short_URL, |
|||
content = .x$content, |
|||
excerpt = .x$excerpt, |
|||
slug = .x$slug, |
|||
guid = .x$guid, |
|||
status = .x$status, |
|||
sticky = .x$sticky, |
|||
password = .x$password, |
|||
parent = .x$parent, |
|||
type = .x$type, |
|||
discussion = list(.x$discussion), |
|||
likes_enabled = .x$likes_enabled, |
|||
sharing_enabled = .x$sharing_enabled, |
|||
like_count = .x$like_count, |
|||
i_like = .x$i_like, |
|||
is_reblogged = .x$is_reblogged, |
|||
is_following = .x$is_following, |
|||
global_id = .x$global_ID, |
|||
featured_image = .x$featured_image, |
|||
post_thumbnail = list(.x$post_thumbnail), |
|||
format = .x$format, |
|||
geo = .x$geo, |
|||
menu_order = .x$menu_order, |
|||
page_template = .x$page_template, |
|||
publicize_urls = list(.x$publicize_URLs), |
|||
terms = list(.x$terms), |
|||
tags = list(.x$tags), |
|||
categories = list(.x$categories), |
|||
attachments = list(.x$attachments), |
|||
attachment_count = list(.x$attachment_count), |
|||
metadata = list(.x$metadata), |
|||
meta = list(.x$meta), |
|||
capabilities = list(.x$capabilities), |
|||
other_URLs = list(.x$other_URLs) |
|||
) |
|||
|
|||
}) |
|||
|
|||
}) -> .posts_df |
|||
|
|||
.posts_df$date <- anytime::anytime(.posts_df$date) |
|||
.posts_df$modified <- anytime::anytime(.posts_df$modified) |
|||
|
|||
return(.posts_df) |
|||
|
|||
} |
@ -0,0 +1,44 @@ |
|||
#' Retrieve statistics for a WordPress post |
|||
#' |
|||
#' TODO: make most of the list columns more immediately usable |
|||
#' |
|||
#' @md |
|||
#' @references <https://developer.wordpress.com/docs/api/1.1/get/sites/$site/stats/post/$post_id/> |
|||
#' @param site site id or domain |
|||
#' @param post_id a valid post id |
|||
#' @note I've only had this work successfully with my blog by using the site id. |
|||
#' @export |
|||
#' @examples \dontrun{ |
|||
#' wp_auth() |
|||
#' me <- wp_about_me() |
|||
#' wp_post_stats(me$primary_blog, "7713") |
|||
#' } |
|||
wp_post_stats <- function(site, post_id) { |
|||
|
|||
httr::GET( |
|||
url = sprintf("https://public-api.wordpress.com/rest/v1.1/sites/%s/stats/post/%s", site, post_id), |
|||
.add_bearer_token(), |
|||
accept_json() |
|||
) -> res |
|||
|
|||
httr::stop_for_status(res) |
|||
|
|||
.stats <- httr::content(res) |
|||
|
|||
tibble::data_frame( |
|||
date = as.Date(.stats$date), |
|||
views = .stats$views, |
|||
years = list(.stats$years), |
|||
averages = list(.stats$averages), |
|||
weeks = list(.stats$weeks), |
|||
fields = list(.stats$fields), |
|||
data = list(.stats$data), |
|||
highest_month = .stats$highest_month, |
|||
highest_day_average = .stats$highest_day_average, |
|||
highest_week_average = .stats$highest_week_average, |
|||
post_detail = list(.stats$post) |
|||
) -> .stats_df |
|||
|
|||
return(.stats_df) |
|||
|
|||
} |
@ -0,0 +1,13 @@ |
|||
#' Query and Orchestrate the 'WordPress' 'API' |
|||
#' |
|||
#' 'WordPress' has a fairly comprehensive 'API' <https://developer.wordpress.com/> |
|||
#' that makes it possible to perform blog orchestration ('CRUD' operations on posts, users, |
|||
#' sites, etc.) as well as retrieve and process blog statistics. Tools are provided to work |
|||
#' with the 'WordPress' 'API' functions. |
|||
#' |
|||
#' @name pressur |
|||
#' @docType package |
|||
#' @author Bob Rudis (bob@@rud.is) |
|||
#' @import purrr stringi httr crayon anytime |
|||
#' @importFrom tibble data_frame |
|||
NULL |
@ -0,0 +1,24 @@ |
|||
#' Get information about a site |
|||
#' |
|||
#' @md |
|||
#' @references <https://developer.wordpress.com/docs/api/1.2/get/sites/$site/> |
|||
#' @param site site id or domain |
|||
#' @note I've only had this work successfully with my blog by using the site id. |
|||
#' @export |
|||
#' @examples \dontrun{ |
|||
#' wp_auth() |
|||
#' me <- wp_about_me() |
|||
#' wp_site_info(me$primary_blog) |
|||
#' } |
|||
wp_site_info <- function(site) { |
|||
|
|||
httr::GET( |
|||
url = sprintf("https://public-api.wordpress.com/rest/v1.2/sites/%s", site), |
|||
httr::accept_json() |
|||
) -> res |
|||
|
|||
httr::stop_for_status(res) |
|||
|
|||
httr::content(res) |
|||
|
|||
} |
@ -0,0 +1,30 @@ |
|||
#' Get a site's stats |
|||
#' |
|||
#' @md |
|||
#' @references <https://developer.wordpress.com/docs/api/1.1/get/sites/$site/stats/> |
|||
#' @param site site id or domain |
|||
#' @note I've only had this work successfully with my blog by using the site id. |
|||
#' @export |
|||
#' @examples \dontrun{ |
|||
#' wp_auth() |
|||
#' me <- wp_about_me() |
|||
#' wp_site_stats(me$primary_blog) |
|||
#' } |
|||
wp_site_stats <- function(site) { |
|||
|
|||
httr::GET( |
|||
url = sprintf("https://public-api.wordpress.com/rest/v1.1/sites/%s/stats", site), |
|||
.add_bearer_token(), |
|||
accept_json() |
|||
) -> res |
|||
|
|||
httr::stop_for_status(res) |
|||
|
|||
.stats <- httr::content(res) |
|||
|
|||
.stats$visits <- purrr::map_df(.stats$visits$data, ~purrr::set_names(.x, .stats$visits$fields)) |
|||
.stats$visits$period <- anytime::anydate(.stats$visits$period) |
|||
|
|||
return(.stats) |
|||
|
|||
} |
@ -0,0 +1,3 @@ |
|||
.add_bearer_token <- function() { |
|||
httr::add_headers(`Authorization` = sprintf("Bearer %s", .pkg$token$credentials$access_token)) |
|||
} |
@ -0,0 +1,41 @@ |
|||
oauth_app( |
|||
appname = "wordpress", |
|||
key = Sys.getenv("WORDPRESS_API_KEY"), |
|||
secret = Sys.getenv("WORDPRESS_API_SECRET") |
|||
) -> wordpress_app |
|||
|
|||
oauth_endpoint( |
|||
base_url = "https://public-api.wordpress.com/oauth2", |
|||
request = "authenticate", |
|||
authorize = "authorize", |
|||
access = "token" |
|||
) -> wordpress_endpoint |
|||
|
|||
#' Authenticate to WordPress |
|||
#' |
|||
#' Call this at the start of any WordPress API interaction |
|||
#' |
|||
#' @md |
|||
#' @references <https://developer.wordpress.com/docs/oauth2/> |
|||
#' @export |
|||
#' @examples \dontrun{ |
|||
#' wp_auth() |
|||
#' } |
|||
wp_auth <- function() { |
|||
|
|||
oauth2.0_token( |
|||
wordpress_endpoint, |
|||
wordpress_app, |
|||
user_params = list( |
|||
grant_type = "authorization_code", |
|||
response_type = "code", |
|||
scope = "global" |
|||
), |
|||
cache = TRUE |
|||
) -> wordpress_token |
|||
|
|||
.pkg$token <- wordpress_token |
|||
|
|||
invisible(wordpress_token) |
|||
|
|||
} |
@ -0,0 +1,77 @@ |
|||
--- |
|||
output: rmarkdown::github_document |
|||
--- |
|||
|
|||
# pressur |
|||
|
|||
Query and Orchestrate the 'WordPress' 'API' |
|||
|
|||
## Description |
|||
|
|||
'WordPress' has a fairly comprehensive 'API' <https://developer.wordpress.com/> |
|||
that makes it possible to perform blog orchestration ('CRUD' operations on posts, users, |
|||
sites, etc.) as well as retrieve and process blog statistics. Tools are provided to work |
|||
with the 'WordPress' 'API' functions. |
|||
|
|||
### YOU MUST |
|||
|
|||
=> Go here and make an app: <https://developer.wordpress.com/apps/> |
|||
|
|||
=> Put the `Client ID` you receive into `~/.Renviron` with a line that looks like: |
|||
|
|||
`WORDPRESS_API_KEY=#####` |
|||
|
|||
=> Put the `Client Secret` you receive into `~/.Renviron` with a line that looks like: |
|||
|
|||
`WORDPRESS_API_SECRET=Yn50ds........` |
|||
|
|||
And start with a fresh R session for any of this to even have a remote possibility of working. |
|||
|
|||
### NOTE |
|||
|
|||
Only minimal functionality is provided at present (enough to get stats out). |
|||
|
|||
You are encouraged to poke around the source and contribute PRs or issues for high priority items you'd like to see in the package. |
|||
|
|||
## What's Inside The Tin |
|||
|
|||
The following functions are implemented: |
|||
|
|||
- `wp_auth`: Authenticate to WordPress |
|||
- `wp_about_me`: Get your user information |
|||
- `wp_get_my_posts`: Get all 'my' posts across all sites |
|||
- `wp_post_stats`: Retrieve statistics for a WordPress post |
|||
- `wp_site_info`: Get information about a site |
|||
- `wp_site_stats`: Get a site's stats |
|||
|
|||
## Installation |
|||
|
|||
```{r eval=FALSE} |
|||
devtools::install_github("hrbrmstr/pressur") |
|||
``` |
|||
|
|||
```{r message=FALSE, warning=FALSE, error=FALSE, include=FALSE} |
|||
options(width=120) |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
```{r message=FALSE, warning=FALSE, error=FALSE} |
|||
library(pressur) |
|||
|
|||
# current verison |
|||
packageVersion("pressur") |
|||
``` |
|||
|
|||
### Basic operation |
|||
|
|||
```{r} |
|||
wp_auth() |
|||
me <- wp_about_me() |
|||
dplyr::glimpse(wp_site_stats(me$primary_blog)) |
|||
``` |
|||
|
|||
## Code of Conduct |
|||
|
|||
Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md). By participating in this project you agree to abide by its terms. |
|||
|
@ -0,0 +1,111 @@ |
|||
|
|||
# pressur |
|||
|
|||
Query and Orchestrate the ‘WordPress’ ‘API’ |
|||
|
|||
## Description |
|||
|
|||
‘WordPress’ has a fairly comprehensive ‘API’ |
|||
<https://developer.wordpress.com/> that makes it possible to perform |
|||
blog orchestration (‘CRUD’ operations on posts, users, sites, etc.) as |
|||
well as retrieve and process blog statistics. Tools are provided to work |
|||
with the ‘WordPress’ ‘API’ functions. |
|||
|
|||
### YOU MUST |
|||
|
|||
\=\> Go here and make an app: <https://developer.wordpress.com/apps/> |
|||
|
|||
\=\> Put the `Client ID` you receive into `~/.Renviron` with a line that |
|||
looks like: |
|||
|
|||
`WORDPRESS_API_KEY=#####` |
|||
|
|||
\=\> Put the `Client Secret` you receive into `~/.Renviron` with a line |
|||
that looks like: |
|||
|
|||
`WORDPRESS_API_SECRET=Yn50ds........` |
|||
|
|||
And start with a fresh R session for any of this to even have a remote |
|||
possibility of working. |
|||
|
|||
### NOTE |
|||
|
|||
Only minimal functionality is provided at present (enough to get stats |
|||
out). |
|||
|
|||
You are encouraged to poke around the source and contribute PRs or |
|||
issues for high priority items you’d like to see in the package. |
|||
|
|||
## What’s Inside The Tin |
|||
|
|||
The following functions are implemented: |
|||
|
|||
- `wp_auth`: Authenticate to WordPress |
|||
- `wp_about_me`: Get your user information |
|||
- `wp_get_my_posts`: Get all ‘my’ posts across all sites |
|||
- `wp_post_stats`: Retrieve statistics for a WordPress post |
|||
- `wp_site_info`: Get information about a site |
|||
- `wp_site_stats`: Get a site’s stats |
|||
|
|||
## Installation |
|||
|
|||
``` r |
|||
devtools::install_github("hrbrmstr/pressur") |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
``` r |
|||
library(pressur) |
|||
|
|||
# current verison |
|||
packageVersion("pressur") |
|||
``` |
|||
|
|||
## [1] '0.1.0' |
|||
|
|||
### Basic operation |
|||
|
|||
``` r |
|||
wp_auth() |
|||
me <- wp_about_me() |
|||
dplyr::glimpse(wp_site_stats(me$primary_blog)) |
|||
``` |
|||
|
|||
## List of 3 |
|||
## $ date : chr "2017-12-27" |
|||
## $ stats :List of 24 |
|||
## ..$ visitors_today : int 86 |
|||
## ..$ visitors_yesterday : int 129 |
|||
## ..$ visitors : int 203068 |
|||
## ..$ views_today : int 147 |
|||
## ..$ views_yesterday : int 178 |
|||
## ..$ views_best_day : chr "2017-05-15" |
|||
## ..$ views_best_day_total : int 3984 |
|||
## ..$ views : int 347797 |
|||
## ..$ comments : int 1324 |
|||
## ..$ posts : int 445 |
|||
## ..$ followers_blog : int 197 |
|||
## ..$ followers_comments : int 132 |
|||
## ..$ comments_per_month : int 16 |
|||
## ..$ comments_most_active_recent_day: chr "2015-10-05 19:39:56" |
|||
## ..$ comments_most_active_time : chr "N/A" |
|||
## ..$ comments_spam : int 0 |
|||
## ..$ categories : int 209 |
|||
## ..$ tags : int 695 |
|||
## ..$ shares : int 0 |
|||
## ..$ shares_twitter : int 0 |
|||
## ..$ shares_print : int 0 |
|||
## ..$ shares_linkedin : int 0 |
|||
## ..$ shares_google-plus-1 : int 0 |
|||
## ..$ shares_email : int 0 |
|||
## $ visits:Classes 'tbl_df', 'tbl' and 'data.frame': 30 obs. of 3 variables: |
|||
## ..$ period : Date[1:30], format: "2017-11-28" "2017-11-29" "2017-11-30" "2017-12-01" ... |
|||
## ..$ views : int [1:30] 364 389 451 427 432 204 353 424 573 354 ... |
|||
## ..$ visitors: int [1:30] 253 268 300 319 325 154 254 312 399 259 ... |
|||
|
|||
## Code of Conduct |
|||
|
|||
Please note that this project is released with a [Contributor Code of |
|||
Conduct](CONDUCT.md). By participating in this project you agree to |
|||
abide by its terms. |
@ -0,0 +1,16 @@ |
|||
% Generated by roxygen2: do not edit by hand |
|||
% Please edit documentation in R/pressur-package.R |
|||
\docType{package} |
|||
\name{pressur} |
|||
\alias{pressur} |
|||
\alias{pressur-package} |
|||
\title{Query and Orchestrate the 'WordPress' 'API'} |
|||
\description{ |
|||
'WordPress' has a fairly comprehensive 'API' <https://developer.wordpress.com/> |
|||
that makes it possible to perform blog orchestration ('CRUD' operations on posts, users, |
|||
sites, etc.) as well as retrieve and process blog statistics. Tools are provided to work |
|||
with the 'WordPress' 'API' functions. |
|||
} |
|||
\author{ |
|||
Bob Rudis (bob@rud.is) |
|||
} |
@ -0,0 +1,20 @@ |
|||
% Generated by roxygen2: do not edit by hand |
|||
% Please edit documentation in R/about-me.R |
|||
\name{wp_about_me} |
|||
\alias{wp_about_me} |
|||
\title{Get your user information} |
|||
\usage{ |
|||
wp_about_me() |
|||
} |
|||
\description{ |
|||
Get your user information |
|||
} |
|||
\examples{ |
|||
\dontrun{ |
|||
wp_auth() |
|||
wp_about_me() |
|||
} |
|||
} |
|||
\references{ |
|||
\url{https://developer.wordpress.com/docs/api/1.1/get/me/} |
|||
} |
@ -0,0 +1,19 @@ |
|||
% Generated by roxygen2: do not edit by hand |
|||
% Please edit documentation in R/wp_auth.R |
|||
\name{wp_auth} |
|||
\alias{wp_auth} |
|||
\title{Authenticate to WordPress} |
|||
\usage{ |
|||
wp_auth() |
|||
} |
|||
\description{ |
|||
Call this at the start of any WordPress API interaction |
|||
} |
|||
\examples{ |
|||
\dontrun{ |
|||
wp_auth() |
|||
} |
|||
} |
|||
\references{ |
|||
\url{https://developer.wordpress.com/docs/oauth2/} |
|||
} |
@ -0,0 +1,23 @@ |
|||
% Generated by roxygen2: do not edit by hand |
|||
% Please edit documentation in R/my-posts.R |
|||
\name{wp_get_my_posts} |
|||
\alias{wp_get_my_posts} |
|||
\title{Get all 'my' posts across all sites} |
|||
\usage{ |
|||
wp_get_my_posts(.quiet = FALSE) |
|||
} |
|||
\arguments{ |
|||
\item{quiet}{if \code{TRUE} then no progress information will be displayed} |
|||
} |
|||
\description{ |
|||
Get all 'my' posts across all sites |
|||
} |
|||
\examples{ |
|||
\dontrun{ |
|||
wp_auth() |
|||
my_posts <- wp_get_my_posts() |
|||
} |
|||
} |
|||
\references{ |
|||
\url{https://developer.wordpress.com/docs/api/1.1/get/me/posts/} |
|||
} |
@ -0,0 +1,29 @@ |
|||
% Generated by roxygen2: do not edit by hand |
|||
% Please edit documentation in R/post-stats.R |
|||
\name{wp_post_stats} |
|||
\alias{wp_post_stats} |
|||
\title{Retrieve statistics for a WordPress post} |
|||
\usage{ |
|||
wp_post_stats(site, post_id) |
|||
} |
|||
\arguments{ |
|||
\item{site}{site id or domain} |
|||
|
|||
\item{post_id}{a valid post id} |
|||
} |
|||
\description{ |
|||
TODO: make most of the list columns more immediately usable |
|||
} |
|||
\note{ |
|||
I've only had this work successfully with my blog by using the site id. |
|||
} |
|||
\examples{ |
|||
\dontrun{ |
|||
wp_auth() |
|||
me <- wp_about_me() |
|||
wp_post_stats(me$primary_blog, "7713") |
|||
} |
|||
} |
|||
\references{ |
|||
\url{https://developer.wordpress.com/docs/api/1.1/get/sites/$site/stats/post/$post_id/} |
|||
} |
@ -0,0 +1,27 @@ |
|||
% Generated by roxygen2: do not edit by hand |
|||
% Please edit documentation in R/site-info.R |
|||
\name{wp_site_info} |
|||
\alias{wp_site_info} |
|||
\title{Get information about a site} |
|||
\usage{ |
|||
wp_site_info(site) |
|||
} |
|||
\arguments{ |
|||
\item{site}{site id or domain} |
|||
} |
|||
\description{ |
|||
Get information about a site |
|||
} |
|||
\note{ |
|||
I've only had this work successfully with my blog by using the site id. |
|||
} |
|||
\examples{ |
|||
\dontrun{ |
|||
wp_auth() |
|||
me <- wp_about_me() |
|||
wp_site_info(me$primary_blog) |
|||
} |
|||
} |
|||
\references{ |
|||
\url{https://developer.wordpress.com/docs/api/1.2/get/sites/$site/} |
|||
} |
@ -0,0 +1,27 @@ |
|||
% Generated by roxygen2: do not edit by hand |
|||
% Please edit documentation in R/site-stats.R |
|||
\name{wp_site_stats} |
|||
\alias{wp_site_stats} |
|||
\title{Get a site's stats} |
|||
\usage{ |
|||
wp_site_stats(site) |
|||
} |
|||
\arguments{ |
|||
\item{site}{site id or domain} |
|||
} |
|||
\description{ |
|||
Get a site's stats |
|||
} |
|||
\note{ |
|||
I've only had this work successfully with my blog by using the site id. |
|||
} |
|||
\examples{ |
|||
\dontrun{ |
|||
wp_auth() |
|||
me <- wp_about_me() |
|||
wp_site_stats(me$primary_blog) |
|||
} |
|||
} |
|||
\references{ |
|||
\url{https://developer.wordpress.com/docs/api/1.1/get/sites/$site/stats/} |
|||
} |
@ -0,0 +1,21 @@ |
|||
Version: 1.0 |
|||
|
|||
RestoreWorkspace: Default |
|||
SaveWorkspace: Default |
|||
AlwaysSaveHistory: Default |
|||
|
|||
EnableCodeIndexing: Yes |
|||
UseSpacesForTab: Yes |
|||
NumSpacesForTab: 2 |
|||
Encoding: UTF-8 |
|||
|
|||
RnwWeave: Sweave |
|||
LaTeX: pdfLaTeX |
|||
|
|||
StripTrailingWhitespace: Yes |
|||
|
|||
BuildType: Package |
|||
PackageUseDevtools: Yes |
|||
PackageInstallArgs: --no-multiarch --with-keep.source |
|||
PackageBuildArgs: --resave-data |
|||
PackageRoxygenize: rd,collate,namespace |
@ -0,0 +1,2 @@ |
|||
library(testthat) |
|||
test_check("pressur") |
@ -0,0 +1,6 @@ |
|||
context("basic functionality") |
|||
test_that("we can do something", { |
|||
|
|||
#expect_that(some_function(), is_a("data.frame")) |
|||
|
|||
}) |
Loading…
Reference in new issue