Skip to content

Commit 762ab9c

Browse files
committed
update README with workflow and other notes
1 parent ee21bc0 commit 762ab9c

File tree

2 files changed

+175
-14
lines changed

2 files changed

+175
-14
lines changed

README.Rmd

+82-7
Original file line numberDiff line numberDiff line change
@@ -17,38 +17,113 @@ knitr::opts_chunk$set(
1717
</a>to.ol</h1>
1818

1919
<!-- badges: start -->
20-
[![lifecycle](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
20+
[![Lifecycle: maturing](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing)
2121
<!-- badges: end -->
2222

2323
The goal of `dev.to.ol` is to help R users publish to dev.to
2424

2525
## Installation
2626

27-
You can install the unreleased version of dev.to from [github](www.github.com) with:
27+
You can install the dev.to.ol from [github](www.github.com) with `remotes`:
2828

2929
``` r
3030
remotes::install.github("DaveParr/dev.to.ol")
3131
```
3232

33-
## Example
33+
## Workflow
3434

35-
This is a basic example which shows you how to solve a common problem:
35+
### Create your article
36+
37+
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.
38+
39+
```r
40+
create_new_article(title = "my title")
41+
```
42+
43+
### Write your article!
44+
45+
This is the fun bit. Mark your great ideas down in an `.Rmd`!
46+
47+
### Post your article
48+
49+
Once the `.Rmd` is written, you can post it to dev.to with `post_new_article`
3650

3751
```r
38-
library(dev.to.ol)
52+
post_new_article("./my-great-article.Rmd")
53+
```
3954

40-
post_new_article("./articles/my_article.Rmd")
55+
### Check your articles
56+
57+
There are two functions to check the posted articles on dev.to, published and unpublished. Both will return a 'tidy' data set by default.
58+
59+
```r
60+
get_users_articles()
61+
62+
Using DEVTO in .Renviron
63+
The API returned the expected success: 200
64+
# A tibble: 27 x 20
65+
type_of id title description published published_at slug path url
66+
<chr> <int> <chr> <chr> <lgl> <chr> <chr> <chr> <chr>
67+
1 article 370013 Nati"I made an… TRUE 2020-06-26T… nati… /dav… http…
68+
2 article 367598 Inve… "Is the deTRUE 2020-06-26Tinve/davhttp
69+
3 article 367500 Why"Motivatio… TRUE 2020-06-25T… why-… /dav… http…
70+
4 article 345011 Buil… "I'm worki… TRUE 2020-06-25T… buil… /dav… http…
71+
5 article 357514 3 mi… "I’ve made… TRUE 2020-06-17T… 3-mi… /dav… http…
72+
6 article 357411 Is '"The langu… TRUE 2020-06-17T… is-r… /dav… http…
73+
7 article 357002 Webs… "library(tTRUE 2020-06-16Twebs/davhttp
74+
8 article 356940 Is i"I seem to… TRUE 2020-06-16T… is-i… /dav… http…
75+
9 article 354878 Reco… "I am writTRUE 2020-06-13Treco/davhttp
76+
10 article 354676 A re"So I have… TRUE 2020-06-13T… a-re… /dav… http…
77+
# … with 17 more rows, and 11 more variables: comments_count <int>,
78+
# public_reactions_count <int>, page_views_count <int>,
79+
# published_timestamp <chr>, body_markdown <chr>,
80+
# positive_reactions_count <int>, tag_list <list>, canonical_url <chr>,
81+
# user <list>, flare_tag <list>, cover_image <chr>
82+
```
83+
84+
### Update your article
85+
86+
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
87+
88+
```r
89+
update_article(id = 151471, "./my-great-article.Rmd")
4190
```
4291
4392
## Authentication
4493
4594
`dev.to.ol` will check for an `.Renviron` file it can access that has a line like this:
4695
47-
``` sh
96+
```sh
4897
DEVTO="my_api_key"
4998
```
5099
100+
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.
101+
51102
You can set up a key on dev.to [here](https://dev.to/settings/account)
52103
104+
The easiest way to check if this has worked is to run the function to check your users details
105+
106+
```r
107+
get_my_user()
108+
Using DEVTO in .Renviron
109+
The API returned the expected success: 200
110+
# A tibble: 11 x 2
111+
key value
112+
<chr> <chr>
113+
1 type_of user
114+
2 id 150692
115+
3 username daveparr
116+
4 name Dave Parr
117+
5 summary Data-scientist who loves to use #datascienceforgood, espec…
118+
6 twitter_usern… DaveParr
119+
7 github_userna… DaveParr
120+
8 website_url https://www.daveparr.info
121+
9 location Cardiff, Wales
122+
10 joined_at Mar 29, 2019
123+
11 profile_image https://res.cloudinary.com/practicaldev/image/fetch/s--842…
124+
```
125+
126+
## Code of Conduct
127+
53128
Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md).
54129
By participating in this project you agree to abide by its terms.

README.md

+93-7
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,85 @@
1111

1212
<!-- badges: start -->
1313

14-
[![lifecycle](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
14+
[![Lifecycle:
15+
maturing](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing)
1516
<!-- badges: end -->
1617

1718
The goal of `dev.to.ol` is to help R users publish to dev.to
1819

1920
## Installation
2021

21-
You can install the unreleased version of dev.to from
22-
[github](www.github.com) with:
22+
You can install the dev.to.ol from [github](www.github.com) with
23+
`remotes`:
2324

2425
``` r
2526
remotes::install.github("DaveParr/dev.to.ol")
2627
```
2728

28-
## Example
29+
## Workflow
2930

30-
This is a basic example which shows you how to solve a common problem:
31+
### Create your article
32+
33+
The `create_new_article` function will give you the front mattter
34+
boilerplate for an article `.Rmd` file. Optionally supplying a file name
35+
will create a new file with the front matter at the start.
36+
37+
``` r
38+
create_new_article(title = "my title")
39+
```
40+
41+
### Write your article\!
42+
43+
This is the fun bit. Mark your great ideas down in an `.Rmd`\!
44+
45+
### Post your article
46+
47+
Once the `.Rmd` is written, you can post it to dev.to with
48+
`post_new_article`
3149

3250
``` r
33-
library(dev.to.ol)
51+
post_new_article("./my-great-article.Rmd")
52+
```
3453

35-
post_new_article("./articles/my_article.Rmd")
54+
### Check your articles
55+
56+
There are two functions to check the posted articles on dev.to,
57+
published and unpublished. Both will return a ‘tidy’ data set by
58+
default.
59+
60+
``` r
61+
get_users_articles()
62+
63+
Using DEVTO in .Renviron
64+
The API returned the expected success: 200
65+
# A tibble: 27 x 20
66+
type_of id title description published published_at slug path url
67+
<chr> <int> <chr> <chr> <lgl> <chr> <chr> <chr> <chr>
68+
1 article 370013 Nati"I made an… TRUE 2020-06-26T… nati… /dav… http…
69+
2 article 367598 Inve… "Is the deTRUE 2020-06-26Tinve/davhttp
70+
3 article 367500 Why"Motivatio… TRUE 2020-06-25T… why-… /dav… http…
71+
4 article 345011 Buil… "I'm worki… TRUE 2020-06-25T… buil… /dav… http…
72+
5 article 357514 3 mi… "I’ve made… TRUE 2020-06-17T… 3-mi… /dav… http…
73+
6 article 357411 Is '"The langu… TRUE 2020-06-17T… is-r… /dav… http…
74+
7 article 357002 Webs… "library(tTRUE 2020-06-16Twebs/davhttp
75+
8 article 356940 Is i"I seem to… TRUE 2020-06-16T… is-i… /dav… http…
76+
9 article 354878 Reco… "I am writTRUE 2020-06-13Treco/davhttp
77+
10 article 354676 A re"So I have… TRUE 2020-06-13T… a-re… /dav… http…
78+
# … with 17 more rows, and 11 more variables: comments_count <int>,
79+
# public_reactions_count <int>, page_views_count <int>,
80+
# published_timestamp <chr>, body_markdown <chr>,
81+
# positive_reactions_count <int>, tag_list <list>, canonical_url <chr>,
82+
# user <list>, flare_tag <list>, cover_image <chr>
83+
```
84+
85+
### Update your article
86+
87+
If you notice you’ve made a mistake, you can get the article id from
88+
`get_users_articles()`, and use that to send the new version of the
89+
`.Rmd` to dev.to
90+
91+
``` r
92+
update_article(id = 151471, "./my-great-article.Rmd")
3693
```
3794
3895
## Authentication
@@ -44,8 +101,37 @@ line like this:
44101
DEVTO="my_api_key"
45102
```
46103
104+
If you use `Rproj` projects (and you should\!), this is easily placed in
105+
the root directory. Alternatively it can be set at user level for the
106+
system.
107+
47108
You can set up a key on dev.to [here](https://dev.to/settings/account)
48109
110+
The easiest way to check if this has worked is to run the function to
111+
check your users details
112+
113+
``` r
114+
get_my_user()
115+
Using DEVTO in .Renviron
116+
The API returned the expected success: 200
117+
# A tibble: 11 x 2
118+
key value
119+
<chr> <chr>
120+
1 type_of user
121+
2 id 150692
122+
3 username daveparr
123+
4 name Dave Parr
124+
5 summary Data-scientist who loves to use #datascienceforgood, espec…
125+
6 twitter_usern… DaveParr
126+
7 github_userna… DaveParr
127+
8 website_url https://www.daveparr.info
128+
9 location Cardiff, Wales
129+
10 joined_at Mar 29, 2019
130+
11 profile_image https://res.cloudinary.com/practicaldev/image/fetch/s--842…
131+
```
132+
133+
## Code of Conduct
134+
49135
Please note that this project is released with a [Contributor Code of
50136
Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree
51137
to abide by its terms.

0 commit comments

Comments
 (0)