| Title: | An Interface to the 'Ravelry' API |
| Version: | 0.1.0 |
| Description: | Provides access to the 'Ravelry' API https://www.ravelry.com/groups/ravelry-api. An R wrapper for pulling data from 'Ravelry.com', an organizational tool for crocheters, knitters, spinners, and weavers. You can retrieve pattern, yarn, author, and shop information by search or by a given id. |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| LazyData: | true |
| Suggests: | spelling, testthat |
| Language: | en-US |
| Imports: | httr, jsonlite, dplyr, tibble, purrr, tidyr |
| RoxygenNote: | 6.1.1 |
| NeedsCompilation: | no |
| Packaged: | 2020-01-09 14:55:42 UTC; kaylinpavlik |
| Author: | Kaylin Pavlik [aut, cre] |
| Maintainer: | Kaylin Pavlik <walkerkq2@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2020-02-19 09:30:02 UTC |
Get details for a designer
Description
This function retrieves details for a designer using their id.
Usage
get_designer(id)
Arguments
id |
designer id |
Value
tibble with name, notes, count of patterns, etc.
Examples
## Not run: get_designer(id = 1)
Get pattern categories
Description
This function retrieves pattern categories.
Usage
get_pattern_categories()
Value
nested tibble containing levels of categories and sub-categories for patterns.
Examples
## Not run: get_pattern_categories()
Get pattern details for multiple patterns
Description
This function retrieves details for one or multiple patterns using the pattern id.
Usage
get_patterns(ids)
Arguments
ids |
one or more 'pattern_id's. Tested for vectors of up to 500 ids; 100 max recommended. |
Value
tibble containing pattern details, like yardage, gauge, count of comments, ratings, etc.
Examples
## Not run: get_patterns(ids = c(600, 601))
Get details for a shop
Description
This function retrieves details for a shop using its id.
Usage
get_shop(id)
Arguments
id |
shop id |
Value
tibble containing shop info including address, contact info, and other descriptive variables.
Examples
## Not run: get_shop(id = 1781)
Get yarn attribute groups
Description
This function retrieves yarn attribute groups.
Usage
get_yarn_attribute_groups()
Value
tibble containing current attribute groups for yarn.
Examples
## Not run: get_yarn_attribute_groups()
Get details for multiple yarns
Description
This function retrieves details for one or multiple yarns using the yarn id.
Usage
get_yarns(ids)
Arguments
ids |
one or more 'yarn_id's |
Value
tibble containing yarn details like company, gauge, grams, texture, needle sizes, ratings, etc.
Examples
## Not run: get_yarns(ids = c(66124,54110))
Get or set basic authentication credentials
Description
The API wrapper functions in this package rely on basic authentication via username
and password residing in the environment variables RAVELRY_USERNAME and
RAVELRY_PASSWORD. The easiest way to accomplish this is to set it in
the '.Renviron' file in your home directory. If you do not have these
credentials, you can create them at https://www.ravelry.com/pro/developer.
Usage
ravelry_auth(key = "username", overwrite = FALSE)
Arguments
key |
the variable to set - either username or password |
overwrite |
overwrite the existing variable in the current environment? |
Value
atomic character vector containing the username or password credential
Basic API call
Description
This function is the base GET call to the Ravelry API.
Usage
ravelry_get(path, query = NULL)
Arguments
path |
the API method to call |
query |
call parameters in the form of a list() |
Value
API object
Search groups
Description
This function retrieves groups based on search terms.
Usage
search_groups(query = NULL, page = NULL, page_size = NULL,
sort = NULL, ...)
Arguments
query |
search string |
page |
result page to retrieve; defaults to first page |
page_size |
number of results to retrieve; defaults to 50 |
sort |
options: 'best', 'added', 'favorites' |
... |
pass any other filter parameters available via https://www.ravelry.com/groups/search (ex. creation, gc) |
Value
tibble containing group information, like name, created_at, short_description, etc.
Examples
## Not run: search_groups(query = 'star wars')
# with site search parameters
## Not run: search_groups(query = 'star wars', gc = 'knitting')
Search for patterns
Description
This function retrieves a list of pattern ids and basic details based on search terms.
Usage
search_patterns(query = NULL, page = NULL, page_size = NULL, ...)
Arguments
query |
search string |
page |
result page to retrieve; defaults to first page |
page_size |
number of results to retrieve; defaults to 100 |
... |
pass any other filter parameters available via https://www.ravelry.com/patterns/search (ex. craft, availability, photo, pa, fit, weight, etc.) |
Value
tibble containing basic pattern details, some nested
Examples
## Not run: search_patterns(query = 'cowl')
# with site search parameters
## Not run: search_patterns(query = 'hat', page_size = 10, availability = 'free', fit = 'baby')
Search shops
Description
This function retrieves shops based on search terms.
Usage
search_shops(query = NULL, shop_type_id = NULL, lat = NULL,
lng = NULL, radius = NULL, units = NULL, page = NULL,
page_size = NULL, sort = NULL)
Arguments
query |
search string |
shop_type_id |
set to 1 to restrict to local stores only (filter out chains and online stores) |
lat |
latitude for geographic search |
lng |
longitude for geographic search |
radius |
radius for geographic search |
units |
units for geographic search, 'miles' or 'km' |
page |
result page to retrieve; defaults to 1 |
page_size |
number of results to retrieve; defaults to 100 |
sort |
options: 'best', 'added', 'favorites' |
Value
tibble with address, social media, and other descriptive features for shops
Examples
## Not run: search_shops(lat = 42.35, lng = -71.05, radius = 100)
Search for yarn
Description
This function retrieves a list of basic yarn details based on search terms.
Usage
search_yarn(query = NULL, page = NULL, page_size = NULL,
sort = NULL, ...)
Arguments
query |
search string |
page |
result page to retrieve; defaults to first page |
page_size |
number of results to retrieve; defaults to 100 |
sort |
options: 'best', 'rating', 'projects' |
... |
pass any other filter parameters available via https://www.ravelry.com/yarns/search (ex. weight, needles, photo, fiberc, ya, ratings, origin) |
Value
tibble containing basic pattern details, some nested
Examples
## Not run: search_yarn(query = 'cascade', page_size = 10)
# using site search parameters
## Not run: search_yarn(query = 'cascade', sort = 'best', weight = 'sport', needles = '3.75mm')
Search yarn companies
Description
This function retrieves yarn companies based on search terms.
Usage
search_yarn_companies(query = NULL, page = NULL, page_size = NULL,
sort = NULL, ...)
Arguments
query |
search string |
page |
result page to retrieve; defaults to first page |
page_size |
number of results to retrieve; defaults to 48 |
sort |
options: 'best' |
... |
pass any other filter parameters available via https://www.ravelry.com/yarns/brands/search |
Value
tibble containing company details
Examples
## Not run: search_yarn_companies(query = 'lion')