-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
129 lines (97 loc) · 4.89 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
<h1> <a href="https://dev.to/daveparr">
<img src="https://d2fltix0v2e0sb.cloudfront.net/dev-badge.svg" alt="Dave Parr's DEV Profile" height="30" width="30">
</a>to.ol</h1>
<!-- badges: start -->
[![Lifecycle: maturing](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing)
<!-- badges: end -->
The goal of `dev.to.ol` is to help R users publish to dev.to
## Installation
You can install the dev.to.ol from [github](www.github.com) with `remotes`:
``` r
remotes::install.github("DaveParr/dev.to.ol")
```
## Workflow
### Create your article
The `create_new_article` function will give you the front mattter boilerplate for an article `.Rmd` file. Optionally supplying a file name will create a new file with the front matter at the start.
```r
create_new_article(title = "my title")
```
### Write your article!
This is the fun bit. Mark your great ideas down in an `.Rmd`!
### Post your article
Once the `.Rmd` is written, you can post it to dev.to with `post_new_article`
```r
post_new_article("./my-great-article.Rmd")
```
### Check your articles
There are two functions to check the posted articles on dev.to, published and unpublished. Both will return a 'tidy' data set by default.
```r
get_users_articles()
Using DEVTO in .Renviron
The API returned the expected success: 200
# A tibble: 27 x 20
type_of id title description published published_at slug path url
<chr> <int> <chr> <chr> <lgl> <chr> <chr> <chr> <chr>
1 article 370013 Nati… "I made an… TRUE 2020-06-26T… nati… /dav… http…
2 article 367598 Inve… "Is the de… TRUE 2020-06-26T… inve… /dav… http…
3 article 367500 Why … "Motivatio… TRUE 2020-06-25T… why-… /dav… http…
4 article 345011 Buil… "I'm worki… TRUE 2020-06-25T… buil… /dav… http…
5 article 357514 3 mi… "I’ve made… TRUE 2020-06-17T… 3-mi… /dav… http…
6 article 357411 Is '… "The langu… TRUE 2020-06-17T… is-r… /dav… http…
7 article 357002 Webs… "library(t… TRUE 2020-06-16T… webs… /dav… http…
8 article 356940 Is i… "I seem to… TRUE 2020-06-16T… is-i… /dav… http…
9 article 354878 Reco… "I am writ… TRUE 2020-06-13T… reco… /dav… http…
10 article 354676 A re… "So I have… TRUE 2020-06-13T… a-re… /dav… http…
# … with 17 more rows, and 11 more variables: comments_count <int>,
# public_reactions_count <int>, page_views_count <int>,
# published_timestamp <chr>, body_markdown <chr>,
# positive_reactions_count <int>, tag_list <list>, canonical_url <chr>,
# user <list>, flare_tag <list>, cover_image <chr>
```
### Update your article
If you notice you've made a mistake, you can get the article id from `get_users_articles()`, and use that to send the new version of the `.Rmd` to dev.to
```r
update_article(id = 151471, "./my-great-article.Rmd")
```
## Authentication
`dev.to.ol` will check for an `.Renviron` file it can access that has a line like this:
```sh
DEVTO="my_api_key"
```
If you use `Rproj` projects (and you should!), this is easily placed in the root directory. Alternatively it can be set at user level for the system.
You can set up a key on dev.to [here](https://dev.to/settings/account)
The easiest way to check if this has worked is to run the function to check your users details
```r
get_my_user()
Using DEVTO in .Renviron
The API returned the expected success: 200
# A tibble: 11 x 2
key value
<chr> <chr>
1 type_of user
2 id 150692
3 username daveparr
4 name Dave Parr
5 summary Data-scientist who loves to use #datascienceforgood, espec…
6 twitter_usern… DaveParr
7 github_userna… DaveParr
8 website_url https://www.daveparr.info
9 location Cardiff, Wales
10 joined_at Mar 29, 2019
11 profile_image https://res.cloudinary.com/practicaldev/image/fetch/s--842…
```
## Code of Conduct
Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md).
By participating in this project you agree to abide by its terms.