Skip to content

Instantly share code, notes, and snippets.

@pedrozath
Created December 16, 2013 13:12
Show Gist options
  • Save pedrozath/7986731 to your computer and use it in GitHub Desktop.
Save pedrozath/7986731 to your computer and use it in GitHub Desktop.
it logs hours into comindwork
def log_hours(day)
month = 12
<<-COMMAND
curl "http://entrue.comindwork.com/Ajax/AjaxUpdateGw.aspx/DynamicList/SaveAjaxHandler" -H "Pragma: no-cache" -H "Origin: http://entrue.comindwork.com" -H "Accept-Encoding: gzip,deflate,sdch" -H "Host: entrue.comindwork.com" -H "Accept-Language: pt-BR,en-US;q=0.8,en;q=0.6" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36" -H "Content-Type: application/x-www-form-urlencoded" -H "Accept: application/json, text/javascript, */*; q=0.01" -H "Cache-Control: no-cache" -H "X-Requested-With: XMLHttpRequest" -H "Cookie: XCMWSERV=z4; ASP.NET_SessionId=c5hbibn3jj2o5tvtq4cgda45; __utma=6456992.24295438.1385548697.1386586882.1386936026.5; __utmc=6456992; __utmz=6456992.1385548697.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); .auth=53412BE84134AFBD304DD9A7B289A13341D285ED434FF2642DBDAE958CD55DCEA28FF4ACCE60B64F7E145F851176C9945637BDEE22F1CC0CA803ED183225F695E67DEB4AA616FCA47F1FAFCA81B7B52C3226F5B2D988F550D66048F76642C5F8307379AFF00DD2E006FD7A365B7DC8D78778DE974F01711CB402047C87E8E8F5D37B221014B91F8A9F4BEC39BEA4BCA8DC2779ADAB97DB3DE3335C2689532AD47F6D1E0C; nothumb=1; require_ssl=false; ccnl_state=0"%"3A"%"20"%"3A"%"20"%"3A3"%"3A0; viewsNavControlctl04_ctl02_ctl06_openState="%"2520"%"2520Tasks"%"2520assigned"%"2520to"%"2520me"%"2526"%"2520Tasks"%"2520assigned"%"2520by"%"2520me"%"2526Current"%"2520to"%"2520do"%"2520for"%"2520team; viewsNavControlctl04_ctl03_ctl05_openState="%"2520"%"2520Tasks"%"2520assigned"%"2520to"%"2520me"%"2526"%"2520Tasks"%"2520assigned"%"2520by"%"2520me" -H "Connection: keep-alive" -H "Referer: http://entrue.comindwork.com/web2.aspx/CDTA/TIMELOG" --data "ajaxCommandName=Save&ajaxCommandArg=&source_name=tickets&company_id=6a0dd8b1-00ca-44b3-a273-36bf61106461&project_id=d96d1474-e7be-4018-a2d5-3509361a6778&dynamic_process_id=7f08243d-cdb1-45c2-8f8d-026ca3466e63&fields="%"7B"%"22total_real"%"22"%"3A"%"228"%"22"%"2C"%"22keeper_id"%"22"%"3A"%"22613b251f-d3a1-4ec5-babb-bfea3a0c10a0"%"22"%"2C"%"22title"%"22"%"3A"%"22Was+working+on"%"22"%"2C"%"22parent_id"%"22"%"3A"%"22fd76b1de-6491-d879-6223-1c55dbd20c30"%"22"%"2C"%"22start_on"%"22"%"3A"%"22#{month}"%"2F#{day}"%"2F2013"%"22"%"7D&list_context="%"7B"%"22publishing_alias"%"22"%"3A"%"22TIMELOG"%"22"%"2C"%"22url_prefix"%"22"%"3A"%"22CDTA"%"2F"%"22"%"2C"%"22process_publishing_policy"%"22"%"3A"%"22"%"22"%"2C"%"22descriptor_id"%"22"%"3A"%"22f30c1ef9-642f-4fa3-a537-9e2c05523983"%"22"%"2C"%"22project_alias"%"22"%"3A"%"22CDTA"%"22"%"7D&ajaxPathPrefix=web2&is_selector_visible=false&is_drag_handle_visible=false" --compressed
COMMAND
end
for day in eval ARGV[0]
system log_hours day
# puts day
end
@pedrozath
Copy link
Author

say for example you wanna log hours from day 2 to day 10:
c:/> ruby log_hours.rb 2..10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment