Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

benkenawell/basecamp-question-counter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

I enjoyed this project, learned a lot about OAuth, but I don't use Basecamp for this anymore so I've decided to Archive this repo.

Project Basecamp

I have been keeping track of the days I've run an when I haven't via a question Basecamp asks me everyday.

The goal of this project is to download the answers to those questions collect them and come up with some insights, while learning Rust along the way! There are probably better languages to do this in, but if it becomes really apparent, maybe I'll try some FFI.

To run

  1. clone git repo
  2. cargo install --path . from base project directory
  3. cargo run

OAuth

BaseCamp 3 requires OAuth 2 to access their API. This is much more difficult than a simple Access Token, but worth the extra security. However, it seems BaseCamp does not return a valid "token_type" when using the oauth2 crate's BasicClient. Luckily the Wunderlist example from their site has a SpecialClient I've used here to get around that. Also worth noting is that BaseCamp expects client id and client secret to be part of the request body when exchanging the code for an access token. This is not the default option for oauth2's BasicClient. But with the help of all the example's the oauth2 crate gave me, I was able to get it up and running!

The config for the oauth I have stored in a local json config file. Obviously this can't go into version control, but it's nice to have it stored close by! Additionally, it was a good starter on serializing json, which will be a lot of this program once I interact with the Basecamp API.

API Path

Once I have OAuth working, I'm off to the races! Basecamp is a pretty full featured project management suite, and they expose everything through their API! What that means is now I need to figure out how to get from my authenticated identity to the project question I want to aggregate the data from. Paths are below:

  1. GET https://launchpad.37signals.com/authorization.json
  2. GET /projects.json
  3. GET /buckets/1/questionnaires/2.json
  4. GET /buckets/1/questionnaires/2/questions.json
  5. GET /buckets/1/questions/2/answers.json

Potential Upgrades

  • Save access token, so I don't need to authorize every run
    • potentially saves me a few seconds every test run
    • could I just save this to an untracked file? there must be a better way, but that could work for this simple project...
  • Other insights on the data
    • filter on the reason I did or did not run
  • Convert answers to csv
    • yes/no in one column
    • rest of the reason in another column
  • Add command line flags
    • --csv flag for csv output
    • --project name of the project that the question is in
    • --question the question to count yes/no for
    • --save-auth save the auth token locally to use on subsequent runs
    • --to-count array of words to count, from the answer

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages