Skip to content

Instantly share code, notes, and snippets.

@jonelf
Created October 16, 2013 18:39
Show Gist options
  • Save jonelf/7012649 to your computer and use it in GitHub Desktop.
Save jonelf/7012649 to your computer and use it in GitHub Desktop.
Gets your RunKeeper activities for the current month.
require 'json'
require 'httpclient'
domain = "runkeeper.com"
sslhost = "https://#{domain}/"
host = "http://#{domain}/"
email, user, password = "[email protected]", "jonelf", "password"
client = HTTPClient.new
body = { '_eventName' => 'submit', 'redirectUrl' => '/index', 'failUrl' => '', 'email' => email, 'password' => password }
client.post(sslhost + 'login', body)
today = Time.new
first_day_of_month = Time.new(today.year, today.month, 1).strftime("%b-%d-%Y")
activities = JSON.parse(client.get_content(host + "user/#{user}/activitiesByDateRange", {'userName' => user, 'startDate' => first_day_of_month}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment