-
Notifications
You must be signed in to change notification settings - Fork 11
/
README.Rmd
80 lines (54 loc) · 2.05 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
---
output: rmarkdown::github_document
---
`pastebin` : Tools to work with the [pastebin](https://pastebin.com/) API
>Pastebin is a website where you can store any text online for easy sharing. The website is mainly used by programmers to store pieces of sources code or configuration information, but anyone is more than welcome to paste any type of text. The idea behind the site is to make it more convenient for people to share large amounts of text online.
**WIP!! The package API will very likely be in rapid change mode for a bit**
The following functions are implemented:
- `get_paste`: Get raw paste data
- `get_paste_metadata`: Get paste metadata
- `get_trending_pastes`: Get trending pastes
- `get_recent_pastes`: Get recent pastes
- `new_paste`: Create a new paste
- `pastebin_api_key`: Get or set `PASTEBIN_API_KEY` value
- `toString.paste`: Extract just the paste text from a paste object
- `as.character.paste`: Extract just the paste text from a paste object
If you want the `impersonate` parameter of `new_paste()` to work you _must_ set `PASTEBIN_USER` and `PASTEBIN_PASSWORD` (preferably in `~/.Renviron`).
### TODO
- <strike>Paste as user</strike>
- Finish API coverage including "Pro"" paste features
- Testing
### Installation
```{r eval=FALSE}
devtools::install_github("hrbrmstr/pastebin")
```
```{r message=FALSE, warning=FALSE, error=FALSE}
options(width=120)
```
### Usage
```{r message=FALSE, warning=FALSE, error=FALSE}
library(pastebin)
library(tidyverse)
# current verison
packageVersion("pastebin")
get_trending_pastes() %>%
arrange(desc(hits))
r_pastes <- get_recent_pastes(lang="rsplus")
glimpse(r_pastes)
```
Can't always trust the `lang` setting. Some non-R stuff in there:
```{r message=FALSE}
walk(r_pastes$key[1:10], ~print(toString(get_paste(.))))
```
Since the user is obvious:
```{r message}
mebbe_r <- filter(r_pastes, user != "AllRls_net")
walk(mebbe_r$key, ~print(toString(get_paste(.))))
```
### Test Results
```{r message=FALSE, warning=FALSE, error=FALSE}
library(pastebin)
library(testthat)
date()
test_dir("tests/")
```