You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2.2 KiB

---
output: rmarkdown::github_document
editor_options:
chunk_output_type: console
---
```{r pkg-knitr-opts, include=FALSE}
hrbrpkghelpr::global_opts()
```

```{r badges, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::stinking_badges()
```

```{r description, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::yank_title_and_description()
```

### `<dalek_voice>` YOU WILL O-BEY `</dalek_voice>`

WordPress API requiring authentication means you have to do the OAuth2 dance, and most API calls require authentication. That means you need to start off working with the WordPress API in/from `pressur` using the `wp_auth()` function. For that to work, **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.

I'll make friendlier documentation for ^^ in the near future.

### 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:

```{r ingredients, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::describe_ingredients()
```

## Installation

```{r install-ex, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::install_block()
```

## Usage

```{r lib-ex}
library(pressur)

# current version
packageVersion("pressur")

```

### Basic operation

```{r}
library(hrbrthemes)
library(ggplot2)

wp_auth()

stats <- wp_site_stats()

ggplot(stats$visits, aes(period, views)) +
geom_col(fill = ft_cols$slate) +
scale_y_comma() +
labs(x = NULL, y = "views", title = "Site Views") +
theme_ipsum_gs(grid="Y")
```

## Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.