forked from marcgiry/imgur-R-Package
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
126 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
Package: imguR | ||
Type: Package | ||
Title: An Imgur.com API Client Package | ||
Version: 1.0.3 | ||
Date: 2016-03-29 | ||
Version: 1.0.4 | ||
Date: 2016-05-28 | ||
Authors@R: c(person("Thomas J.", "Leeper", role = c("aut", "cre"), | ||
email = "[email protected]"), | ||
person("Aaron", "Statham", role = c("ctb"), | ||
email = "[email protected]"), | ||
person("Yihui", "Xie", role = c("ctb")) | ||
) | ||
Maintainer: Thomas J. Leeper <[email protected]> | ||
Imports: httr, png, jpeg, tools | ||
Imports: tools, graphics, grDevices, httr, png, jpeg | ||
Suggests: testthat | ||
Description: A complete API client for the image hosting service Imgur.com, including the an imgur graphics device, enabling the easy upload and sharing of plots. | ||
License: GPL-3 | ||
URL: https://github.com/leeper/imguR | ||
BugReports: https://github.com/leeper/imguR/issues | ||
URL: https://github.com/cloudyr/imguR | ||
BugReports: https://github.com/cloudyr/imguR/issues |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
default_memes <- | ||
function(...){ | ||
out <- imgurGET('memegen/defaults', ...) | ||
lapply(out, `class<-`, 'imgur_image') | ||
} | ||
structure(lapply(out, `class<-`, 'imgur_image'), class = 'imgur_gallery_album') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
.onLoad <- function(libname, pkgname){ | ||
options(imgur_user_rate_warning = 20) | ||
options(imgur_client_rate_warning = 100) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
library("testthat") | ||
library("imguR") | ||
test_check("imguR") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
context("Basic Get Requests") | ||
|
||
test_that("Get Album", { | ||
expect_true(inherits(get_album("cVsXX"), "imgur_album")) | ||
}) | ||
|
||
test_that("Get Galleries", { | ||
expect_true(inherits(get_gallery(), "imgur_gallery_album")) | ||
}) | ||
|
||
test_that("Search Galleries", { | ||
expect_true(inherits(search_gallery(query = "meme"), "imgur_gallery_album")) | ||
}) | ||
|
||
test_that("Get Album Images", { | ||
expect_true(inherits(get_album_images("cVsXX")[[1]], "imgur_image")) | ||
}) | ||
|
||
test_that("Get Image", { | ||
expect_true(inherits(get_image("VI8MBMu"), "imgur_image")) | ||
}) | ||
|
||
test_that("Plot Image", { | ||
expect_true(inherits(plot(get_image("VI8MBMu")), "imgur_image")) | ||
}) | ||
|
||
test_that("Get Random Images", { | ||
expect_true(inherits(get_random_images(), "imgur_gallery_album")) | ||
}) | ||
|
||
test_that("Get Reddit Images", { | ||
expect_true(inherits(g <- get_reddit_gallery('dataisbeautiful'), "imgur_gallery_album")) | ||
expect_true(inherits(get_reddit_image('dataisbeautiful', g[[1]]), "imgur_gallery_image")) | ||
}) | ||
|
||
test_that("Get Memes", { | ||
expect_true(inherits(default_memes(), "imgur_gallery_album")) | ||
expect_true(inherits(get_memes_gallery('viral', page = 1), "imgur_gallery_album")) | ||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
context("image upload") | ||
|
||
test_that("image upload", { | ||
pdf(tmpfile <- tempfile()) | ||
hist(rnorm(20)) | ||
dev.off() | ||
expect_true(inherits(upload_image(tmpfile), "imgur_image")) | ||
}) | ||
|
||
test_that("update image (anonymously)", { | ||
pdf(tmpfile <- tempfile()) | ||
hist(rnorm(20)) | ||
dev.off() | ||
expect_true(inherits(u <- upload_image(tmpfile, title = "Old Title"), "imgur_image")) | ||
expect_true(update_image(u$deletehash, title = 'New Title')) | ||
expect_true(get_image(u)[["title"]] == "New Title") | ||
}) | ||
|
||
test_that("delete image (anonymously)", { | ||
pdf(tmpfile <- tempfile()) | ||
hist(rnorm(20)) | ||
dev.off() | ||
expect_true(inherits(u <- upload_image(tmpfile, title = "Old Title"), "imgur_image")) | ||
expect_true(delete_image(u$deletehash)) | ||
}) | ||
|
||
test_that("imgur device", { | ||
i <- imgur('png') | ||
hist(rnorm(20)) | ||
expect_true(inherits(imgur_off(i), "imgur_image")) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
context("Rate limits") | ||
|
||
test_that("Rate Limits", { | ||
expect_true(inherits(rl <- rate_limit(), "imgur_basic")) | ||
expect_true(all(c("UserLimit", "UserRemaining", "ClientLimit", "ClientRemaining") %in% names(rl))) | ||
}) | ||
|