Sha256: 0f2726d0bba86f04715e4ebcfdec89bf65279d4354371e3b3f09f42c24054bee

Contents?: true

Size: 1.24 KB

Versions: 4

Compression:

Stored size: 1.24 KB

Contents

# frozen_string_literal: true

module MediaWiktory::Wikipedia
  module Actions
    # Validate a two-factor authentication (OATH) token.
    #
    # Usage:
    #
    # ```ruby
    # api.oathvalidate.user(value).perform # returns string with raw output
    # # or
    # api.oathvalidate.user(value).response # returns output parsed and wrapped into Response object
    # ```
    #
    # See {Base} for generic explanation of working with MediaWiki actions and
    # {MediaWiktory::Wikipedia::Response} for working with action responses.
    #
    # All action's parameters are documented as its public methods, see below.
    #
    class Oathvalidate < MediaWiktory::Wikipedia::Actions::Post

      # User to validate token for. Defaults to the current user.
      #
      # @param value [String]
      # @return [self]
      def user(value)
        merge(user: value.to_s)
      end

      # Two-factor authentication (OATH) token.
      #
      # @param value [String]
      # @return [self]
      def totp(value)
        merge(totp: value.to_s)
      end

      # A "csrf" token retrieved from action=query&meta=tokens
      #
      # @param value [String]
      # @return [self]
      def token(value)
        merge(token: value.to_s)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mediawiktory-0.1.3 lib/mediawiktory/wikipedia/actions/oathvalidate.rb
mediawiktory-0.1.2 lib/mediawiktory/wikipedia/actions/oathvalidate.rb
mediawiktory-0.1.1 lib/mediawiktory/wikipedia/actions/oathvalidate.rb
mediawiktory-0.1.0 lib/mediawiktory/wikipedia/actions/oathvalidate.rb