Last active
August 29, 2015 14:19
-
-
Save leesharma/1dcc0b76aeaa418a2779 to your computer and use it in GitHub Desktop.
Lists all actions available in rescuetime v0.2.0
This file contains 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
# Basics | |
@client = Rescuetime::Client.new | |
@client.api_key? #=> false | |
@client.valid_credentials? #=> false | |
@client.activities #=> Rescuetime::MissingCredentials | |
@client.api_key='invalid' | |
@client.api_key? #=> true | |
@client.valid_credentials? #=> false | |
@client.activities #=> Rescuetime::InvalidCredentials | |
@client.api_key= VALID_KEY | |
@client.valid_credentials? #=> true | |
# #productivity_levels | |
@client.productivity_levels #=> Hash | |
@client.productivity_levels[-2] #=> 'Very Unproductive' | |
@client.productivity_levels[0] #=> 'Neutral' | |
# #activities | |
@client.activities #=> Array<Hash> | |
@client.activities.first #=> Hash | |
# :by (report order/perspective) | |
@client.activities(by: 'rank') # returns ranked report by time spent per activity/category | |
@client.activities(by: 'time') # returns chronological report | |
@client.activities(by: 'member') # returns report grouped by member | |
# :detail (detail level of report) | |
@client.activities(detail: 'overview') # returns report at the 'overview' level (ie. Entertainment) | |
@client.activities(detail: 'category') # returns report at the 'category' level (ie. News and Opionion) | |
@client.activities(detail: 'activity') # returns report at the 'activity' level (ie. reddit.com) | |
# note: 'productivity' and 'efficiency' are options as well, but | |
# #productivity and #efficiency are the preferred way to | |
# get that information. | |
# :date, :from, and :to (date range of report) | |
@client.activities(date: '2015-04-02') # returns report for selected date | |
@client.activities(from: '2015-04-18') # returns report between selected and current date | |
@client.activities(from: Time.new(2015,04,19)) # time objects work too | |
@client.activities(from: '2015-04-02', to: '2015-04-02') # returns report between start and end date | |
# :interval (time interval of the report) | |
@client.activities(by: 'time', interval: 'minute') # returns report in 5-minute intervals | |
@client.activities(by: 'time', interval: 'hour') # returns report in 1-hour intervals | |
@client.activities(by: 'time', interval: 'day') # returns report in 1-day intervals | |
@client.activities(by: 'time', interval: 'week') # returns report in 1-week intervals | |
@client.activities(by: 'time', interval: 'month') # returns report in 1-month intervals | |
# :format (output format) | |
@client.activities #=> Array<Hash> | |
@client.activities(format: 'csv') #=> CSV | |
# #productivity | |
@client.productivity(...) # productivity takes the same options as #activities except :detail | |
# returns a productivity report with the given options | |
# #efficiency | |
@client.efficiency(...) # efficiency takes the same options as #activities except :detail | |
# returns an efficiency report with the given options | |
# All of this can be used together | |
@client.efficiency( from: '2015-03-20', # returns weekly efficiency report between March 20th and | |
to: '2015-04-20' , # April 20th of 2015 by member in csv format | |
interval: 'week', | |
format: 'csv' ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment