Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Commit

Permalink
Merge pull request #6 from ropensci/with-vcr
Browse files Browse the repository at this point in the history
done with vcr
  • Loading branch information
sckott authored Oct 22, 2018
2 parents 6feb300 + e73fb96 commit 2053bb6
Show file tree
Hide file tree
Showing 22 changed files with 496 additions and 116 deletions.
20 changes: 11 additions & 9 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,25 @@ Package: microdemic
Type: Package
Title: 'Microsoft Academic' API Client
Description: The 'Microsoft Academic Knowledge' API provides programmatic access
to scholarly articles in the 'Microsoft Academic Graph'
(<https://academic.microsoft.com/>). Includes methods matching all 'Microsoft
Academic' API routes, including search, graph search, text similarity, and
interpret natural language query string.
Version: 0.3.1.9100
to scholarly articles in the 'Microsoft Academic Graph'
(<https://academic.microsoft.com/>). Includes methods matching all 'Microsoft
Academic' API routes, including search, graph search, text similarity, and
interpret natural language query string.
Version: 0.3.2.9100
Authors@R: person("Scott", "Chamberlain", email = "myrmecocystus+r@gmail.com",
role = c("aut", "cre"))
role = c("aut", "cre"), comment = c(ORCID = "0000-0003-1444-9135"))
License: MIT + file LICENSE
LazyData: TRUE
Encoding: UTF-8
URL: https://github.com/ropensci/microdemic
BugReports: https://github.com/ropensci/microdemic/issues
Roxygen: list(markdown = TRUE)
Imports:
crul (>= 0.4.0),
crul (>= 0.5.2),
jsonlite (>= 1.5),
data.table,
tibble
Suggests:
testthat
RoxygenNote: 6.0.1
testthat,
vcr
RoxygenNote: 6.1.0
34 changes: 18 additions & 16 deletions R/graph_search.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,29 @@
#' @param key (character) microsoft academic API key, see the `Authentication`
#' section in [microdemic-package]
#' @param ... curl options passed on to [crul::HttpClient]
#' @note THIS FUNCTION CURRENTLY DOES NOT WORK AS OF 2018-10-22 -
#' IT'S NOT CLEAR HOW TO QUERY AGAINST THIS API ROUTE
#' (`academic/v1.0/graph/search`)
#' @references
#' <https://westus.dev.cognitive.microsoft.com/docs/services/56332331778daf02acc0a50b/operations/57e3569ddbe2d91158fa270e>
#' graph search method: <https://docs.microsoft.com/en-us/azure/cognitive-services/academic-knowledge/graphsearchmethod>
#' json search: <https://docs.microsoft.com/en-us/azure/cognitive-services/academic-knowledge/jsonsearchsyntax>
#' lambda search: <https://docs.microsoft.com/en-us/azure/cognitive-services/academic-knowledge/lambdasearchsyntax>
#' @examples \dontrun{
#' x <- '{
#' "path": "/paper/AuthorIDs/author",
#' "paper": {
#' "type": "Paper",
#' "NormalizedTitle": "graph engine",
#' "select": [ "OriginalTitle" ]
#' },
#' "author": {
#' "return": { "type": "Author", "Name": "bin shao" }
#' }
#' }'
#'
#' res <- ma_graph_search(query = x)
#' res$Results
#' do.call(rbind, res$Results)
#' # x <- '{
#' # "path": "/paper/AuthorIDs/author",
#' # "paper": {
#' # "type": "Paper",
#' # "NormalizedTitle": "graph engine",
#' # "select": [ "OriginalTitle" ]
#' # },
#' # "author": {
#' # "return": { "type": "Author", "Name": "bin shao" }
#' # }
#' # }'
#' #
#' # res <- ma_graph_search(query = x)
#' # res$Results
#' # do.call(rbind, res$Results)
#' }
ma_graph_search <- function(query, mode = "json", key = NULL, ...) {
assert(mode, "character")
Expand Down
8 changes: 4 additions & 4 deletions R/similarity.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ ma_similarity <- function(s1, s2, method = "GET", model = "latest",

if (!method %in% c("GET", "POST")) stop("'method' must be one of GET or POST")

assert(model, "character")
if (!model %in% c('latest', 'beta-2015')) {
stop("model must be one or 'latest' or 'beta-2015'")
}
# assert(model, "character")
# if (!model %in% c('latest', 'beta-2015')) {
# stop("model must be one or 'latest' or 'beta-2015'")
# }

if (method == "GET") {
args <- comp(list(s1 = s1, s2 = s2, model = model))
Expand Down
4 changes: 2 additions & 2 deletions man/ma_evaluate.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 20 additions & 16 deletions man/ma_graph_search.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/ma_interpret.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/ma_search.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/ma_similarity.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 9 additions & 8 deletions revdep/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,27 @@

|field |value |
|:--------|:-------------------------------------------|
|version |R version 3.4.4 Patched (2018-03-19 r74426) |
|os |macOS High Sierra 10.13.3 |
|version |R version 3.5.1 Patched (2018-08-12 r75119) |
|os |macOS High Sierra 10.13.6 |
|system |x86_64, darwin15.6.0 |
|ui |X11 |
|language |(EN) |
|collate |en_US.UTF-8 |
|tz |America/Los_Angeles |
|date |2018-03-28 |
|ctype |en_US.UTF-8 |
|tz |US/Pacific |
|date |2018-10-22 |

# Dependencies

|package |old |new |Δ |
|:----------|:-----|:-----|:--|
|microdemic |0.2.0 |0.3.0 |* |
|package |old |new |Δ |
|:----------|:-----|:---|:--|
|microdemic |0.3.0 |NA |* |

# Revdeps

## All (1)

|package |version |error |warning |note |
|:--------|:-------|:-----|:-------|:----|
|fulltext |1.0.1 | | | |
|fulltext |1.1.0 | | | |

3 changes: 1 addition & 2 deletions revdep/check.R
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
library("revdepcheck")
revdep_check()
revdepcheck::revdep_check()
Loading

0 comments on commit 2053bb6

Please sign in to comment.