Created
October 16, 2013 18:39
-
-
Save jonelf/7012649 to your computer and use it in GitHub Desktop.
Gets your RunKeeper activities for the current month.
This file contains hidden or 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
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