dblock/slack-ruby-client

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

Summary

Maintainability
A
40 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 Reminders
          #
          # Creates a reminder.
          #
          # @option options [string] :text
          #   The content of the reminder.
          # @option options [string] :time
          #   When this reminder should happen: the Unix timestamp (up to five years from now), the number of seconds until the reminder (if within 24 hours), or a natural language description (Ex. "in 15 minutes," or "every Thursday").
          # @option options [object] :recurrence
          #   Specify the repeating behavior of a reminder. Available options: daily, weekly, monthly, or yearly. If weekly, may further specify the days of the week.
          # @option options [string] :team_id
          #   Encoded team id, required if org token is used.
          # @option options [user] :user
          #   The user who will receive the reminder. If no user is specified, the reminder will go to user who created it.
          # @see https://api.slack.com/methods/reminders.add
          # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/reminders/reminders.add.json
          def reminders_add(options = {})
            raise ArgumentError, 'Required arguments :text missing' if options[:text].nil?
            raise ArgumentError, 'Required arguments :time missing' if options[:time].nil?
            options = options.merge(user: users_id(options)['user']['id']) if options[:user]
            post('reminders.add', options)
          end

          #
          # Marks a reminder as complete.
          #
          # @option options [string] :reminder
          #   The ID of the reminder to be marked as complete.
          # @option options [string] :team_id
          #   Encoded team id, required if org token is used.
          # @see https://api.slack.com/methods/reminders.complete
          # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/reminders/reminders.complete.json
          def reminders_complete(options = {})
            raise ArgumentError, 'Required arguments :reminder missing' if options[:reminder].nil?
            post('reminders.complete', options)
          end

          #
          # Deletes a reminder.
          #
          # @option options [string] :reminder
          #   The ID of the reminder.
          # @option options [string] :team_id
          #   Encoded team id, required if org token is used.
          # @see https://api.slack.com/methods/reminders.delete
          # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/reminders/reminders.delete.json
          def reminders_delete(options = {})
            raise ArgumentError, 'Required arguments :reminder missing' if options[:reminder].nil?
            post('reminders.delete', options)
          end

          #
          # Gets information about a reminder.
          #
          # @option options [string] :reminder
          #   The ID of the reminder.
          # @option options [string] :team_id
          #   Encoded team id, required if org token is passed.
          # @see https://api.slack.com/methods/reminders.info
          # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/reminders/reminders.info.json
          def reminders_info(options = {})
            raise ArgumentError, 'Required arguments :reminder missing' if options[:reminder].nil?
            post('reminders.info', options)
          end

          #
          # Lists all reminders created by or for a given user.
          #
          # @option options [string] :team_id
          #   Encoded team id, required if org token is passed.
          # @see https://api.slack.com/methods/reminders.list
          # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/reminders/reminders.list.json
          def reminders_list(options = {})
            post('reminders.list', options)
          end
        end
      end
    end
  end
end