Open elifoster opened 4 years ago
Here's a rough start for a protection method: https://github.com/elifoster/gp-work-utils/blob/01f3b54e160e9e4fc3f4298d96ec6fb5a5e555c3/lib/butt_extensions.rb#L21-L31
def protect(page)
params = {
action: 'protect',
title: page,
cascade: true,
protections: 'edit=sysop|move=sysop',
expiry: 'never|never',
reason: 'High traffic page',
token: get_token
}
post(params)
end
Doesn't look awful. I would add more parameters of course, and perhaps String constants for the expiration date. Or the method would take whatever Ruby's time stamp object is, and we could have constants for the max value of that, and just convert that to the String "never" if equal.
Add support for the protection API. Not exactly sure how this should work because the protection API is pretty complicated. @xbony2 ?