Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggested new functions #40

Closed
restonslacker opened this issue Feb 5, 2017 · 6 comments
Closed

Suggested new functions #40

restonslacker opened this issue Feb 5, 2017 · 6 comments

Comments

@restonslacker
Copy link
Contributor

@restonslacker restonslacker commented Feb 5, 2017

Public versus private indicate by leading dot, though any of these could go either way.

  • .isValidKey(key) - key is a string
  • .isValidDevice(device, key) - device string is associated with key
  • pbValidateConf(conf=NULL) - if null, check env variables, otherwise a path to json file, or a json string.
  • .isValidChannel(chan) - chan is a string

Thoughts? Additional functions?

@eddelbuettel
Copy link
Owner

@eddelbuettel eddelbuettel commented Feb 5, 2017

I think these are all good. Maybe split into two PRs?

I also realized that my conf is probably different from your as I have a test-channel in there. Happy to share that one if you want to see if you can blast messages at it. I can twitter-DM you the name. Or maybe send a pushbullet message to you :)

@restonslacker
Copy link
Contributor Author

@restonslacker restonslacker commented Feb 6, 2017

WRT test-channel, i actually set one up after looking over simpleTests.R after starting on this. So i think that's okay unless we need to coordinate some testing effort in the future.

@restonslacker
Copy link
Contributor Author

@restonslacker restonslacker commented Feb 7, 2017

code for public functions is now set to go:

  • pbValidateConf(conf=NULL)
  • pbGetChannelInfo(channel, no_recent_pushes=FALSE) - S3 like pdGetDevices
  • pbGetUser(apikey=.getKey()) - S3 like pdGetDevices

I wrote the 2nd and 3rd functions because once i looked up the API for the .isValid*() functions, they were a trivial addition.

@eddelbuettel
Copy link
Owner

@eddelbuettel eddelbuettel commented Feb 7, 2017

If you feel super-adventurous, I think some folks (Jenny Bryan and others) figured out how to test token based web apis from Travis without spilling the token. But I can't remember where that was. :-/ It would be sweet if we could actually hit some tests as the code base it getting better and bigger. Not urgent, obviously.

@restonslacker
Copy link
Contributor Author

@restonslacker restonslacker commented Feb 7, 2017

I did look into this some. The general approach seems like we encrypt the info with our public keys and travis's public key. something like:

conf <- readLines("~/.rpushbullet.json")
save(list(dirk=openssl::rsa_encrypt(conf, dirks_key),
           seth=openssl::rsa_encrypt(conf, seths_key),
           travis=openssl::rsa_encrypt(conf, traviss_key)),
      file="conf.RData")

conf.RData is then added to the repo and somehow we tell travis to use it.

We'd still have to setup a throw-away gmail account but maybe that's ok. I don't have my notes in front of me, but i actually started to do that previously. Also, we'd have to convert simpleTests.R to a proper test framework which checks return codes. Not sure how to test for the issue we had in #39, however.

@eddelbuettel
Copy link
Owner

@eddelbuettel eddelbuettel commented Feb 7, 2017

Well put, that's the way to do it. I actually do have a throw-away gmail account for the work I do with Philippe on his/our gtrendsR package.

That is definitely worth playing with, and as you say once we have it we may as well switch to proper tests. I know RUnit pretty well (include setup/teardown) and testthat not at all :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.