slack-ruby/slack-ruby-client

View on GitHub
lib/slack/web/api/endpoints/oauth_v2.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true
# This file was auto-generated by lib/tasks/web.rake

module Slack
  module Web
    module Api
      module Endpoints
        module OauthV2
          #
          # Exchanges a temporary OAuth verifier code for an access token.
          #
          # @option options [string] :client_id
          #   Issued when you created your application. If possible, avoid sending client_id and client_secret as parameters in your request and instead supply the Client ID and Client Secret using the HTTP Basic authentication scheme.
          # @option options [string] :client_secret
          #   Issued when you created your application. If possible, avoid sending client_id and client_secret as parameters in your request and instead supply the Client ID and Client Secret using the HTTP Basic authentication scheme.
          # @option options [string] :code
          #   The code param returned via the OAuth callback.
          # @option options [string] :grant_type
          #   The grant_type param as described in the OAuth spec.
          # @option options [string] :redirect_uri
          #   This must match the originally submitted URI (if one was sent).
          # @option options [string] :refresh_token
          #   The refresh_token param as described in the OAuth spec.
          # @see https://api.slack.com/methods/oauth.v2.access
          # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/oauth.v2/oauth.v2.access.json
          def oauth_v2_access(options = {})
            post('oauth.v2.access', options)
          end

          #
          # Exchanges a legacy access token for a new expiring access token and refresh token
          #
          # @option options [string] :client_id
          #   Issued when you created your application.
          # @option options [string] :client_secret
          #   Issued when you created your application.
          # @see https://api.slack.com/methods/oauth.v2.exchange
          # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/oauth.v2/oauth.v2.exchange.json
          def oauth_v2_exchange(options = {})
            raise ArgumentError, 'Required arguments :client_id missing' if options[:client_id].nil?
            raise ArgumentError, 'Required arguments :client_secret missing' if options[:client_secret].nil?
            post('oauth.v2.exchange', options)
          end
        end
      end
    end
  end
end