Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/muschellij2/leanpubr
Leanpub API
https://github.com/muschellij2/leanpubr
Last synced: 19 days ago
JSON representation
Leanpub API
- Host: GitHub
- URL: https://github.com/muschellij2/leanpubr
- Owner: muschellij2
- License: gpl-3.0
- Created: 2017-12-06T17:44:52.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-25T19:42:43.000Z (over 5 years ago)
- Last Synced: 2023-11-20T16:01:09.658Z (about 1 year ago)
- Language: R
- Size: 119 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE.md
Awesome Lists containing this project
README
---
output: github_document
---[![Travis build status](https://travis-ci.org/muschellij2/leanpubr.svg?branch=master)](https://travis-ci.org/muschellij2/leanpubr)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/muschellij2/leanpubr?branch=master&svg=true)](https://ci.appveyor.com/project/muschellij2/leanpubr)
[![Coverage status](https://coveralls.io/repos/github/muschellij2/leanpubr/badge.svg?branch=master)](https://coveralls.io/r/muschellij2/leanpubr?branch=master)```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-"
)
```
# leanpubr Package:
The goal of `leanpubr` is to provide provides access to the 'Leanpub' 'API' for gathering information about publications and submissions to the 'Leanpub' platform.## Installation
You can install `leanpubr` from GitHub with:
```{r gh-installation, eval = FALSE}
# install.packages("remotes")
remotes::install_github("muschellij2/leanpubr")
```## Setting the API key
The main thing you need to do is get an API key from Leanpub. You can do this by visiting https://leanpub.com/author_dashboard/settings if you are an author. If you are not an author, I don't believe access to the API is possible. You can pass this `api_key` to functions in Leanpub (almost all prefixed by `lp_`), or you can set the environmental variable `LEANPUB_API_KEY`. You can set this in an interactive `R` session such as:```r
Sys.setenv("LEANPUB_API_KEY" = "YOUR_KEY")
```or put this in your `~/.Renviron`:
```r
LEANPUB_API_KEY = "YOUR_KEY"
```## Example
You can use `lp_book_info` to get information about any book in Leanpub:
```{r, echo = FALSE}
Sys.setenv("LEANPUB_API_KEY" = "asdf")
``````{r}
library(leanpubr)
slug = "biostatmethods"
res = lp_book_info(slug, error = FALSE, verbose = TRUE)
res$content
```