21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/zombie_fans/actions/repo.rb', line 21
def star_repo repo
page = agent.get("https://github.com/#{repo}")
form = page.at('.starring-container:not(.on) form.unstarred')
return unless form
log_action 'StarRepo', "#{repo}."
authenticity_token = form.at('input[name=authenticity_token]').attr('value')
star_repo_url = form.attr('action')
query = {
authenticity_token: authenticity_token
}
= {
'X-Requested-With' => 'XMLHttpRequest'
}
page = agent.post(star_repo_url, query, )
response = JSON.parse page.body
end
|