Sha256: beaa92ff96181dbbe74767ee85df73e90e00b4adec8f7295e3bdae6da9116989

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true
# This file was auto-generated by lib/tasks/web.rake

module Slack
  module Web
    module Api
      module Endpoints
        module Dialog
          #
          # Open a dialog with a user
          #
          # @option options [string] :dialog
          #   The dialog definition. This must be a JSON-encoded string.
          # @option options [string] :trigger_id
          #   Exchange a trigger to post to the user.
          # @see https://api.slack.com/methods/dialog.open
          # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/dialog/dialog.open.json
          def dialog_open(options = {})
            raise ArgumentError, 'Required arguments :dialog missing' if options[:dialog].nil?
            raise ArgumentError, 'Required arguments :trigger_id missing' if options[:trigger_id].nil?
            # dialog must be passed as an encoded JSON string
            if options.key?(:dialog)
              dialog = options[:dialog]
              dialog = JSON.dump(dialog) unless dialog.is_a?(String)
              options = options.merge(dialog: dialog)
            end
            post('dialog.open', options)
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
slack-ruby-client-2.1.0 lib/slack/web/api/endpoints/dialog.rb
slack-ruby-client-2.0.0 lib/slack/web/api/endpoints/dialog.rb