Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support protection API #79

Open
elifoster opened this issue May 29, 2020 · 2 comments
Open

Support protection API #79

elifoster opened this issue May 29, 2020 · 2 comments

Comments

@elifoster
Copy link
Member

Add support for the protection API. Not exactly sure how this should work because the protection API is pretty complicated. @xbony2 ?

@elifoster
Copy link
Member Author

elifoster commented May 29, 2020

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

@xbony2
Copy link
Member

xbony2 commented May 29, 2020

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.

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

No branches or pull requests

2 participants