Skip to content

Instantly share code, notes, and snippets.

@pedrozath
Last active January 4, 2016 03:19
Show Gist options
  • Select an option

  • Save pedrozath/8560660 to your computer and use it in GitHub Desktop.

Select an option

Save pedrozath/8560660 to your computer and use it in GitHub Desktop.
require "uri"
require "json"
require "ostruct"
def log_hours(options)
options = OpenStruct.new options
<<-CURL
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 "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/32.0.1700.76 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; viewsNavControlctl04_ctl02_ctl06_openState="%"2520"%"2520Tasks"%"2520assigned"%"2520to"%"2520me"%"2526"%"2520Tasks"%"2520assigned"%"2520by"%"2520me"%"2526Current"%"2520to"%"2520do"%"2520for"%"2520team; __utma=6456992.24295438.1385548697.1390224203.1390300429.12; __utmb=6456992.2.10.1390300429; __utmc=6456992; __utmz=6456992.1385548697.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); require_ssl=false; ASP.NET_SessionId=#{options.session_id}; .auth=#{options.auth}; viewsNavControlctl04_ctl03_ctl05_openState="%"2520"%"2520Tasks"%"2520assigned"%"2520to"%"2520me"%"2526"%"2520Tasks"%"2520assigned"%"2520by"%"2520me; ticketsDefTabNew2ctl05_ctl01_ctl01_ctl16=TICKET"%"2FCURRENT; nothumb=1" -H "Connection: keep-alive" -H "Referer: http://entrue.comindwork.com/web2.aspx/GDTA/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"%"22#{options.project}"%"22"%"2C"%"22start_on"%"22"%"3A"%"22#{options.month}"%"2F#{options.day}"%"2F#{options.year}"%"22"%"7D&list_context="%"7B"%"22publishing_alias"%"22"%"3A"%"22TIMELOG"%"22"%"2C"%"22url_prefix"%"22"%"3A"%"22GDTA"%"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"%"22GDTA"%"22"%"7D&ajaxPathPrefix=web2&is_selector_visible=false&is_drag_handle_visible=false" --compressed
CURL
end
for day in eval ARGV[0]
oled_mobile = "fd76b1de-6491-d879-6223-1c55dbd20c30"
entrue = "1e96442a-544a-1383-ad76-112d8cd25a14"
oled = "9da3b60e-c4f6-3c20-a985-d9070d282cfd"
auth = "" # Coloque aqui o AUTH do cookie
session_id = "" # Coloque aqui o ID da sessão
month=1
year=2014
project=entrue
puts "\n#{day}/#{month}/#{year}\n#{project}\n"+ log_hours(day:day, month:month, year:year, project:project)+"\n-\n-\n"
system log_hours day:day, month:month, year:year, project:project, auth: auth, session_id: session_id
# puts day
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment